All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class w3c.jigsaw.resources.DirectoryResource
java.lang.Object
   |
   +----w3c.tools.store.AttributeHolder
           |
           +----w3c.tools.store.Resource
                   |
                   +----w3c.jigsaw.resources.HTTPResource
                           |
                           +----w3c.jigsaw.resources.FilteredResource
                                   |
                                   +----w3c.jigsaw.resources.ContainerResource
                                           |
                                           +----w3c.jigsaw.resources.StoreContainer
                                                   |
                                                   +----w3c.jigsaw.resources.DirectoryResource
  -  public class DirectoryResource
  -  extends StoreContainer
A simple, and reasonably efficient directory resource.
 This directory resource embeds its own resource store object to keep
 track of its next children (wich might themselves be DirectoryResource). It
 is reasonably efficient in the sense that it won't overload the memory with 
 unused informations. However, stay tuned for a really efficient
 file based directory resource (tuned to serve only files).
   
  -   ATTR_DIRECTORY ATTR_DIRECTORY
-   Attribute index - The index for our directory attribute.
  
-   ATTR_DIRSTAMP ATTR_DIRSTAMP
-   Attribute index - The last we we physically visited the directory.
  
-   ATTR_ICONDIR ATTR_ICONDIR
-   Attribute index - The icon directory to use in dir listing.
  
-   ATTR_INDEXER ATTR_INDEXER
-   Attribute index - The indexer to use for that directory, if any.
  
-   ATTR_NEGOTIABLE ATTR_NEGOTIABLE
-   Attribute index - Should this directory support content negotiation.
  
-   listing listing
-   Our current (cached) directory listing.
  
-   listing_stamp listing_stamp
-   The time at which we generated the directory index.
   
  -   DirectoryResource() DirectoryResource()
-  
   
  -   checkIfModifiedSince(Request) checkIfModifiedSince(Request)
-   Check the If-Modified-Sincecondition of that request.
-   createDefaultResource(String) createDefaultResource(String)
-   Try creating a default resource having the given name.
  
-   delete() delete()
-   Delete this directory resource, for ever.
  
-   enumerateResourceIdentifiers(boolean) enumerateResourceIdentifiers(boolean)
-   Enumerate all available children resource identifiers.
  
-   get(Request) get(Request)
-   GET on a directory, generate a directory listing.
  
-   getDirectory() getDirectory()
-   Get the physical directory exported by this resource.
  
-   getDirectoryListing(Request) getDirectoryListing(Request)
-   Reply with an HTML doc listing the resources of this directory.
  
-   getDirStamp() getDirStamp()
-   Get the absolute time at which we examined the physicall directory.
  
-   getIconDirectory() getIconDirectory()
-   Get the optional icon directory.
  
-   getIndexer(ResourceContext) getIndexer(ResourceContext)
-   Get the indexer out of the given context.
  
-   getNegotiableFlag() getNegotiableFlag()
-   Get the negotiable flag for this directory.
  
-   initialize(Object[]) initialize(Object[])
-   Initialize this directory resource with the given set of attributes.
  
-   main(String[]) main(String[])
-   Create an empty resource store, and store a default resource directory
 in it.
  
-   setValue(int, Object) setValue(int, Object)
-   Keep our cached repository value in sync.
  
-   updateDefaultChildAttributes(Hashtable) updateDefaultChildAttributes(Hashtable)
-   Initialize and register a new resource into this directory.
  
-   updateNegotiableResource(String) updateNegotiableResource(String)
-   Update a negotiable resource.
  
-   verify() verify()
-   Verify that resource.
   
 ATTR_DIRECTORY
ATTR_DIRECTORY
 protected static int ATTR_DIRECTORY
  -  Attribute index - The index for our directory attribute.
 
 ATTR_ICONDIR
ATTR_ICONDIR
 protected static int ATTR_ICONDIR
  -  Attribute index - The icon directory to use in dir listing.
 
 ATTR_DIRSTAMP
ATTR_DIRSTAMP
 protected static int ATTR_DIRSTAMP
  -  Attribute index - The last we we physically visited the directory.
 
 ATTR_NEGOTIABLE
ATTR_NEGOTIABLE
 protected static int ATTR_NEGOTIABLE
  -  Attribute index - Should this directory support content negotiation.
 
 ATTR_INDEXER
ATTR_INDEXER
 protected static int ATTR_INDEXER
  -  Attribute index - The indexer to use for that directory, if any.
 
 listing
listing
 protected HtmlGenerator listing
  -  Our current (cached) directory listing.
 
 listing_stamp
listing_stamp
 protected long listing_stamp
  -  The time at which we generated the directory index.
 
   
 DirectoryResource
