org.pentaho.di.trans.steps.ldapinput
Class LDAPConnection

java.lang.Object
  extended by org.pentaho.di.trans.steps.ldapinput.LDAPConnection

public class LDAPConnection
extends Object


Field Summary
static String DEFAUL_FILTER_STRING
           
static int DEFAULT_PORT
           
static int PROTOCOL_LDAP
           
static int PROTOCOL_LDAP_SSL
           
static int PROTOCOL_LDAP_TLS
           
static String[] PROTOCOLS
           
static int SEARCH_SCOPE_OBJECT_SCOPE
           
static int SEARCH_SCOPE_ONELEVEL_SCOPE
           
static int SEARCH_SCOPE_SUBTREE_SCOPE
           
static int STATUS_ADDED
           
static int STATUS_DELETED
           
static int STATUS_INSERTED
           
static int STATUS_SKIPPED
           
static int STATUS_UPDATED
           
 
Constructor Summary
LDAPConnection(LogChannelInterface logInterface, String hostName, int port)
          Construct a new LDAP Connection
 
Method Summary
 int add(String dn, String[] attributes, String[] values, String multValuedSeparator, boolean checkEntry)
           
 void addBinaryAttribute(String name)
           
 void addSortingAttributes(String value)
           
 void close()
          Close the LDAP connection
 void connect()
          Connect to LDAP server
 void connect(String username, String password)
          Connect to LDAP server
 int delete(String dn, boolean checkEntry)
           
static String extractBytesAndConvertToString(Attribute attr, boolean isSID)
           
 Attributes getAttributes()
           
 String getDerefAliases()
           
 RowMeta getFields(String searchBase)
           
 int getProtocol()
           
static String getProtocolCode(int protocol)
           
static int getProtocolFromCode(String protocol)
           
 String getReferral()
           
 List<String> getSortingAttributes()
           
 int getTimeLimit()
           
 String getTrustStorePassword()
           
 String getTrustStorePath()
           
 void insert(String dn, String[] attributes, String[] values, String multValuedSeparator)
          Insert record in LDAP based on DN
 boolean isTrustAllCertificates()
           
 void rename(String oldDn, String newDn, boolean deleteRDN)
          Rename an entry
 void search(String searchBase, String filter, int limitRows, String[] attributeReturned, int searchScope)
           
 void setDerefAliases(String value)
           
 void SetPagingSize(int value)
           
 void setProtocol(int protocol)
           
 void setReferral(String value)
           
 void setSortingAttributesKeys(String[] value)
           
 void setTimeLimit(int timeLimit)
           
 void setTrustStorePassword(String password)
           
 void setTrustStorePath(String trustStorePath)
           
 void trustAllCertificates(boolean value)
           
 int update(String dn, String[] attributes, String[] values, boolean checkEntry)
           
 int upsert(String dn, String[] attributes, String[] values, String[] attributesToUpdate, String[] valuesToUpdate, String multValuedSeparator)
          Upsert record in LDAP First we will check if the entry exist based on DN If we can not find it, we will create it otherwise, we will perform an update
 void useTLS()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOLS

public static final String[] PROTOCOLS

PROTOCOL_LDAP

public static final int PROTOCOL_LDAP
See Also:
Constant Field Values

PROTOCOL_LDAP_SSL

public static final int PROTOCOL_LDAP_SSL
See Also:
Constant Field Values

PROTOCOL_LDAP_TLS

public static final int PROTOCOL_LDAP_TLS
See Also:
Constant Field Values

SEARCH_SCOPE_OBJECT_SCOPE

public static final int SEARCH_SCOPE_OBJECT_SCOPE
See Also:
Constant Field Values

SEARCH_SCOPE_ONELEVEL_SCOPE

public static final int SEARCH_SCOPE_ONELEVEL_SCOPE
See Also:
Constant Field Values

SEARCH_SCOPE_SUBTREE_SCOPE

public static final int SEARCH_SCOPE_SUBTREE_SCOPE
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAUL_FILTER_STRING

public static final String DEFAUL_FILTER_STRING
See Also:
Constant Field Values

STATUS_SKIPPED

public static final int STATUS_SKIPPED
See Also:
Constant Field Values

STATUS_INSERTED

public static final int STATUS_INSERTED
See Also:
Constant Field Values

STATUS_UPDATED

public static final int STATUS_UPDATED
See Also:
Constant Field Values

STATUS_DELETED

public static final int STATUS_DELETED
See Also:
Constant Field Values

