All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.indexer.SampleResourceIndexer

java.lang.Object
   |
   +----w3c.tools.store.AttributeHolder
           |
           +----w3c.tools.store.Resource
                   |
                   +----w3c.jigsaw.indexer.SampleResourceIndexer

public class SampleResourceIndexer
extends Resource
implements ContainerInterface, ResourceIndexer
A container for directories and templates.


Variable Index

 o ATTR_CONTEXT
Attribute index - the context (a nasty hack)
 o ATTR_LAST_MODIFIED
Attribute index - Date of last modification.
 o ATTR_SUPER_INDEXER
Attribute index - the super indexer, if any.
 o directories
 o extensions

Constructor Index

 o SampleResourceIndexer()
 o SampleResourceIndexer(ResourceContext)

Method Index

 o createDirectoryResource(File, String, Hashtable)
Create a default container resource for this directory (that exists).
 o createFileResource(File, String, Hashtable)
Create a default file resource for this file (that exists).
 o createResource(ContainerResource, Request, File, String, Hashtable)
Try to create a resource for the given file.
 o delete()
Delete this Resource instance, and remove it from its store.
 o delete(String)
 o enumerateResourceIdentifiers(boolean)
 o getContext()
 o getDirectories()
 o getExtensions()
 o getFileExtensions(String)
 o getResourceStore(ResourceStoreHolder)
 o getSuperIndexer()
 o getTemplateFor(String)
Return the class (if any) that our store defines for given extension.
 o hasResourceStore()
 o lastModified()
 o loadDirectory(String)
Load a given directory template from the store.
 o loadExtension(String)
 o lookup(String)
 o mergeDefaultAttributes(HTTPResource, String, Hashtable)
Merge the attributes this extension defines, with the provided ones.
 o notifyResourceLockBreak(Resource)
 o registerResource(String, Resource, Hashtable)

Variables

 o ATTR_LAST_MODIFIED
 protected static int ATTR_LAST_MODIFIED
Attribute index - Date of last modification.

 o ATTR_CONTEXT
 protected static int ATTR_CONTEXT
Attribute index - the context (a nasty hack)

 o ATTR_SUPER_INDEXER
 protected static int ATTR_SUPER_INDEXER
Attribute index - the super indexer, if any.

 o directories
 protected SampleContainer directories
 o extensions
 protected SampleContainer extensions

Constructors

 o SampleResourceIndexer
 public SampleResourceIndexer(ResourceContext ctxt)
 o SampleResourceIndexer
 public SampleResourceIndexer()

Methods

 o getContext
 protected ResourceContext getContext()
 o getDirectories
 protected synchronized SampleContainer getDirectories()
 o getExtensions
 protected synchronized SampleContainer getExtensions()
 o lastModified
 public long lastModified()
 o getSuperIndexer
 public String getSuperIndexer()
 o notifyResourceLockBreak
 public synchronized void notifyResourceLockBreak(Resource r)
 o hasResourceStore
 public boolean hasResourceStore()
 o getResourceStore
 public ResourceStore getResourceStore(ResourceStoreHolder holder)
 o enumerateResourceIdentifiers
 public Enumeration enumerateResourceIdentifiers(boolean all)
 o lookup
 public Resource lookup(String name)
 o delete
 public synchronized void delete()
Delete this Resource instance, and remove it from its store.

Overrides:
delete in class Resource
 o delete
 public void delete(String name)
 o registerResource
 public void registerResource(String name,
                              Resource resource,
                              Hashtable defs)
 o loadExtension
 public synchronized HTTPResource loadExtension(String name)
 o getTemplateFor
 protected HTTPResource getTemplateFor(String ext)
Return the class (if any) that our store defines for given extension.

Parameters:
ext - The extension we want a class for.
Returns:
A Class instance, or null.
 o mergeDefaultAttributes
 protected Hashtable mergeDefaultAttributes(HTTPResource template,
                                            String ext,
                                            Hashtable into)
Merge the attributes this extension defines, with the provided ones.

Parameters:
attrs - The attributes we want to fill with default values.
ext - The extension name.
into - The already built set of default values.
Returns:
A Hashtable, containing the augmented set of default attribute values.
 o getFileExtensions
 protected String[] getFileExtensions(String name)
 o createFileResource
 protected HTTPResource createFileResource(File directory,
                                           String name,
                                           Hashtable defs)
Create a default file resource for this file (that exists).

Parameters:
directory - The directory of the file.
name - The name of the file.
defs - A set of default attribute values.
Returns:
An instance of HTTPResource, or null if we were unable to create it.
 o loadDirectory
 public synchronized HTTPResource loadDirectory(String name)
Load a given directory template from the store.

Parameters:
name - The name of the template to load.
Returns:
An instance of Directory, or null.
 o createDirectoryResource
 protected HTTPResource createDirectoryResource(File directory,
                                                String name,
                                                Hashtable defs)
Create a default container resource for this directory (that exists).

Parameters:
directory - The parent directory.
name - The name of its sub-directory to index.
defaults - A set of default atribute values.
Returns:
An HTTP instance, or null if the indexer was unable to build a default resource for the directory.
 o createResource
 public HTTPResource createResource(ContainerResource container,
                                    Request request,
                                    File directory,
                                    String name,
                                    Hashtable defs)
Try to create a resource for the given file. This method makes its best efforts to try to build a default resource out of a file.

Parameters:
directory - The directory the file is in.
name - The name of the file.
defs - Any default attribute values that should be provided to the created resource at initialization time.
Returns:
A Resource instance, or null if the given file can't be truned into a resource given our configuration database.

All Packages  Class Hierarchy  This Package  Previous  Next  Index