0N/A/*
2362N/A * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.jndi.toolkit.ctx;
0N/A
0N/Aimport javax.naming.*;
0N/Aimport javax.naming.directory.*;
0N/Aimport javax.naming.spi.ResolveResult;
0N/A
0N/A/**
0N/A * Direct subclasses of AtomicDirContext must provide implementations for
0N/A * the abstract a_ DirContext methods, and override the a_ Context methods
0N/A * (which are no longer abstract because they have been overriden by
0N/A * PartialCompositeDirContext with dummy implementations).
0N/A *
0N/A * If the subclass implements the notion of implicit nns,
0N/A * it must override the a_*_nns DirContext and Context methods as well.
0N/A *
0N/A * @author Rosanna Lee
0N/A *
0N/A */
0N/A
0N/Apublic abstract class AtomicDirContext extends ComponentDirContext {
0N/A
0N/A protected AtomicDirContext() {
0N/A _contextType = _ATOMIC;
0N/A }
0N/A
0N/A// ------ Abstract methods whose implementations come from subclass
0N/A
0N/A protected abstract Attributes a_getAttributes(String name, String[] attrIds,
0N/A Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract void a_modifyAttributes(String name, int mod_op,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract void a_modifyAttributes(String name,
0N/A ModificationItem[] mods,
0N/A Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract void a_bind(String name, Object obj,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract void a_rebind(String name, Object obj,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract DirContext a_createSubcontext(String name,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract NamingEnumeration a_search(Attributes matchingAttributes,
0N/A String[] attributesToReturn,
0N/A Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract NamingEnumeration a_search(String name,
0N/A String filterExpr,
0N/A Object[] filterArgs,
0N/A SearchControls cons, Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract NamingEnumeration a_search(String name,
0N/A String filter,
0N/A SearchControls cons, Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract DirContext a_getSchema(Continuation cont)
0N/A throws NamingException;
0N/A
0N/A protected abstract DirContext a_getSchemaClassDefinition(Continuation cont)
0N/A throws NamingException;
0N/A
0N/A// ------ Methods that need to be overridden by subclass
0N/A
0N/A // default implementations of a_*_nns methods
0N/A
0N/A // The following methods are called when the DirContext methods
0N/A // are invoked with a name that has a trailing slash.
0N/A // For naming systems that support implicit nns,
0N/A // the trailing slash signifies the implicit nns.
0N/A // For such naming systems, override these a_*_nns methods.
0N/A //
0N/A // For naming systems that support junctions (explicit nns),
0N/A // the trailing slash is meaningless because a junction does not
0N/A // have an implicit nns. The default implementation here
0N/A // throws a NameNotFoundException for such names.
0N/A // If a context wants to accept a trailing slash as having
0N/A // the same meaning as the same name without a trailing slash,
0N/A // then it should override these a_*_nns methods.
0N/A
0N/A protected Attributes a_getAttributes_nns(String name,
0N/A String[] attrIds,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(name, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected void a_modifyAttributes_nns(String name, int mod_op,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(name, cont);
0N/A }
0N/A
0N/A protected void a_modifyAttributes_nns(String name,
0N/A ModificationItem[] mods,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(name, cont);
0N/A }
0N/A
0N/A protected void a_bind_nns(String name, Object obj,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(name, cont);
0N/A }
0N/A
0N/A protected void a_rebind_nns(String name, Object obj,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(name, cont);
0N/A }
0N/A
0N/A protected DirContext a_createSubcontext_nns(String name,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(name, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration a_search_nns(Attributes matchingAttributes,
0N/A String[] attributesToReturn,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration a_search_nns(String name,
0N/A String filterExpr,
0N/A Object[] filterArgs,
0N/A SearchControls cons,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(name, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration a_search_nns(String name,
0N/A String filter,
0N/A SearchControls cons,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(name, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected DirContext a_getSchema_nns(Continuation cont) throws NamingException {
0N/A a_processJunction_nns(cont);
0N/A return null;
0N/A }
0N/A
0N/A protected DirContext a_getSchemaDefinition_nns(Continuation cont)
0N/A throws NamingException {
0N/A a_processJunction_nns(cont);
0N/A return null;
0N/A }
0N/A
0N/A// ------- implementations of c_ DirContext methods using corresponding
0N/A// ------- a_ and a_*_nns methods
0N/A
0N/A protected Attributes c_getAttributes(Name name, String[] attrIds,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context(name, cont))
0N/A return a_getAttributes(name.toString(), attrIds, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected void c_modifyAttributes(Name name, int mod_op,
0N/A Attributes attrs, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context(name, cont))
0N/A a_modifyAttributes(name.toString(), mod_op, attrs, cont);
0N/A }
0N/A
0N/A protected void c_modifyAttributes(Name name, ModificationItem[] mods,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context(name, cont))
0N/A a_modifyAttributes(name.toString(), mods, cont);
0N/A }
0N/A
0N/A protected void c_bind(Name name, Object obj,
0N/A Attributes attrs, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context(name, cont))
0N/A a_bind(name.toString(), obj, attrs, cont);
0N/A }
0N/A
0N/A protected void c_rebind(Name name, Object obj,
0N/A Attributes attrs, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context(name, cont))
0N/A a_rebind(name.toString(), obj, attrs, cont);
0N/A }
0N/A
0N/A protected DirContext c_createSubcontext(Name name,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context(name, cont))
0N/A return a_createSubcontext(name.toString(),
0N/A attrs, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration c_search(Name name,
0N/A Attributes matchingAttributes,
0N/A String[] attributesToReturn,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_context(name, cont))
0N/A return a_search(matchingAttributes, attributesToReturn, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration c_search(Name name,
0N/A String filter,
0N/A SearchControls cons, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context(name, cont))
0N/A return a_search(name.toString(), filter, cons, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration c_search(Name name,
0N/A String filterExpr,
0N/A Object[] filterArgs,
0N/A SearchControls cons, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context(name, cont))
0N/A return a_search(name.toString(), filterExpr, filterArgs, cons, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected DirContext c_getSchema(Name name, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_context(name, cont))
0N/A return a_getSchema(cont);
0N/A return null;
0N/A }
0N/A
0N/A protected DirContext c_getSchemaClassDefinition(Name name, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_context(name, cont))
0N/A return a_getSchemaClassDefinition(cont);
0N/A return null;
0N/A }
0N/A
0N/A /* equivalent to methods in DirContext interface for nns */
0N/A
0N/A protected Attributes c_getAttributes_nns(Name name, String[] attrIds,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context_nns(name, cont))
0N/A return a_getAttributes_nns(name.toString(), attrIds, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected void c_modifyAttributes_nns(Name name, int mod_op,
0N/A Attributes attrs, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context_nns(name, cont))
0N/A a_modifyAttributes_nns(name.toString(), mod_op, attrs, cont);
0N/A }
0N/A
0N/A protected void c_modifyAttributes_nns(Name name, ModificationItem[] mods,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context_nns(name, cont))
0N/A a_modifyAttributes_nns(name.toString(), mods, cont);
0N/A }
0N/A
0N/A protected void c_bind_nns(Name name, Object obj,
0N/A Attributes attrs, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context_nns(name, cont))
0N/A a_bind_nns(name.toString(), obj, attrs, cont);
0N/A }
0N/A
0N/A protected void c_rebind_nns(Name name, Object obj,
0N/A Attributes attrs, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context_nns(name, cont))
0N/A a_rebind_nns(name.toString(), obj, attrs, cont);
0N/A }
0N/A
0N/A protected DirContext c_createSubcontext_nns(Name name,
0N/A Attributes attrs,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context_nns(name, cont))
0N/A return a_createSubcontext_nns(name.toString(), attrs, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration c_search_nns(Name name,
0N/A Attributes matchingAttributes,
0N/A String[] attributesToReturn,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A resolve_to_nns_and_continue(name, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration c_search_nns(Name name,
0N/A String filter,
0N/A SearchControls cons, Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context_nns(name, cont))
0N/A return a_search_nns(name.toString(), filter, cons, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected NamingEnumeration c_search_nns(Name name,
0N/A String filterExpr,
0N/A Object[] filterArgs,
0N/A SearchControls cons,
0N/A Continuation cont)
0N/A throws NamingException {
0N/A if (resolve_to_penultimate_context_nns(name, cont))
0N/A return a_search_nns(name.toString(), filterExpr, filterArgs,
0N/A cons, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected DirContext c_getSchema_nns(Name name, Continuation cont)
0N/A throws NamingException {
0N/A resolve_to_nns_and_continue(name, cont);
0N/A return null;
0N/A }
0N/A
0N/A protected DirContext c_getSchemaClassDefinition_nns(Name name, Continuation cont)
0N/A throws NamingException {
0N/A resolve_to_nns_and_continue(name, cont);
0N/A return null;
0N/A }
0N/A}