org.apache.naming.resources
Class VirtualDirContext
java.lang.Object
org.apache.naming.resources.BaseDirContext
org.apache.naming.resources.FileDirContext
org.apache.naming.resources.VirtualDirContext
- All Implemented Interfaces:
- Context, DirContext
public class VirtualDirContext
- extends FileDirContext
Extended FileDirContext implementation that will allow loading of tld files
from the META-INF directory (or subdirectories) in classpath. This will fully
mimic the behavior of compressed jars also when using unjarred resources. Tld
files can be loaded indifferently from WEB-INF webapp dir (or subdirs) or
from META-INF dir from jars available in the classpath: using this DirContext
implementation you will be able to use unexpanded jars during development and
to make any tld in them virtually available to the webapp.
Sample context xml configuration:
<Context docBase="\webapps\mydocbase">
<Resources className="org.apache.naming.resources.VirtualDirContext"
virtualClasspath="\dir\classes;\somedir\somejar.jar"/>
</Resources>
This is not meant to be used for production.
Its meant to ease development with IDE's without the
need for fully republishing jars in WEB-INF/lib
- Version:
- $Id: VirtualDirContext.java 943447 2010-05-12 11:10:03Z markt $
- Author:
- Fabrizio Giustina
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 |
Method Summary |
void |
allocate()
Allocate resources for this directory context. |
protected Object |
doLookup(String name)
Retrieves the named object. |
Attributes |
getAttributes(String name)
Retrieves all of the attributes associated with a named object. |
protected ArrayList<NamingEntry> |
list(File file)
List the resources which are members of a collection. |
void |
release()
Release any resources allocated for this directory context. |
void |
setVirtualClasspath(String path)
virtualClasspath attribute that will be automatically set
from the Context virtualClasspath attribute
from the context xml file. |
Methods inherited from class org.apache.naming.resources.FileDirContext |
bind, createSubcontext, destroySubcontext, doGetAttributes, doGetRealPath, doListBindings, file, getAllowLinking, getNameInNamespace, getSchema, getSchemaClassDefinition, list, lookupLink, modifyAttributes, modifyAttributes, normalize, rebind, rename, search, search, search, search, setAllowLinking, setDocBase, unbind |
Methods inherited from class org.apache.naming.resources.BaseDirContext |
addAlias, addResourcesJar, addToEnvironment, bind, bind, bind, close, composeName, composeName, createSubcontext, createSubcontext, createSubcontext, destroySubcontext, getAliases, getAttributes, getAttributes, getAttributes, getCacheMaxSize, getCacheObjectMaxSize, getCacheTTL, getDocBase, getEnvironment, getNameParser, getNameParser, getRealPath, getSchema, getSchemaClassDefinition, isCached, list, listBindings, listBindings, lookup, lookup, lookupLink, modifyAttributes, modifyAttributes, rebind, rebind, rebind, removeAlias, removeFromEnvironment, rename, search, search, search, search, setAliases, setCached, setCacheMaxSize, setCacheObjectMaxSize, setCacheTTL, unbind |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VirtualDirContext
public VirtualDirContext()
setVirtualClasspath
public void setVirtualClasspath(String path)
virtualClasspath
attribute that will be automatically set
from the Context
virtualClasspath
attribute
from the context xml file.
- Parameters:
path
- ;
separated list of path elements.
allocate
public void allocate()
- Allocate resources for this directory context.
- Overrides:
allocate
in class BaseDirContext
release
public void release()
- Release any resources allocated for this directory context.
- Overrides:
release
in class FileDirContext
getAttributes
public Attributes getAttributes(String name)
throws NamingException
- Description copied from class:
BaseDirContext
- Retrieves all of the attributes associated with a named object.
- Specified by:
getAttributes
in interface DirContext
- Overrides:
getAttributes
in class BaseDirContext
- Parameters:
name
- the name of the object from which to retrieve attributes
- Returns:
- the set of attributes associated with name
- Throws:
NamingException
- if a naming exception is encountered
list
protected ArrayList<NamingEntry> list(File file)
- Description copied from class:
FileDirContext
- List the resources which are members of a collection.
- Overrides:
list
in class FileDirContext
- Parameters:
file
- Collection
- Returns:
- Vector containing NamingEntry objects
doLookup
protected Object doLookup(String name)
- Description copied from class:
FileDirContext
- Retrieves the named object.
- Overrides:
doLookup
in class FileDirContext
- Parameters:
name
- the name of the object to look up
- Returns:
- the object bound to name
Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.