Package org.apache.naming.resources
Class WebDirContext
- java.lang.Object
-
- org.apache.naming.resources.BaseDirContext
-
- org.apache.naming.resources.FileDirContext
-
- org.apache.naming.resources.WebDirContext
-
- All Implemented Interfaces:
Context
,DirContext
public class WebDirContext extends FileDirContext
Filesystem Directory Web Context implementation helper class.- Author:
- Shing Wai Chan
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
WebDirContext.JarFileEntry
protected static class
WebDirContext.JarResource
This specialized resource implementation avoids opening the InputStream to the jar entry right away (which would put a lock on the jar file).protected static class
WebDirContext.JarResourceAttributes
This specialized resource attribute implementation does some lazy reading (to speed up simple checks, like checking the last modified date).-
Nested classes/interfaces inherited from class org.apache.naming.resources.FileDirContext
FileDirContext.FileResource, FileDirContext.FileResourceAttributes
-
-
Field Summary
Fields Modifier and Type Field Description protected JarFileResourcesProvider
jarFileResourcesProvider
protected String
jarResourceBase
protected static String
META_INF_RESOURCES
-
Fields inherited from class org.apache.naming.resources.FileDirContext
absoluteBase, allowLinking, base, BUFFER_SIZE, caseSensitive, docBaseFileCache, fileCache, listFileCache, rb
-
Fields inherited from class org.apache.naming.resources.BaseDirContext
cached, cacheMaxSize, cacheTTL, debug, docBase, env
-
Fields inherited from interface javax.naming.Context
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES
-
Fields inherited from interface javax.naming.directory.DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
-
-
Constructor Summary
Constructors Constructor Description WebDirContext()
Builds a file directory context using the given environment.WebDirContext(Hashtable<String,Object> env)
Builds a file directory context using the given environment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getAbsoluteJarResourceName(String name)
Attributes
getAttributes(String name, String[] attrIds)
Retrieves selected attributes associated with a named object.NamingEnumeration<NameClassPair>
list(String name)
Enumerates the names bound in the named context, along with the class names of objects bound to them.protected List<NamingEntry>
list(WebDirContext.JarFileEntry jfeEntry)
NamingEnumeration<Binding>
listBindings(String name)
Enumerates the names bound in the named context, along with the objects bound to them.Object
lookup(String name)
Retrieves the named object.protected List<WebDirContext.JarFileEntry>
lookupAllFromJars(String name)
protected WebDirContext.JarFileEntry
lookupFromJars(String name)
void
release()
Release any resources allocated for this directory context.void
setJarFileResourcesProvider(JarFileResourcesProvider jarFileResourcesProvider)
-
Methods inherited from class org.apache.naming.resources.FileDirContext
bind, createSubcontext, destroySubcontext, file, getAllowLinking, getNameInNamespace, getSchema, getSchemaClassDefinition, isCaseSensitive, list, lookupLink, modifyAttributes, modifyAttributes, normalize, rebind, rebind, rename, search, search, search, search, setAllowLinking, setCaseSensitive, setDocBase, unbind
-
Methods inherited from class org.apache.naming.resources.BaseDirContext
addToEnvironment, allocate, bind, bind, bind, close, composeName, composeName, createSubcontext, createSubcontext, createSubcontext, destroySubcontext, getAttributes, getAttributes, getAttributes, getCacheMaxSize, getCacheTTL, getDebug, getDocBase, getEnvironment, getNameParser, getNameParser, getSchema, getSchemaClassDefinition, isCached, list, listBindings, lookup, lookupLink, modifyAttributes, modifyAttributes, rebind, rebind, rebind, removeFromEnvironment, rename, search, search, search, search, setCached, setCacheMaxSize, setCacheTTL, setDebug, unbind
-
-
-
-
Field Detail
-
META_INF_RESOURCES
protected static final String META_INF_RESOURCES
- See Also:
- Constant Field Values
-
jarFileResourcesProvider
protected JarFileResourcesProvider jarFileResourcesProvider
-
jarResourceBase
protected String jarResourceBase
-
-
Method Detail
-
setJarFileResourcesProvider
public void setJarFileResourcesProvider(JarFileResourcesProvider jarFileResourcesProvider)
-
release
public void release()
Release any resources allocated for this directory context.- Overrides:
release
in classFileDirContext
-
lookup
public Object lookup(String name) throws NamingException
Retrieves the named object.- Specified by:
lookup
in interfaceContext
- Overrides:
lookup
in classFileDirContext
- Parameters:
name
- the name of the object to look up- Returns:
- the object bound to name
- Throws:
NamingException
- if a naming exception is encountered
-
list
public NamingEnumeration<NameClassPair> list(String name) throws NamingException
Enumerates the names bound in the named context, along with the class names of objects bound to them. The contents of any subcontexts are not included.If a binding is added to or removed from this context, its effect on an enumeration previously returned is undefined.
- Specified by:
list
in interfaceContext
- Overrides:
list
in classFileDirContext
- Parameters:
name
- the name of the context to list- Returns:
- an enumeration of the names and class names of the bindings in this context. Each element of the enumeration is of type NameClassPair.
- Throws:
NamingException
- if a naming exception is encountered
-
listBindings
public NamingEnumeration<Binding> listBindings(String name) throws NamingException
Enumerates the names bound in the named context, along with the objects bound to them. The contents of any subcontexts are not included.If a binding is added to or removed from this context, its effect on an enumeration previously returned is undefined.
- Specified by:
listBindings
in interfaceContext
- Overrides:
listBindings
in classFileDirContext
- Parameters:
name
- the name of the context to list- Returns:
- an enumeration of the bindings in this context. Each element of the enumeration is of type Binding.
- Throws:
NamingException
- if a naming exception is encountered
-
getAttributes
public Attributes getAttributes(String name, String[] attrIds) throws NamingException
Retrieves selected attributes associated with a named object. See the class description regarding attribute models, attribute type names, and operational attributes.- Specified by:
getAttributes
in interfaceDirContext
- Overrides:
getAttributes
in classFileDirContext
- Parameters:
name
- the name of the object from which to retrieve attributesattrIds
- the identifiers of the attributes to retrieve. null indicates that all attributes should be retrieved; an empty array indicates that none should be retrieved- Returns:
- the requested attributes; never null
- Throws:
NamingException
- if a naming exception is encountered
-
lookupFromJars
protected WebDirContext.JarFileEntry lookupFromJars(String name)
-
lookupAllFromJars
protected List<WebDirContext.JarFileEntry> lookupAllFromJars(String name)
-
list
protected List<NamingEntry> list(WebDirContext.JarFileEntry jfeEntry)
-
-