    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.

##

acceptStoreUnload(ResourceStore)
  Resource store holder implementation - get rid of our store.
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.
getFileExtensions(String)
getTemplateFor(String)
  Return the class (if any) that our store defines for given extension.
loadDirectory(String)
loadExtension(String)
  Load an extension descriptor.
mergeDefaultAttributes(HTTPResource, 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.
registerDirectory(Directory)
  Register this new directory template into our directory store.
registerExtension(HTTPResource)
  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 synchronized HTTPResource 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(HTTPResource 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.

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.

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.

getFileExtensions

      protected String[] getFileExtensions(String name)

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 synchronized Directory loadDirectory(String name)

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.

acceptStoreUnload

      public synchronized boolean acceptStoreUnload(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 void 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