IP*Works!

ipworks
Class Ldap

java.lang.Object
  |
  +--ipworks.Ldap

public class Ldap
extends java.lang.Object

The LDAP control is used to communicate with LDAP Directory Servers using the LDAP (Lightweight Directory Access) protocol.

The LDAP control implements a standard LDAP client as specified in the various LDAP RFCs. Support for both LDAP v2 and v3 is provided.

The first step in using the control is specifying the ServerName , a DN (Distinguished Name) to bind as, and optionally a Password . Then, you can call one or more of the control methods to act upon the server. This is identical to setting the corresponding Action property. Server responses are normally received through the Result event. The only exception are search requests which result in one or more SearchResult events, followed by a final SearchComplete event.

Attributes are set and returned through attribute arrays such as AttrType and AttrValue . Other command arguments are specified through other properties. TThese are specified in detail in each method as well as in the values of the Action properties.

Search filters are defined as strings in the SearchFilter property. The format must be a standard LDAP search string as specified in RFC 1558. Other search attributes are set in properties such as SearchScope , SearchTimeLimit , etc..

The control operates asynchronously. Server responses are retrieved only through events, and the Action property returns control immediately. This also means that you may send more than one request at a time, without waiting for previous requests to complete.


Field Summary
static int amoAdd
           
static int amoDelete
           
static int amoReplace
           
static int fwNone
           
static int fwSOCKS4
           
static int fwSOCKS5
           
static int fwTunnel
           
static int ldapAbandon
           
static int ldapAdd
           
static int ldapBind
           
static int ldapCompare
           
static int ldapDelete
           
static int ldapIdle
           
static int ldapModify
           
static int ldapModifyRDN
           
static int ldapSearch
           
static int ldapUnbind
           
static int sdaAlways
           
static int sdaFindingBaseObject
           
static int sdaInSearching
           
static int sdaNever
           
static int ssBaseObject
           
static int ssSingleLevel
           