DirectoryResource
 public DirectoryResource()
   
 updateNegotiableResource
updateNegotiableResource
 public synchronized void updateNegotiableResource(String name)
  -  Update a negotiable resource.
 Given the name of a resource that exists, create or update the 
 attributes of a resource that allows to negotiate its content.
 I hate this part here: it has nothing to do within the directory
 resource itself, and the indexer shouldn't know that much about
 directory resource, so I am stuck.
 
   
- 
    -  Parameters:
    
-  name - The name of the newly created resource.
  
 
 getIndexer
getIndexer
 protected ResourceIndexer getIndexer(ResourceContext c)
  -  Get the indexer out of the given context.
   
- 
    -  Returns:
    
-  A ResourceIndexer instance, guaranteeed not to be 
 null.
  
 
 setValue
setValue
 public void setValue(int idx,
                      Object value)
  -  Keep our cached repository value in sync.
   
- 
    -  Overrides:
    
-  setValue in class StoreContainer
  
 
 createDefaultResource
createDefaultResource
 public synchronized HTTPResource createDefaultResource(String name)
  -  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.
    
-  Returns:
    
-  A HTTPResource instance, if possible, null
    otherwise.
    
-  Overrides:
    
-  createDefaultResource in class ContainerResource
  
 
 updateDefaultChildAttributes
updateDefaultChildAttributes
 protected void updateDefaultChildAttributes(Hashtable attrs)
  -  Initialize and register a new resource into this directory.
   
- 
    -  Parameters:
    
-  resource - The uninitialized resource to be added.
    
-  Overrides:
    
-  updateDefaultChildAttributes in class StoreContainer
  
 
 getDirectory
getDirectory
 public File getDirectory()
  -  Get the physical directory exported by this resource.
   
- 
    -  Returns:
    
-  A non-null File object giving the directory of this resource.
  
 
 getIconDirectory
getIconDirectory
 public String getIconDirectory()
  -  Get the optional icon directory.
 
 getDirStamp
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.
  
 
 getNegotiableFlag
getNegotiableFlag
 public boolean getNegotiableFlag()
  -  Get the negotiable flag for this directory.
 When turned to true, this flag indicates to the
 directory resource that it should automatically build negotiated 
 resources ont op of all existing resources.
 You should know, at least, that turning this flag on has some
 not so small cost in terms of the size of the index files, and some
 not so small costs in CPU time when detecting not found documents. 
 Otherwise, in all other situations its cost is probably negligible.
 
   
- 
    -  Returns:
    
-  A boolean, true if the directory is extensible
 false otherwise.
  
 
 initialize
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 StoreContainer
  
 
 enumerateResourceIdentifiers
enumerateResourceIdentifiers
 public 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 StoreContainer
  
 
 getDirectoryListing
getDirectoryListing
 public synchronized Reply getDirectoryListing(Request request) throws HTTPException
  -  Reply with an HTML doc listing the resources of this directory.
 This function takes special care not to regenerate a directory listing
 when one is available. It also caches the date of the directory 
 listing, so that it can win big with NOT_MODIFIED.
 Using a modem, I know that each place I can reply with an 
 NOT_MODIFIED, is a big win.
 
   
- 
    -  Parameters:
    
-  request - The request to handle.
    
-  Throws: HTTPException
    
-  If processsing the request failed.
  
 
 checkIfModifiedSince
checkIfModifiedSince
 public int checkIfModifiedSince(Request request)
  -  Check the If-Modified-Sincecondition of that request.
   
- 
    -  Parameters:
    
-  request - The request to check.
    
-  Returns:
    
-  An integer, either COND_FAILED if condition
 was checked, but failed, COND_OKif condition was checked
 and succeeded, or 0 if the condition was not checked
 at all (eg because the resource or the request didn't support it).
-  Overrides:
    
-  checkIfModifiedSince in class HTTPResource
  
 
 get
get
 public Reply get(Request request) throws HTTPException
  -  GET on a directory, generate a directory listing.
   
- 
    -  Parameters:
    
-  request - The request to handle.
    
-  Overrides:
    
-  get in class HTTPResource
  
 
 delete
delete
 public synchronized void delete()
  -  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 is removed from its inital store
 and will not be unpickleable any more.
 
   
- 
    -  Overrides:
    
-  delete in class StoreContainer
  
 
 verify
verify
 public synchronized boolean verify()
  -  Verify that resource.
   
- 
    -  Overrides:
    
-  verify in class HTTPResource
  
 
 main
main
 public static void main(String args[]) throws Exception
  -  Create an empty resource store, and store a default resource directory
 in it.
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index