javax.naming.spi.NamingManager Java Examples
The following examples show how to use
javax.naming.spi.NamingManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PartialCompositeContext.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NamingEnumeration<NameClassPair> answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_list(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_list(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.list(e.getRemainingName()); } return answer; }
Example #2
Source File: CNCtx.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static private javax.naming.Context getContinuationContext(CannotProceedException cpe) throws NamingException { try { return NamingManager.getContinuationContext(cpe); } catch (CannotProceedException e) { java.lang.Object resObj = e.getResolvedObj(); if (resObj instanceof Reference) { Reference ref = (Reference)resObj; RefAddr addr = ref.get("nns"); if (addr.getContent() instanceof javax.naming.Context) { NamingException ne = new NameNotFoundException( "No object reference bound for specified name"); ne.setRootCause(cpe.getRootCause()); ne.setRemainingName(cpe.getRemainingName()); throw ne; } } throw e; } }
Example #3
Source File: PartialCompositeContext.java From hottub with GNU General Public License v2.0 | 6 votes |
public void rename(Name oldName, Name newName) throws NamingException { PartialCompositeContext ctx = this; Name nm = oldName; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(oldName, env); try { ctx.p_rename(nm, newName, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); ctx.p_rename(nm, newName, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); if (e.getRemainingNewName() != null) { // %%% e.getRemainingNewName() should never be null newName = e.getRemainingNewName(); } cctx.rename(e.getRemainingName(), newName); } }
Example #4
Source File: PartialCompositeContext.java From hottub with GNU General Public License v2.0 | 6 votes |
public void destroySubcontext(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { ctx.p_destroySubcontext(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); ctx.p_destroySubcontext(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); cctx.destroySubcontext(e.getRemainingName()); } }
Example #5
Source File: CNCtx.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static private javax.naming.Context getContinuationContext(CannotProceedException cpe) throws NamingException { try { return NamingManager.getContinuationContext(cpe); } catch (CannotProceedException e) { java.lang.Object resObj = e.getResolvedObj(); if (resObj instanceof Reference) { Reference ref = (Reference)resObj; RefAddr addr = ref.get("nns"); if (addr.getContent() instanceof javax.naming.Context) { NamingException ne = new NameNotFoundException( "No object reference bound for specified name"); ne.setRootCause(cpe.getRootCause()); ne.setRemainingName(cpe.getRemainingName()); throw ne; } } throw e; } }
Example #6
Source File: PartialCompositeContext.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NamingEnumeration<NameClassPair> answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_list(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_list(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.list(e.getRemainingName()); } return answer; }
Example #7
Source File: CNCtx.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static private javax.naming.Context getContinuationContext(CannotProceedException cpe) throws NamingException { try { return NamingManager.getContinuationContext(cpe); } catch (CannotProceedException e) { java.lang.Object resObj = e.getResolvedObj(); if (resObj instanceof Reference) { Reference ref = (Reference)resObj; RefAddr addr = ref.get("nns"); if (addr.getContent() instanceof javax.naming.Context) { NamingException ne = new NameNotFoundException( "No object reference bound for specified name"); ne.setRootCause(cpe.getRootCause()); ne.setRemainingName(cpe.getRemainingName()); throw ne; } } throw e; } }
Example #8
Source File: RegistryContext.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Encodes an object prior to binding it in the registry. First, * NamingManager.getStateToBind() is invoked. If the resulting * object is Remote, it is returned. If it is a Reference or * Referenceable, the reference is wrapped in a Remote object. * Otherwise, an exception is thrown. * * @param name The object's name relative to this context. */ private Remote encodeObject(Object obj, Name name) throws NamingException, RemoteException { obj = NamingManager.getStateToBind(obj, name, this, environment); if (obj instanceof Remote) { return (Remote)obj; } if (obj instanceof Reference) { return (new ReferenceWrapper((Reference)obj)); } if (obj instanceof Referenceable) { return (new ReferenceWrapper(((Referenceable)obj).getReference())); } throw (new IllegalArgumentException( "RegistryContext: " + "object to bind must be Remote, Reference, or Referenceable")); }
Example #9
Source File: PartialCompositeContext.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public Object lookupLink(Name name) throws NamingException { PartialCompositeContext ctx = this; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); Object answer; Name nm = name; try { answer = ctx.p_lookupLink(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_lookupLink(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.lookupLink(e.getRemainingName()); } return answer; }
Example #10
Source File: PartialCompositeContext.java From hottub with GNU General Public License v2.0 | 6 votes |
public NameParser getNameParser(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NameParser answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_getNameParser(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_getNameParser(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.getNameParser(e.getRemainingName()); } return answer; }
Example #11
Source File: PartialCompositeContext.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NamingEnumeration<Binding> answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_listBindings(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_listBindings(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.listBindings(e.getRemainingName()); } return answer; }
Example #12
Source File: PartialCompositeContext.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void bind(Name name, Object newObj) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { ctx.p_bind(nm, newObj, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); ctx.p_bind(nm, newObj, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); cctx.bind(e.getRemainingName(), newObj); } }
Example #13
Source File: PartialCompositeContext.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void rebind(Name name, Object newObj) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { ctx.p_rebind(nm, newObj, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); ctx.p_rebind(nm, newObj, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); cctx.rebind(e.getRemainingName(), newObj); } }
Example #14
Source File: PartialCompositeContext.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NamingEnumeration<NameClassPair> answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_list(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_list(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.list(e.getRemainingName()); } return answer; }
Example #15
Source File: PartialCompositeContext.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public Object lookupLink(Name name) throws NamingException { PartialCompositeContext ctx = this; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); Object answer; Name nm = name; try { answer = ctx.p_lookupLink(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_lookupLink(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.lookupLink(e.getRemainingName()); } return answer; }
Example #16
Source File: TestJNDIInitialization.java From sqlg with MIT License | 6 votes |
@BeforeClass public static void beforeClass() throws Exception { URL sqlProperties = Thread.currentThread().getContextClassLoader().getResource("sqlg.properties"); configuration = new PropertiesConfiguration(sqlProperties); if (!configuration.containsKey("jdbc.url")) { throw new IllegalArgumentException(String.format("SqlGraph configuration requires that the %s be set", "jdbc.url")); } ds = C3P0DataSource.create(configuration).getDatasource(); //change the connection url to be a JNDI one configuration.setProperty("jdbc.url", "jndi:testConnection"); //set up the initial context NamingManager.setInitialContextFactoryBuilder(environment -> { InitialContextFactory mockFactory = mock(InitialContextFactory.class); Context mockContext = mock(Context.class); when(mockFactory.getInitialContext(any())).thenReturn(mockContext); when(mockContext.lookup("testConnection")).thenReturn(ds); return mockFactory; }); }
Example #17
Source File: PartialCompositeContext.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void destroySubcontext(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { ctx.p_destroySubcontext(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); ctx.p_destroySubcontext(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); cctx.destroySubcontext(e.getRemainingName()); } }
Example #18
Source File: PartialCompositeContext.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public Context createSubcontext(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Context answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_createSubcontext(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_createSubcontext(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.createSubcontext(e.getRemainingName()); } return answer; }
Example #19
Source File: PartialCompositeContext.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NamingEnumeration<NameClassPair> answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_list(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_list(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.list(e.getRemainingName()); } return answer; }
Example #20
Source File: PartialCompositeContext.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void rename(Name oldName, Name newName) throws NamingException { PartialCompositeContext ctx = this; Name nm = oldName; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(oldName, env); try { ctx.p_rename(nm, newName, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); ctx.p_rename(nm, newName, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); if (e.getRemainingNewName() != null) { // %%% e.getRemainingNewName() should never be null newName = e.getRemainingNewName(); } cctx.rename(e.getRemainingName(), newName); } }
Example #21
Source File: PartialCompositeContext.java From hottub with GNU General Public License v2.0 | 6 votes |
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NamingEnumeration<NameClassPair> answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_list(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_list(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.list(e.getRemainingName()); } return answer; }
Example #22
Source File: PartialCompositeContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public Context createSubcontext(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Context answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_createSubcontext(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_createSubcontext(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.createSubcontext(e.getRemainingName()); } return answer; }
Example #23
Source File: PartialCompositeContext.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NamingEnumeration<Binding> answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_listBindings(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_listBindings(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.listBindings(e.getRemainingName()); } return answer; }
Example #24
Source File: PartialCompositeContext.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void bind(Name name, Object newObj) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { ctx.p_bind(nm, newObj, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); ctx.p_bind(nm, newObj, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); cctx.bind(e.getRemainingName(), newObj); } }
Example #25
Source File: PartialCompositeContext.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public Context createSubcontext(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Context answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_createSubcontext(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_createSubcontext(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.createSubcontext(e.getRemainingName()); } return answer; }
Example #26
Source File: PartialCompositeContext.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void bind(Name name, Object newObj) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { ctx.p_bind(nm, newObj, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); ctx.p_bind(nm, newObj, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); cctx.bind(e.getRemainingName(), newObj); } }
Example #27
Source File: CNCtx.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static private javax.naming.Context getContinuationContext(CannotProceedException cpe) throws NamingException { try { return NamingManager.getContinuationContext(cpe); } catch (CannotProceedException e) { java.lang.Object resObj = e.getResolvedObj(); if (resObj instanceof Reference) { Reference ref = (Reference)resObj; RefAddr addr = ref.get("nns"); if (addr.getContent() instanceof javax.naming.Context) { NamingException ne = new NameNotFoundException( "No object reference bound for specified name"); ne.setRootCause(cpe.getRootCause()); ne.setRemainingName(cpe.getRemainingName()); throw ne; } } throw e; } }
Example #28
Source File: RegistryContext.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Encodes an object prior to binding it in the registry. First, * NamingManager.getStateToBind() is invoked. If the resulting * object is Remote, it is returned. If it is a Reference or * Referenceable, the reference is wrapped in a Remote object. * Otherwise, an exception is thrown. * * @param name The object's name relative to this context. */ private Remote encodeObject(Object obj, Name name) throws NamingException, RemoteException { obj = NamingManager.getStateToBind(obj, name, this, environment); if (obj instanceof Remote) { return (Remote)obj; } if (obj instanceof Reference) { return (new ReferenceWrapper((Reference)obj)); } if (obj instanceof Referenceable) { return (new ReferenceWrapper(((Referenceable)obj).getReference())); } throw (new IllegalArgumentException( "RegistryContext: " + "object to bind must be Remote, Reference, or Referenceable")); }
Example #29
Source File: PartialCompositeContext.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public NameParser getNameParser(Name name) throws NamingException { PartialCompositeContext ctx = this; Name nm = name; NameParser answer; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); try { answer = ctx.p_getNameParser(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_getNameParser(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.getNameParser(e.getRemainingName()); } return answer; }
Example #30
Source File: PartialCompositeContext.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public Object lookup(Name name) throws NamingException { PartialCompositeContext ctx = this; Hashtable<?,?> env = p_getEnvironment(); Continuation cont = new Continuation(name, env); Object answer; Name nm = name; try { answer = ctx.p_lookup(nm, cont); while (cont.isContinue()) { nm = cont.getRemainingName(); ctx = getPCContext(cont); answer = ctx.p_lookup(nm, cont); } } catch (CannotProceedException e) { Context cctx = NamingManager.getContinuationContext(e); answer = cctx.lookup(e.getRemainingName()); } return answer; }