Package org.teiid.translator.ldap
Class LDAPUpdateExecution
- java.lang.Object
-
- org.teiid.translator.ldap.LDAPUpdateExecution
-
- All Implemented Interfaces:
Execution
,UpdateExecution
public class LDAPUpdateExecution extends Object 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
Constructors Constructor Description LDAPUpdateExecution(Command command, LdapContext ldapCtx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
Returns the update counts for the execution.
-
-
-
Constructor Detail
-
LDAPUpdateExecution
public LDAPUpdateExecution(Command command, LdapContext ldapCtx)
-
-
Method Detail
-
execute
public void execute() throws TranslatorException
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 interfaceExecution
- Throws:
TranslatorException
-
getUpdateCounts
public int[] getUpdateCounts() throws DataNotAvailableException, TranslatorException
Description copied from interface:UpdateExecution
Returns the update counts for the execution.
A single positive integer value is expected for non bulk/batch commands.
bulk/batch should return an integer for each value/command. 0 or greater for successful update count, -2 for no info, -3 failure- Specified by:
getUpdateCounts
in interfaceUpdateExecution
- Returns:
- the update counts corresponding to the command executed
- Throws:
DataNotAvailableException
TranslatorException
-
cancel
public void cancel() throws TranslatorException
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 interfaceExecution
- Throws:
TranslatorException
-
-