src/java.naming/share/classes/javax/naming/ldap/package.html
author jjg
Fri, 31 May 2019 10:59:54 -0700
changeset 55131 9889f5e3ba00
parent 47216 71c04702a3d5
permissions -rw-r--r--
8225129: Fix minor HTML issues in java.naming Reviewed-by: mchung, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
<html>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
<head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
<!--
55131
9889f5e3ba00 8225129: Fix minor HTML issues in java.naming
jjg
parents: 47216
diff changeset
     5
Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
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
    10
published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    12
by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
5551
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    24
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    25
or visit www.oracle.com if you need additional information or have any
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    26
questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
-->
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
</head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
<body bgcolor="white">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
Provides support for LDAPv3 extended operations and controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
This package extends the directory operations of the Java Naming and
30678
a8b7fd8ede97 8075284: fix up miscellaneous TM constructions
darcy
parents: 25859
diff changeset
    36
Directory Interface&trade; (JNDI). &nbsp;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
JNDI provides naming and directory functionality to applications
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
written in the Java programming language.  It is designed to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
independent of any specific naming or directory service
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
implementation.  Thus a variety of services--new, emerging, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
already deployed ones--can be accessed in a common way.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
This package is for applications and service providers that deal with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
LDAPv3 extended operations and controls, as defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
<a href=http://www.ietf.org/rfc/rfc2251.txt>RFC 2251</a>.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
    47
The core interface in this package is <code>LdapContext</code>, which defines
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
methods on a context for performing extended operations and handling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
55131
9889f5e3ba00 8225129: Fix minor HTML issues in java.naming
jjg
parents: 47216
diff changeset
    51
<h2>Extended Operations</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
    53
This package defines the interface <code>ExtendedRequest</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
to represent the argument to an extended operation,
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
    55
and the interface <code>ExtendedResponse</code> to represent the result
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
of the extended operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
An extended response is always paired with an extended request
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
but not necessarily vice versa. That is, you can have an extended request
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
that has no corresponding extended response.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
An application typically does not deal directly with these interfaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
Instead, it deals with classes that <em>implement</em> these
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
interfaces.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
The application gets these classes either as part of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
repertoire of extended operations standardized through the IETF, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
from directory vendors for vendor-specific extended operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
The request classes should have constructors that accept
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
arguments in a type-safe and user-friendly manner, while the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
response classes should have access methods for getting the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
of the response in a type-safe and user-friendly manner.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
Internally, the request/response classes deal with encoding and decoding
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
BER values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
For example, suppose an LDAP server supports a "get time" extended operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
It would supply classes such as
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
    76
<code>GetTimeRequest</code> and <code>GetTimeResponse</code>,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
so that applications can use this feature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
An application would use these classes as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
GetTimeResponse resp =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    (GetTimeResponse) ectx.extendedOperation(new GetTimeRequest());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
long time = resp.getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
    85
