Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 Resource
implements 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 ResourceReference` | `contentTypes`
`protected static java.lang.String` | `defname`
`protected ResourceReference` | `directories`
`protected static boolean` | `extCaseSensitive`
`protected 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(ResourceContext ctxt)`

Method Summary
`protected Resource` | `createDirectoryResource(java.io.File directory, RequestInterface req, java.lang.String name, java.util.Hashtable defs)` Create a default container resource for this directory (that exists).
`protected Resource` | `createFileResource(java.io.File directory, RequestInterface req, java.lang.String name, java.util.Hashtable defs)` Create a default file resource for this file (that exists).
`Resource` | `createResource(ContainerResource container, RequestInterface request, java.io.File directory, java.lang.String name, java.util.Hashtable defs)` Try to create a resource for the given file.
`protected Resource` | `createVirtualResource(java.io.File directory, 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 ResourceContext` | `getContext()`
`protected ResourceReference` | `getDirectories()`
`protected 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 ResourceReference` | `getTemplateFor(java.lang.String ext)` Return the class (if any) that our store defines for given extension.
`long` | `lastModified()`
`ResourceReference` | `loadDirectory(java.lang.String name)` Load a given directory template from the store.
`ResourceReference` | `loadExtension(java.lang.String name)`
`ResourceReference` | `lookup(java.lang.String name)`
`protected java.util.Hashtable` | `mergeDefaultAttributes(Resource template, java.lang.String ext, java.util.Hashtable into)` Merge the attributes this extension defines, with the provided ones.
`protected void` | `mergeFrameAttributes(ResourceFrame origFrame, java.lang.String ext, ResourceReference frameref)` Merge the attributes this extension defines, with the provided ones.
`void` | `registerResource(java.lang.String name, 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, isUnloaded, 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 ResourceReference directories

### extensions

    protected ResourceReference extensions

### contentTypes

    protected ResourceReference contentTypes

Constructor Detail

### SampleResourceIndexer

    public SampleResourceIndexer(ResourceContext ctxt)

### SampleResourceIndexer

    public SampleResourceIndexer()

Method Detail

### getContext

    protected ResourceContext getContext()

  Overrides:
    getContext in class Resource

### getDirectories

    protected ResourceReference getDirectories()

### getExtensions

    protected 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 ContainerInterface

### lookup

    public ResourceReference lookup(java.lang.String name)

  Specified by:
    lookup in interface ContainerInterface

### delete

    public 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(java.lang.String name)

  Specified by:
    delete in interface ContainerInterface

### registerResource

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

  Specified by:
    registerResource in interface ContainerInterface

### loadExtension

    public ResourceReference loadExtension(java.lang.String name)

### getTemplateFor

    protected 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(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(ResourceFrame origFrame,
                                        java.lang.String ext,
                                        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 Resource createFileResource(java.io.File directory,
                                          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 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 Resource createDirectoryResource(java.io.File directory,
                                               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 Resource createVirtualResource(java.io.File directory,
                                             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 Resource createResource(ContainerResource container,
                                   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)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD