jdk/src/java.naming/share/classes/javax/naming/spi/ContinuationDirContext.java
author sspitsyn
Wed, 07 Sep 2016 03:35:45 +0000
changeset 40963 c7c990c4ec68
parent 25859 3317bb8137f4
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
     2
 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.naming.spi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.naming.Name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.naming.NamingEnumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.naming.CompositeName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.naming.NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.naming.CannotProceedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.naming.OperationNotSupportedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.naming.Context;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.naming.directory.DirContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import javax.naming.directory.Attributes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import javax.naming.directory.SearchControls;
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    41
import javax.naming.directory.SearchResult;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import javax.naming.directory.ModificationItem;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
  * This class is the continuation context for invoking DirContext methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
  * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
class ContinuationDirContext extends ContinuationContext implements DirContext {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    54
    ContinuationDirContext(CannotProceedException cpe, Hashtable<?,?> env) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        super(cpe, env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    protected DirContextNamePair getTargetContext(Name name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        if (cpe.getResolvedObj() == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
            throw (NamingException)cpe.fillInStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        Context ctx = NamingManager.getContext(cpe.getResolvedObj(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                               cpe.getAltName(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                               cpe.getAltNameCtx(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                                               env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        if (ctx == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
            throw (NamingException)cpe.fillInStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        if (ctx instanceof DirContext)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
            return new DirContextNamePair((DirContext)ctx, name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        if (ctx instanceof Resolver) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            Resolver res = (Resolver)ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            ResolveResult rr = res.resolveToClass(name, DirContext.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            // Reached a DirContext; return result.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            DirContext dctx = (DirContext)rr.getResolvedObj();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            return (new DirContextNamePair(dctx, rr.getRemainingName()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        // Resolve all the way using lookup().  This may allow the operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        // to succeed if it doesn't require the penultimate context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        Object ultimate = ctx.lookup(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        if (ultimate instanceof DirContext) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            return (new DirContextNamePair((DirContext)ultimate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                                          new CompositeName()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        throw (NamingException)cpe.fillInStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    protected DirContextStringPair getTargetContext(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        if (cpe.getResolvedObj() == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            throw (NamingException)cpe.fillInStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        Context ctx = NamingManager.getContext(cpe.getResolvedObj(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                                               cpe.getAltName(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                                               cpe.getAltNameCtx(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                                               env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        if (ctx instanceof DirContext)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            return new DirContextStringPair((DirContext)ctx, name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        if (ctx instanceof Resolver) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            Resolver res = (Resolver)ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            ResolveResult rr = res.resolveToClass(name, DirContext.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            // Reached a DirContext; return result.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            DirContext dctx = (DirContext)rr.getResolvedObj();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            Name tmp = rr.getRemainingName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            String remains = (tmp != null) ? tmp.toString() : "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            return (new DirContextStringPair(dctx, remains));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        // Resolve all the way using lookup().  This may allow the operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        // to succeed if it doesn't require the penultimate context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        Object ultimate = ctx.lookup(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        if (ultimate instanceof DirContext) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            return (new DirContextStringPair((DirContext)ultimate, ""));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        throw (NamingException)cpe.fillInStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    public Attributes getAttributes(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        return res.getDirContext().getAttributes(res.getString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public Attributes getAttributes(String name, String[] attrIds)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            return res.getDirContext().getAttributes(res.getString(), attrIds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    public Attributes getAttributes(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        return res.getDirContext().getAttributes(res.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public Attributes getAttributes(Name name, String[] attrIds)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            return res.getDirContext().getAttributes(res.getName(), attrIds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public void modifyAttributes(Name name, int mod_op, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            res.getDirContext().modifyAttributes(res.getName(), mod_op, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    public void modifyAttributes(String name, int mod_op, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            res.getDirContext().modifyAttributes(res.getString(), mod_op, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    public void modifyAttributes(Name name, ModificationItem[] mods)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            res.getDirContext().modifyAttributes(res.getName(), mods);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    public void modifyAttributes(String name, ModificationItem[] mods)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            res.getDirContext().modifyAttributes(res.getString(), mods);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    public void bind(Name name, Object obj, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            res.getDirContext().bind(res.getName(), obj, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    public void bind(String name, Object obj, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            res.getDirContext().bind(res.getString(), obj, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    public void rebind(Name name, Object obj, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            res.getDirContext().rebind(res.getName(), obj, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    public void rebind(String name, Object obj, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            res.getDirContext().rebind(res.getString(), obj, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    public DirContext createSubcontext(Name name, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            return res.getDirContext().createSubcontext(res.getName(), attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    public DirContext createSubcontext(String name, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                res.getDirContext().createSubcontext(res.getString(), attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   208
    public NamingEnumeration<SearchResult> search(Name name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                                    Attributes matchingAttributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                                    String[] attributesToReturn)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            return res.getDirContext().search(res.getName(), matchingAttributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                                             attributesToReturn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   217
    public NamingEnumeration<SearchResult> search(String name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                                    Attributes matchingAttributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                                    String[] attributesToReturn)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            return res.getDirContext().search(res.getString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                                             matchingAttributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                                             attributesToReturn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   227
    public NamingEnumeration<SearchResult> search(Name name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                                    Attributes matchingAttributes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            return res.getDirContext().search(res.getName(), matchingAttributes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        }
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   233
    public NamingEnumeration<SearchResult> search(String name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                                    Attributes matchingAttributes)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            return res.getDirContext().search(res.getString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                                             matchingAttributes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   241
    public NamingEnumeration<SearchResult> search(Name name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                                    String filter,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                                    SearchControls cons)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            return res.getDirContext().search(res.getName(), filter, cons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   249
    public NamingEnumeration<SearchResult> search(String name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                                    String filter,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                                    SearchControls cons)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            return res.getDirContext().search(res.getString(), filter, cons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   257
    public NamingEnumeration<SearchResult> search(Name name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                                    String filterExpr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                                    Object[] args,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                                    SearchControls cons)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            return res.getDirContext().search(res.getName(), filterExpr, args,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                                             cons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   267
    public NamingEnumeration<SearchResult> search(String name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                                    String filterExpr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                                    Object[] args,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                                    SearchControls cons)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
            DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            return res.getDirContext().search(res.getString(), filterExpr, args,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                                             cons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    public DirContext getSchema(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        return res.getDirContext().getSchema(res.getString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    public DirContext getSchema(Name name) throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        return res.getDirContext().getSchema(res.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public DirContext getSchemaClassDefinition(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
            throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        DirContextStringPair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        return res.getDirContext().getSchemaClassDefinition(res.getString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    public DirContext getSchemaClassDefinition(Name name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            throws NamingException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        DirContextNamePair res = getTargetContext(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        return res.getDirContext().getSchemaClassDefinition(res.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
class DirContextNamePair {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        DirContext ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        Name name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        DirContextNamePair(DirContext ctx, Name name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            this.ctx = ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        DirContext getDirContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
            return ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        Name getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
class DirContextStringPair {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        DirContext ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        String str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        DirContextStringPair(DirContext ctx, String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            this.ctx = ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            this.str = str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        DirContext getDirContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            return ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        String getString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            return str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
}