/* * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.jndi.toolkit.ctx; import javax.naming.*;import javax.naming.spi.ResolveResult; /** * Clients: deal only with names for its own naming service * and deals with single contexts that can be built up into * hierarchical naming systems. * Direct subclasses of AtomicContext must provide implementations for * the abstract a_ Context methods, and c_parseComponent(). * * If the subclass implements the notion of implicit nns, * it must override the a_*_nns Context methods as well. * * @author Rosanna Lee * */ public abstract class AtomicContext extends ComponentContext { private static int debug = 0; protected AtomicContext () { _contextType = _ATOMIC; } // ------ Abstract methods whose implementation are provided by subclasses /* Equivalent to Context methods */ protected abstract Object a_lookup(String name, Continuation cont) throws NamingException; protected abstract Object a_lookupLink(String name, Continuation cont) throws NamingException; protected abstract NamingEnumeration a_list( Continuation cont) throws NamingException; protected abstract NamingEnumeration a_listBindings( Continuation cont) throws NamingException; protected abstract void a_bind(String name, Object obj, Continuation cont) throws NamingException; protected abstract void a_rebind(String name, Object obj, Continuation cont) throws NamingException; protected abstract void a_unbind(String name, Continuation cont) throws NamingException; protected abstract void a_destroySubcontext(String name, Continuation cont) throws NamingException; protected abstract Context a_createSubcontext(String name, Continuation cont) throws NamingException; protected abstract void a_rename(String oldname, Name newname, Continuation cont) throws NamingException; protected abstract NameParser a_getNameParser(Continuation cont) throws NamingException; /* Parsing */ /** * Parse 'inputName' into two parts: * head: the first component in this name * tail: the rest of the unused name. * * Subclasses should provide an implementation for this method * which parses inputName using its own name syntax. */ protected abstract StringHeadTail c_parseComponent(String inputName, Continuation cont) throws NamingException; // ------ Methods that need to be overridden by subclass /* Resolution method for supporting federation */ /** * Resolves the nns for 'name' when the named context is acting * as an intermediate context. * * For a system that supports junctions, this would be equilvalent to * a_lookup(name, cont); * because for junctions, an intermediate slash simply signifies * a syntactic separator. * * For a system that supports implicit nns, this would be equivalent to * a_lookup_nns(name, cont); * because for implicit nns, a slash always signifies the implicit nns, * regardless of whether it is intermediate or trailing. * * By default this method supports junctions, and also allows for an * implicit nns to be dynamically determined through the use of the * "nns" reference (see a_processJunction_nns()). * Contexts that implement implicit nns directly should provide an * appropriate override. */ protected Object a_resolveIntermediate_nns(String name, Continuation cont) throws NamingException { try { final Object obj = a_lookup(name, cont); // Do not append "" to Continuation 'cont' even if set // because the intention is to ignore the nns // if (obj != null && getClass().isInstance(obj)) { // If "obj" is in the same type as this object, it must // not be a junction. Continue the lookup with "/". cont.setContinueNNS(obj, name, this); return null; } else if (obj != null && !(obj instanceof Context)) { // obj is not even a context, so try to find its nns // dynamically by constructing a Reference containing obj. RefAddr addr = new RefAddr("nns") { public Object getContent() { return obj; } private static final long serialVersionUID = -3399518522645918499L; }; Reference ref = new Reference("java.lang.Object", addr); // Resolved name has trailing slash to indicate nns CompositeName resName = new CompositeName(); resName.add(name); resName.add(""); // add trailing slash // Set continuation leave it to // PartialCompositeContext.getPCContext() to throw CPE. // Do not use setContinueNNS() because we've already // consumed "/" (i.e., moved it to resName). cont.setContinue(ref, resName, this); return null; } else { return obj; } } catch (NamingException e) { e.appendRemainingComponent(""); // add nns back throw e; } } /* Equivalent of Context Methods for supporting nns */ // The following methods are called when the DirContext methods // are invoked with a name that has a trailing slash. // For naming systems that support implicit nns, // the trailing slash signifies the implicit nns. // For such naming systems, override these a_*_nns methods. // // For naming systems that support junctions (explicit nns), // the trailing slash is meaningless because a junction does not // have an implicit nns. The default implementation here // throws a NameNotFoundException for such names. // If a context wants to accept a trailing slash as having // the same meaning as the same name without a trailing slash, // then it should override these a_*_nns methods. protected Object a_lookup_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); return null; } protected Object a_lookupLink_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); return null; } protected NamingEnumeration a_list_nns(Continuation cont) throws NamingException { a_processJunction_nns(cont); return null; } protected NamingEnumeration a_listBindings_nns(Continuation cont) throws NamingException { a_processJunction_nns(cont); return null; } protected void a_bind_nns(String name, Object obj, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); } protected void a_rebind_nns(String name, Object obj, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); } protected void a_unbind_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); } protected Context a_createSubcontext_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); return null; } protected void a_destroySubcontext_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); } protected void a_rename_nns(String oldname, Name newname, Continuation cont) throws NamingException { a_processJunction_nns(oldname, cont); } protected NameParser a_getNameParser_nns(Continuation cont) throws NamingException { a_processJunction_nns(cont); return null; } protected boolean isEmpty(String name) { return name == null || name.equals(""); } // ------ implementations of c_ and c_*_nns methods using// ------ the corresponding a_ and a_*_nns methods /* Equivalent to methods in Context interface */ protected Object c_lookup(Name name, Continuation cont) throws NamingException { Object ret = null; if (resolve_to_penultimate_context(name, cont)) { ret = a_lookup(name.toString(), cont); if (ret != null && ret instanceof LinkRef) { cont.setContinue(ret, name, this); ret = null; } } return ret; } protected Object c_lookupLink(Name name, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) { return a_lookupLink(name.toString(), cont); } return null; } protected NamingEnumeration c_list(Name name, Continuation cont) throws NamingException { if (resolve_to_context(name, cont)) { return a_list(cont); } return null; } protected NamingEnumeration c_listBindings(Name name, Continuation cont) throws NamingException { if (resolve_to_context(name, cont)) { return a_listBindings(cont); } return null; } protected void c_bind(Name name, Object obj, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) a_bind(name.toString(), obj, cont); } protected void c_rebind(Name name, Object obj, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) a_rebind(name.toString(), obj, cont); } protected void c_unbind(Name name, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) a_unbind(name.toString(), cont); } protected void c_destroySubcontext(Name name, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) a_destroySubcontext(name.toString(), cont); } protected Context c_createSubcontext(Name name, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) return a_createSubcontext(name.toString(), cont); else return null; } protected void c_rename(Name oldname, Name newname, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(oldname, cont)) a_rename(oldname.toString(), newname, cont); } protected NameParser c_getNameParser(Name name, Continuation cont) throws NamingException { if (resolve_to_context(name, cont)) return a_getNameParser(cont); return null; } /* The following are overridden only for AtomicContexts. * AtomicContext is used by PartialCompositeDirContext and ComponentDirContext * in the inheritance tree to make use of methods in * PartialCompositeContext and ComponentContext. We only want to use the * atomic forms when we're actually an atomic context. */ /* From ComponentContext */ protected Object c_resolveIntermediate_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { Object ret = null; if (resolve_to_penultimate_context_nns(name, cont)) { ret = a_resolveIntermediate_nns(name.toString(), cont); if (ret != null && ret instanceof LinkRef) { cont.setContinue(ret, name, this); ret = null; } } return ret; } else { // use ComponentContext return super.c_resolveIntermediate_nns(name, cont); } } /* Equivalent to methods in Context interface for nns */ protected Object c_lookup_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { Object ret = null; if (resolve_to_penultimate_context_nns(name, cont)) { ret = a_lookup_nns(name.toString(), cont); if (ret != null && ret instanceof LinkRef) { cont.setContinue(ret, name, this); ret = null; } } return ret; } else { return super.c_lookup_nns(name, cont); } } protected Object c_lookupLink_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { // %%% check logic resolve_to_nns_and_continue(name, cont); return null; } else { // use ComponentContext return super.c_lookupLink_nns(name, cont); } } protected NamingEnumeration c_list_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { resolve_to_nns_and_continue(name, cont); return null; } else { // use ComponentContext return super.c_list_nns(name, cont); } } protected NamingEnumeration c_listBindings_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { resolve_to_nns_and_continue(name, cont); return null; } else { // use ComponentContext return super.c_list_nns(name, cont); } } protected void c_bind_nns(Name name, Object obj, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) a_bind_nns(name.toString(), obj, cont); } else { // use ComponentContext super.c_bind_nns(name, obj, cont); } } protected void c_rebind_nns(Name name, Object obj, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) a_rebind_nns(name.toString(), obj, cont); } else { // use ComponentContext super.c_rebind_nns(name, obj, cont); } } protected void c_unbind_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) a_unbind_nns(name.toString(), cont); } else { // use ComponentContext super.c_unbind_nns(name, cont); } } protected Context c_createSubcontext_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) return a_createSubcontext_nns(name.toString(), cont); else return null; } else { // use ComponentContext return super.c_createSubcontext_nns(name, cont); } } protected void c_destroySubcontext_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) a_destroySubcontext_nns(name.toString(), cont); } else { // use ComponentContext super.c_destroySubcontext_nns(name, cont); } } protected void c_rename_nns(Name oldname, Name newname, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(oldname, cont)) a_rename_nns(oldname.toString(), newname, cont); } else { // use ComponentContext super.c_rename_nns(oldname, newname, cont); } } protected NameParser c_getNameParser_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { resolve_to_nns_and_continue(name, cont); return null; } else { // use COmponentContext return super.c_getNameParser_nns(name, cont); } } // -------------- internal methods used by this class /* Handles nns for junctions */ /** * This function is used when implementing a naming system thatLines 1–500 of 693. Load more
/* * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.jndi.toolkit.ctx; import javax.naming.*; import javax.naming.spi.ResolveResult; /** * Clients: deal only with names for its own naming service * and deals with single contexts that can be built up into * hierarchical naming systems. * Direct subclasses of AtomicContext must provide implementations for * the abstract a_ Context methods, and c_parseComponent(). * * If the subclass implements the notion of implicit nns, * it must override the a_*_nns Context methods as well. * * @author Rosanna Lee * */ public abstract class AtomicContext extends ComponentContext { private static int debug = 0; protected AtomicContext () { _contextType = _ATOMIC; } // ------ Abstract methods whose implementation are provided by subclasses /* Equivalent to Context methods */ protected abstract Object a_lookup(String name, Continuation cont) throws NamingException; protected abstract Object a_lookupLink(String name, Continuation cont) throws NamingException; protected abstract NamingEnumeration a_list( Continuation cont) throws NamingException; protected abstract NamingEnumeration a_listBindings( Continuation cont) throws NamingException; protected abstract void a_bind(String name, Object obj, Continuation cont) throws NamingException; protected abstract void a_rebind(String name, Object obj, Continuation cont) throws NamingException; protected abstract void a_unbind(String name, Continuation cont) throws NamingException; protected abstract void a_destroySubcontext(String name, Continuation cont) throws NamingException; protected abstract Context a_createSubcontext(String name, Continuation cont) throws NamingException; protected abstract void a_rename(String oldname, Name newname, Continuation cont) throws NamingException; protected abstract NameParser a_getNameParser(Continuation cont) throws NamingException; /* Parsing */ /** * Parse 'inputName' into two parts: * head: the first component in this name * tail: the rest of the unused name. * * Subclasses should provide an implementation for this method * which parses inputName using its own name syntax. */ protected abstract StringHeadTail c_parseComponent(String inputName, Continuation cont) throws NamingException; // ------ Methods that need to be overridden by subclass /* Resolution method for supporting federation */ /** * Resolves the nns for 'name' when the named context is acting * as an intermediate context. * * For a system that supports junctions, this would be equilvalent to * a_lookup(name, cont); * because for junctions, an intermediate slash simply signifies * a syntactic separator. * * For a system that supports implicit nns, this would be equivalent to * a_lookup_nns(name, cont); * because for implicit nns, a slash always signifies the implicit nns, * regardless of whether it is intermediate or trailing. * * By default this method supports junctions, and also allows for an * implicit nns to be dynamically determined through the use of the * "nns" reference (see a_processJunction_nns()). * Contexts that implement implicit nns directly should provide an * appropriate override. */ protected Object a_resolveIntermediate_nns(String name, Continuation cont) throws NamingException { try { final Object obj = a_lookup(name, cont); // Do not append "" to Continuation 'cont' even if set // because the intention is to ignore the nns // if (obj != null && getClass().isInstance(obj)) { // If "obj" is in the same type as this object, it must // not be a junction. Continue the lookup with "/". cont.setContinueNNS(obj, name, this); return null; } else if (obj != null && !(obj instanceof Context)) { // obj is not even a context, so try to find its nns // dynamically by constructing a Reference containing obj. RefAddr addr = new RefAddr("nns") { public Object getContent() { return obj; } private static final long serialVersionUID = -3399518522645918499L; }; Reference ref = new Reference("java.lang.Object", addr); // Resolved name has trailing slash to indicate nns CompositeName resName = new CompositeName(); resName.add(name); resName.add(""); // add trailing slash // Set continuation leave it to // PartialCompositeContext.getPCContext() to throw CPE. // Do not use setContinueNNS() because we've already // consumed "/" (i.e., moved it to resName). cont.setContinue(ref, resName, this); return null; } else { return obj; } } catch (NamingException e) { e.appendRemainingComponent(""); // add nns back throw e; } } /* Equivalent of Context Methods for supporting nns */ // The following methods are called when the DirContext methods // are invoked with a name that has a trailing slash. // For naming systems that support implicit nns, // the trailing slash signifies the implicit nns. // For such naming systems, override these a_*_nns methods. // // For naming systems that support junctions (explicit nns), // the trailing slash is meaningless because a junction does not // have an implicit nns. The default implementation here // throws a NameNotFoundException for such names. // If a context wants to accept a trailing slash as having // the same meaning as the same name without a trailing slash, // then it should override these a_*_nns methods. protected Object a_lookup_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); return null; } protected Object a_lookupLink_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); return null; } protected NamingEnumeration a_list_nns(Continuation cont) throws NamingException { a_processJunction_nns(cont); return null; } protected NamingEnumeration a_listBindings_nns(Continuation cont) throws NamingException { a_processJunction_nns(cont); return null; } protected void a_bind_nns(String name, Object obj, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); } protected void a_rebind_nns(String name, Object obj, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); } protected void a_unbind_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); } protected Context a_createSubcontext_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); return null; } protected void a_destroySubcontext_nns(String name, Continuation cont) throws NamingException { a_processJunction_nns(name, cont); } protected void a_rename_nns(String oldname, Name newname, Continuation cont) throws NamingException { a_processJunction_nns(oldname, cont); } protected NameParser a_getNameParser_nns(Continuation cont) throws NamingException { a_processJunction_nns(cont); return null; } protected boolean isEmpty(String name) { return name == null || name.equals(""); } // ------ implementations of c_ and c_*_nns methods using // ------ the corresponding a_ and a_*_nns methods /* Equivalent to methods in Context interface */ protected Object c_lookup(Name name, Continuation cont) throws NamingException { Object ret = null; if (resolve_to_penultimate_context(name, cont)) { ret = a_lookup(name.toString(), cont); if (ret != null && ret instanceof LinkRef) { cont.setContinue(ret, name, this); ret = null; } } return ret; } protected Object c_lookupLink(Name name, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) { return a_lookupLink(name.toString(), cont); } return null; } protected NamingEnumeration c_list(Name name, Continuation cont) throws NamingException { if (resolve_to_context(name, cont)) { return a_list(cont); } return null; } protected NamingEnumeration c_listBindings(Name name, Continuation cont) throws NamingException { if (resolve_to_context(name, cont)) { return a_listBindings(cont); } return null; } protected void c_bind(Name name, Object obj, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) a_bind(name.toString(), obj, cont); } protected void c_rebind(Name name, Object obj, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) a_rebind(name.toString(), obj, cont); } protected void c_unbind(Name name, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) a_unbind(name.toString(), cont); } protected void c_destroySubcontext(Name name, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) a_destroySubcontext(name.toString(), cont); } protected Context c_createSubcontext(Name name, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(name, cont)) return a_createSubcontext(name.toString(), cont); else return null; } protected void c_rename(Name oldname, Name newname, Continuation cont) throws NamingException { if (resolve_to_penultimate_context(oldname, cont)) a_rename(oldname.toString(), newname, cont); } protected NameParser c_getNameParser(Name name, Continuation cont) throws NamingException { if (resolve_to_context(name, cont)) return a_getNameParser(cont); return null; } /* The following are overridden only for AtomicContexts. * AtomicContext is used by PartialCompositeDirContext and ComponentDirContext * in the inheritance tree to make use of methods in * PartialCompositeContext and ComponentContext. We only want to use the * atomic forms when we're actually an atomic context. */ /* From ComponentContext */ protected Object c_resolveIntermediate_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { Object ret = null; if (resolve_to_penultimate_context_nns(name, cont)) { ret = a_resolveIntermediate_nns(name.toString(), cont); if (ret != null && ret instanceof LinkRef) { cont.setContinue(ret, name, this); ret = null; } } return ret; } else { // use ComponentContext return super.c_resolveIntermediate_nns(name, cont); } } /* Equivalent to methods in Context interface for nns */ protected Object c_lookup_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { Object ret = null; if (resolve_to_penultimate_context_nns(name, cont)) { ret = a_lookup_nns(name.toString(), cont); if (ret != null && ret instanceof LinkRef) { cont.setContinue(ret, name, this); ret = null; } } return ret; } else { return super.c_lookup_nns(name, cont); } } protected Object c_lookupLink_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { // %%% check logic resolve_to_nns_and_continue(name, cont); return null; } else { // use ComponentContext return super.c_lookupLink_nns(name, cont); } } protected NamingEnumeration c_list_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { resolve_to_nns_and_continue(name, cont); return null; } else { // use ComponentContext return super.c_list_nns(name, cont); } } protected NamingEnumeration c_listBindings_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { resolve_to_nns_and_continue(name, cont); return null; } else { // use ComponentContext return super.c_list_nns(name, cont); } } protected void c_bind_nns(Name name, Object obj, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) a_bind_nns(name.toString(), obj, cont); } else { // use ComponentContext super.c_bind_nns(name, obj, cont); } } protected void c_rebind_nns(Name name, Object obj, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) a_rebind_nns(name.toString(), obj, cont); } else { // use ComponentContext super.c_rebind_nns(name, obj, cont); } } protected void c_unbind_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) a_unbind_nns(name.toString(), cont); } else { // use ComponentContext super.c_unbind_nns(name, cont); } } protected Context c_createSubcontext_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) return a_createSubcontext_nns(name.toString(), cont); else return null; } else { // use ComponentContext return super.c_createSubcontext_nns(name, cont); } } protected void c_destroySubcontext_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(name, cont)) a_destroySubcontext_nns(name.toString(), cont); } else { // use ComponentContext super.c_destroySubcontext_nns(name, cont); } } protected void c_rename_nns(Name oldname, Name newname, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { if (resolve_to_penultimate_context_nns(oldname, cont)) a_rename_nns(oldname.toString(), newname, cont); } else { // use ComponentContext super.c_rename_nns(oldname, newname, cont); } } protected NameParser c_getNameParser_nns(Name name, Continuation cont) throws NamingException { if (_contextType == _ATOMIC) { resolve_to_nns_and_continue(name, cont); return null; } else { // use COmponentContext return super.c_getNameParser_nns(name, cont); } } // -------------- internal methods used by this class /* Handles nns for junctions */ /** * This function is used when implementing a naming system that