< prev index next >

src/java.naming/share/classes/javax/naming/spi/NamingManager.java

Print this page




 395         // If no context found, continue to try object factories.
 396         if (refInfo instanceof String[]) {
 397             String[] urls = (String[])refInfo;
 398             for (int i = 0; i <urls.length; i++) {
 399                 String scheme = getURLScheme(urls[i]);
 400                 if (scheme != null) {
 401                     answer = getURLObject(scheme, refInfo, name, nameCtx,
 402                                           environment);
 403                     if (answer != null)
 404                         return answer;
 405                 }
 406             }
 407         }
 408         return null;
 409     }
 410 
 411 
 412     /**
 413      * Retrieves a context identified by {@code obj}, using the specified
 414      * environment.
 415      * Used by ContinuationContext.
 416      *
 417      * @param obj       The object identifying the context.
 418      * @param name      The name of the context being returned, relative to
 419      *                  {@code nameCtx}, or null if no name is being
 420      *                  specified.
 421      *                  See the {@code getObjectInstance} method for
 422      *                  details.
 423      * @param nameCtx   The context relative to which {@code name} is
 424      *                  specified, or null for the default initial context.
 425      *                  See the {@code getObjectInstance} method for
 426      *                  details.
 427      * @param environment Environment specifying characteristics of the
 428      *                  resulting context.
 429      * @return A context identified by {@code obj}.
 430      *
 431      * @see #getObjectInstance
 432      */
 433     static Context getContext(Object obj, Name name, Context nameCtx,
 434                               Hashtable<?,?> environment) throws NamingException {
 435         Object answer;


 437         if (obj instanceof Context) {
 438             // %%% Ignore environment for now.  OK since method not public.
 439             return (Context)obj;
 440         }
 441 
 442         try {
 443             answer = getObjectInstance(obj, name, nameCtx, environment);
 444         } catch (NamingException e) {
 445             throw e;
 446         } catch (Exception e) {
 447             NamingException ne = new NamingException();
 448             ne.setRootCause(e);
 449             throw ne;
 450         }
 451 
 452         return (answer instanceof Context)
 453             ? (Context)answer
 454             : null;
 455     }
 456 
 457     // Used by ContinuationContext
 458     static Resolver getResolver(Object obj, Name name, Context nameCtx,
 459                                 Hashtable<?,?> environment) throws NamingException {
 460         Object answer;
 461 
 462         if (obj instanceof Resolver) {
 463             // %%% Ignore environment for now.  OK since method not public.
 464             return (Resolver)obj;
 465         }
 466 
 467         try {
 468             answer = getObjectInstance(obj, name, nameCtx, environment);
 469         } catch (NamingException e) {
 470             throw e;
 471         } catch (Exception e) {
 472             NamingException ne = new NamingException();
 473             ne.setRootCause(e);
 474             throw ne;
 475         }
 476 
 477         return (answer instanceof Resolver)




 395         // If no context found, continue to try object factories.
 396         if (refInfo instanceof String[]) {
 397             String[] urls = (String[])refInfo;
 398             for (int i = 0; i <urls.length; i++) {
 399                 String scheme = getURLScheme(urls[i]);
 400                 if (scheme != null) {
 401                     answer = getURLObject(scheme, refInfo, name, nameCtx,
 402                                           environment);
 403                     if (answer != null)
 404                         return answer;
 405                 }
 406             }
 407         }
 408         return null;
 409     }
 410 
 411 
 412     /**
 413      * Retrieves a context identified by {@code obj}, using the specified
 414      * environment.
 415      * Used by ContinuationScope.
 416      *
 417      * @param obj       The object identifying the context.
 418      * @param name      The name of the context being returned, relative to
 419      *                  {@code nameCtx}, or null if no name is being
 420      *                  specified.
 421      *                  See the {@code getObjectInstance} method for
 422      *                  details.
 423      * @param nameCtx   The context relative to which {@code name} is
 424      *                  specified, or null for the default initial context.
 425      *                  See the {@code getObjectInstance} method for
 426      *                  details.
 427      * @param environment Environment specifying characteristics of the
 428      *                  resulting context.
 429      * @return A context identified by {@code obj}.
 430      *
 431      * @see #getObjectInstance
 432      */
 433     static Context getContext(Object obj, Name name, Context nameCtx,
 434                               Hashtable<?,?> environment) throws NamingException {
 435         Object answer;


 437         if (obj instanceof Context) {
 438             // %%% Ignore environment for now.  OK since method not public.
 439             return (Context)obj;
 440         }
 441 
 442         try {
 443             answer = getObjectInstance(obj, name, nameCtx, environment);
 444         } catch (NamingException e) {
 445             throw e;
 446         } catch (Exception e) {
 447             NamingException ne = new NamingException();
 448             ne.setRootCause(e);
 449             throw ne;
 450         }
 451 
 452         return (answer instanceof Context)
 453             ? (Context)answer
 454             : null;
 455     }
 456 
 457     // Used by ContinuationScope
 458     static Resolver getResolver(Object obj, Name name, Context nameCtx,
 459                                 Hashtable<?,?> environment) throws NamingException {
 460         Object answer;
 461 
 462         if (obj instanceof Resolver) {
 463             // %%% Ignore environment for now.  OK since method not public.
 464             return (Resolver)obj;
 465         }
 466 
 467         try {
 468             answer = getObjectInstance(obj, name, nameCtx, environment);
 469         } catch (NamingException e) {
 470             throw e;
 471         } catch (Exception e) {
 472             NamingException ne = new NamingException();
 473             ne.setRootCause(e);
 474             throw ne;
 475         }
 476 
 477         return (answer instanceof Resolver)


< prev index next >