static int ssWholeSubtree
           
 
Constructor Summary
Ldap()
           
 
Method Summary
 void abandon()
          Ask the server to abandon a request.
 void add()
          Add an entry to the directory server specified by DN .
 void addLdapEventListener(LdapEventListener l)
           
 void bind()
          Connect and bind to the directory server.
 void compare()
          Compare attributes and values for the entry specified by DN .
 void delete()
          Delete an entry from the directory server specified by DN .
 void fireError(int errorCode, java.lang.String description)
          Information about errors during data delivery.
 void fireResult(int messageId, java.lang.String DN, int resultCode, java.lang.String description)
          Fired for every server response, except search responses.
 void fireSearchComplete(int messageId, java.lang.String DN, int resultCode, java.lang.String description)
          Fired upon completion of a search operation.
 void fireSearchResult(int messageId, java.lang.String DN)
          Fired for every entry returned from a search operation.
 int getAbandonMessageId()
          The message id to abandon (for LDAP abandon requests).
 int getAction()
          An action code for the component.
 int getAttrCount()
          Number of attributes values for the current entry.
 int getAttrModOp(int attrIndex)
          Array of operations to apply on attributes during an LDAP modify operation.
 java.lang.String getAttrType(int attrIndex)
          Array of attribute types for the current entry.
 byte[] getAttrValue(int attrIndex)
          Array of attribute values for the current entry.
 java.lang.String getDN()
          The Distinguished Name used as the base for LDAP operations.
 byte[] getFirewallData()
          Used to send other data to firewall.
 java.lang.String getFirewallHost()
          Name or IP address of firewall (optional).
 java.lang.String getFirewallPassword()
          A password if authentication is to be used connecting through the firewall.
 int getFirewallPort()
          Port of the firewall to connect to.
 int getFirewallType()
          Determines the type of firewall to connect through.
 java.lang.String getFirewallUser()
          A user name if authentication is to be used connecting through a firewall.
 int getLDAPVersion()
          The version of LDAP used.
 java.lang.String getLocalHost()
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 int getMessageId()
          The message id for the next LDAP request.
 java.lang.String getNewRDN()
          The new RDN for the entry.
 java.lang.String getPassword()
          The password used to authenticate to the LDAP server.
 int getResultCode()
          The result code returned in the last server response.
 java.lang.String getResultDescription()
          The descriptive text returned in the last server response (if any).
 java.lang.String getResultDN()
          The Distinguished Name returned in the last server response (if any).
 int getSearchDerefAliases()
          Controls alias dereferencing during searching.
 java.lang.String getSearchFilter()
          A string representation of the LDAP search filter used during searches.
 int getSearchScope()
          Controls the scope of LDAP search operations.
 int getSearchSizeLimit()
          Maximum number of entries that can be returned by the next search operation.
 int getSearchTimeLimit()
          A time limit for the next search operation (in seconds).
 java.lang.String getServerName()
          The name or address of the LDAP server.
 int getServerPort()
          The server port for LDAP (default 389).
 int getTimeout()
          A timeout for the component.
 boolean isAcceptData()
          Enables or disables data reception from the server.
 boolean isConnected()
          Shows whether the component is connected.
 boolean isDeleteOldRDN()
          Controls whether the old RDN should be deleted.
 boolean isSearchReturnValues()
          Controls whether the search operation returns values of attributes, or only types.
 void modify()
          Perform an LDAP 'modify' operation an entry specified by DN .
 void modifyRDN()
          Perform an LDAP 'modify RDN' operation an entry specified by DN .
 void removeLdapEventListener(LdapEventListener l)
           
 void search()
          Search the directory server using the based object specified in DN and the search filter SearchFilter Search the directory server using the based object specified in the DN and the search filter specified in the SearchFilter property.
 void setAbandonMessageId(int abandonMessageId)
          The message id to abandon (for LDAP abandon requests).
 void setAcceptData(boolean acceptData)
          Enables or disables data reception from the server.
 void setAction(int action)
          An action code for the component.
 void setAttrCount(int attrCount)
          Number of attributes values for the current entry.
 void setAttrModOp(int attrIndex, int attrModOp)
          Array of operations to apply on attributes during an LDAP modify operation.
 void setAttrType(int attrIndex, java.lang.String attrType)
          Array of attribute types for the current entry.
 void setAttrValue(int attrIndex, byte[] attrValue)
          Array of attribute values for the current entry.
 void setDeleteOldRDN(boolean deleteOldRDN)
          Controls whether the old RDN should be deleted.
 void setDN(java.lang.String DN)
          The Distinguished Name used as the base for LDAP operations.
 void setFirewallData(byte[] firewallData)
          Used to send other data to firewall.
 void setFirewallHost(java.lang.String firewallHost)
          Name or IP address of firewall (optional).
 void setFirewallPassword(java.lang.String firewallPassword)
          A password if authentication is to be used connecting through the firewall.
 void setFirewallPort(int firewallPort)
          Port of the firewall to connect to.
 void setFirewallType(int firewallType)
          Determines the type of firewall to connect through.
 void setFirewallUser(java.lang.String firewallUser)
          A user name if authentication is to be used connecting through a firewall.
 void setLDAPVersion(int LDAPVersion)
          The version of LDAP used.
 void setLocalHost(java.lang.String localHost)
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 void setMessageId(int messageId)
          The message id for the next LDAP request.
 void setNewRDN(java.lang.String newRDN)
          The new RDN for the entry.
 void setPassword(java.lang.String password)
          The password used to authenticate to the LDAP server.
 void setSearchDerefAliases(int searchDerefAliases)
          Controls alias dereferencing during searching.
 void setSearchFilter(java.lang.String searchFilter)
          A string representation of the LDAP search filter used during searches.
 void setSearchReturnValues(boolean searchReturnValues)
          Controls whether the search operation returns values of attributes, or only types.
 void setSearchScope(int searchScope)
          Controls the scope of LDAP search operations.
 void setSearchSizeLimit(int searchSizeLimit)
          Maximum number of entries that can be returned by the next search operation.
 void setSearchTimeLimit(int searchTimeLimit)
          A time limit for the next search operation (in seconds).
 void setServerName(java.lang.String serverName)
          The name or address of the LDAP server.
 void setServerPort(int serverPort)
          The server port for LDAP (default 389).
 void setTimeout(int timeout)
          A timeout for the component.
 void unbind()
          Unbind from the directory server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ldapIdle

