## org.w3c.tools.resources.indexer
Class SampleResourceIndexer

    java.lang.Object
      |
      +--org.w3c.tools.resources.AttributeHolder
            |
            +--org.w3c.tools.resources.Resource
                  |
                  +--org.w3c.tools.resources.indexer.SampleResourceIndexer

Direct Known Subclasses:
  ContentTypeIndexer, GhostResourceIndexer, ServletIndexer, ZipIndexer

public class SampleResourceIndexer
extends org.w3c.tools.resources.Resource
implements org.w3c.tools.resources.ContainerInterface, ResourceIndexer

A container for directories and templates.

Field Summary
`protected static int` | `ATTR_CONTEXT` Attribute index - the context (a nasty hack)
`protected static int` | `ATTR_LAST_MODIFIED` Attribute index - Date of last modification.
`protected static int` | `ATTR_SUPER_INDEXER` Attribute index - the super indexer, if any.
`protected org.w3c.tools.resources.ResourceReference` | `contentTypes`
`protected static java.lang.String` | `defname`
`protected org.w3c.tools.resources.ResourceReference` | `directories`
`protected static boolean` | `extCaseSensitive`
`protected org.w3c.tools.resources.ResourceReference` | `extensions`

Fields inherited from class org.w3c.tools.resources.Resource
`ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL`

Fields inherited from class org.w3c.tools.resources.AttributeHolder
`attributes, slowpickle, values`

Constructor Summary
`SampleResourceIndexer()`
`SampleResourceIndexer(org.w3c.tools.resources.ResourceContext ctxt)`

Method Summary
`protected org.w3c.tools.resources.Resource` | `createDirectoryResource(java.io.File directory, org.w3c.tools.resources.RequestInterface req, java.lang.String name, java.util.Hashtable defs)` Create a default container resource for this directory (that exists).
`protected org.w3c.tools.resources.Resource` | `createFileResource(java.io.File directory, org.w3c.tools.resources.RequestInterface req, java.lang.String name, java.util.Hashtable defs)` Create a default file resource for this file (that exists).
`org.w3c.tools.resources.Resource` | `createResource(org.w3c.tools.resources.ContainerResource container, org.w3c.tools.resources.RequestInterface request, java.io.File directory, java.lang.String name, java.util.Hashtable defs)` Try to create a resource for the given file.
`protected org.w3c.tools.resources.Resource` | `createVirtualResource(java.io.File directory, org.w3c.tools.resources.RequestInterface req, java.lang.String name, java.util.Hashtable defs)` Try to create a virtual resource if the real (physical) resource is not there.
`void` | `delete()` Delete this inexer
`void` | `delete(java.lang.String name)`
`java.util.Enumeration` | `enumerateResourceIdentifiers(boolean all)`
`protected org.w3c.tools.resources.ResourceContext` | `getContext()`
`protected org.w3c.tools.resources.ResourceReference` | `getDirectories()`
`protected org.w3c.tools.resources.ResourceReference` | `getExtensions()`
`protected java.lang.String[]` | `getFileExtensions(java.lang.String name)`
`protected java.lang.String` | `getIndexedDirName(java.lang.String name)`
`protected java.lang.String` | `getIndexedFileName(java.lang.String name)`
`java.lang.String` | `getIndexedName(java.io.File directory, java.lang.String name)` Get the name of the resource relative to the given filename.
`java.lang.String` | `getSuperIndexer()`
`protected org.w3c.tools.resources.ResourceReference` | `getTemplateFor(java.lang.String ext)` Return the class (if any) that our store defines for given extension.
`long` | `lastModified()`
`org.w3c.tools.resources.ResourceReference` | `loadDirectory(java.lang.String name)` Load a given directory template from the store.
`org.w3c.tools.resources.ResourceReference` | `loadExtension(java.lang.String name)`
`org.w3c.tools.resources.ResourceReference` | `lookup(java.lang.String name)`
`protected java.util.Hashtable` | `mergeDefaultAttributes(org.w3c.tools.resources.Resource template, java.lang.String ext, java.util.Hashtable into)` Merge the attributes this extension defines, with the provided ones.
`protected void` | `mergeFrameAttributes(org.w3c.tools.resources.ResourceFrame origFrame, java.lang.String ext, org.w3c.tools.resources.ResourceReference frameref)` Merge the attributes this extension defines, with the provided ones.
`void` | `registerResource(java.lang.String name, org.w3c.tools.resources.Resource resource, java.util.Hashtable defs)`

Methods inherited from class org.w3c.tools.resources.Resource
`acceptUnload, checkMultipleLock, collectFrames, getClone, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getResourceReference, getServer, getSpace, getSpaceEntry, getStoreEntry, getURLPath, getValue, getValue, initialize, isInitialized, markModified, notifyUnload, registerFrame, setContext, setContext, setValue, setValue, unregisterFrame, updateAttributes`

