All Resources All filters

# DirectoryResource

The directory resource is the basic resource to export file-system directories. It keeps track of all its children resources, create them dynamically if needed, and is also able to create negotiated resources on the fly (as needed).

This class should be used as the basic class to export file system directories.

## Inherits

The DirectoryResource class inherits from the following classes:

- ContainerResource (an abstract class)

## Attributes description

The DirectoryResource defines the following attributes:

- directory
- storeid
- relocate
- extensible
- index
- icondir
- dirstamp
- negotiable

`directory`

semantics
  The physical directory that this resource exports.
type
  This attribute is a computed and not saved FileAttribute.
default value
  This attribute value is computed by concatenating (in the appropriate file-system dependent way), the parent's resource directory value, with this directory identifier.

`storeid`

semantics
  The name of the file to be used as the resource store database in this directory.
type
  This attribute is an editable and mandatory FilenameAttribute.
default value
  This attribute value is computed by concatenating (in the appropriate file-system dependant way), the parent's resource directory value, with this directory identifier.

`relocate`

semantics
  Should the directory emit a relocation reply when accessed through an invalid URL. A common case of handling invalid directory access is to emit a relocation reply so that the browser gets access to the directory through a valid URL (e.g. `http://www.w3.org/pub` is invalid, because `pub` is a directory, the correct URL is `http://www.w3.org/pub/`). When this flag is set to true, the directory resource will emit the appropriate relocation reply.
type
  This attribute is an editable and non-saved BooleanAttribute.
default value
  This attribute value defaults to true.

`extensible`

semantics
  Should this directory automatically keep in sync with the underlying physical directory ? The directory resource maintains a cache of its list of children, which may be outdated if the directory is changed through direct file system access. When this flag is turned to true, the directory resource will make its best effort to keep in sync with it, by adopting the following lookup algorithm: first look up children in our cache list, if this fails, check if some appropriate file exists. If such a file exists, hand it to the ResourceIndexer and install the resulting resource (if any) as a new child of the directory resource.
type
  This attribute is an editable BooleanAttribute.
default value
  This attribute defaults to true.

`index`

semantics
  The optional name of the directory child resource that is to be used as the directory index. This attribute should name an existing child resource, that will be used as the index resource of the directory (all accesses to the directory will be delegated to it).
type
  This attribute is an editable StringAttribute.
default value
  This attribute value is computed by concatenating (in the appropriate file-system dependant way), the parent's resource directory value, with this directory identifier.

`icondir`

semantics
  The name of the directory that handles this directory's icons. Each HTTPResource has an optional icon attribute. When a directory resource needs to produce a listing it will dereference each icons relative to its icon directory.
type
  This attribute is an editable StringAttribute, giving the path of the URL to the icon directory.
default value
  This attribute defaults to /icons.

`dirstamp`

semantics
  The date at which the directory resource last checked its consistency against the underlying physical directory.
type
  This attribute is a non-editable, computed DateAttribute.
default value
  This attribute defaults to -1 (meaning it is undefined).

`negotiable`

semantics
  Should the directory resource automatically create NegotiatedResource ? When this flag is turned to true, the directory resource will automatically create negotiable resources on top of normal resources: each time a new resource is added to the directory, the resource looks up for a resource having the new child name, but possibly different extensions. If this succeeds, either the found resource is already a negotiated resource, in which case the new child is added as one of its variant resource; otherwise (the negotiated resource doesn't exist), the directory resource creates it with only one variant (the new child resource).
type
  This attribute is an editable BooleanAttribute.
default value
  This attribute defaults to false.

Anselm Baird-Smith
$Id: w3c.jigsaw.resources.DirectoryResource.html,v 1.2 1996/04/11 20:36:40 abaird Exp $