Class LDAPExtendedOperation
- All Implemented Interfaces:
Serializable
Objects of this class can be used to represent extended operation requests (sent by your client) or extended operation responses (returned by an LDAP v3 server).
To determine which extended operations are supported by a server,
you need to search for the root DSE (DSA-specific entry, where DSA is
another term for "LDAP server") and find the values of the
supportedExtension
attribute. This attribute contains the
object IDs (OIDs) of the extended operations supported by this server.
The following section of code demonstrates how to get the list of the extended operations supported by an LDAP server.
public static void main( String[] args ) { LDAPConnection ld = new LDAPConnection(); try { String MY_HOST = "localhost"; int MY_PORT = 389; ld.connect( MY_HOST, MY_PORT ); try { ld.authenticate( 3, "cn=Directory Manager", "23skidoo" ); } catch( LDAPException e ) { System.out.println( "LDAP server does not support v3." ); ld.disconnect(); System.exit(1); } String MY_FILT = "(objectclass=*)"; String MY_BASE = ""; String getAttrs[] = { "supportedExtension" }; LDAPSearchResults res = ld.search( MY_BASE, LDAPConnection.SCOPE_BASE, MY_FILT, getAttrs, false ); while ( res.hasMoreElements() ) { LDAPEntry findEntry = (LDAPEntry)res.nextElement(); LDAPAttributeSet findAttrs = findEntry.getAttributeSet(); Enumeration enumAttrs = findAttrs.getAttributes(); while ( enumAttrs.hasMoreElements() ) { LDAPAttribute anAttr = (LDAPAttribute)enumAttrs.nextElement(); String attrName = anAttr.getName(); System.out.println( attrName ); Enumeration enumVals = anAttr.getStringValues(); while ( enumVals.hasMoreElements() ) { String aVal = ( String )enumVals.nextElement(); System.out.println( "\t" + aVal ); } } } } catch( LDAPException e ) { System.out.println( "Error: " + e.toString() ); } try { ld.disconnect(); } catch( LDAPException e ) { System.exit(1); } System.exit(0); }
If you compile and run this example against an LDAP server that supports v3 of the protocol, you might receive the following results:
supportedextension 1.2.3.4
For more information on LDAP controls, see the Internet-Draft on the LDAP v3 protocol. (Note that this internet draft is still a work in progress. You can find the latest draft at the ASID home page.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LDAPExtendedOperation
Construct an object- Parameters:
oid
- identifier for the particular operationvals
- operation-specific data
-
-
Method Details
-
getID
Get the identifier for this operation.- Returns:
- oid identifier for the particular operation.
-
getValue
public byte[] getValue()Get the data for this operation.- Returns:
- vals operation-specific data.
-