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.
-
directories
- Our directory templates database.
-
dirrep
- our directory database repository.
-
extensions
- Our extensions database.
-
extrep
- Our extension database repository.
-
server
- The server that's using us.
-
ResourceIndexer(httpd)
- Create a new resource indexer object.
-
acquireDirectoriesStore()
- Acquire the directories store.
-
acquireExtensionsStore()
- Acquire the extension store.
-
createDirectoryResource(File, String, Hashtable)
- Create a default container resource for this directory (that exists).
-
createFileResource(File, String, Hashtable)
- Create a default file resource for this file (that exists).
-
createResource(File, String, Hashtable)
- Try to create a resource for the given file.
-
enumerateDirectoryNames()
- Enumerate the names of the defined directory templates.
-
enumerateExtensionNames()
- Get the list of extension names.
-
getClassFor(String)
- Return the class (if any) that our store defines for given extension.
-
getFileExtensions(String)
- Get this name's extensions.
-
loadDirectory(String)
- Load a given directory template from the store.
-
loadExtension(String)
- Load an extension descriptor.
-
mergeDefaultAttributes(Attribute[], String, Hashtable)
- Merge the attributes this extension defines, with the provided ones.
-
notifyStoreShutdown(ResourceStore)
- Resource store holder implementation - Shutdown our store.
-
notifyStoreStabilize(ResourceStore)
- Resource store holder implementation - Save the store.
-
notifyStoreUnload(ResourceStore)
-
Resource store holder implementation - get rid of our store.
-
registerDirectory(Directory)
- Register this new directory template into our directory store.
-
registerExtension(Extension)
- Register a new extension to the store.
-
save()
- Save your state.
-
unregisterDirectory(String)
- Unregister the given directory from our stor.
-
unregisterExtension(String)
- Unregister knowledge about a given extension.
extrep
protected File extrep
- Our extension database repository.
dirrep
protected File dirrep
- our directory database repository.
extensions
protected ResourceStore extensions
- Our extensions database.
directories
protected ResourceStore directories
- Our directory templates database.
server
protected httpd server
- The server that's using us.
ResourceIndexer
public ResourceIndexer(httpd server)
- Create a new resource indexer object.
acquireExtensionsStore
protected synchronized void acquireExtensionsStore()
- Acquire the extension store.
Should only be called from a synchronized method.
acquireDirectoriesStore
protected synchronized void acquireDirectoriesStore()
- Acquire the directories store.
Should only be called from a synchronized method.
loadExtension
public Extension loadExtension(String name)
- Load an extension descriptor.
- Parameters:
- ext - The name of the extension.
- Returns:
- An instance of Extension, or null.
save
public void save()
- Save your state.
registerExtension
public synchronized void registerExtension(Extension e)
- Register a new extension to the store.
- Parameters:
- e - The extension to register.
unregisterExtension
public synchronized void unregisterExtension(String ext)
- Unregister knowledge about a given extension.
- Parameters:
- ext - The extension to unregister.
enumerateExtensionNames
public Enumeration enumerateExtensionNames()
- Get the list of extension names.
- Returns:
- An enumeration of the known extension names.
getClassFor
protected Class getClassFor(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.
mergeDefaultAttributes
protected Hashtable mergeDefaultAttributes(Attribute attrs[],
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.
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.
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.
registerDirectory
public synchronized void registerDirectory(Directory directory)
- Register this new directory template into our directory store.
- Parameters:
- template - The directory template.
unregisterDirectory
public synchronized void unregisterDirectory(String id)
- Unregister the given directory from our stor.
- Parameters:
- name - The name of the directory to unregister.
enumerateDirectoryNames
public synchronized Enumeration enumerateDirectoryNames()
- Enumerate the names of the defined directory templates.
- Returns:
- An enumeration of directory names.
loadDirectory
public Directory 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.
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.
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.
notifyStoreShutdown
public synchronized void notifyStoreShutdown(ResourceStore store)
- Resource store holder implementation - Shutdown our store.
- Parameters:
- store - The store we should shut down.
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.
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