The <code>GetTimeRequest</code> and <code>GetTimeResponse</code> classes might
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
be defined as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
public class GetTimeRequest implements ExtendedRequest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    // User-friendly constructor 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    public GetTimeRequest() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    // Methods used by service providers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public String getID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        return GETTIME_REQ_OID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public byte[] getEncodedValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        return null;  // no value needed for get time request
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    public ExtendedResponse createExtendedResponse(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        String id, byte[] berValue, int offset, int length) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        return new GetTimeResponse(id, berValue, offset, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
public class GetTimeResponse() implements ExtendedResponse {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    long time;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    // called by GetTimeRequest.createExtendedResponse()
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   108
    public GetTimeResponse(String id, byte[] berValue, int offset, int length)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        // check validity of id
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        long time =  ... // decode berValue to get time
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    // Type-safe and User-friendly methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    public java.util.Date getDate() { return new java.util.Date(time); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    public long getTime() { return time; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    // Low level methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    public byte[] getEncodedValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        return // berValue saved;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    public String getID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        return GETTIME_RESP_OID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
55131
9889f5e3ba00 8225129: Fix minor HTML issues in java.naming
jjg
parents: 47216
diff changeset
   128
<h2>Controls</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   130
This package defines the interface <code>Control</code> to represent an LDAPv3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
control. It can be a control that is sent to an LDAP server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
(<em>request control</em>) or a control returned by an LDAP server
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
(<em>response control</em>).  Unlike extended requests and responses,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
there is not necessarily any pairing between request controls and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
response controls.  You can send request controls and expect no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
response controls back, or receive response controls without sending
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
any request controls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
An application typically does not deal directly with this interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
Instead, it deals with classes that <em>implement</em> this interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
The application gets control classes either as part of a repertoire of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
controls standardized through the IETF, or from directory vendors for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
vendor-specific controls.  The request control classes should have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
constructors that accept arguments in a type-safe and user-friendly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
manner, while the response control classes should have access methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
for getting the data of the response in a type-safe and user-friendly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
manner.  Internally, the request/response control classes deal with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
encoding and decoding BER values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
For example, suppose an LDAP server supports a "signed results"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
request control, which when sent with a request, asks the
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   152
server to digitally sign the results of an operation.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   153
It would supply a class <code>SignedResultsControl</code>  so that applications
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
can use this feature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
An application  would use this class as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
<blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
<pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
Control[] reqCtls = new Control[] {new SignedResultsControl(Control.CRITICAL)};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
ectx.setRequestControls(reqCtls);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
NamingEnumeration enum = ectx.search(...);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
</blockquote>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   163
The <code>SignedResultsControl</code> class might be defined as follows:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
public class SignedResultsControl implements Control {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    // User-friendly constructor 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    public SignedResultsControl(boolean criticality) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
	// assemble the components of the request control
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    // Methods used by service providers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    public String getID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        return // control's object identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    public byte[] getEncodedValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        return // ASN.1 BER encoded control value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
When a service provider receives response controls, it uses
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   183
the <code>ControlFactory</code> class to produce specific classes
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   184
that implement the <code>Control</code> interface.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
An LDAP server can send back response controls with an LDAP operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
and also with enumeration results, such as those returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
by a list or search operation.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   189
The <code>LdapContext</code> provides a method (<code>getResponseControls()</code>)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
for getting the response controls sent with an LDAP operation,
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   191
while the <code>HasControls</code> interface is used to retrieve
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
response controls associated with enumeration results.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
For example, suppose an LDAP server sends back a "change ID" control in response
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   195
to a successful modification. It would supply a class <code>ChangeIDControl</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
so that the application can use this feature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
An application would perform an update, and then try to get the change ID.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
// Perform update
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
Context ctx = ectx.createSubsubcontext("cn=newobj");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
// Get response controls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
Control[] respCtls = ectx.getResponseControls();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
if (respCtls != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    // Find the one we want
45132
db2f2d72cd4f 8179697: Fix Html5 errors in java.naming, java.logging, jdk.httpserver, jdk.net, jdk.sctp
ksrini
parents: 32029
diff changeset
   206
    for (int i = 0; i &lt; respCtls; i++) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        if(respCtls[i] instanceof ChangeIDControl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
	    ChangeIDControl cctl = (ChangeIDControl)respCtls[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
	    System.out.println(cctl.getChangeID());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
</pre></blockquote>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   214
The vendor might supply the following <code>ChangeIDControl</code> and
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   215
<code>VendorXControlFactory</code> classes. The <code>VendorXControlFactory</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
will be used by the service provider when the provider receives response
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
controls from the LDAP server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
<blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
public class ChangeIDControl implements Control {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    long id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    // Constructor used by ControlFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public ChangeIDControl(String OID, byte[] berVal) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        // check validity of OID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        id = // extract change ID from berVal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    // Type-safe and User-friendly method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    public long getChangeID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        return id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    // Low-level methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    public String getID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        return CHANGEID_OID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    public byte[] getEncodedValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        return // original berVal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
public class VendorXControlFactory extends ControlFactory {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    public VendorXControlFactory () {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public Control getControlInstance(Control orig) throws NamingException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        if (isOneOfMyControls(orig.getID())) {
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 30678
diff changeset
   248
	    ...
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
	    // determine which of ours it is and call its constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
	    return (new ChangeIDControl(orig.getID(), orig.getEncodedValue()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
	}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        return null;  // not one of ours
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
</pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
<h2>Package Specification</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
The JNDI API Specification and related documents can be found in the
45136
bd5c526bc443 8180176: Broken javadoc links in java.logging and java.naming
dfuchs
parents: 45132
diff changeset
   261
{@extLink jndi_overview JNDI documentation}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
@since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
</body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
</html>