Methods inherited from class org.w3c.tools.resources.AttributeHolder
`definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, initialize, lookupAttribute, pickle, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unpickle, unpickle, unpickle, unpickleInstance, unpickleInstance`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### extCaseSensitive

    protected static final boolean extCaseSensitive

### defname

    protected static final java.lang.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 org.w3c.tools.resources.ResourceReference directories

### extensions

    protected org.w3c.tools.resources.ResourceReference extensions

### contentTypes

    protected org.w3c.tools.resources.ResourceReference contentTypes

Constructor Detail

### SampleResourceIndexer

    public SampleResourceIndexer(org.w3c.tools.resources.ResourceContext ctxt)

### SampleResourceIndexer

    public SampleResourceIndexer()

Method Detail

### getContext

    protected org.w3c.tools.resources.ResourceContext getContext()

  Overrides:
    getContext in class org.w3c.tools.resources.Resource

### getDirectories

    protected org.w3c.tools.resources.ResourceReference getDirectories()

### getExtensions

    protected org.w3c.tools.resources.ResourceReference getExtensions()

### lastModified

    public long lastModified()

  Specified by:
    lastModified in interface ResourceIndexer

### getSuperIndexer

    public java.lang.String getSuperIndexer()

### enumerateResourceIdentifiers

    public java.util.Enumeration enumerateResourceIdentifiers(boolean all)

  Specified by:
    enumerateResourceIdentifiers in interface org.w3c.tools.resources.ContainerInterface

### lookup

    public org.w3c.tools.resources.ResourceReference lookup(java.lang.String name)

  Specified by:
    lookup in interface org.w3c.tools.resources.ContainerInterface

### delete

    public void delete()
                throws org.w3c.tools.resources.MultipleLockException

  Delete this inexer
  Throws:
    org.w3c.tools.resources.MultipleLockException - if someone else has locked the indexer.
  Overrides:
    delete in class org.w3c.tools.resources.Resource

### delete

    public void delete(java.lang.String name)

  Specified by:
    delete in interface org.w3c.tools.resources.ContainerInterface

### registerResource

    public void registerResource(java.lang.String name,
                                 org.w3c.tools.resources.Resource resource,
                                 java.util.Hashtable defs)

  Specified by:
    registerResource in interface org.w3c.tools.resources.ContainerInterface

### loadExtension

    public org.w3c.tools.resources.ResourceReference loadExtension(java.lang.String name)

### getTemplateFor

    protected org.w3c.tools.resources.ResourceReference getTemplateFor(java.lang.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 java.util.Hashtable mergeDefaultAttributes(org.w3c.tools.resources.Resource template,
                                                         java.lang.String ext,
                                                         java.util.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.

### mergeFrameAttributes

    protected void mergeFrameAttributes(org.w3c.tools.resources.ResourceFrame origFrame,
                                        java.lang.String ext,
                                        org.w3c.tools.resources.ResourceReference frameref)

  Merge the attributes this extension defines, with the provided ones.
  Parameters:
    `origFrame` - The original frame
    `ext` - The extension name
    `into` - The ResourceReference of the frame to be merged

### getFileExtensions

    protected java.lang.String[] getFileExtensions(java.lang.String name)

### createFileResource

    protected org.w3c.tools.resources.Resource createFileResource(java.io.File directory,
                                                                  org.w3c.tools.resources.RequestInterface req,
                                                                  java.lang.String name,
                                                                  java.util.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 org.w3c.tools.resources.ResourceReference loadDirectory(java.lang.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 org.w3c.tools.resources.Resource createDirectoryResource(java.io.File directory,
                                                                       org.w3c.tools.resources.RequestInterface req,
                                                                       java.lang.String name,
                                                                       java.util.Hashtable defs)

  Create a default container resource for this directory (that exists).
  Parameters:
    `directory` - The parent directory.
    `req` - the request that triggered this creation
    `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 org.w3c.tools.resources.Resource createVirtualResource(java.io.File directory,
                                                                     org.w3c.tools.resources.RequestInterface req,
                                                                     java.lang.String name,
                                                                     java.util.Hashtable defs)

  Try to create a virtual resource if the real (physical) resource is not there.
  Parameters:
    `directory` - The directory the file is in.
    `req` - the request that triggered this creation
    `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 org.w3c.tools.resources.Resource createResource(org.w3c.tools.resources.ContainerResource container,
                                                           org.w3c.tools.resources.RequestInterface request,
                                                           java.io.File directory,
                                                           java.lang.String name,
                                                           java.util.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.
  Specified by:
    createResource in interface ResourceIndexer
  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 java.lang.String getIndexedName(java.io.File directory,
                                           java.lang.String name)

  Get the name of the resource relative to the given filename.
  Specified by:
    getIndexedName in interface ResourceIndexer
  Parameters:
    `name` - The name of the file.
  Returns:
    a String, the resource name.

### getIndexedFileName

    protected java.lang.String getIndexedFileName(java.lang.String name)

### getIndexedDirName

    protected java.lang.String getIndexedDirName(java.lang.String name)