public static final int ldapIdle

ldapBind

public static final int ldapBind

ldapUnbind

public static final int ldapUnbind

ldapSearch

public static final int ldapSearch

ldapModify

public static final int ldapModify

ldapModifyRDN

public static final int ldapModifyRDN

ldapAdd

public static final int ldapAdd

ldapDelete

public static final int ldapDelete

ldapCompare

public static final int ldapCompare

ldapAbandon

public static final int ldapAbandon

amoAdd

public static final int amoAdd

amoDelete

public static final int amoDelete

amoReplace

public static final int amoReplace

fwNone

public static final int fwNone

fwTunnel

public static final int fwTunnel

fwSOCKS4

public static final int fwSOCKS4

fwSOCKS5

public static final int fwSOCKS5

sdaNever

public static final int sdaNever

sdaInSearching

public static final int sdaInSearching

sdaFindingBaseObject

public static final int sdaFindingBaseObject

sdaAlways

public static final int sdaAlways

ssBaseObject

public static final int ssBaseObject

ssSingleLevel

public static final int ssSingleLevel

ssWholeSubtree

public static final int ssWholeSubtree
Constructor Detail

Ldap

public Ldap()
Method Detail

getAbandonMessageId

public int getAbandonMessageId()
The message id to abandon (for LDAP abandon requests). Used when an ldapAbandon operation is initiated via the Action property.


setAbandonMessageId

public void setAbandonMessageId(int abandonMessageId)
                         throws IPWorksException
The message id to abandon (for LDAP abandon requests). Used when an ldapAbandon operation is initiated via the Action property.


isAcceptData

public boolean isAcceptData()
Enables or disables data reception from the server. Setting the property to False, temporarily disables data reception. Setting the property to True, reenables data reception.


setAcceptData

public void setAcceptData(boolean acceptData)
                   throws IPWorksException
Enables or disables data reception from the server. Setting the property to False, temporarily disables data reception. Setting the property to True, reenables data reception.


getAction

public int getAction()
An action code for the component. Setting the Action property to a valid action code makes the control perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

The control operates asynchronously. Every time a value is assigned to the Action property, an LDAP request message is prepared and transmitted to the server. Then control is immediately returned to the caller. The server response (if any) will arrive through one of the control events, and will be marked with the same MessageId used for the request. This also means that multiple LDAP requests may be sent to the server, without waiting for a server response. This is very useful when bulk directory operations are performed.

The following are the possible values for the Action property and the corresponding descriptions:

ldapIdle (0)
Default action. It can also be used to interrupt the current operation.
ldapBind (1)
Connect and bind to the directory server. If the Password property has a value, it is used for authentication. The result of the operation is returned via the Result event.
ldapUnbind (2)
Unbind from the directory server and break the connection.
ldapSearch (3)
Search the directory server using the based object specified in the DN and the search filter specified in the SearchFilter property. Additional search parameters are specified through the SearchScope , SearchDerefAliases , SearchSizeLimit , SearchTimeLimit , and SearchReturnValues properties. Results are returned through zero or more SearchResult events, after which a SearchComplete event is fired.
ldapModify (4)
Perform an LDAP 'modify' operation on the entry specified by DN . The result of the operation is returned via the Result event.
ldapModifyRDN (5)
Perform an LDAP 'modify RDN' operation on the entry specified by DN . The result of the operation is returned via the Result event.
ldapAdd (6)
Add the entry specified by DN to the directory. The result of the operation is returned via the Result event.
ldapDelete (7)
Delete the entry specified by DN from the directory. The result of the operation is returned via the Result event.
ldapCompare (8)
Compare attributes and values specified via the AttrType and AttrValue properties, with the values in the directory for the entry specified by DN . The result of the operation is returned via the Result event.
ldapAbandon (9)
Ask the server to abandon the request specified by MessageId . The result of the operation is returned via the Result event.


