    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.

##

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

##

SampleResourceIndexer()
SampleResourceIndexer(ResourceContext)

##

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(ContainerResource, Request, File, String, Hashtable)
  Try to create a resource for the given file.
createVirtualResource(File, String, Hashtable)
  Try to create a virtual resource if the real (physical) resource is not there.
delete()
  Delete this Resource instance, and remove it from its store.
delete(String)
enumerateResourceIdentifiers(boolean)
getContext()
getDirectories()
getExtensions()
getFileExtensions(String)
getResourceStore(ResourceStoreHolder)
getSuperIndexer()
getTemplateFor(String)
  Return the class (if any) that our store defines for given extension.
hasResourceStore()
lastModified()
loadDirectory(String)
  Load a given directory template from the store.
loadExtension(String)
lookup(String)
mergeDefaultAttributes(HTTPResource, String, Hashtable)
  Merge the attributes this extension defines, with the provided ones.
notifyResourceLockBreak(Resource)
registerResource(String, Resource, Hashtable)

##

ATTR_LAST_MODIFIED

     protected static int ATTR_LAST_MODIFIED

  Attribute index - Date of last modification.

ATTR_CONTEXT

     protected static int ATTR_CONTEXT

  Attribute index - the context (a nasty hack)

ATTR_SUPER_INDEXER

     protected static int ATTR_SUPER_INDEXER

  Attribute index - the super indexer, if any.

directories

     protected SampleContainer directories

extensions

     protected SampleContainer extensions

##

SampleResourceIndexer

     public SampleResourceIndexer(ResourceContext ctxt)

SampleResourceIndexer

     public SampleResourceIndexer()

##

getContext

     protected ResourceContext getContext()

getDirectories

     protected synchronized SampleContainer getDirectories()

getExtensions

     protected synchronized SampleContainer getExtensions()

lastModified

     public long lastModified()

getSuperIndexer

     public String getSuperIndexer()

notifyResourceLockBreak

     public synchronized void notifyResourceLockBreak(Resource r)

hasResourceStore

     public boolean hasResourceStore()

getResourceStore

     public ResourceStore getResourceStore(ResourceStoreHolder holder)

enumerateResourceIdentifiers

     public Enumeration enumerateResourceIdentifiers(boolean all)

lookup

     public Resource lookup(String name)

delete

     public synchronized void delete()

  Delete this Resource instance, and remove it from its store.

  Overrides:
    delete in class Resource

delete

     public void delete(String name)

registerResource

     public void registerResource(String name,
                                  Resource resource,
                                  Hashtable defs)

loadExtension

     public synchronized HTTPResource loadExtension(String name)

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.

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.

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.

createVirtualResource

     protected HTTPResource 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.

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