Class w3c.jigsaw.indexer.ResourceIndexer
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.indexer.ResourceIndexer

java.lang.Object
   |
   +----w3c.jigsaw.indexer.ResourceIndexer

public class ResourceIndexer
extends Object
implements ResourceStoreHolder
Jigsaw indexer. The indexer is an object that given some global configuration informations, tries to build default resources for files that the server doesn't know about.

Variable Index

 o directories
Our directory templates database.
 o dirrep
our directory database repository.
 o extensions
Our extensions database.
 o extrep
Our extension database repository.
 o server
The server that's using us.

Constructor Index

 o ResourceIndexer(httpd)
Create a new resource indexer object.

Method Index

 o acquireDirectoriesStore()
Acquire the directories store.
 o acquireExtensionsStore()
Acquire the extension store.
 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(File, String, Hashtable)
Try to create a resource for the given file.
 o enumerateDirectoryNames()
Enumerate the names of the defined directory templates.
 o enumerateExtensionNames()
Get the list of extension names.
 o getFileExtensions(String)
Get this name's extensions.
 o getTemplateFor(String)
Return the class (if any) that our store defines for given extension.
 o loadDirectory(String)
 o loadExtension(String)
Load an extension descriptor.
 o mergeDefaultAttributes(HTTPResource, String, Hashtable)
Merge the attributes this extension defines, with the provided ones.
 o notifyStoreShutdown(ResourceStore)
Resource store holder implementation - Shutdown our store.
 o notifyStoreStabilize(ResourceStore)
Resource store holder implementation - Save the store.
 o notifyStoreUnload(ResourceStore)
Resource store holder implementation - get rid of our store.
 o registerDirectory(Directory)
Register this new directory template into our directory store.
 o registerExtension(HTTPResource)
Register a new extension to the store.
 o save()
Save your state.
 o unregisterDirectory(String)
Unregister the given directory from our stor.
 o unregisterExtension(String)
Unregister knowledge about a given extension.

Variables

 o extrep
  protected File extrep
Our extension database repository.
 o dirrep
  protected File dirrep
our directory database repository.
 o extensions
  protected ResourceStore extensions
Our extensions database.
 o directories
  protected ResourceStore directories
Our directory templates database.
 o server
  protected httpd server
The server that's using us.

Constructors

 o ResourceIndexer
  public ResourceIndexer(httpd server)
Create a new resource indexer object.

Methods

 o acquireExtensionsStore
  protected synchronized void acquireExtensionsStore()
Acquire the extension store. Should only be called from a synchronized method.
 o acquireDirectoriesStore
  protected synchronized void acquireDirectoriesStore()
Acquire the directories store. Should only be called from a synchronized method.
 o loadExtension
  public HTTPResource loadExtension(String name)
Load an extension descriptor.
Parameters:
ext - The name of the extension.
Returns:
An instance of Extension, or null.
 o save
  public void save()
Save your state.
 o registerExtension
  public synchronized void registerExtension(HTTPResource e)
Register a new extension to the store.
Parameters:
e - The extension to register.
 o unregisterExtension
  public synchronized void unregisterExtension(String ext)
Unregister knowledge about a given extension.
Parameters:
ext - The extension to unregister.
 o enumerateExtensionNames
  public Enumeration enumerateExtensionNames()
Get the list of extension names.
Returns:
An enumeration of the known extension names.
 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)
Get this name's extensions.
Parameters:
name - The file name.
Returns:
An array of string, giving ach (parsed) extension, or null if none was found.
 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 registerDirectory
  public synchronized void registerDirectory(Directory directory)
Register this new directory template into our directory store.
Parameters:
template - The directory template.
 o unregisterDirectory
  public synchronized void unregisterDirectory(String id)
Unregister the given directory from our stor.
Parameters:
name - The name of the directory to unregister.
 o enumerateDirectoryNames
  public synchronized Enumeration enumerateDirectoryNames()
Enumerate the names of the defined directory templates.
Returns:
An enumeration of directory names.
 o loadDirectory
  public Directory loadDirectory(String name)
 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 notifyStoreUnload
  public synchronized boolean notifyStoreUnload(ResourceStore store)
Resource store holder implementation - get rid of our store.
Parameters:
store - The store we should get rid of.
Returns:
Always true.
 o notifyStoreShutdown
  public synchronized void notifyStoreShutdown(ResourceStore store)
Resource store holder implementation - Shutdown our store.
Parameters:
store - The store we should shut down.
 o notifyStoreStabilize
  public boolean notifyStoreStabilize(ResourceStore store)
Resource store holder implementation - Save the store.
Parameters:
store - The store to be saved.
Returns:
A boolean true if success.
 o createResource
  public HTTPResource createResource(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