All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.w3c.tools.resources.indexer.SampleResourceIndexer

java.lang.Object
   |
   +----org.w3c.tools.resources.AttributeHolder
           |
           +----org.w3c.tools.resources.Resource
                   |
                   +----org.w3c.tools.resources.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 contentTypes
 o defname
 o directories
 o extCaseSensitive
 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, RequestInterface, String, Hashtable)
Create a default file resource for this file (that exists).
 o createResource(ContainerResource, RequestInterface, File, String, Hashtable)
Try to create a resource for the given file.
 o createVirtualResource(File, String, Hashtable)
Try to create a virtual resource if the real (physical) resource is not there.
 o delete()
Delete this inexer
 o delete(String)
 o enumerateResourceIdentifiers(boolean)
 o getContext()
Get the hierarchical context for that resource.
 o getDirectories()
 o getExtensions()
 o getFileExtensions(String)
 o getSuperIndexer()
 o getTemplateFor(String)
Return the class (if any) that our store defines for given extension.
 o lastModified()
 o loadDirectory(String)
Load a given directory template from the store.
 o loadExtension(String)
 o lookup(String)
 o mergeDefaultAttributes(Resource, String, Hashtable)
Merge the attributes this extension defines, with the provided ones.
 o registerResource(String, Resource, Hashtable)

Variables

 o extCaseSensitive
 protected static final boolean extCaseSensitive
 o defname
 protected static final String defname
 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 ResourceReference directories
 o extensions
 protected ResourceReference extensions
 o contentTypes
 protected ResourceReference contentTypes

Constructors

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

Methods

 o getContext
 protected ResourceContext getContext()
Get the hierarchical context for that resource.

Overrides:
getContext in class Resource
 o getDirectories
 protected synchronized ResourceReference getDirectories()
 o getExtensions
 protected synchronized ResourceReference getExtensions()
 o lastModified
 public long lastModified()
 o getSuperIndexer
 public String getSuperIndexer()
 o enumerateResourceIdentifiers
 public Enumeration enumerateResourceIdentifiers(boolean all)
 o lookup
 public ResourceReference lookup(String name)
 o delete
 public synchronized void delete() throws MultipleLockException
Delete this inexer

Throws: MultipleLockException
if someone else has locked the indexer.
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 ResourceReference loadExtension(String name)
 o getTemplateFor
 protected ResourceReference 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(Resource 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 Resource createFileResource(File directory,
                                       RequestInterface req,
                                       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 Resource, or null if we were unable to create it.
 o loadDirectory
 public synchronized ResourceReference loadDirectory(String name)
Load a given directory template from the store.

Parameters:
name - The name of the template to load.
Returns:
An instance of ResourceReference, or null.
 o createDirectoryResource
 protected Resource 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:
A Resource instance, or null if the indexer was unable to build a default resource for the directory.
 o createVirtualResource
 protected Resource createVirtualResource(File directory,
                                          String name,
                                          Hashtable defs)
Try to create a virtual resource if the real (physical) resource is not there.

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.
 o createResource
 public Resource createResource(ContainerResource container,
                                RequestInterface 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