src/share/classes/javax/naming/spi/NamingManager.java
Print this page
*** 137,147 ****
static ObjectFactory getObjectFactoryFromReference(
Reference ref, String factoryName)
throws IllegalAccessException,
InstantiationException,
MalformedURLException {
! Class clas = null;
// Try to use current class loader
try {
clas = helper.loadClass(factoryName);
} catch (ClassNotFoundException e) {
--- 137,147 ----
static ObjectFactory getObjectFactoryFromReference(
Reference ref, String factoryName)
throws IllegalAccessException,
InstantiationException,
MalformedURLException {
! Class<?> clas = null;
// Try to use current class loader
try {
clas = helper.loadClass(factoryName);
} catch (ClassNotFoundException e) {
*** 170,180 ****
* or of the provider resource file associated with <tt>nameCtx</tt>.
*
* @return factory created; null if cannot create
*/
private static Object createObjectFromFactories(Object obj, Name name,
! Context nameCtx, Hashtable environment) throws Exception {
FactoryEnumeration factories = ResourceManager.getFactories(
Context.OBJECT_FACTORIES, environment, nameCtx);
if (factories == null)
--- 170,180 ----
* or of the provider resource file associated with <tt>nameCtx</tt>.
*
* @return factory created; null if cannot create
*/
private static Object createObjectFromFactories(Object obj, Name name,
! Context nameCtx, Hashtable<?,?> environment) throws Exception {
FactoryEnumeration factories = ResourceManager.getFactories(
Context.OBJECT_FACTORIES, environment, nameCtx);
if (factories == null)
*** 347,357 ****
* Ref has no factory. For each address of type "URL", try its URL
* context factory. Returns null if unsuccessful in creating and
* invoking a factory.
*/
static Object processURLAddrs(Reference ref, Name name, Context nameCtx,
! Hashtable environment)
throws NamingException {
for (int i = 0; i < ref.size(); i++) {
RefAddr addr = ref.get(i);
if (addr instanceof StringRefAddr &&
--- 347,357 ----
* Ref has no factory. For each address of type "URL", try its URL
* context factory. Returns null if unsuccessful in creating and
* invoking a factory.
*/
static Object processURLAddrs(Reference ref, Name name, Context nameCtx,
! Hashtable<?,?> environment)
throws NamingException {
for (int i = 0; i < ref.size(); i++) {
RefAddr addr = ref.get(i);
if (addr instanceof StringRefAddr &&
*** 366,376 ****
}
return null;
}
private static Object processURL(Object refInfo, Name name,
! Context nameCtx, Hashtable environment)
throws NamingException {
Object answer;
// If refInfo is a URL string, try to use its URL context factory
// If no context found, continue to try object factories.
--- 366,376 ----
}
return null;
}
private static Object processURL(Object refInfo, Name name,
! Context nameCtx, Hashtable<?,?> environment)
throws NamingException {
Object answer;
// If refInfo is a URL string, try to use its URL context factory
// If no context found, continue to try object factories.
*** 425,435 ****
* @return A context identified by <code>obj</code>.
*
* @see #getObjectInstance
*/
static Context getContext(Object obj, Name name, Context nameCtx,
! Hashtable environment) throws NamingException {
Object answer;
if (obj instanceof Context) {
// %%% Ignore environment for now. OK since method not public.
return (Context)obj;
--- 425,435 ----
* @return A context identified by <code>obj</code>.
*
* @see #getObjectInstance
*/
static Context getContext(Object obj, Name name, Context nameCtx,
! Hashtable<?,?> environment) throws NamingException {
Object answer;
if (obj instanceof Context) {
// %%% Ignore environment for now. OK since method not public.
return (Context)obj;
*** 450,460 ****
: null;
}
// Used by ContinuationContext
static Resolver getResolver(Object obj, Name name, Context nameCtx,
! Hashtable environment) throws NamingException {
Object answer;
if (obj instanceof Resolver) {
// %%% Ignore environment for now. OK since method not public.
return (Resolver)obj;
--- 450,460 ----
: null;
}
// Used by ContinuationContext
static Resolver getResolver(Object obj, Name name, Context nameCtx,
! Hashtable<?,?> environment) throws NamingException {
Object answer;
if (obj instanceof Resolver) {
// %%% Ignore environment for now. OK since method not public.
return (Resolver)obj;
*** 583,593 ****
* @param environment Environment properties for creating the context
* @see javax.naming.InitialContext
*/
private static Object getURLObject(String scheme, Object urlInfo,
Name name, Context nameCtx,
! Hashtable environment)
throws NamingException {
// e.g. "ftpURLContextFactory"
ObjectFactory factory = (ObjectFactory)ResourceManager.getFactory(
Context.URL_PKG_PREFIXES, environment, nameCtx,
--- 583,593 ----
* @param environment Environment properties for creating the context
* @see javax.naming.InitialContext
*/
private static Object getURLObject(String scheme, Object urlInfo,
Name name, Context nameCtx,
! Hashtable<?,?> environment)
throws NamingException {
// e.g. "ftpURLContextFactory"
ObjectFactory factory = (ObjectFactory)ResourceManager.getFactory(
Context.URL_PKG_PREFIXES, environment, nameCtx,
*** 769,787 ****
* @param cpe
* The non-null exception that triggered this continuation.
* @return A non-null Context object for continuing the operation.
* @exception NamingException If a naming exception occurred.
*/
public static Context getContinuationContext(CannotProceedException cpe)
throws NamingException {
! Hashtable env = cpe.getEnvironment();
if (env == null) {
! env = new Hashtable(7);
} else {
// Make a (shallow) copy of the environment.
! env = (Hashtable) env.clone();
}
env.put(CPE, cpe);
ContinuationContext cctx = new ContinuationContext(cpe, env);
return cctx.getTargetContext();
--- 769,788 ----
* @param cpe
* The non-null exception that triggered this continuation.
* @return A non-null Context object for continuing the operation.
* @exception NamingException If a naming exception occurred.
*/
+ @SuppressWarnings("unchecked")
public static Context getContinuationContext(CannotProceedException cpe)
throws NamingException {
! Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
if (env == null) {
! env = new Hashtable<>(7);
} else {
// Make a (shallow) copy of the environment.
! env = (Hashtable<Object,Object>)env.clone();
}
env.put(CPE, cpe);
ContinuationContext cctx = new ContinuationContext(cpe, env);
return cctx.getTargetContext();