API java : javax.naming.ldap


Package javax.naming.ldap

Provides support for LDAPv3 extended operations and controls.

See:
          Description

Interface Summary
Control This interface represents an LDAPv3 control as defined in RFC 2251.
ExtendedRequest This interface represents an LDAPv3 extended operation request as defined in RFC 2251.
ExtendedResponse This interface represents an LDAP extended operation response as defined in RFC 2251.
HasControls This interface is for returning controls with objects returned in NamingEnumerations.
LdapContext This interface represents a context in which you can perform operations with LDAPv3-style controls and perform LDAPv3-style extended operations.
UnsolicitedNotification This interface represents an unsolicited notification as defined in RFC 2251.
UnsolicitedNotificationListener This interface is for handling UnsolicitedNotificationEvent.
 

Class Summary
BasicControl This class provides a basic implementation of the Control interface.
ControlFactory This abstract class represents a factory for creating LDAPv3 controls.
InitialLdapContext This class is the starting context for performing LDAPv3-style extended operations and controls.
LdapName This class represents a distinguished name as specified by RFC 2253.
ManageReferralControl Requests that referral and other special LDAP objects be manipulated as normal LDAP objects.
PagedResultsControl Requests that the results of a search operation be returned by the LDAP server in batches of a specified size.
PagedResultsResponseControl Indicates the end of a batch of search results.
Rdn This class represents a relative distinguished name, or RDN, which is a component of a distinguished name as specified by RFC 2253.
SortControl Requests that the results of a search operation be sorted by the LDAP server before being returned.
SortKey A sort key and its associated sort parameters.
SortResponseControl Indicates whether the requested sort of search results was successful or not.
StartTlsRequest This class implements the LDAPv3 Extended Request for StartTLS as defined in Lightweight Directory Access Protocol (v3): Extension for Transport Layer Security The object identifier for StartTLS is 1.3.6.1.4.1.1466.20037 and no extended request value is defined.
StartTlsResponse This class implements the LDAPv3 Extended Response for StartTLS as defined in Lightweight Directory Access Protocol (v3): Extension for Transport Layer Security The object identifier for StartTLS is 1.3.6.1.4.1.1466.20037 and no extended response value is defined.
UnsolicitedNotificationEvent This class represents an event fired in response to an unsolicited notification sent by the LDAP server.
 

Exception Summary
LdapReferralException This abstract class is used to represent an LDAP referral exception.
 

Package javax.naming.ldap Description

Provides 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 Operations

This 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:

  1. GetTimeResponse resp =
  2. (GetTimeResponse) ectx.extendedOperation(new GetTimeRequest());
  3. long time = resp.getTime();

The GetTimeRequest and GetTimeResponse classes might be defined as follows:

  1. public class GetTimeRequest implements ExtendedRequest {
  2. // User-friendly constructor
  3. public GetTimeRequest() {
  4. };
  5.  
  6. // Methods used by service providers
  7. public String getID() {
  8. return GETTIME_REQ_OID;
  9. }
  10. public byte[] getEncodedValue() {
  11. return null; // no value needed for get time request
  12. }
  13. public ExtendedResponse createExtendedResponse(
  14. String id, byte[] berValue, int offset, int length) throws NamingException {
  15. return new GetTimeResponse(id, berValue, offset, length);
  16. }
  17. }
  18. public class GetTimeResponse() implements ExtendedResponse {
  19. long time;
  20. // called by GetTimeRequest.createExtendedResponse()
  21. public GetTimeResponse(String id, byte[] berValue, int offset, int length)
  22. throws NamingException {
  23. // check validity of id
  24. long time = ... // decode berValue to get time
  25. }
  26.  
  27. // Type-safe and User-friendly methods
  28. public java.util.Date getDate() { return new java.util.Date(time); }
  29. public long getTime() { return time; }
  30.  
  31. // Low level methods
  32. public byte[] getEncodedValue() {
  33. return // berValue saved;
  34. }
  35. public String getID() {
  36. return GETTIME_RESP_OID;
  37. }
  38. }

Controls

This 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 "signed results" request control, which when sent with a request, asks the server to digitally sign the results of an operation. It would supply a class SignedResultsControl so that applications can use this feature. An application would use this class as follows:

  1. Control[] reqCtls = new Control[] {new SignedResultsControl(Control.CRITICAL)};
  2. ectx.setRequestControls(reqCtls);
  3. NamingEnumeration enum = ectx.search(...);
The SignedResultsControl class might be defined as follows:
  1. public class SignedResultsControl implements Control {
  2. // User-friendly constructor
  3. public SignedResultsControl(boolean criticality) {
  4. // assemble the components of the request control
  5. };
  6.  
  7. // Methods used by service providers
  8. public String getID() {
  9. return // control's object identifier
  10. }
  11. public byte[] getEncodedValue() {
  12. return // ASN.1 BER encoded control value
  13. }
  14. ...
  15. }

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.

  1. // Perform update
  2. Context ctx = ectx.createSubsubcontext("cn=newobj");
  3.  
  4. // Get response controls
  5. Control[] respCtls = ectx.getResponseControls();
  6. if (respCtls != null) {
  7. // Find the one we want
  8. for (int i = 0; i < respCtls; i++) {
  9. if(respCtls[i] instanceof ChangeIDControl) {
  10. ChangeIDControl cctl = (ChangeIDControl)respCtls[i];
  11. System.out.println(cctl.getChangeID());
  12. }
  13. }
  14. }
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.
  1. public class ChangeIDControl implements Control {
  2. long id;
  3.  
  4. // Constructor used by ControlFactory
  5. public ChangeIDControl(String OID, byte[] berVal) throws NamingException {
  6. // check validity of OID
  7. id = // extract change ID from berVal
  8. };
  9.  
  10. // Type-safe and User-friendly method
  11. public long getChangeID() {
  12. return id;
  13. }
  14.  
  15. // Low-level methods
  16. public String getID() {
  17. return CHANGEID_OID;
  18. }
  19. public byte[] getEncodedValue() {
  20. return // original berVal
  21. }
  22. ...
  23. }
  24. public class VendorXControlFactory extends ControlFactory {
  25. public VendorXControlFactory () {
  26. }
  27.  
  28. public Control getControlInstance(Control orig) throws NamingException {
  29. if (isOneOfMyControls(orig.getID())) {
  30. ...
  31.  
  32. // determine which of ours it is and call its constructor
  33. return (new ChangeIDControl(orig.getID(), orig.getEncodedValue()));
  34. }
  35. return null; // not one of ours
  36. }
  37. }

Package Specification

The following documents can be found at the Java technology web site:

Since:
1.3

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

7 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-10114
Document créé le 24/01/07 04:34, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/naming/ldap/package-summary.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
1,08 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Tout ce que les hommes ont fait de beau et de bien, ils l'ont construit avec leurs rêves...

Bernard Moitessier [Extrait de La longue route]
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 01:50, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)