com.metamatrix.connector.ldap
Class LDAPUpdateExecution

java.lang.Object
  extended by org.teiid.connector.basic.BasicExecution
      extended by com.metamatrix.connector.ldap.LDAPUpdateExecution
All Implemented Interfaces:
Execution, UpdateExecution

public class LDAPUpdateExecution
extends BasicExecution
implements UpdateExecution

Please see the user's guide for a full description of capabilties, etc. Description/Assumptions: 1. Table's name in source defines the base DN (or context) for the search. Example: Table.NameInSource=ou=people,dc=gene,dc=com 2. Column's name in source defines the LDAP attribute name. [Default] If no name in source is defined, then we attempt to use the column name as the LDAP attribute name. 3. Since all of the underlying LDAP methods for adding/deleting/updating require specification of the LDAP distinguished name (DN) to change, for all corresponding MetaMatrix operations the DN must be specified (as the sole item in the WHERE clause for UPDATE and DELETE operations, and in the list of attributes to assign values in an INSERT operation * Responsible for update/insert/delete operations against LDAP


Constructor Summary
LDAPUpdateExecution(ICommand command, ExecutionContext ctx, RuntimeMetadata rm, ConnectorLogger logger, javax.naming.ldap.InitialLdapContext ldapCtx)
           
 
Method Summary
 void cancel()
          Cancels the execution abnormally.
 void close()
          Terminates the execution normally.
 void execute()
          execute generic update-class (either an update, delete, or insert) operation and returns a count of affected rows.
 int[] getUpdateCounts()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPUpdateExecution

public LDAPUpdateExecution(ICommand command,
                           ExecutionContext ctx,
                           RuntimeMetadata rm,
                           ConnectorLogger logger,
                           javax.naming.ldap.InitialLdapContext ldapCtx)
                    throws ConnectorException
Throws:
ConnectorException
Method Detail

execute

public void execute()
             throws ConnectorException
execute generic update-class (either an update, delete, or insert) operation and returns a count of affected rows. Since underlying LDAP operations (and this connector) can modify at most one LDAP leaf context at a time, this will always return 1. It will never actually return 0, because if an operation fails, a ConnectorException will be thrown instead. Note that really it should return 0 if a delete is performed on an entry that doesn't exist (but whose parent does exist), but since the underlying LDAP operation will return success for such a delete, we just blindly return 1. To return 0 would mean performing a search for the entry first before deleting it (to confirm that it did exist prior to the delete), so right now we sacrifice accuracy here for the sake of efficiency.

Specified by:
execute in interface Execution
Throws:
ConnectorException

getUpdateCounts

public int[] getUpdateCounts()
                      throws DataNotAvailableException,
                             ConnectorException
Specified by:
getUpdateCounts in interface UpdateExecution
Throws:
DataNotAvailableException
ConnectorException

cancel

public void cancel()
            throws ConnectorException
Description copied from interface: Execution
Cancels the execution abnormally. This will happen via a different thread from the one performing the execution, so should be expected to happen in a multi-threaded scenario.

Specified by:
cancel in interface Execution
Throws:
ConnectorException

close

public void close()
           throws ConnectorException
Description copied from interface: Execution
Terminates the execution normally.

Specified by:
close in interface Execution
Throws:
ConnectorException


Copyright © 2009. All Rights Reserved.