setAction

public void setAction(int action)
               throws IPWorksException
An action code for the component. Setting the Action property to a valid action code makes the control perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

The control operates asynchronously. Every time a value is assigned to the Action property, an LDAP request message is prepared and transmitted to the server. Then control is immediately returned to the caller. The server response (if any) will arrive through one of the control events, and will be marked with the same MessageId used for the request. This also means that multiple LDAP requests may be sent to the server, without waiting for a server response. This is very useful when bulk directory operations are performed.

The following are the possible values for the Action property and the corresponding descriptions:

ldapIdle (0)
Default action. It can also be used to interrupt the current operation.
ldapBind (1)
Connect and bind to the directory server. If the Password property has a value, it is used for authentication. The result of the operation is returned via the Result event.
ldapUnbind (2)
Unbind from the directory server and break the connection.
ldapSearch (3)
Search the directory server using the based object specified in the DN and the search filter specified in the SearchFilter property. Additional search parameters are specified through the SearchScope , SearchDerefAliases , SearchSizeLimit , SearchTimeLimit , and SearchReturnValues properties. Results are returned through zero or more SearchResult events, after which a SearchComplete event is fired.
ldapModify (4)
Perform an LDAP 'modify' operation on the entry specified by DN . The result of the operation is returned via the Result event.
ldapModifyRDN (5)
Perform an LDAP 'modify RDN' operation on the entry specified by DN . The result of the operation is returned via the Result event.
ldapAdd (6)
Add the entry specified by DN to the directory. The result of the operation is returned via the Result event.
ldapDelete (7)
Delete the entry specified by DN from the directory. The result of the operation is returned via the Result event.
ldapCompare (8)
Compare attributes and values specified via the AttrType and AttrValue properties, with the values in the directory for the entry specified by DN . The result of the operation is returned via the Result event.
ldapAbandon (9)
Ask the server to abandon the request specified by MessageId . The result of the operation is returned via the Result event.


getAttrCount

public int getAttrCount()
Number of attributes values for the current entry. Setting AttrCount to 0 clears the AttrType and AttrValue arrays.


setAttrCount

public void setAttrCount(int attrCount)
                  throws IPWorksException
Number of attributes values for the current entry. Setting AttrCount to 0 clears the AttrType and AttrValue arrays.


getAttrModOp

public int getAttrModOp(int attrIndex)
                 throws IPWorksException
Array of operations to apply on attributes during an LDAP modify operation. Possible values include:
amoAdd (0)
Add attribute.
amoDelete (1)
Delete attribute.
amoReplace (2)
Replace attribute.
The indexes start at 0 and end at AttrCount - 1.


setAttrModOp

public void setAttrModOp(int attrIndex,
                         int attrModOp)
                  throws IPWorksException
Array of operations to apply on attributes during an LDAP modify operation. Possible values include:
amoAdd (0)
Add attribute.
amoDelete (1)
Delete attribute.
amoReplace (2)
Replace attribute.
The indexes start at 0 and end at AttrCount - 1.


getAttrType

public java.lang.String getAttrType(int attrIndex)
                             throws IPWorksException
Array of attribute types for the current entry. If the value of AttrType for a particular array index is an empty string, then the corresponding value is part of a set of values, and the attribute type for the set is specified in the nearest AttrType with a lower index that has a value other than an empty string.

The number of valid members in the array is specified by AttrCount .

The indexes start at 0 and end at AttrCount - 1.


setAttrType

public void setAttrType(int attrIndex,
                        java.lang.String attrType)
                 throws IPWorksException
Array of attribute types for the current entry. If the value of AttrType for a particular array index is an empty string, then the corresponding value is part of a set of values, and the attribute type for the set is specified in the nearest AttrType with a lower index that has a value other than an empty string.

The number of valid members in the array is specified by AttrCount .

The indexes start at 0 and end at AttrCount - 1.


getAttrValue

public byte[] getAttrValue(int attrIndex)
                    throws IPWorksException
