previo | siguiente

Package structure


A package has a recommended directory structure:

package_key/
    package_key.info
    tcl/
    lib/
    sql/common
    sql/oracle
    sql/postgresql
    www/
    www/admin
    www/resources
  • package_key/package_key.info
    This XML file defines the package metadata. It includes the definition of the package name, version, package dependencies, callbacks, and parameters. This file must be present in the package's root directly with the given name format.

  • package_key/tcl/
    This directory contains Tcl procedure (*-procs.tcl) and initialization (*-init.tcl) files required by the package. Initialization files are called once upon OpenACS startup, and are commonly used to set up caching and similar structures. Procedure files contain utility procedures required by package templates. For callbacks procs the standard file is apm-callback-procs.tcl

  • package_key/lib
    This directory includes templates that are referenced by other templates with the include template tag. They are placed here because in general they should not be directly visible to HTTP: requests.

  • package_key/www
    This directory is visible to HTTP: requests and is used to store templates that respond to particular URLs. The Request Processor ensures that a visitor has the "read" privilege on the site node object mapped to a package's www subdirectory - there is no need to check within the pages themselves.

  • package_key/www/admin
    By convention package administration pages are stored here. The Request Processor ensures that a visitor to this subdirectory has the "admin" privilege on the package instance before allowing access. Administration pages meant to manipulate individual objects are often kept in the www subdirectory so users can administer their own objects (in other words, they'll have the "admin" privilege on specific objects, but not the entire package instance).

  • package_key/www/resources
    Items stored here are returned directly to the HTTP: request. The Request Processor makes no permission checks on files stored here. Nor does it analyze the request to determine if it is for a template, etc. This directory is normally used to store graphics items (arrows, buttons, etc) that need to be visible to HTTP: requests (img tags in templates) but can be returned without checking or analysis to the user. These items are referenced by special URLs of the form
    http://your.site/resources/package_key/file.extension
  • package_key/sql/common
    SQL files common to all supported RDBMS platforms (currently Oracle and PostgreSQL) are stored here.

  • package_key/sql/oracle
    SQL files specific to Oracle are stored here. If the package has a datamodel and supports Oracle, at minimum the files
    package-key-create.sql
    and
    package-key-drop.sql
    must be present.

  • package_key/sql/postgresql
    SQL files specific to PostgreSQL are stored here. If the package has a datamodel and supports PostgreSQL, at minimum the files
    package-key-create.sql
    and
    package-key-drop.sql
    must be present.

This package structure is a recent (OpenACS 5.0) recommendation, and many packages do not follow it yet. All new development should place files in the recommended directory structure, and existing packages will be migrated as maintainers find the time to do so.

Don Baccus (dhogaza@pacifier.com)

Don Baccus (dhogaza@pacifier.com)