|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||||||
| JavaTM 2 Platform Std. Ed. v1.4.2
Package javax.naming.ldapProvides support for LDAPv3 extended operations and controls.
See:
Package javax.naming.ldap DescriptionProvides support for LDAPv3 extended operations and controls. This package extends the directory operations of the Java Naming and Directory InterfaceTM (JNDI). JNDI provides naming and directory functionality to applications written in the Java programming language. It is designed to be independent of any specific naming or directory service implementation. Thus a variety of services--new, emerging, and already deployed ones--can be accessed in a common way. This package is for applications and service providers that deal with LDAPv3 extended operations and controls, as defined by RFC 2251. The core interface in this package is LdapContext, which defines methods on a context for performing extended operations and handling controls. Extended OperationsThis package defines the interface ExtendedRequest to represent the argument to an extended operation, and the interface ExtendedResponse to represent the result of the extended operation. An extended response is always paired with an extended request but not necessarily vice versa. That is, you can have an extended request that has no corresponding extended response. An application typically does not deal directly with these interfaces. Instead, it deals with classes that implement these interfaces. The application gets these classes either as part of a repertoire of extended operations standardized through the IETF, or from directory vendors for vendor-specific extended operations. The request classes should have constructors that accept arguments in a type-safe and user-friendly manner, while the response classes should have access methods for getting the data of the response in a type-safe and user-friendly manner. Internally, the request/response classes deal with encoding and decoding BER values. For example, suppose an LDAP server supports a "get time" extended operation. It would supply classes such as GetTimeRequest and GetTimeResponse, so that applications can use this feature. An application would use these classes as follows:
The GetTimeRequest and GetTimeResponse classes might be defined as follows:
ControlsThis package defines the interface Control to represent an LDAPv3 control. It can be a control that is sent to an LDAP server (request control) or a control returned by an LDAP server (response control). Unlike extended requests and responses, there is not necessarily any pairing between request controls and response controls. You can send request controls and expect no response controls back, or receive response controls without sending any request controls.An application typically does not deal directly with this interface. Instead, it deals with classes that implement this interface. The application gets control classes either as part of a repertoire of controls standardized through the IETF, or from directory vendors for vendor-specific controls. The request control classes should have constructors that accept arguments in a type-safe and user-friendly manner, while the response control classes should have access methods for getting the data of the response in a type-safe and user-friendly manner. Internally, the request/response control classes deal with encoding and decoding BER values. For example, suppose an LDAP server supports a "sort" request control, which when sent with a search request, asks the server to return the results of the search ordered by a particular attribute It would supply a class SortControl so that applications can use this feature. An application would use this class as follows:
The SortControl class might be defined as follows:
When a service provider receives response controls, it uses the ControlFactory class to produce specific classes that implement the Control interface. An LDAP server can send back response controls with an LDAP operation and also with enumeration results, such as those returned by a list or search operation. The LdapContext provides a method (getResponseControls()) for getting the response controls sent with an LDAP operation, while the HasControls interface is used to retrieve response controls associated with enumeration results. For example, suppose an LDAP server sends back a "change ID" control in response to a successful modification. It would supply a class ChangeIDControl so that the application can use this feature. An application would perform an update, and then try to get the change ID.
The vendor might supply the following ChangeIDControl and
VendorXControlFactory classes. The VendorXControlFactory
will be used by the service provider when the provider receives response
controls from the LDAP server.
Package SpecificationThe following documents can be found at the Java technology web site:
Copyright 2003 Sun Microsystems, Inc. All rights reserved
|
||||||||||||||||||||||||||||||||