Array of attribute values for the current entry. If the value is part of a set of values, the corresponding AttrType is an empty string, and the attribute type for the set is specified in the nearest AttrType with a lower index that has a value other than an empty string.

The number of valid members in the array is specified by AttrCount .

The indexes start at 0 and end at AttrCount - 1.


setAttrValue

public void setAttrValue(int attrIndex,
                         byte[] attrValue)
                  throws IPWorksException
Array of attribute values for the current entry. If the value is part of a set of values, the corresponding AttrType is an empty string, and the attribute type for the set is specified in the nearest AttrType with a lower index that has a value other than an empty string.

The number of valid members in the array is specified by AttrCount .

The indexes start at 0 and end at AttrCount - 1.


isConnected

public boolean isConnected()
Shows whether the component is connected. Use this property to determine whether the control is connected to the remote host or not.


isDeleteOldRDN

public boolean isDeleteOldRDN()
Controls whether the old RDN should be deleted. Used when an ldapModify operation is initiated via the Action property.


setDeleteOldRDN

public void setDeleteOldRDN(boolean deleteOldRDN)
                     throws IPWorksException
Controls whether the old RDN should be deleted. Used when an ldapModify operation is initiated via the Action property.


getDN

public java.lang.String getDN()
The Distinguished Name used as the base for LDAP operations. Also the base object during LDAP searches.

The Distinguished Name is provided in string format as specified by RFC 1779.


setDN

public void setDN(java.lang.String DN)
           throws IPWorksException
The Distinguished Name used as the base for LDAP operations. Also the base object during LDAP searches.

The Distinguished Name is provided in string format as specified by RFC 1779.


getFirewallData

public byte[] getFirewallData()
Used to send other data to firewall. When the firewall is a tunneling proxy, use this property to to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).


setFirewallData

public void setFirewallData(byte[] firewallData)
                     throws IPWorksException
Used to send other data to firewall. When the firewall is a tunneling proxy, use this property to to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).


getFirewallHost

public java.lang.String getFirewallHost()
Name or IP address of firewall (optional). If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.

If the FirewallHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the FirewallHost property is set to the corresponding address. If the search is not successful, an error is returned.


setFirewallHost

public void setFirewallHost(java.lang.String firewallHost)
                     throws IPWorksException
Name or IP address of firewall (optional). If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.

If the FirewallHost property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the FirewallHost property is set to the corresponding address. If the search is not successful, an error is returned.


getFirewallPassword

public java.lang.String getFirewallPassword()
A password if authentication is to be used connecting through the firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


setFirewallPassword

public void setFirewallPassword(java.lang.String firewallPassword)
                         throws IPWorksException
A password if authentication is to be used connecting through the firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


getFirewallPort

public int getFirewallPort()
Port of the firewall to connect to. The TCP port for the FirewallHost . See the description of the FirewallHost property for details.

Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.


setFirewallPort

public void setFirewallPort(int firewallPort)
                     throws IPWorksException
Port of the firewall to connect to. The TCP port for the FirewallHost . See the description of the FirewallHost property for details.

Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.


getFirewallType

public int getFirewallType()
Determines the type of firewall to connect through. The applicable values are the following:
fwNone (0)
No firewall (default setting).
fwTunnel (1)
Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.


setFirewallType

public void setFirewallType(int firewallType)
                     throws IPWorksException
Determines the type of firewall to connect through. The applicable values are the following:
fwNone (0)
No firewall (default setting).
fwTunnel (1)
Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.


getFirewallUser

public java.lang.String getFirewallUser()
A user name if authentication is to be used connecting through a firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


setFirewallUser

public void setFirewallUser(java.lang.String firewallUser)
                     throws IPWorksException
A user name if authentication is to be used connecting through a firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


getLDAPVersion

public int getLDAPVersion()
The version of LDAP used. The default value is 2 (for LDAPv2).


setLDAPVersion

public void setLDAPVersion(int LDAPVersion)
                    throws IPWorksException
The version of LDAP used. The default value is 2 (for LDAPv2).


getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.

If the control is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.

If the control is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


getMessageId

public int getMessageId()
The message id for the next LDAP request. If a custom value is needed for MessageId , the property must be set before setting Action . The control increments MessageId automatically after each request.


setMessageId

public void setMessageId(int messageId)
                  throws IPWorksException
The message id for the next LDAP request. If a custom value is needed for MessageId , the property must be set before setting Action . The control increments MessageId automatically after each request.


getNewRDN

public java.lang.String getNewRDN()
The new RDN for the entry. Used when an ldapModify operation is initiated via the Action property.

The Distinguished Name is provided in string format as specified by RFC 1779.


setNewRDN

public void setNewRDN(java.lang.String newRDN)
               throws IPWorksException
The new RDN for the entry. Used when an ldapModify operation is initiated via the Action property.

The Distinguished Name is provided in string format as specified by RFC 1779.


getPassword

public java.lang.String getPassword()
The password used to authenticate to the LDAP server. Leave this value empty if no password is required.


setPassword

public void setPassword(java.lang.String password)
                 throws IPWorksException
The password used to authenticate to the LDAP server. Leave this value empty if no password is required.


getResultCode

public int getResultCode()
The result code returned in the last server response. This is identical to the corresponding parameter provided by the last Result , SearchResult , or SearchComplete event.


getResultDescription

public java.lang.String getResultDescription()
The descriptive text returned in the last server response (if any). This is identical to the corresponding parameter provided by the last Result , SearchResult , or SearchComplete event.


getResultDN

public java.lang.String getResultDN()
The Distinguished Name returned in the last server response (if any). This is identical to the corresponding parameter provided by the last Result , SearchResult , or SearchComplete event.


getSearchDerefAliases

public int getSearchDerefAliases()
Controls alias dereferencing during searching. Possible values are:
sdaNever (0)
Do not dereference aliases in searching or in locating the base object of the search.
sdaInSearching (1)
Dereference aliases in subordinates of the base object in searching, but not in locating the base object of the search.
sdaFindingBaseObject (2)
Dereference aliases in locating the base object of the search, but not when searching subordinates of the base object.
sdaAlways (3)
Dereference aliases both in searching and in locating the base object of the search.

Default is to never dereference aliases.


setSearchDerefAliases

public void setSearchDerefAliases(int searchDerefAliases)
                           throws IPWorksException
Controls alias dereferencing during searching. Possible values are:
sdaNever (0)
Do not dereference aliases in searching or in locating the base object of the search.
sdaInSearching (1)
Dereference aliases in subordinates of the base object in searching, but not in locating the base object of the search.
sdaFindingBaseObject (2)
Dereference aliases in locating the base object of the search, but not when searching subordinates of the base object.
sdaAlways (3)
Dereference aliases both in searching and in locating the base object of the search.

Default is to never dereference aliases.


getSearchFilter

public java.lang.String getSearchFilter()
A string representation of the LDAP search filter used during searches. The format of the search filters is specified by RFC 1558 and is identical to the format used by most LDAP applications.

The following are examples of search filters, as provided in the RFC:

(cn=Babs Jensen) (!(cn=Tim Howes)) (&(objectClass=Person)(|(sn=Jensen)(cn=Babs J*))) (o=univ*of*mich*)

The complete specification is given by the following BNF:

::= "(" ")" ::= | | | ::= "&" ::= "|" ::= "!" ::= | ::= | | ::= ::= | | | ::= "=" ::= "~=" ::= ">=" ::= "<=" ::= "=*" ::= "=" ::= NULL | ::= "*" ::= NULL | "*" ::= NULL |

is a string representing an attribute type as defined in RFC 1777. is a string representing an attribute value, or part of one, and has the form defined in RFC 1779. If a must contain one of the characters '*' or '(' or ')', these characters should be escaped by preceding them with the backslash '\\' character.


setSearchFilter

public void setSearchFilter(java.lang.String searchFilter)
                     throws IPWorksException
A string representation of the LDAP search filter used during searches. The format of the search filters is specified by RFC 1558 and is identical to the format used by most LDAP applications.

The following are examples of search filters, as provided in the RFC:

(cn=Babs Jensen) (!(cn=Tim Howes)) (&(objectClass=Person)(|(sn=Jensen)(cn=Babs J*))) (o=univ*of*mich*)

The complete specification is given by the following BNF:

::= "(" ")" ::= | | | ::= "&" ::= "|" ::= "!" ::= | ::= | | ::= ::= | | | ::= "=" ::= "~=" ::= ">=" ::= "<=" ::= "=*" ::= "=" ::= NULL | ::= "*" ::= NULL | "*" ::= NULL |

is a string representing an attribute type as defined in RFC 1777. is a string representing an attribute value, or part of one, and has the form defined in RFC 1779. If a must contain one of the characters '*' or '(' or ')', these characters should be escaped by preceding them with the backslash '\\' character.


isSearchReturnValues

public boolean isSearchReturnValues()
Controls whether the search operation returns values of attributes, or only types. If only attributes are need, disabling returning of values will enhance performance.


setSearchReturnValues

public void setSearchReturnValues(boolean searchReturnValues)
                           throws IPWorksException
Controls whether the search operation returns values of attributes, or only types. If only attributes are need, disabling returning of values will enhance performance.


getSearchScope

public int getSearchScope()
Controls the scope of LDAP search operations. Possible values are:
ssBaseObject (0)
Search only the base object.
ssSingleLevel (1)
Search only one level.
ssWholeSubtree (2)
Search the whole subtree.

Default is to search the whole subtree.


setSearchScope

public void setSearchScope(int searchScope)
                    throws IPWorksException
Controls the scope of LDAP search operations. Possible values are:
ssBaseObject (0)
Search only the base object.
ssSingleLevel (1)
Search only one level.
ssWholeSubtree (2)
Search the whole subtree.

Default is to search the whole subtree.


getSearchSizeLimit

public int getSearchSizeLimit()
Maximum number of entries that can be returned by the next search operation. This limit is provided as a hint to the directory server. A value of 0 means that no size limits are in effect for the search.


setSearchSizeLimit

public void setSearchSizeLimit(int searchSizeLimit)
                        throws IPWorksException
Maximum number of entries that can be returned by the next search operation. This limit is provided as a hint to the directory server. A value of 0 means that no size limits are in effect for the search.


getSearchTimeLimit

public int getSearchTimeLimit()
A time limit for the next search operation (in seconds). This limit is provided as a hint to the directory server. A value of 0 means that no time limits are in effect for the search.


setSearchTimeLimit

public void setSearchTimeLimit(int searchTimeLimit)
                        throws IPWorksException
A time limit for the next search operation (in seconds). This limit is provided as a hint to the directory server. A value of 0 means that no time limits are in effect for the search.


getServerName

public java.lang.String getServerName()
The name or address of the LDAP server. The ServerName property specifies the IP address (IP number in dotted internet format) or Domain Name of the directory server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the ServerName property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the ServerName property is set to the corresponding address. If the search is not successful, an error is returned.


setServerName

public void setServerName(java.lang.String serverName)
                   throws IPWorksException
The name or address of the LDAP server. The ServerName property specifies the IP address (IP number in dotted internet format) or Domain Name of the directory server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the ServerName property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the ServerName property is set to the corresponding address. If the search is not successful, an error is returned.


getServerPort

public int getServerPort()
The server port for LDAP (default 389). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed while a connection is in progress. Any attempt to change the ServerPort while connected will fail with an error.


setServerPort

public void setServerPort(int serverPort)
                   throws IPWorksException
The server port for LDAP (default 389). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed while a connection is in progress. Any attempt to change the ServerPort while connected will fail with an error.


getTimeout

public int getTimeout()
A timeout for the component. If the Timeout property is set to 0 (default value), all operations return immediately, potentially failing with an 'WOULDBLOCK' error if they can't be completed..

If Timeout is set to a positive value, the control will automatically retry each operation that would otherwise result in a 'WOULDBLOCK' error for a maximum of Timeout seconds.

The control will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If the Timeout expires, and the operation is not yet complete, a Timeout error is fired.


setTimeout

public void setTimeout(int timeout)
                throws IPWorksException