STATUS_ADDED

public static final int STATUS_ADDED
See Also:
Constant Field Values
Constructor Detail

LDAPConnection

public LDAPConnection(LogChannelInterface logInterface,
                      String hostName,
                      int port)
               throws KettleException
Construct a new LDAP Connection

Throws:
KettleException
Method Detail

setTrustStorePath

public void setTrustStorePath(String trustStorePath)

getTrustStorePath

public String getTrustStorePath()

setTrustStorePassword

public void setTrustStorePassword(String password)

getTrustStorePassword

public String getTrustStorePassword()

trustAllCertificates

public void trustAllCertificates(boolean value)

isTrustAllCertificates

public boolean isTrustAllCertificates()

getProtocol

public int getProtocol()

setProtocol

public void setProtocol(int protocol)

useTLS

public void useTLS()

connect

public void connect()
             throws KettleException
Connect to LDAP server

Throws:
KettleException

connect

public void connect(String username,
                    String password)
             throws KettleException
Connect to LDAP server

Parameters:
username - : username
password - : password
Throws:
KettleException

setSortingAttributesKeys

public void setSortingAttributesKeys(String[] value)

addSortingAttributes

public void addSortingAttributes(String value)

getSortingAttributes

public List<String> getSortingAttributes()

setTimeLimit

public void setTimeLimit(int timeLimit)

getTimeLimit

public int getTimeLimit()

SetPagingSize

public void SetPagingSize(int value)

setReferral

public void setReferral(String value)

getReferral

public String getReferral()

setDerefAliases

public void setDerefAliases(String value)

getDerefAliases

public String getDerefAliases()

search

public void search(String searchBase,
                   String filter,
                   int limitRows,
                   String[] attributeReturned,
                   int searchScope)
            throws KettleException
Throws:
KettleException

addBinaryAttribute

public void addBinaryAttribute(String name)

delete

public int delete(String dn,
                  boolean checkEntry)
           throws KettleException
Throws:
KettleException

update

public int update(String dn,
                  String[] attributes,
                  String[] values,
                  boolean checkEntry)
           throws KettleException
Throws:
KettleException

add

public int add(String dn,
               String[] attributes,
               String[] values,
               String multValuedSeparator,
               boolean checkEntry)
        throws KettleException
Throws:
KettleException

insert

public void insert(String dn,
                   String[] attributes,
                   String[] values,
                   String multValuedSeparator)
            throws KettleException
Insert record in LDAP based on DN

Parameters:
dn - : Distinguished Name (Key for lookup)
attributes - : contains all the attributes to set for insert
values - : contains all the values for attributes
multValuedSeparator - : multi-valued attributes separator
Throws:
KettleException

upsert

public int upsert(String dn,
                  String[] attributes,
                  String[] values,
                  String[] attributesToUpdate,
                  String[] valuesToUpdate,
                  String multValuedSeparator)
           throws KettleException
Upsert record in LDAP First we will check if the entry exist based on DN If we can not find it, we will create it otherwise, we will perform an update

Parameters:
dn - : Distinguished Name (Key for lookup)
attributes - : contains all the attributes to set for insert
values - : contains all the values for attributes
attributesToUpdate - : contains attributes to update
valuesToUpdate - : contains values for attributes to update
multValuedSeparator - : multi-valued attributes separator
Returns:
status : STATUS_INSERTED, STATUS_UPDATED or STATUS_SKIPPED
Throws:
KettleException

rename

public void rename(String oldDn,
                   String newDn,
                   boolean deleteRDN)
            throws KettleException
Rename an entry

Parameters:
oldDn - Distinguished name of the entry to rename
newDn - target Distinguished name (new)
deleteRDN - To specify whether you want to keep the old name attribute when you use rename entry true : do not keep the old value (defaut) false : keep the old value as an attribute
Throws:
KettleException

close

public void close()
           throws KettleException
Close the LDAP connection

Throws:
KettleException

getAttributes

public Attributes getAttributes()
                         throws KettleException
Throws:
KettleException

extractBytesAndConvertToString

public static String extractBytesAndConvertToString(Attribute attr,
                                                    boolean isSID)
                                             throws Exception
Throws:
Exception

getFields

public RowMeta getFields(String searchBase)
                  throws KettleException
Throws:
KettleException

getProtocolFromCode

public static int getProtocolFromCode(String protocol)

getProtocolCode

public static String getProtocolCode(int protocol)