src/java.naming/share/classes/javax/naming/directory/SearchControls.java
author herrick
Tue, 24 Sep 2019 13:41:16 -0400
branchJDK-8200758-branch
changeset 58301 e0efb29609bd
parent 47216 71c04702a3d5
permissions -rw-r--r--
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code Submitted-by: asemenyuk Reviewed-by: herrick, almatvee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1999, 2000, 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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package javax.naming.directory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
  * This class encapsulates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
  * factors that determine scope of search and what gets returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
  * as a result of the search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
  *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
  * A SearchControls instance is not synchronized against concurrent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
  * multithreaded access. Multiple threads trying to access and modify
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
  * a single SearchControls instance should lock the object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
  * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
public class SearchControls implements java.io.Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * Search the named object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * The NamingEnumeration that results from search()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * using OBJECT_SCOPE will contain one or zero element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * The enumeration contains one element if the named object satisfies
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * the search filter specified in search().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * The element will have as its name the empty string because the names
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * of elements in the NamingEnumeration are relative to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * target context--in this case, the target context is the named object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * It contains zero element if the named object does not satisfy
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * the search filter specified in search().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * <p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    57
     * The value of this constant is {@code 0}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    public final static int OBJECT_SCOPE = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * Search one level of the named context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * The NamingEnumeration that results from search()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * using ONELEVEL_SCOPE contains elements with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * objects in the named context that satisfy
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * the search filter specified in search().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * The names of elements in the NamingEnumeration are atomic names
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * relative to the named context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * <p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    71
     * The value of this constant is {@code 1}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    public final static int ONELEVEL_SCOPE = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * Search the entire subtree rooted at the named object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * If the named object is not a DirContext, search only the object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * If the named object is a DirContext, search the subtree
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * rooted at the named object, including the named object itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * The search will not cross naming system boundaries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * The NamingEnumeration that results from search()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * using SUBTREE_SCOPE contains elements of objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * from the subtree (including the named context)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * that satisfy the search filter specified in search().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * The names of elements in the NamingEnumeration are either
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * relative to the named context or is a URL string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * If the named context satisfies the search filter, it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * included in the enumeration with the empty string as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * its name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * <p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    93
     * The value of this constant is {@code 2}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public final static int SUBTREE_SCOPE = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * Contains the scope with which to apply the search. One of
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    99
     * {@code ONELEVEL_SCOPE}, {@code OBJECT_SCOPE}, or
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   100
     * {@code SUBTREE_SCOPE}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    private int searchScope;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * Contains the milliseconds to wait before returning
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * from search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    private int timeLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * Indicates whether JNDI links are dereferenced during
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    private boolean derefLink;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    /**
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   120
     *  Indicates whether object is returned in {@code SearchResult}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    private boolean returnObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * Contains the maximum number of SearchResults to return.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    private long countLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *  Contains the list of attributes to be returned in
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   133
     * {@code SearchResult} for each matching entry of search. {@code null}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * indicates that all attributes are to be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    private String[] attributesToReturn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * Constructs a search constraints using defaults.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * The defaults are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * <li>search one level
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * <li>no maximum return limit for search results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * <li>no time limit for search
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * <li>return all attributes associated with objects that satisfy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     *   the search filter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * <li>do not return named object  (return only name and class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * <li>do not dereference links during search
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public SearchControls() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        searchScope = ONELEVEL_SCOPE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        timeLimit = 0; // no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        countLimit = 0; // no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        derefLink = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        returnObj = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        attributesToReturn = null; // return all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * Constructs a search constraints using arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @param scope     The search scope.  One of:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *                  OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @param timelim   The number of milliseconds to wait before returning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *                  If 0, wait indefinitely.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @param deref     If true, dereference links during search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @param countlim  The maximum number of entries to return.  If 0, return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *                  all entries that satisfy filter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @param retobj    If true, return the object bound to the name of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     *                  entry; if false, do not return object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @param attrs     The identifiers of the attributes to return along with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *                  the entry.  If null, return all attributes. If empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *                  return no attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    public SearchControls(int scope,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                             long countlim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                             int timelim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                             String[] attrs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                             boolean retobj,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                             boolean deref) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        searchScope = scope;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        timeLimit = timelim; // no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        derefLink = deref;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        returnObj = retobj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        countLimit = countlim; // no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        attributesToReturn = attrs; // return all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * Retrieves the search scope of these SearchControls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * One of OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @return The search scope of this SearchControls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @see #setSearchScope
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    public int getSearchScope() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        return searchScope;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Retrieves the time limit of these SearchControls in milliseconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * If the value is 0, this means to wait indefinitely.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @return The time limit of these SearchControls in milliseconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * @see #setTimeLimit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    public int getTimeLimit() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        return timeLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * Determines whether links will be dereferenced during the search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * @return true if links will be dereferenced; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * @see #setDerefLinkFlag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    public boolean getDerefLinkFlag() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        return derefLink;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * Determines whether objects will be returned as part of the result.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * @return true if objects will be returned; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * @see #setReturningObjFlag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    public boolean getReturningObjFlag() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        return returnObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * Retrieves the maximum number of entries that will be returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * as a result of the search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * 0 indicates that all entries will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @return The maximum number of entries that will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @see #setCountLimit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    public long getCountLimit() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        return countLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * Retrieves the attributes that will be returned as part of the search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * A value of null indicates that all attributes will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * An empty array indicates that no attributes are to be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @return An array of attribute ids identifying the attributes that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * will be returned. Can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * @see #setReturningAttributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    public String[] getReturningAttributes() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        return attributesToReturn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * Sets the search scope to one of:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @param scope     The search scope of this SearchControls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @see #getSearchScope
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    public void setSearchScope(int scope) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        searchScope = scope;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * Sets the time limit of these SearchControls in milliseconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * If the value is 0, this means to wait indefinitely.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * @param ms        The time limit of these SearchControls in milliseconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @see #getTimeLimit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    public void setTimeLimit(int ms) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        timeLimit = ms;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * Enables/disables link dereferencing during the search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @param on        if true links will be dereferenced; if false, not followed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @see #getDerefLinkFlag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public void setDerefLinkFlag(boolean on) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        derefLink = on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * Enables/disables returning objects returned as part of the result.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * If disabled, only the name and class of the object is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * If enabled, the object will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @param on        if true, objects will be returned; if false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     *                  objects will not be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * @see #getReturningObjFlag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    public void setReturningObjFlag(boolean on) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        returnObj = on;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * Sets the maximum number of entries to be returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * as a result of the search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * 0 indicates no limit:  all entries will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @param limit The maximum number of entries that will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * @see #getCountLimit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    public void setCountLimit(long limit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        countLimit = limit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * Specifies the attributes that will be returned as part of the search.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * null indicates that all attributes will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * An empty array indicates no attributes are returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @param attrs An array of attribute ids identifying the attributes that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     *              will be returned. Can be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * @see #getReturningAttributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public void setReturningAttributes(String[] attrs) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        attributesToReturn = attrs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * Use serialVersionUID from JNDI 1.1.1 for interoperability.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    private static final long serialVersionUID = -2480540967773454797L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
}