    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.

##

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.
contentTypes
defname
directories
extCaseSensitive
extensions

##

SampleResourceIndexer()
SampleResourceIndexer(ResourceContext)

##

createDirectoryResource(File, String, Hashtable)
  Create a default container resource for this directory (that exists).
createFileResource(File, RequestInterface, String, Hashtable)
  Create a default file resource for this file (that exists).
createResource(ContainerResource, RequestInterface, 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 inexer
delete(String)
enumerateResourceIdentifiers(boolean)
getContext()
  Get the hierarchical context for that resource.
getDirectories()
getExtensions()
getFileExtensions(String)
getIndexedDirName(String)
getIndexedFileName(String)
getIndexedName(File, String)
  Get the name of the resource relative to the given filename.
getSuperIndexer()
getTemplateFor(String)
  Return the class (if any) that our store defines for given extension.
lastModified()
loadDirectory(String)
  Load a given directory template from the store.
loadExtension(String)
lookup(String)
mergeDefaultAttributes(Resource, String, Hashtable)
  Merge the attributes this extension defines, with the provided ones.
registerResource(String, Resource, Hashtable)

##

extCaseSensitive

     protected static final boolean extCaseSensitive

defname

     protected static final String defname

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 ResourceReference directories

extensions

     protected ResourceReference extensions

contentTypes

     protected ResourceReference contentTypes

##

SampleResourceIndexer

     public SampleResourceIndexer(ResourceContext ctxt)

SampleResourceIndexer

     public SampleResourceIndexer()

##

getContext

     protected ResourceContext getContext()

  Get the hierarchical context for that resource.

  Overrides:
    getContext in class Resource

getDirectories

     protected synchronized ResourceReference getDirectories()

getExtensions

     protected synchronized ResourceReference getExtensions()

lastModified

     public long lastModified()

getSuperIndexer

     public String getSuperIndexer()

enumerateResourceIdentifiers

     public Enumeration enumerateResourceIdentifiers(boolean all)

lookup

     public ResourceReference lookup(String name)

delete

     public synchronized void delete() throws MultipleLockException

  Delete this inexer

  Throws: MultipleLockException
    if someone else has locked the indexer.
  Overrides:
    delete in class Resource

delete

     public void delete(String name)

registerResource

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

loadExtension

     public synchronized ResourceReference loadExtension(String name)

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.

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.

getFileExtensions

     protected String[] getFileExtensions(String name)

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.

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.

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.

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.

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.

getIndexedName

     public String getIndexedName(File directory,
                                  String name)

  Get the name of the resource relative to the given filename.

  Parameters:
    name - The name of the file.
  Returns:
    a String, the resource name.

getIndexedFileName

     protected String getIndexedFileName(String name)

getIndexedDirName

     protected String getIndexedDirName(String name)

    All Packages  Class Hierarchy  This Package  Previous  Next  Index