A timeout for the component. If the Timeout property is set to 0 (default value), all operations return immediately, potentially failing with an 'WOULDBLOCK' error if they can't be completed..

If Timeout is set to a positive value, the control will automatically retry each operation that would otherwise result in a 'WOULDBLOCK' error for a maximum of Timeout seconds.

The control will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If the Timeout expires, and the operation is not yet complete, a Timeout error is fired.


fireError

public void fireError(int errorCode,
                      java.lang.String description)
Information about errors during data delivery. (Called internally to dispatch the event.)
See Also:
LdapErrorEvent

fireResult

public void fireResult(int messageId,
                       java.lang.String DN,
                       int resultCode,
                       java.lang.String description)
Fired for every server response, except search responses. (Called internally to dispatch the event.)
See Also:
LdapResultEvent

fireSearchComplete

public void fireSearchComplete(int messageId,
                               java.lang.String DN,
                               int resultCode,
                               java.lang.String description)
Fired upon completion of a search operation. (Called internally to dispatch the event.)
See Also:
LdapSearchCompleteEvent

fireSearchResult

public void fireSearchResult(int messageId,
                             java.lang.String DN)
Fired for every entry returned from a search operation. (Called internally to dispatch the event.)
See Also:
LdapSearchResultEvent

abandon

public void abandon()
             throws IPWorksException
Ask the server to abandon a request. Ask the server to abandon the request specified by MessageId . The result of the operation is returned via the Result event.

Calling this method is equivalent to setting the Action property to ldapAbandon .


add

public void add()
         throws IPWorksException
Add an entry to the directory server specified by DN . Add the entry specified by DN to the directory. The result of the operation is returned via the Result event.

Calling this method is equivalent to setting the Action property to ldapAdd .


bind

public void bind()
          throws IPWorksException
Connect and bind to the directory server. Connect and bind to the directory server. If the Password property has a value, it is used for authentication. The result of the operation is returned via the Result event.

Calling this method is equivalent to setting the Action property to ldapBind .


compare

public void compare()
             throws IPWorksException
Compare attributes and values for the entry specified by DN . Compare attributes and values specified via the AttrType and AttrValue properties, with the values in the directory for the entry specified by DN . The result of the operation is returned via the Result event.

Calling this method is equivalent to setting the Action property to ldapCompare .


delete

public void delete()
            throws IPWorksException
Delete an entry from the directory server specified by DN . Delete the entry specified by DN from the directory. The result of the operation is returned via the Result event.

Calling this method is equivalent to setting the Action property to ldapDelete .


modify

public void modify()
            throws IPWorksException
Perform an LDAP 'modify' operation an entry specified by DN . Perform an LDAP 'modify' operation on the entry specified by DN . The result of the operation is returned via the Result event.

Calling this method is equivalent to setting the Action property to ldapModify .


modifyRDN

public void modifyRDN()
               throws IPWorksException
Perform an LDAP 'modify RDN' operation an entry specified by DN . Perform an LDAP 'modify RDN' operation on the entry specified by DN . The result of the operation is returned via the Result event.

Calling this method is equivalent to setting the Action property to ldapModifyRDN .


search

public void search()
            throws IPWorksException
Search the directory server using the based object specified in DN and the search filter SearchFilter Search the directory server using the based object specified in the DN and the search filter specified in the SearchFilter property. Additional search parameters are specified through the SearchScope , SearchDerefAliases , SearchSizeLimit , SearchTimeLimit , and SearchReturnValues properties. Results are returned through zero or more SearchResult events, after which a SearchComplete event is fired.

Calling this method is equivalent to setting the Action property to ldapSearch .


unbind

public void unbind()
            throws IPWorksException
Unbind from the directory server. Unbind from the directory server and break the connection.

Calling this method is equivalent to setting the Action property to ldapUnbind .


addLdapEventListener

public void addLdapEventListener(LdapEventListener l)
                          throws java.util.TooManyListenersException

removeLdapEventListener

public void removeLdapEventListener(LdapEventListener l)

IP*Works!

Copyright (c) 2001 /n software inc. - All rights reserved.