|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.tools.resources.AttributeHolder org.w3c.tools.resources.Resource org.w3c.tools.resources.indexer.SampleResourceIndexer
public class SampleResourceIndexer
A container for directories and templates.
Field Summary | |
---|---|
protected static int |
ATTR_NOT_INDEXED
Attribute index - the super indexer, if any. |
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
|
static boolean |
isWinPlatform
|
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, co, id |
Fields inherited from class org.w3c.tools.resources.AttributeHolder |
---|
attributes, 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)
Remove a child resource from that container. |
java.util.Enumeration |
enumerateResourceIdentifiers(boolean all)
Enumerate children resource identifiers. |
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()
When was this indexer configuration last modified. |
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)
Lookup a children in the container. |
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)
Initialize and register the given resource within that container. |
Methods inherited from class org.w3c.tools.resources.Resource |
---|
acceptUnload, checkMultipleLock, collectFrames, getClone, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getResourceReference, getServer, getSpace, getSpaceEntry, getStoreEntry, getURLPath, getValue, getValue, initialize, initialize, isInitialized, isUnloaded, markModified, notifyUnload, pickleValues, registerFrame, setContext, setContext, setValue, setValue, unregisterFrame, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue, updateAttributes |
Methods inherited from class org.w3c.tools.resources.AttributeHolder |
---|
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final boolean extCaseSensitive
protected static final java.lang.String defname
public static boolean isWinPlatform
protected static int ATTR_SUPER_INDEXER
protected static int ATTR_NOT_INDEXED
protected ResourceReference directories
protected ResourceReference extensions
protected ResourceReference contentTypes
Constructor Detail |
---|
public SampleResourceIndexer(ResourceContext ctxt)
public SampleResourceIndexer()
Method Detail |
---|
protected ResourceReference getDirectories()
protected ResourceReference getExtensions()
public long lastModified()
ResourceIndexer
lastModified
in interface ResourceIndexer
public java.lang.String getSuperIndexer()
public java.util.Enumeration enumerateResourceIdentifiers(boolean all)
ContainerInterface
enumerateResourceIdentifiers
in interface ContainerInterface
all
- Should all resources be enumerated ? Resources are often
created on demand only, this flag allows the caller to tell the
container about wether it is interested only in already created
resources, or in all resources (even the one that have not yet been
created).
public ResourceReference lookup(java.lang.String name)
ContainerInterface
lookup
in interface ContainerInterface
name
- The name of the children to lookup.
the resource from its store.public void delete() throws MultipleLockException
delete
in class Resource
MultipleLockException
- if someone
else has locked the indexer.public void delete(java.lang.String name)
ContainerInterface
delete
in interface ContainerInterface
name
- The name of the child to remove.public void registerResource(java.lang.String name, Resource resource, java.util.Hashtable defs)
ContainerInterface
registerResource
in interface ContainerInterface
name
- The identifier for the resource.resource
- An unitialized resource instance.defs
- A default set of init attribute values (may be
null).public ResourceReference loadExtension(java.lang.String name)
protected ResourceReference getTemplateFor(java.lang.String ext)
ext
- The extension we want a class for.
protected java.util.Hashtable mergeDefaultAttributes(Resource template, java.lang.String ext, java.util.Hashtable into)
attrs
- The attributes we want to fill with default values.ext
- The extension name.into
- The already built set of default values.
protected void mergeFrameAttributes(ResourceFrame origFrame, java.lang.String ext, ResourceReference frameref)
origFrame
- The original frameext
- The extension nameinto
- The ResourceReference of the frame to be mergedprotected java.lang.String[] getFileExtensions(java.lang.String name)
protected Resource createFileResource(java.io.File directory, RequestInterface req, java.lang.String name, java.util.Hashtable defs)
directory
- The directory of the file.name
- The name of the file.defs
- A set of default attribute values.
public ResourceReference loadDirectory(java.lang.String name)
name
- The name of the template to load.
protected Resource createDirectoryResource(java.io.File directory, RequestInterface req, java.lang.String name, java.util.Hashtable defs)
directory
- The parent directory.req
- the request that triggered this creationname
- The name of its sub-directory to index.defaults
- A set of default atribute values.
protected Resource createVirtualResource(java.io.File directory, RequestInterface req, java.lang.String name, java.util.Hashtable defs)
directory
- The directory the file is in.req
- the request that triggered this creationname
- The name of the file.defs
- Any default attribute values that should be provided
to the created resource at initialization time.
public Resource createResource(ContainerResource container, RequestInterface request, java.io.File directory, java.lang.String name, java.util.Hashtable defs)
createResource
in interface ResourceIndexer
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.container
- The container making the call.request
- The HTTP request that triggered the call to the indexer
(may be null).
public java.lang.String getIndexedName(java.io.File directory, java.lang.String name)
getIndexedName
in interface ResourceIndexer
name
- The name of the file.
protected java.lang.String getIndexedFileName(java.lang.String name)
protected java.lang.String getIndexedDirName(java.lang.String name)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |