Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.tools.resources
Class DirectoryResource

    java.lang.Object
      |
      +--org.w3c.tools.resources.AttributeHolder
            |
            +--org.w3c.tools.resources.Resource
                  |
                  +--org.w3c.tools.resources.FramedResource
                        |
                        +--org.w3c.tools.resources.AbstractContainer
                              |
                              +--org.w3c.tools.resources.ContainerResource
                                    |
                                    +--org.w3c.tools.resources.DirectoryResource

Direct Known Subclasses:
  DirectoryResource, PassDirectory, ZipDirectoryResource

public class DirectoryResource
extends ContainerResource

A simple, and reasonably efficient directory resource.

Field Summary
`protected static int` | `ATTR_DIRECTORY` Attribute index - The index for our directory attribute.
`protected static int` | `ATTR_DIRSTAMP` Attribute index - The last time we physically visited the directory.
`protected static int` | `ATTR_EXTENSIBLE` Attribute index - The index of wether we are extensible.
`protected static int` | `ATTR_INDEXER` Attribute index - The indexer to use for that directory, if any.
`protected static int` | `ATTR_SHRINKABLE` Attribute index - The index of wether we can be shrinked.

Fields inherited from class org.w3c.tools.resources.ContainerResource
`acquired, ATTR_KEY, debug`

Fields inherited from class org.w3c.tools.resources.AbstractContainer
`ur`

Fields inherited from class org.w3c.tools.resources.FramedResource
`ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener`

Fields inherited from class org.w3c.tools.resources.Resource
`ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id`

Fields inherited from class org.w3c.tools.resources.AttributeHolder
`attributes, values`

Constructor Summary
`DirectoryResource()`

Method Summary
`ResourceReference` | `createDefaultResource(java.lang.String name)` Create a default child resource in that container.
`protected ResourceReference` | `createDefaultResource(java.lang.String name, RequestInterface req)` Try creating a default resource having the given name.
`ResourceReference` | `createDirectoryResource(java.lang.String name)` Create a DirectoryResource and the physical directory too.
`ResourceReference` | `createResource(java.lang.String name)` Create a Resource and the physical file too.
`ResourceReference` | `createResource(java.lang.String name, RequestInterface req)` Create a Resource and the physical file too.
`void` | `delete()` Delete this directory resource, for ever.
`protected java.util.Enumeration` | `enumerateAllResourceIdentifiers()` Enumerate all available children resource identifiers.
`java.util.Enumeration` | `enumerateResourceIdentifiers(boolean all)` Enumerate all available children resource identifiers.
`java.io.File` | `getDirectory()` Get the physical directory exported by this resource.
`long` | `getDirStamp()` Get the absolute time at which we examined the physicall directory.
`boolean` | `getExtensibleFlag()` Get the extensible flag value.
`protected java.lang.String` | `getIndexedName(java.lang.String name)` Get the name of the resource relative to the given filename.
`protected ResourceReference` | `getIndexer(ResourceContext c)` Get the indexer out of the given context.
`boolean` | `getShrinkableFlag()` Get the extensible flag value.
`protected Resource` | `index(java.lang.String name, java.util.Hashtable defs, RequestInterface req)` Index a Resource.
`void` | `initialize(java.lang.Object[] values)` Initialize this directory resource with the given set of attributes.
`ResourceReference` | `lookup(java.lang.String name)` Lookup the resource having the given name in this directory.
`void` | `reindex(boolean rec)` Reindex recursivly all the resources from this DirectoryResource.
`void` | `resourceRemoved(StructureChangedEvent evt)` A resource is about to be removed This handles the `RESOURCE_REMOVED` kind of events.
`void` | `setValue(int idx, java.lang.Object value)` Set some of this resource attribute.
`java.io.File` | `unsafeGetDirectory()` Get the physical directory exported by this resource.
`boolean` | `unsafeGetShrinkableFlag()` Get the extensible flag value.
`protected ResourceContext` | `updateDefaultChildAttributes(java.util.Hashtable attrs)` Initialize and register a new resource into this directory.
`boolean` | `verify()` Was return false (don't khow why)

Methods inherited from class org.w3c.tools.resources.ContainerResource
`acquireChildren, addResource, delete, deleteChildren, getChildrenSpaceEntry, getClone, getKey, getMatchingCharsCount, getSpaceEntry, internalLookup, lookup, notifyUnload, registerResource, replace, resourceCreated, resourceModified`

Methods inherited from class org.w3c.tools.resources.AbstractContainer
`attributeChanged, enumerateResourceIdentifiers, resourceUnloaded`

Methods inherited from class org.w3c.tools.resources.FramedResource
`addAttributeChangedListener, addStructureChangedListener, collectFramesReference, disableEvent, displayEvent, enableEvent, eventDisabled, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameModified, frameRemoved, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, markModified, perform, performFrames, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, processEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, unregisterFrame`

Methods inherited from class org.w3c.tools.resources.Resource
`acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getResourceReference, getServer, getSpace, getStoreEntry, getURLPath, getValue, getValue, initialize, isInitialized, isUnloaded, pickleValues, setContext, setContext, setValue, unsafeGetContext, unsafeGetIdentifier, unsafeGetValue, updateAttributes`

Methods inherited from class org.w3c.tools.resources.AttributeHolder
`definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeGetString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ATTR_DIRECTORY

    protected static int ATTR_DIRECTORY

  Attribute index - The index for our directory attribute.

### ATTR_DIRSTAMP

    protected static int ATTR_DIRSTAMP

  Attribute index - The last time we physically visited the directory.

### ATTR_INDEXER

    protected static int ATTR_INDEXER

  Attribute index - The indexer to use for that directory, if any.

### ATTR_EXTENSIBLE

    protected static int ATTR_EXTENSIBLE

  Attribute index - The index of wether we are extensible.

### ATTR_SHRINKABLE

    protected static int ATTR_SHRINKABLE

  Attribute index - The index of wether we can be shrinked.

Constructor Detail

### DirectoryResource

    public DirectoryResource()

Method Detail

### getIndexer

    protected ResourceReference getIndexer(ResourceContext c)

  Get the indexer out of the given context.
  Returns:
    A ResourceIndexer instance, guaranteeed not to be null.

### setValue

    public void setValue(int idx,
                         java.lang.Object value)

  Description copied from class: FramedResource
  Set some of this resource attribute. We overide setValue to post events.
  Overrides:
    setValue in class FramedResource
  Tags copied from class: Resource
  Parameters:
    `idx` - The index of the attribute to modify.
    `value` - The new attribute value.

### getDirectory

    public java.io.File getDirectory()

  Get the physical directory exported by this resource.
  Returns:
    A non-null File object giving the directory of this resource.

### unsafeGetDirectory

    public java.io.File unsafeGetDirectory()

  Get the physical directory exported by this resource.
  Returns:
    A non-null File object giving the directory of this resource.

### getDirStamp

    public long getDirStamp()

  Get the absolute time at which we examined the physicall directory.
  Returns:
    The date (as a long number of ms since Java epoch), or -1 if we never examined it before.

### getExtensibleFlag

    public boolean getExtensibleFlag()

  Get the extensible flag value. A DirectoryResource is extensible, if it is allowed to create new resources out of the file system knowledge on the fly.

  Setting this flag might slow down the server. It unfortunatelly defaults to true until I have a decent admin program.

  Returns:
    A boolean true if the directory is extensible.

### getShrinkableFlag

    public boolean getShrinkableFlag()

  Get the extensible flag value. A DirectoryResource is extensible, if it is allowed to create new resources out of the file system knowledge on the fly.

  Setting this flag might slow down the server. It unfortunatelly defaults to true until I have a decent admin program.

  Returns:
    A boolean true if the directory is extensible.

### unsafeGetShrinkableFlag

    public boolean unsafeGetShrinkableFlag()

  Get the extensible flag value. A DirectoryResource is extensible, if it is allowed to create new resources out of the file system knowledge on the fly.

  Setting this flag might slow down the server. It unfortunatelly defaults to true until I have a decent admin program.

  Returns:
    A boolean true if the directory is extensible.

### resourceRemoved

    public void resourceRemoved(StructureChangedEvent evt)

  A resource is about to be removed This handles the `RESOURCE_REMOVED` kind of events.
  Overrides:
    resourceRemoved in class ContainerResource
  Parameters:
    `evt` - The event describing the change.

### createDirectoryResource

    public ResourceReference createDirectoryResource(java.lang.String name)

  Create a DirectoryResource and the physical directory too.
  Parameters:
    `name` - the name of the resource.
  Returns:
    A ResourceReference instance.

### createResource

    public ResourceReference createResource(java.lang.String name)

  Create a Resource and the physical file too.
  Parameters:
    `name` - the name of the resource.
  Returns:
    A ResourceReference instance.

### createResource

    public ResourceReference createResource(java.lang.String name,
                                            RequestInterface req)

  Create a Resource and the physical file too.
  Parameters:
    `name` - the name of the resource.
    `req` - the protocol request.
  Returns:
    A ResourceReference instance.

### index

    protected Resource index(java.lang.String name,
                             java.util.Hashtable defs,
                             RequestInterface req)

  Index a Resource. Call the indexer.
  Parameters:
    `name` - The name of the resource to index.
    `defs` - The defaults attributes.
    `req` - The protocol request.
  Returns:
    A resource instance.
  See Also:
    `SampleResourceIndexer`

### getIndexedName

    protected java.lang.String getIndexedName(java.lang.String name)

  Get the name of the resource relative to the given filename.
  Parameters:
    `name` - The name of the file.
  Returns:
    a String, the resource name.
  See Also:
    `SampleResourceIndexer`

### createDefaultResource

    public ResourceReference createDefaultResource(java.lang.String name)

  Description copied from class: ContainerResource
  Create a default child resource in that container. This method is called by the editor to add a default resource in the container under the given name. The meaning of default is left up to the container here.
  Overrides:
    createDefaultResource in class ContainerResource
  Tags copied from class: ContainerResource
  Parameters:
    `name` - The identifier for the new resource.

### createDefaultResource

    protected ResourceReference createDefaultResource(java.lang.String name,
                                                      RequestInterface req)

  Try creating a default resource having the given name. This method will make its best effort to create a default resource having this name in the directory. If a file with this name exists, it will check the pre-defined admin extensions and look for a match. If a directory with this name exists, and admin allows to do so, it will create a sub-directory resource.
  Parameters:
    `name` - The name of the resource to try to create.
    `req` - The incomming request
  Returns:
    A Resource instance, if possible, null otherwise.

### updateDefaultChildAttributes

    protected ResourceContext updateDefaultChildAttributes(java.util.Hashtable attrs)

  Initialize and register a new resource into this directory.
  Overrides:
    updateDefaultChildAttributes in class ContainerResource
  Parameters:
    `resource` - The uninitialized resource to be added.

### reindex

    public void reindex(boolean rec)

  Reindex recursivly all the resources from this DirectoryResource.
  Parameters:
    `rec` - recursivly?

### enumerateAllResourceIdentifiers

    protected java.util.Enumeration enumerateAllResourceIdentifiers()

  Enumerate all available children resource identifiers. This method requires that we create all our pending resources.
  Returns:
    An enumeration of all our resources.

### enumerateResourceIdentifiers

    public java.util.Enumeration enumerateResourceIdentifiers(boolean all)

  Enumerate all available children resource identifiers. This method requires that we create all our pending resources if we are in the extensible mode...too bad !
  Overrides:
    enumerateResourceIdentifiers in class ContainerResource
  Returns:
    An enumeration of all our resources.

### lookup

    public ResourceReference lookup(java.lang.String name)

  Lookup the resource having the given name in this directory.
  Overrides:
    lookup in class ContainerResource
  Parameters:
    `name` - The name of the resource.
  Returns:
    A resource instance, or null.

### delete

    public void delete()
                throws MultipleLockException

  Delete this directory resource, for ever. This method will delete the directory resource, and its associated store, along with any of the sub-resources it contains. Deleting the root directory of your server might take sometime...

  Once the resource is deleted, it isx1 removed from its inital store and will not be unpickleable any more.

  Overrides:
    delete in class ContainerResource
  Throws:
    MultipleLockException - if someone has locked this resource.

### verify

    public boolean verify()

  Was return false (don't khow why)

### initialize

    public void initialize(java.lang.Object[] values)

  Initialize this directory resource with the given set of attributes.
  Overrides:
    initialize in class ContainerResource
  Parameters:
    `values` - The attribute values.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD