    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.tools.resources.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

public class DirectoryResource
extends ContainerResource

A simple, and reasonably efficient directory resource.

##

ATTR_DIRECTORY
  Attribute index - The index for our directory attribute.
ATTR_DIRSTAMP
  Attribute index - The last time we physically visited the directory.
ATTR_EXTENSIBLE
  Attribute index - The index of wether we are extensible.
ATTR_INDEXER
  Attribute index - The indexer to use for that directory, if any.

##

DirectoryResource()

##

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

##

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.

##

DirectoryResource

     public DirectoryResource()

##

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,
                          Object value)

  Set some of this resource attribute.

  Overrides:
    setValue in class FramedResource

getDirectory

     public File getDirectory()

  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.

resourceRemoved

     public void resourceRemoved(StructureChangedEvent evt)

  A resource is about to be removed This handles the `RESOURCE_REMOVED` kind of events.

  Parameters:
    evt - The event describing the change.
  Overrides:
    resourceRemoved in class ContainerResource

createDirectoryResource

     public ResourceReference createDirectoryResource(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(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(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(String name,
                              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

createDefaultResource

     public synchronized ResourceReference createDefaultResource(String name)

  Create a default child resource in that container.

  Overrides:
    createDefaultResource in class ContainerResource

createDefaultResource

     protected synchronized ResourceReference createDefaultResource(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(Hashtable attrs)

  Initialize and register a new resource into this directory.

  Parameters:
    resource - The uninitialized resource to be added.
  Overrides:
    updateDefaultChildAttributes in class ContainerResource

reindex

     public synchronized void reindex()

  Reindex recursivly all the resources from this DirectoryResource.

enumerateAllResourceIdentifiers

     protected synchronized 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 synchronized 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 !

  Returns:
    An enumeration of all our resources.
  Overrides:
    enumerateResourceIdentifiers in class ContainerResource

lookup

     public ResourceReference lookup(String name)

  Lookup the resource having the given name in this directory.

  Parameters:
    name - The name of the resource.
  Returns:
    A resource instance, or null.
  Overrides:
    lookup in class ContainerResource

delete

     public synchronized 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

verify

     public synchronized boolean verify()

  Was return false (don't khow why)

initialize

     public void initialize(Object values[])

  Initialize this directory resource with the given set of attributes.

  Parameters:
    values - The attribute values.
  Overrides:
    initialize in class ContainerResource

    All Packages  Class Hierarchy  This Package  Previous  Next  Index