Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.cisco.ipphone.sdk
Class LDAPProvider

    java.lang.Object
      com.cisco.ipphone.sdk.LDAPProvider

All Implemented Interfaces:
  LDAPProviderIF

    public class LDAPProvider

extends java.lang.Object
implements LDAPProviderIF

The `LDAPProvider` implements the `LDAPProviderIF` and provides a simple Java "wrapper" around a generic LDAP directory. This class handles the formatting and communication of LDAP query commands and provides basic LDAP attribute parsing.

See Also:
  `LDAPProviderIF`

Constructor Summary
`LDAPProvider(java.lang.String ldapServer, java.lang.String ldapUserId, java.lang.String ldapPassword, int ldapPort, java.lang.String rootDn)` This is the only constructor provided for the `LDAPProvider` class and all parameters must be supplied.

Method Summary
`java.lang.String[]` | `getAttributeNames(int index)`
`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.
`static void` | `main(java.lang.String[] args)` This main() method is for testing purposes only.
`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)` This method performs an LDAP query based on the specified parameters and returns the result as a Vector of HashMaps.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LDAPProvider

    public LDAPProvider(java.lang.String ldapServer,
                        java.lang.String ldapUserId,
                        java.lang.String ldapPassword,
                        int ldapPort,
                        java.lang.String rootDn)

  This is the only constructor provided for the `LDAPProvider` class and all parameters must be supplied. The parameters can be modified after instantiation, if needed, by direct access to the public attributes.

  Parameters:
    `ldapServer` - The IP address or hostname of the LDAP server to be queried
    `ldapUserId` - The UserId used to authenticate to the LDAP server
    `ldapPassword` - The password of the above UserId
    `ldapPort` - The TCP port number used by the LDAP server (Example: 8404 for CallManager's integrated LDAP directory)

Method Detail

### getAttributeValue

    public 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`.

  Specified by:
    `getAttributeValue` in interface `LDAPProviderIF`
  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

    public 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`.

  Specified by:
    `getAttributeValues` in interface `LDAPProviderIF`
  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.

### getAttributeNames

    public java.lang.String[] getAttributeNames(int index)

### sendRequest

    public 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 `LDAPProvider` object for subsequent `getAttributeValue` requests - those methods provide a simple method of extracting attribute values without the need to parse the Vector of HashMaps returned by this method.

  Specified by:
    `sendRequest` in interface `LDAPProviderIF`
  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

    public java.util.Vector sendRequest(java.lang.String searchBase,
                                        java.lang.String filter,
                                        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 `LDAPProvider` object for subsequent `getAttributeValue` requests - those methods provide a simple method of extracting attribute values without the need to parse the Vector of HashMaps returned by this method.

  Specified by:
    `sendRequest` in interface `LDAPProviderIF`
  Parameters:
    `searchBase` - The LDAP Search Base to be used for this search (Example: ou=Users)
    `filter` - An LDAP filter String containing attributes to match. For example: (sn=Stearns*)
    `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`

### main

    public static void main(java.lang.String[] args)

  This main() method is for testing purposes only. It provides a simple mechanism for setting up and debugging LDAP server connections. The arguments must be: LDAPServer UserID Password LDAPPort RootDN SearchBase [repeatCount] [repeatInterval]

  Parameters:
    `args` - String[]

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD