|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ipworks.Ldap
The LDAP class is used to communicate with LDAP Directory Servers using the LDAP (Lightweight Directory Access) protocol.
The LDAP class implements a standard LDAP client as specified in RFC 1777, RFC 1778, and RFC 1779.
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 specify one or more actions for the server via the 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. These are specified in detail in the Action property section.
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 |
a_Abandon
|
static int |
a_Add
|
static int |
a_Bind
|
static int |
a_Compare
|
static int |
a_Delete
|
static int |
a_Idle
|
static int |
a_Modify
|
static int |
a_ModifyRDN
|
static int |
a_Search
|
static int |
a_Unbind
|
static int |
amo_Add
|
static int |
amo_Delete
|
static int |
amo_Replace
|
static int |
sda_Always
|
static int |
sda_FindingBaseObject
|
static int |
sda_InSearching
|
static int |
sda_Never
|
static int |
ss_BaseObject
|
static int |
ss_SingleLevel
|
static int |
ss_WholeSubtree
|
Constructor Summary | |
Ldap()
|
Method Summary | |
void |
addLdapEventListener(LdapEventListener l)
|
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. |
java.lang.String |
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. |
java.lang.String |
getLocalHost()
The name of the local host. |
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). |
boolean |
isAcceptData()
Enables or disables data reception. |
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 |
removeLdapEventListener(LdapEventListener l)
|
void |
setAbandonMessageId(int abandonMessageId)
The message id to abandon (for LDAP abandon requests). |
void |
setAcceptData(boolean acceptData)
Enables or disables data reception. |
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,
java.lang.String 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 |
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). |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int a_Idle
public static final int a_Bind
public static final int a_Unbind
public static final int a_Search
public static final int a_Modify
public static final int a_ModifyRDN
public static final int a_Add
public static final int a_Delete
public static final int a_Compare
public static final int a_Abandon
public static final int amo_Add
public static final int amo_Delete
public static final int amo_Replace
public static final int sda_Never
public static final int sda_InSearching
public static final int sda_FindingBaseObject
public static final int sda_Always
public static final int ss_BaseObject
public static final int ss_SingleLevel
public static final int ss_WholeSubtree
Constructor Detail |
public Ldap()
Method Detail |
public int getAbandonMessageId()
public void setAbandonMessageId(int abandonMessageId) throws IPWorksException
public boolean isAcceptData()
public void setAcceptData(boolean acceptData) throws IPWorksException
public int getAction()
The class 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 class 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:
public void setAction(int action) throws IPWorksException
The class 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 class 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:
public int getAttrCount()
public void setAttrCount(int attrCount) throws IPWorksException
public int getAttrModOp(int attrIndex) throws IPWorksException
public void setAttrModOp(int attrIndex, int attrModOp) throws IPWorksException
public java.lang.String getAttrType(int attrIndex) throws IPWorksException
The number of valid members in the array is specified by AttrCount .
public void setAttrType(int attrIndex, java.lang.String attrType) throws IPWorksException
The number of valid members in the array is specified by AttrCount .
public java.lang.String getAttrValue(int attrIndex) throws IPWorksException
The number of valid members in the array is specified by AttrCount .
public void setAttrValue(int attrIndex, java.lang.String attrValue) throws IPWorksException
The number of valid members in the array is specified by AttrCount .
public java.lang.String getDN()
The Distinguished Name is provided in string format as specified by RFC 1779.
public void setDN(java.lang.String DN) throws IPWorksException
The Distinguished Name is provided in string format as specified by RFC 1779.
public boolean isDeleteOldRDN()
public void setDeleteOldRDN(boolean deleteOldRDN) throws IPWorksException
public int getMessageId()
public void setMessageId(int messageId) throws IPWorksException
public java.lang.String getNewRDN()
The Distinguished Name is provided in string format as specified by RFC 1779.
public void setNewRDN(java.lang.String newRDN) throws IPWorksException
The Distinguished Name is provided in string format as specified by RFC 1779.
public java.lang.String getPassword()
public void setPassword(java.lang.String password) throws IPWorksException
public int getResultCode()
public java.lang.String getResultDescription()
public java.lang.String getResultDN()
public int getSearchDerefAliases()
Default is to never dereference aliases.
public void setSearchDerefAliases(int searchDerefAliases) throws IPWorksException
Default is to never dereference aliases.
public java.lang.String getSearchFilter()
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:
<filter> ::= "(" <filtercomp> ")"
<filtercomp> ::= <and> | <or> | <not> | <item>
<and> ::= "&" <filterlist>
<or> ::= "|" <filterlist>
<not> ::= "!" <filter>
<filterlist> ::= <filter> | <filter> <filterlist>
<item> ::= <simple> | <present> | <substring>
<simple> ::= <attr> <filtertype> <value>
<filtertype> ::= <equal> | <approx> | <greater> | <less>
<equal> ::= "="
<approx> ::= "~="
<greater> ::= ">="
<less> ::= "<="
<present> ::= <attr> "=*"
<substring> ::= <attr> "=" <initial> <any> <final>
<initial> ::= NULL | <value>
<any> ::= "*" <starval>
<starval> ::= NULL | <value> "*" <starval>
<final> ::= NULL | <value>
<attr> is a string representing an attribute type as defined in RFC 1777. <value> is a string representing an attribute value, or part of one, and has the form defined in RFC 1779. If a <value> must contain one of the characters '*' or '(' or ')', these characters should be escaped by preceding them with the backslash '\\' character.
public void setSearchFilter(java.lang.String searchFilter) throws IPWorksException
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:
<filter> ::= "(" <filtercomp> ")"
<filtercomp> ::= <and> | <or> | <not> | <item>
<and> ::= "&" <filterlist>
<or> ::= "|" <filterlist>
<not> ::= "!" <filter>
<filterlist> ::= <filter> | <filter> <filterlist>
<item> ::= <simple> | <present> | <substring>
<simple> ::= <attr> <filtertype> <value>
<filtertype> ::= <equal> | <approx> | <greater> | <less>
<equal> ::= "="
<approx> ::= "~="
<greater> ::= ">="
<less> ::= "<="
<present> ::= <attr> "=*"
<substring> ::= <attr> "=" <initial> <any> <final>
<initial> ::= NULL | <value>
<any> ::= "*" <starval>
<starval> ::= NULL | <value> "*" <starval>
<final> ::= NULL | <value>
<attr> is a string representing an attribute type as defined in RFC 1777. <value> is a string representing an attribute value, or part of one, and has the form defined in RFC 1779. If a <value> must contain one of the characters '*' or '(' or ')', these characters should be escaped by preceding them with the backslash '\\' character.
public boolean isSearchReturnValues()
public void setSearchReturnValues(boolean searchReturnValues) throws IPWorksException
public int getSearchScope()
Default is to search the whole subtree.
public void setSearchScope(int searchScope) throws IPWorksException
Default is to search the whole subtree.
public int getSearchSizeLimit()
public void setSearchSizeLimit(int searchSizeLimit) throws IPWorksException
public int getSearchTimeLimit()
public void setSearchTimeLimit(int searchTimeLimit) throws IPWorksException
public java.lang.String getServerName()
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.
public void setServerName(java.lang.String serverName) throws IPWorksException
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.
public int getServerPort()
public void setServerPort(int serverPort) throws IPWorksException
public java.lang.String getLocalHost()
If the class 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).
public void fireError(int errorCode, java.lang.String description)
LdapErrorEvent
public void fireResult(int messageId, java.lang.String DN, int resultCode, java.lang.String description)
LdapResultEvent
public void fireSearchComplete(int messageId, java.lang.String DN, int resultCode, java.lang.String description)
LdapSearchCompleteEvent
public void fireSearchResult(int messageId, java.lang.String DN)
LdapSearchResultEvent
public void addLdapEventListener(LdapEventListener l) throws java.util.TooManyListenersException
public void removeLdapEventListener(LdapEventListener l)
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |