org.apache.ldap.clients.embedded
Interface LdapClient

All Known Implementing Classes:
LdapClientImpl

public interface LdapClient

Interface into the LDAPd session


Method Summary
 void closeServerConnection()
          Close the socket connection to the server.
 void connectToServer()
          Connects the socket to the server.
 java.lang.String getBindDn()
          DN used to bind to the server
 java.lang.String getHost()
          Get the hostname if of the LDAP server
 java.lang.String getPassword()
          Password of the DN entry used to bind to the server
 int getPort()
          Port used to connect to the LDAP server
 boolean isConnectedToServer()
          Determines if there is a current connection to the server
 boolean isDryRun()
          Determine if this is a dry run, no message sent to the server
 boolean isVerbose()
          Determine if verbose has been turned on
 boolean isVersion3()
          Determine if the LDIF format version 3 compliant
 LdapClientResponse ldapAdd(java.lang.StringBuffer a_entry)
           
 LdapClientResponse ldapBind()
          Perform an LDAP bind to the server
 LdapClientResponse ldapDelete(java.lang.String a_deleteDn)
          Perform an LDAP delete on the DN passed in
 LdapClientResponse ldapModify(java.lang.StringBuffer a_entry)
           
 LdapClientResponse ldapSearch(LdapSearchParameters a_parms)
          Perform an LDAP search operation on the search filer passed in.
 void ldapUnbind()
          Perform an LDAP unbind to the server
 void printAttributeList(javax.naming.NamingEnumeration a_attributeList)
          Print each attribute and the values for each attribute from the list passed into the method.
 void printAttributeNames(javax.naming.NamingEnumeration a_attributeList)
          Print each attribute name only.
 void setBindDn(java.lang.String a_bindDn)
          Set the DN of the user to bind to server with
 void setHost(java.lang.String a_host)
          Set the hostname of the LDAP Server
 void setIsDryRun(boolean a_isDryRun)
          Set the value of the dry run mode
 void setIsVerbose(boolean a_isVerbose)
          Set verbose mode
 void setIsVersion3(boolean a_isVersion3)
          Set value of version3 compatibility
 void setPassword(java.lang.String a_password)
          Password for the DN entry being used to bind
 void setPort(int a_port)
          Set the port number to connect to server with
 

Method Detail

setHost

void setHost(java.lang.String a_host)
Set the hostname of the LDAP Server

Parameters:
a_host - Hostname of the LDAP Server

setPort

void setPort(int a_port)
Set the port number to connect to server with

Parameters:
a_port - Port number to use to connect to the server

setBindDn

void setBindDn(java.lang.String a_bindDn)
Set the DN of the user to bind to server with

Parameters:
a_bindDn - DN of the user to bind to server with

setPassword

void setPassword(java.lang.String a_password)
Password for the DN entry being used to bind

Parameters:
a_password - Password for the DN entry being used to bind

setIsVersion3

void setIsVersion3(boolean a_isVersion3)
Set value of version3 compatibility

Parameters:
a_isVersion3 - True if LDIF is version3

setIsVerbose

void setIsVerbose(boolean a_isVerbose)
Set verbose mode

Parameters:
a_isVerbose - True if verbose mode is turned on

setIsDryRun

void setIsDryRun(boolean a_isDryRun)
Set the value of the dry run mode

Parameters:
a_isDryRun - True if the dry run mode is turned on

getHost

java.lang.String getHost()
Get the hostname if of the LDAP server

Returns:
hostname of the LDAP server

getPort

int getPort()
Port used to connect to the LDAP server

Returns:
Port used to connect to the LDAP server

getBindDn

java.lang.String getBindDn()
DN used to bind to the server

Returns:
DN used to bind to the server

getPassword

java.lang.String getPassword()
Password of the DN entry used to bind to the server

Returns:
Password of the DN entry used to bind to the server

isVersion3

boolean isVersion3()
Determine if the LDIF format version 3 compliant

Returns:
True if the LDIF format version 3 compliant

isVerbose

boolean isVerbose()
Determine if verbose has been turned on

Returns:
True if verbose has been turned on

isDryRun

boolean isDryRun()
Determine if this is a dry run, no message sent to the server

Returns:
True if this is a dry run

connectToServer

void connectToServer()
                     throws java.net.UnknownHostException,
                            java.io.IOException
Connects the socket to the server. This will not perform a bind, it will only establish the connection. The bind will call this, it does not have to be done manually. This can be used to test or step through the communication process.

Throws:
java.net.UnknownHostException - Cannot find the host
java.io.IOException - Error establishing the socket connection

isConnectedToServer

boolean isConnectedToServer()
Determines if there is a current connection to the server

Returns:
True if the connection is established

ldapBind

LdapClientResponse ldapBind()
                            throws java.io.IOException
Perform an LDAP bind to the server

Returns:
Response Object
Throws:
java.io.IOException - Error with the IO communication to the server

closeServerConnection

void closeServerConnection()
                           throws java.io.IOException
Close the socket connection to the server. This will help keep the server clean.

Throws:
java.io.IOException - Error terminating the socket connection

ldapUnbind

void ldapUnbind()
                throws java.io.IOException
Perform an LDAP unbind to the server

Throws:
java.io.IOException - Error with the IO communication to the server

ldapDelete

LdapClientResponse ldapDelete(java.lang.String a_deleteDn)
                              throws java.io.IOException
Perform an LDAP delete on the DN passed in

Parameters:
a_deleteDn - DN of the entry to delete
Returns:
Response Object
Throws:
java.io.IOException - Error with the IO communication to the server

ldapAdd

LdapClientResponse ldapAdd(java.lang.StringBuffer a_entry)
                           throws java.io.IOException
Parameters:
a_stream - Stream to read the input from. This can either be STDIN or a file
Returns:
Response Object
Throws:
java.io.IOException - Error with the IO communication to the server

ldapModify

LdapClientResponse ldapModify(java.lang.StringBuffer a_entry)
                              throws java.io.IOException
Parameters:
a_stream - Stream to read the input from. This can either be STDIN or a file
Returns:
Response Object
Throws:
java.io.IOException - Error with the IO communication to the server

ldapSearch

LdapClientResponse ldapSearch(LdapSearchParameters a_parms)
                              throws java.io.IOException
Perform an LDAP search operation on the search filer passed in. The result code and the actuall search results will be placed in the LdapClientResponse objected returned

Parameters:
a_filterString - Search filter to use
Returns:
Response Object containing the result code and search results
Throws:
java.io.IOException - Error with the IO communication to the server

printAttributeNames

void printAttributeNames(javax.naming.NamingEnumeration a_attributeList)
Print each attribute name only. This is used when the Types Only mode is selected from the command line options

Parameters:
a_attributeList - NamingEnumeration of Attributes

printAttributeList

void printAttributeList(javax.naming.NamingEnumeration a_attributeList)
Print each attribute and the values for each attribute from the list passed into the method. Each attribute has an ID, which is the name of the attribute and a list of values. This is the default method for the search client output. Each value of the same attribute will also print the ID, for example an entry with two value for objectclass will look like this: ou=unix,ou=People,dc=fl,dc=wellspringres,dc=com objectClass=top objectClass=organizationalunit ou=unix

Parameters:
a_attributeList - NamingEnumeration of Attributes