org.apache.jmeter.protocol.ldap.sampler

## Class LdapExtClient

- java.lang.Object
- - org.apache.jmeter.protocol.ldap.sampler.LdapExtClient

-     public class LdapExtClient
      extends java.lang.Object

  Ldap Client class is main class to create ,modify, search and delete all the LDAP functionality available author Dolf Smits(Dolf.Smits@Siemens.com) created Aug 09 2003 11:00 AM company Siemens Netherlands N.V.. Based on the work of: author T.Elanjchezhiyan(chezhiyan@siptech.co.in)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LdapExtClient()` Constructor for the LdapClient object

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>` | `compare(javax.naming.directory.DirContext dirContext, java.lang.String filter, java.lang.String entrydn)` Filter the data in the ldap directory
    `static javax.naming.directory.DirContext` | `connect(java.lang.String host, java.lang.String port, java.lang.String rootdn, java.lang.String username, java.lang.String password, java.lang.String connTimeOut, boolean secure)` connect to server
    `static javax.naming.directory.DirContext` | `createTest(javax.naming.directory.DirContext dirContext, javax.naming.directory.Attributes attributes, java.lang.String string)` Create the entry in the ldap directory for the given string
    `static void` | `deleteTest(javax.naming.directory.DirContext dirContext, java.lang.String string)` Delete the attribute from the ldap directory
    `static void` | `disconnect(javax.naming.directory.DirContext dirContext)` disconnect from the server
    `static void` | `moddnOp(javax.naming.directory.DirContext dirContext, java.lang.String ddn, java.lang.String newdn)` ModDN the data in the ldap directory for the given search base
    `static void` | `modifyTest(javax.naming.directory.DirContext dirContext, javax.naming.directory.ModificationItem[] mods, java.lang.String string)` Modify the attribute in the ldap directory for the given string
    `static javax.naming.NamingEnumeration<javax.naming.directory.SearchResult>` | `searchTest(javax.naming.directory.DirContext dirContext, java.lang.String searchBase, java.lang.String searchFilter, int scope, long countlim, int timelim, java.lang.String[] attrs, boolean retobj, boolean deref)` Filter the data in the ldap directory for the given search base

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LdapExtClient

          public LdapExtClient()

      Constructor for the LdapClient object

  - ### Method Detail

    - #### connect

          public static javax.naming.directory.DirContext connect(java.lang.String host,
                                                                  java.lang.String port,
                                                                  java.lang.String rootdn,
                                                                  java.lang.String username,
                                                                  java.lang.String password,
                                                                  java.lang.String connTimeOut,
                                                                  boolean secure)
                                                           throws javax.naming.NamingException

      connect to server
      Parameters:
        `host` - name of the server to connect
        `port` - port of the server to connect
        `rootdn` - base of the tree to operate on
        `username` - name of the user to use for binding
        `password` - password to use for binding
        `connTimeOut` - connection timeout for connecting the server see "com.sun.jndi.ldap.connect.timeout"
        `secure` - flag whether ssl should be used
      Returns:
        newly created `DirContext`
      Throws:
        `javax.naming.NamingException` - when creating the `DirContext` fails

    - #### disconnect

          public static void disconnect(javax.naming.directory.DirContext dirContext)

      disconnect from the server
      Parameters:
        `dirContext` - context do disconnect (may be `null`)

    - #### searchTest

          public static javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> searchTest(javax.naming.directory.DirContext dirContext,
                                                                                                       java.lang.String searchBase,
                                                                                                       java.lang.String searchFilter,
                                                                                                       int scope,
                                                                                                       long countlim,
                                                                                                       int timelim,
                                                                                                       java.lang.String[] attrs,
                                                                                                       boolean retobj,
                                                                                                       boolean deref)
                                                                                                throws javax.naming.NamingException

      Filter the data in the ldap directory for the given search base
      Parameters:
        `dirContext` - context to perform the search on
        `searchBase` - base where the search should start
        `searchFilter` - filter this value from the base
        `scope` - scope for search. May be one of `SearchControls.OBJECT_SCOPE`, `SearchControls.ONELEVEL_SCOPE` or `SearchControls.SUBTREE_SCOPE`
        `countlim` - max number of results to get, `0` for all entries
        `timelim` - max time to wait for entries (in milliseconds), `0` for unlimited time
        `attrs` - list of attributes to return. If `null` all attributes will be returned. If empty, none will be returned
        `retobj` - flag whether the objects should be returned
        `deref` - flag whether objects should be dereferenced
      Returns:
        result of the search
      Throws:
        `javax.naming.NamingException` - when searching fails

    - #### compare

          public static javax.naming.NamingEnumeration<javax.naming.directory.SearchResult> compare(javax.naming.directory.DirContext dirContext,
                                                                                                    java.lang.String filter,
                                                                                                    java.lang.String entrydn)
                                                                                             throws javax.naming.NamingException

      Filter the data in the ldap directory
      Parameters:
        `dirContext` - the context to operate on
        `filter` - filter this value from the base
        `entrydn` - distinguished name of entry to compare
      Returns:
        result of the search
      Throws:
        `javax.naming.NamingException` - when searching fails

    - #### moddnOp

          public static void moddnOp(javax.naming.directory.DirContext dirContext,
                                     java.lang.String ddn,
                                     java.lang.String newdn)
                              throws javax.naming.NamingException

      ModDN the data in the ldap directory for the given search base
      Parameters:
        `dirContext` - context to operate on
        `ddn` - distinguished name of object to rename
        `newdn` - new distinguished name of object
      Throws:
        `javax.naming.NamingException` - when renaming fails

    - #### modifyTest

          public static void modifyTest(javax.naming.directory.DirContext dirContext,
                                        javax.naming.directory.ModificationItem[] mods,
                                        java.lang.String string)
                                 throws javax.naming.NamingException

      Modify the attribute in the ldap directory for the given string
      Parameters:
        `dirContext` - context to operate on
        `mods` - list of all the `ModificationItem`s to apply on `string`
        `string` - distinguished name of the object to modify
      Throws:
        `javax.naming.NamingException` - when modification fails

    - #### createTest

          public static javax.naming.directory.DirContext createTest(javax.naming.directory.DirContext dirContext,
                                                                     javax.naming.directory.Attributes attributes,
                                                                     java.lang.String string)
                                                              throws javax.naming.NamingException

      Create the entry in the ldap directory for the given string
      Parameters:
        `dirContext` - context to operate on
        `attributes` - add all the attributes and values from the attributes object
        `string` - distinguished name of the subcontext to create
      Returns:
        newly created subcontext
      Throws:
        `javax.naming.NamingException` - when creating subcontext fails

    - #### deleteTest

          public static void deleteTest(javax.naming.directory.DirContext dirContext,
                                        java.lang.String string)
                                 throws javax.naming.NamingException

      Delete the attribute from the ldap directory
      Parameters:
        `dirContext` - context to operate on
        `string` - distinguished name of the subcontext to destroy
      Throws:
        `javax.naming.NamingException` - when destroying the subcontext fails

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.