org.apache.naming.java
public class: javaURLContextFactory [javadoc |
source]
java.lang.Object
org.apache.naming.java.javaURLContextFactory
All Implemented Interfaces:
InitialContextFactory, ObjectFactory
Context factory for the "java:" namespace.
Important note : This factory MUST be associated with the "java" URL
prefix, which can be done by either :
- author:
Remy - Maucherat
- version:
$ - Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
| Field Summary |
|---|
| public static final String | MAIN | |
| protected static Context | initialContext | Initial context. |
| Method from org.apache.naming.java.javaURLContextFactory Detail: |
public Context getInitialContext(Hashtable environment) throws NamingException {
if (ContextBindings.isThreadBound() ||
(ContextBindings.isClassLoaderBound())) {
// Redirect the request to the bound initial context
return new SelectorContext(environment, true);
} else {
// If the thread is not bound, return a shared writable context
if (initialContext == null)
initialContext = new NamingContext(environment, MAIN);
return initialContext;
}
}
Get a new (writable) initial context. |
public Object getObjectInstance(Object obj,
Name name,
Context nameCtx,
Hashtable environment) throws NamingException {
// --------------------------------------------------------- Public Methods
// -------------------------------------------------- ObjectFactory Methods
if ((ContextBindings.isThreadBound()) ||
(ContextBindings.isClassLoaderBound())) {
return new SelectorContext(environment);
} else {
return null;
}
}
Crete a new Context's instance. |