com.cisco.ipphone.sdk
Interface LDAPProviderIF

All Known Implementing Classes:
LDAPProvider

public interface LDAPProviderIF

The LDAPProviderIF interface defines a simple Java "wrapper" interface into an LDAP directory. Any class implementing the LDAPProviderIF interface is expected to take care of formatting and communication of LDAP query commands along with basic LDAP attribute parsing. The LDAPProvider class included in this SDK is an implementation of the LDAPProviderIF interface.

See Also:
LDAPProvider

Method Summary
 java.lang.String getAttributeValue(java.lang.String attrName)
          This method searches the previous LDAP sendReqest result looking for the first child node with the specified LDAP attribute and returns the value (the first value if multiple values exist) of that attribute.
 java.lang.String[] getAttributeValues(java.lang.String attrName)
          This method searches the previous LDAP sendReqest result looking for the first child node with the specified LDAP attribute and returns the values of that attribute.
 java.util.Vector sendRequest(java.lang.String searchBase, java.util.HashMap matchRules, boolean ignoreCase, java.lang.String[] returnAttrs)
          This method performs an LDAP query based on the specified parameters and returns the result as a Vector of HashMaps.
 java.util.Vector sendRequest(java.lang.String searchBase, java.lang.String filter, boolean ignoreCase, java.lang.String[] returnAttrs)
           
 

Method Detail

getAttributeValue

java.lang.String getAttributeValue(java.lang.String attrName)
This method searches the previous LDAP sendReqest result looking for the first child node with the specified LDAP attribute and returns the value (the first value if multiple values exist) of that attribute. The sendReqest MUST always be called first to populate the search result - otherwise this method will always return null.

Parameters:
attrName - The String name of the desired attribute (Example: telephoneNumber);
Returns:
String containing the value of the requested attribute. If multiple values exist, only the first value will be returned. If the specified attribute cannot be found or does not contain a value, null will be returned.

getAttributeValues

java.lang.String[] getAttributeValues(java.lang.String attrName)
This method searches the previous LDAP sendReqest result looking for the first child node with the specified LDAP attribute and returns the values of that attribute. The sendReqest MUST always be called first to populate the search result - otherwise this method will always return null.

Parameters:
attrName - The String name of the desired attribute (Example: ciscoCCNatControlDevices);
Returns:
An array of Strings containing the values of the requested attribute. If the specified attribute cannot be found or does not contain any values, null will be returned.

sendRequest

java.util.Vector sendRequest(java.lang.String searchBase,
                             java.util.HashMap matchRules,
                             boolean ignoreCase,
                             java.lang.String[] returnAttrs)
This method performs an LDAP query based on the specified parameters and returns the result as a Vector of HashMaps. This may seem a bit strange, but it is actually much easier to use and parse than a standard LDAP tree object. The result of the last search is also cached in the LDAPProviderIF object for subsequent getAttributeValue requests - these methods provide a simple method of extracting attribute values without the need to parse the Vector of HashMaps returned by this method. The implementing LDAPProviderIF class must be fully initialized prior to calling this method, but the initialization is not specified by the interface and is implementation-specific.

Parameters:
searchBase - The LDAP Search Base to be used for this search (Example: ou=Users)
matchRules - A HashMap containing attribute String names (the HashMap keys) and their String values. These filters limit the search results to only those nodes which match the specified criteria. A value of null will specify that no filtering is applied. (Example: sn=Stearns, givenName=Kelly)
ignoreCase - boolean value indicating whether or not the search should be case-sensitive. If true, the search ignores case.
returnAttrs - an Array of Strings indicating which attributes should be returned in the result. A value of null will specify ALL attributes. (Example: sn, givenName, telephoneNumber)
Returns:
returns a Vector of HashMaps where the HashMaps represent the matching nodes of the LDAP search. Each HashMap entry has the attribute names as the keys (for example, givenName) and a Vector as the value - these Vectors, in turn, contain the attribute's String values. See the User class in this SDK for an example of how to extract information from this result.
See Also:
User

sendRequest

java.util.Vector sendRequest(java.lang.String searchBase,
                             java.lang.String filter,
                             boolean ignoreCase,
                             java.lang.String[] returnAttrs)