/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception InvalidAttributesException if creation of the subcontext * requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ public Context createSubcontext(Name name) throws NamingException { checkWritable(); Context newContext = new NamingContext(env, this.name); bind(name, newContext); return newContext; }
/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception javax.naming.directory.InvalidAttributesException if creation * of the sub-context requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ @Override public Context createSubcontext(Name name) throws NamingException { checkWritable(); Context newContext = new NamingContext(env, this.name); bind(name, newContext); return newContext; }
/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception javax.naming.directory.InvalidAttributesException if creation * of the sub-context requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ @Override public Context createSubcontext(Name name) throws NamingException { checkWritable(); Context newContext = new NamingContext(env, this.name); bind(name, newContext); return newContext; }
/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception javax.naming.directory.InvalidAttributesException if creation * of the sub-context requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ @Override public Context createSubcontext(Name name) throws NamingException { checkWritable(); Context newContext = new NamingContext(env, this.name); bind(name, newContext); return newContext; }
/** * Get a new (writable) initial context. */ 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. */ @SuppressWarnings("unchecked") @Override public Context getInitialContext(Hashtable<?,?> environment) throws NamingException { if (ContextBindings.isThreadBound() || (ContextBindings.isClassLoaderBound())) { // Redirect the request to the bound initial context return new SelectorContext( (Hashtable<String,Object>)environment, true); } // If the thread is not bound, return a shared writable context if (initialContext == null) { synchronized(javaURLContextFactory.class) { if (initialContext == null) { initialContext = new NamingContext( (Hashtable<String,Object>)environment, MAIN); } } } return initialContext; }
/** * Get a new (writable) initial context. */ @SuppressWarnings("unchecked") @Override public Context getInitialContext(Hashtable<?,?> environment) throws NamingException { if (ContextBindings.isThreadBound() || (ContextBindings.isClassLoaderBound())) { // Redirect the request to the bound initial context return new SelectorContext( (Hashtable<String,Object>)environment, true); } // If the thread is not bound, return a shared writable context if (initialContext == null) { synchronized(javaURLContextFactory.class) { if (initialContext == null) { initialContext = new NamingContext( (Hashtable<String,Object>)environment, MAIN); } } } return initialContext; }
/** * Get a new (writable) initial context. */ @SuppressWarnings("unchecked") @Override public Context getInitialContext(Hashtable<?,?> environment) throws NamingException { if (ContextBindings.isThreadBound() || (ContextBindings.isClassLoaderBound())) { // Redirect the request to the bound initial context return new SelectorContext( (Hashtable<String,Object>)environment, true); } // If the thread is not bound, return a shared writable context if (initialContext == null) { synchronized(javaURLContextFactory.class) { if (initialContext == null) { initialContext = new NamingContext( (Hashtable<String,Object>)environment, MAIN); } } } return initialContext; }
/** * Get a new (writable) initial context. */ @SuppressWarnings("unchecked") @Override public Context getInitialContext(Hashtable<?,?> environment) throws NamingException { if (ContextBindings.isThreadBound() || (ContextBindings.isClassLoaderBound())) { // Redirect the request to the bound initial context return new SelectorContext( (Hashtable<String,Object>)environment, true); } // If the thread is not bound, return a shared writable context if (initialContext == null) { synchronized(javaURLContextFactory.class) { if (initialContext == null) { initialContext = new NamingContext( (Hashtable<String,Object>)environment, MAIN); } } } return initialContext; }
/** * Get a new (writable) initial context. */ @SuppressWarnings("unchecked") @Override public Context getInitialContext(Hashtable<?,?> environment) throws NamingException { if (ContextBindings.isThreadBound() || (ContextBindings.isClassLoaderBound())) { // Redirect the request to the bound initial context return new SelectorContext( (Hashtable<String,Object>)environment, true); } // If the thread is not bound, return a shared writable context if (initialContext == null) { synchronized(javaURLContextFactory.class) { if (initialContext == null) { initialContext = new NamingContext( (Hashtable<String,Object>)environment, MAIN); } } } return initialContext; }
/** * Get a new (writable) initial context. */ @SuppressWarnings("unchecked") @Override public Context getInitialContext(Hashtable<?,?> environment) throws NamingException { if (ContextBindings.isThreadBound() || (ContextBindings.isClassLoaderBound())) { // Redirect the request to the bound initial context return new SelectorContext( (Hashtable<String,Object>)environment, true); } // If the thread is not bound, return a shared writable context if (initialContext == null) { synchronized(javaURLContextFactory.class) { if (initialContext == null) { initialContext = new NamingContext( (Hashtable<String,Object>)environment, MAIN); } } } return initialContext; }
/** * Get a new (writable) initial context. */ @SuppressWarnings("unchecked") @Override public Context getInitialContext(Hashtable<?,?> environment) throws NamingException { if (ContextBindings.isThreadBound() || (ContextBindings.isClassLoaderBound())) { // Redirect the request to the bound initial context return new SelectorContext( (Hashtable<String,Object>)environment, true); } // If the thread is not bound, return a shared writable context if (initialContext == null) { synchronized(javaURLContextFactory.class) { if (initialContext == null) { initialContext = new NamingContext( (Hashtable<String,Object>)environment, MAIN); } } } return initialContext; }
/** * Get a new (writable) initial context. */ @SuppressWarnings("unchecked") @Override public Context getInitialContext(Hashtable<?,?> environment) throws NamingException { if (ContextBindings.isThreadBound() || (ContextBindings.isClassLoaderBound())) { // Redirect the request to the bound initial context return new SelectorContext( (Hashtable<String,Object>)environment, true); } // If the thread is not bound, return a shared writable context if (initialContext == null) { synchronized(javaURLContextFactory.class) { if (initialContext == null) { initialContext = new NamingContext( (Hashtable<String,Object>)environment, MAIN); } } } return initialContext; }
/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception javax.naming.directory.InvalidAttributesException if creation * of the sub-context requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ @Override public Context createSubcontext(Name name) throws NamingException { if (!checkWritable()) { return null; } NamingContext newContext = new NamingContext(env, this.name); bind(name, newContext); newContext.setExceptionOnFailedWrite(getExceptionOnFailedWrite()); return newContext; }
/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception javax.naming.directory.InvalidAttributesException if creation * of the sub-context requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ @Override public Context createSubcontext(Name name) throws NamingException { if (!checkWritable()) { return null; } NamingContext newContext = new NamingContext(env, this.name); bind(name, newContext); newContext.setExceptionOnFailedWrite(getExceptionOnFailedWrite()); return newContext; }
/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception javax.naming.directory.InvalidAttributesException if creation * of the sub-context requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ @Override public Context createSubcontext(Name name) throws NamingException { if (!checkWritable()) { return null; } NamingContext newContext = new NamingContext(env, this.name); bind(name, newContext); newContext.setExceptionOnFailedWrite(getExceptionOnFailedWrite()); return newContext; }
/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception javax.naming.directory.InvalidAttributesException if creation * of the sub-context requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ @Override public Context createSubcontext(Name name) throws NamingException { if (!checkWritable()) { return null; } NamingContext newContext = new NamingContext(env, this.name); bind(name, newContext); newContext.setExceptionOnFailedWrite(getExceptionOnFailedWrite()); return newContext; }
/** * Creates and binds a new context. Creates a new context with the given * name and binds it in the target context (that named by all but * terminal atomic component of the name). All intermediate contexts and * the target context must already exist. * * @param name the name of the context to create; may not be empty * @return the newly created context * @exception NameAlreadyBoundException if name is already bound * @exception javax.naming.directory.InvalidAttributesException if creation * of the sub-context requires specification of mandatory attributes * @exception NamingException if a naming exception is encountered */ @Override public Context createSubcontext(Name name) throws NamingException { if (!checkWritable()) { return null; } NamingContext newContext = new NamingContext(env, this.name); bind(name, newContext); newContext.setExceptionOnFailedWrite(getExceptionOnFailedWrite()); return newContext; }
/** * Get the bound context. */ protected Context getBoundContext() throws NamingException { if (initialContext) { String ICName = IC_PREFIX; if (ContextBindings.isThreadBound()) { ICName += ContextBindings.getThreadName(); } else if (ContextBindings.isClassLoaderBound()) { ICName += ContextBindings.getClassLoaderName(); } Context initialContext = ContextBindings.getContext(ICName); if (initialContext == null) { // Allocating a new context and binding it to the appropriate // name initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext); } return initialContext; } else { if (ContextBindings.isThreadBound()) { return ContextBindings.getThread(); } else { return ContextBindings.getClassLoader(); } } }
initialContext = new NamingContext(env, ICName); ContextBindings.bindContext(ICName, initialContext);