jdk/src/share/classes/com/sun/jndi/ldap/LdapReferralContext.java
author prappo
Fri, 01 Aug 2014 22:32:51 +0100
changeset 25808 e113d0a0fde0
parent 10324 e28265130e4f
permissions -rw-r--r--
8054158: Fix typos in JNDI-related packages Reviewed-by: rriggs, vinnie
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 com.sun.jndi.ldap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.naming.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.naming.directory.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.naming.spi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.naming.ldap.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.StringTokenizer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import com.sun.jndi.toolkit.dir.SearchFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * A context for handling referrals.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @author Vincent Ryan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
final class LdapReferralContext implements DirContext, LdapContext {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    private DirContext refCtx = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private Name urlName = null;   // override the supplied name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    private String urlAttrs = null;  // override attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private String urlScope = null;  // override scope
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    private String urlFilter = null; // override filter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    private LdapReferralException refEx = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    private boolean skipThisReferral = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    private int hopCount = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private NamingException previousEx = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    55
    @SuppressWarnings("unchecked") // clone()
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    56
    LdapReferralContext(LdapReferralException ex,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    57
        Hashtable<?,?> env,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        Control[] connCtls,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        Control[] reqCtls,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        String nextName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        boolean skipThisReferral,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        int handleReferrals) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        refEx = ex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        if (this.skipThisReferral = skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
            return; // don't create a DirContext for this referral
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        String referral;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        // Make copies of environment and connect controls for our own use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        if (env != null) {
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    74
            env = (Hashtable<?,?>) env.clone();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            // Remove old connect controls from environment, unless we have new
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            // ones that will override them anyway.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
            if (connCtls == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                env.remove(LdapCtx.BIND_CONTROLS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        } else if (connCtls != null) {
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    81
            env = new Hashtable<String, Control[]>(5);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        if (connCtls != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            Control[] copiedCtls = new Control[connCtls.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            System.arraycopy(connCtls, 0, copiedCtls, 0, connCtls.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            // Add copied controls to environment, replacing any old ones.
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    87
            ((Hashtable<? super String, ? super Control[]>)env)
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
    88
                    .put(LdapCtx.BIND_CONTROLS, copiedCtls);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        while (true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                referral = refEx.getNextReferral();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                if (referral == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                    throw (NamingException)(previousEx.fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            } catch (LdapReferralException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                if (handleReferrals == LdapClient.LDAP_REF_THROW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                    throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                    refEx = e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                    continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            // Create a Reference containing the referral URL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            Reference ref = new Reference("javax.naming.directory.DirContext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                                          new StringRefAddr("URL", referral));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            Object obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                obj = NamingManager.getObjectInstance(ref, null, null, env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            } catch (NamingException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                if (handleReferrals == LdapClient.LDAP_REF_THROW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                    throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                // mask the exception and save it for later
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                previousEx = e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                // follow another referral
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                NamingException e2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                    new NamingException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                        "problem generating object using object factory");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                e2.setRootCause(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                throw e2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            if (obj instanceof DirContext) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                refCtx = (DirContext)obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                if (refCtx instanceof LdapContext && reqCtls != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                    ((LdapContext)refCtx).setRequestControls(reqCtls);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                initDefaults(referral, nextName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                NamingException ne = new NotContextException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                    "Cannot create context for: " + referral);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                ne.setRemainingName((new CompositeName()).add(nextName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                throw ne;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    private void initDefaults(String referral, String nextName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        String urlString;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            // parse URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            LdapURL url = new LdapURL(referral);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            urlString = url.getDN();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            urlAttrs = url.getAttributes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            urlScope = url.getScope();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            urlFilter = url.getFilter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        } catch (NamingException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            // Not an LDAP URL; use original URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            urlString = referral;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            urlAttrs = urlScope = urlFilter = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        // reuse original name if URL DN is absent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        if (urlString == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            urlString = nextName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            // concatenate with remaining name if URL DN is present
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            urlString = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        if (urlString == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            urlName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            urlName = urlString.equals("") ? new CompositeName() :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                new CompositeName().add(urlString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    public void close() throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        if (refCtx != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            refCtx.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            refCtx = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        refEx = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    void setHopCount(int hopCount) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        this.hopCount = hopCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        if ((refCtx != null) && (refCtx instanceof LdapCtx)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            ((LdapCtx)refCtx).setHopCount(hopCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
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 Object lookup(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        return lookup(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    public Object lookup(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        return refCtx.lookup(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public void bind(String name, Object obj) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        bind(toName(name), obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    public void bind(Name name, Object obj) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        refCtx.bind(overrideName(name), obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    public void rebind(String name, Object obj) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        rebind(toName(name), obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    public void rebind(Name name, Object obj) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        refCtx.rebind(overrideName(name), obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    public void unbind(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        unbind(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    public void unbind(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        refCtx.unbind(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    public void rename(String oldName, String newName) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        rename(toName(oldName), toName(newName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    public void rename(Name oldName, Name newName) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        refCtx.rename(overrideName(oldName), toName(refEx.getNewRdn()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   266
    public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        return list(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   270
    @SuppressWarnings("unchecked")
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   271
    public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        try {
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   277
            NamingEnumeration<NameClassPair> ne = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            if (urlScope != null && urlScope.equals("base")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                SearchControls cons = new SearchControls();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                cons.setReturningObjFlag(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                cons.setSearchScope(SearchControls.OBJECT_SCOPE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   284
                ne = (NamingEnumeration)
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   285
                        refCtx.search(overrideName(name), "(objectclass=*)", cons);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                ne = refCtx.list(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            refEx.setNameResolved(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            // append (referrals from) the exception that generated this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            // context to the new search results, so that referral processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            // can continue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            ((ReferralEnumeration)ne).appendUnprocessedReferrals(refEx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            return (ne);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        } catch (LdapReferralException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            // append (referrals from) the exception that generated this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            // context to the new exception, so that referral processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            // can continue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            e.appendUnprocessedReferrals(refEx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            throw (NamingException)(e.fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        } catch (NamingException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
            // record the exception if there are no remaining referrals
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            if ((refEx != null) && (! refEx.hasMoreReferrals())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                refEx.setNamingException(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            if ((refEx != null) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                (refEx.hasMoreReferrals() ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                 refEx.hasMoreReferralExceptions())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                    ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   326
    public NamingEnumeration<Binding> listBindings(String name) throws
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   327
            NamingException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        return listBindings(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   331
    @SuppressWarnings("unchecked")
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   332
    public NamingEnumeration<Binding> listBindings(Name name) throws
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   333
            NamingException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        try {
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   340
            NamingEnumeration<Binding> be = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
            if (urlScope != null && urlScope.equals("base")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                SearchControls cons = new SearchControls();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                cons.setReturningObjFlag(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                cons.setSearchScope(SearchControls.OBJECT_SCOPE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   347
                be = (NamingEnumeration)refCtx.search(overrideName(name),
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   348
                        "(objectclass=*)", cons);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                be = refCtx.listBindings(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            refEx.setNameResolved(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
            // append (referrals from) the exception that generated this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
            // context to the new search results, so that referral processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            // can continue
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   359
            ((ReferralEnumeration<Binding>)be).appendUnprocessedReferrals(refEx);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            return (be);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        } catch (LdapReferralException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            // append (referrals from) the exception that generated this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            // context to the new exception, so that referral processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            // can continue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
            e.appendUnprocessedReferrals(refEx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            throw (NamingException)(e.fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        } catch (NamingException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
            // record the exception if there are no remaining referrals
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
            if ((refEx != null) && (! refEx.hasMoreReferrals())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                refEx.setNamingException(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            if ((refEx != null) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                (refEx.hasMoreReferrals() ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                 refEx.hasMoreReferralExceptions())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
                    ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    public void destroySubcontext(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        destroySubcontext(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    public void destroySubcontext(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        refCtx.destroySubcontext(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    public Context createSubcontext(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        return createSubcontext(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    public Context createSubcontext(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        return refCtx.createSubcontext(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    public Object lookupLink(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        return lookupLink(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    public Object lookupLink(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        return refCtx.lookupLink(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    public NameParser getNameParser(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        return getNameParser(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    public NameParser getNameParser(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        return refCtx.getNameParser(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    public String composeName(String name, String prefix)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                return composeName(toName(name), toName(prefix)).toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    public Name composeName(Name name, Name prefix) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        return refCtx.composeName(name, prefix);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    public Object addToEnvironment(String propName, Object propVal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        return refCtx.addToEnvironment(propName, propVal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
    public Object removeFromEnvironment(String propName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        return refCtx.removeFromEnvironment(propName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   474
    public Hashtable<?,?> getEnvironment() throws NamingException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        return refCtx.getEnvironment();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    public Attributes getAttributes(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        return getAttributes(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    public Attributes getAttributes(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
        return refCtx.getAttributes(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    public Attributes getAttributes(String name, String[] attrIds)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        return getAttributes(toName(name), attrIds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    public Attributes getAttributes(Name name, String[] attrIds)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
        return refCtx.getAttributes(overrideName(name), attrIds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    public void modifyAttributes(String name, int mod_op, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        modifyAttributes(toName(name), mod_op, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
    public void modifyAttributes(Name name, int mod_op, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        refCtx.modifyAttributes(overrideName(name), mod_op, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    public void modifyAttributes(String name, ModificationItem[] mods)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
        modifyAttributes(toName(name), mods);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    public void modifyAttributes(Name name, ModificationItem[] mods)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        refCtx.modifyAttributes(overrideName(name), mods);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    public void bind(String name, Object obj, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
        bind(toName(name), obj, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    public void bind(Name name, Object obj, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
        refCtx.bind(overrideName(name), obj, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    public void rebind(String name, Object obj, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
        rebind(toName(name), obj, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
    public void rebind(Name name, Object obj, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        refCtx.rebind(overrideName(name), obj, attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    public DirContext createSubcontext(String name, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
        return createSubcontext(toName(name), attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    public DirContext createSubcontext(Name name, Attributes attrs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
        return refCtx.createSubcontext(overrideName(name), attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    public DirContext getSchema(String name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
        return getSchema(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    public DirContext getSchema(Name name) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
        return refCtx.getSchema(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
    public DirContext getSchemaClassDefinition(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
        return getSchemaClassDefinition(toName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    public DirContext getSchemaClassDefinition(Name name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
      return refCtx.getSchemaClassDefinition(overrideName(name));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   614
    public NamingEnumeration<SearchResult> search(String name,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   615
                                                  Attributes matchingAttributes)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
        return search(toName(name), SearchFilter.format(matchingAttributes),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
            new SearchControls());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   621
    public NamingEnumeration<SearchResult> search(Name name,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   622
                                                  Attributes matchingAttributes)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
        return search(name, SearchFilter.format(matchingAttributes),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
            new SearchControls());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   628
    public NamingEnumeration<SearchResult> search(String name,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   629
                                                  Attributes matchingAttributes,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   630
                                                  String[] attributesToReturn)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
        SearchControls cons = new SearchControls();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        cons.setReturningAttributes(attributesToReturn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        return search(toName(name), SearchFilter.format(matchingAttributes),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
            cons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   639
    public NamingEnumeration<SearchResult> search(Name name,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   640
                                                  Attributes matchingAttributes,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   641
                                                  String[] attributesToReturn)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
        SearchControls cons = new SearchControls();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
        cons.setReturningAttributes(attributesToReturn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
        return search(name, SearchFilter.format(matchingAttributes), cons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   649
    public NamingEnumeration<SearchResult> search(String name,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   650
                                                  String filter,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   651
                                                  SearchControls cons)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
        return search(toName(name), filter, cons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   656
    public NamingEnumeration<SearchResult> search(Name name,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   657
                                                  String filter,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
        SearchControls cons) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
        try {
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   666
            NamingEnumeration<SearchResult> se =
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   667
                    refCtx.search(overrideName(name),
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   668
                                  overrideFilter(filter),
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   669
                                  overrideAttributesAndScope(cons));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
            refEx.setNameResolved(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
            // append (referrals from) the exception that generated this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
            // context to the new search results, so that referral processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
            // can continue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
            ((ReferralEnumeration)se).appendUnprocessedReferrals(refEx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
            return (se);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
        } catch (LdapReferralException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
25808
e113d0a0fde0 8054158: Fix typos in JNDI-related packages
prappo
parents: 10324
diff changeset
   682
            // %%% setNameResolved(true);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
            // append (referrals from) the exception that generated this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
            // context to the new exception, so that referral processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
            // can continue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
            e.appendUnprocessedReferrals(refEx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
            throw (NamingException)(e.fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
        } catch (NamingException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
            // record the exception if there are no remaining referrals
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
            if ((refEx != null) && (! refEx.hasMoreReferrals())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
                refEx.setNamingException(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
            if ((refEx != null) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
                (refEx.hasMoreReferrals() ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
                 refEx.hasMoreReferralExceptions())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
                    ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
                throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   708
    public NamingEnumeration<SearchResult> search(String name,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   709
                                                  String filterExpr,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   710
                                                  Object[] filterArgs,
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   711
                                                  SearchControls cons)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
            throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
        return search(toName(name), filterExpr, filterArgs, cons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   716
    public NamingEnumeration<SearchResult> search(Name name,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
        String filterExpr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
        Object[] filterArgs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
        SearchControls cons) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
        try {
10324
e28265130e4f 7072353: JNDI libraries do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   727
            NamingEnumeration<SearchResult> se;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
            if (urlFilter != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
                se = refCtx.search(overrideName(name), urlFilter,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
                overrideAttributesAndScope(cons));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
                se = refCtx.search(overrideName(name), filterExpr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
                filterArgs, overrideAttributesAndScope(cons));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
            refEx.setNameResolved(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
            // append (referrals from) the exception that generated this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
            // context to the new search results, so that referral processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
            // can continue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
            ((ReferralEnumeration)se).appendUnprocessedReferrals(refEx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
            return (se);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
        } catch (LdapReferralException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
            // append (referrals from) the exception that generated this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
            // context to the new exception, so that referral processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
            // can continue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
            e.appendUnprocessedReferrals(refEx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
            throw (NamingException)(e.fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
        } catch (NamingException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
            // record the exception if there are no remaining referrals
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
            if ((refEx != null) && (! refEx.hasMoreReferrals())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
                refEx.setNamingException(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
            if ((refEx != null) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
                (refEx.hasMoreReferrals() ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
                 refEx.hasMoreReferralExceptions())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
                throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
                    ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
                throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
    public String getNameInNamespace() throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
        return urlName != null && !urlName.isEmpty() ? urlName.get(0) : "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
    // ---------------------- LdapContext ---------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
    public ExtendedResponse extendedOperation(ExtendedRequest request)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
        if (!(refCtx instanceof LdapContext)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
            throw new NotContextException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
                "Referral context not an instance of LdapContext");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
        return ((LdapContext)refCtx).extendedOperation(request);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
    public LdapContext newInstance(Control[] requestControls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
        if (!(refCtx instanceof LdapContext)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
            throw new NotContextException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
                "Referral context not an instance of LdapContext");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
        return ((LdapContext)refCtx).newInstance(requestControls);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
    public void reconnect(Control[] connCtls) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
        if (!(refCtx instanceof LdapContext)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
            throw new NotContextException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
                "Referral context not an instance of LdapContext");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
        ((LdapContext)refCtx).reconnect(connCtls);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
    public Control[] getConnectControls() throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
        if (!(refCtx instanceof LdapContext)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
            throw new NotContextException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
                "Referral context not an instance of LdapContext");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
        return ((LdapContext)refCtx).getConnectControls();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
    public void setRequestControls(Control[] requestControls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
        if (!(refCtx instanceof LdapContext)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
            throw new NotContextException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
                "Referral context not an instance of LdapContext");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
        ((LdapContext)refCtx).setRequestControls(requestControls);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
    public Control[] getRequestControls() throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
        if (!(refCtx instanceof LdapContext)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
            throw new NotContextException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
                "Referral context not an instance of LdapContext");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
        return ((LdapContext)refCtx).getRequestControls();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
    public Control[] getResponseControls() throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
        if (skipThisReferral) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
            throw (NamingException)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
                ((refEx.appendUnprocessedReferrals(null)).fillInStackTrace());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
        if (!(refCtx instanceof LdapContext)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
            throw new NotContextException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
                "Referral context not an instance of LdapContext");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
        return ((LdapContext)refCtx).getResponseControls();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
    // ---------------------- Private methods  ---------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
    private Name toName(String name) throws InvalidNameException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
        return name.equals("") ? new CompositeName() :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
            new CompositeName().add(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     * Use the DN component from the LDAP URL (if present) to override the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     * supplied DN.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
    private Name overrideName(Name name) throws InvalidNameException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
        return (urlName == null ? name : urlName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * Use the attributes and scope components from the LDAP URL (if present)
25808
e113d0a0fde0 8054158: Fix typos in JNDI-related packages
prappo
parents: 10324
diff changeset
   900
     * to override the corresponding components supplied in SearchControls.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
    private SearchControls overrideAttributesAndScope(SearchControls cons) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
        SearchControls urlCons;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
        if ((urlScope != null) || (urlAttrs != null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
            urlCons = new SearchControls(cons.getSearchScope(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
                                        cons.getCountLimit(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
                                        cons.getTimeLimit(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
                                        cons.getReturningAttributes(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
                                        cons.getReturningObjFlag(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
                                        cons.getDerefLinkFlag());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
            if (urlScope != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
                if (urlScope.equals("base")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
                    urlCons.setSearchScope(SearchControls.OBJECT_SCOPE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
                } else if (urlScope.equals("one")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
                    urlCons.setSearchScope(SearchControls.ONELEVEL_SCOPE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
                } else if (urlScope.equals("sub")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
                    urlCons.setSearchScope(SearchControls.SUBTREE_SCOPE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
            if (urlAttrs != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
                StringTokenizer tokens = new StringTokenizer(urlAttrs, ",");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
                int count = tokens.countTokens();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
                String[] attrs = new String[count];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
                for (int i = 0; i < count; i ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
                    attrs[i] = tokens.nextToken();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
                urlCons.setReturningAttributes(attrs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
            return urlCons;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
            return cons;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     * Use the filter component from the LDAP URL (if present) to override the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     * supplied filter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
    private String overrideFilter(String filter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
        return (urlFilter == null ? filter : urlFilter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
}