|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.server.AssemblyLineComponent
public class AssemblyLineComponent
This class is used by the AssemblyLine (AssemblyLine) to wrap a Connector object and provide additional functionality over the underlying Connector object. All attribute mapping and hook handling is performed by this class.
The underlying Connector object is exposed as a property called connector. This class is also the root class of a hierarchy of classes which represent components which can be hosted in an AssemblyLine (for example Function Components, Script Components, Branch Components, Loop Components, etc.)
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Field Summary | |
---|---|
protected AttributeMapping |
addmap
|
static String |
CHECKPOINT_GETS
Deprecated. Checkpoint/restart is deprecated |
protected ConnectorConfig |
config
This is our configuration (with attribute maps, hooks etc ...) |
protected RawConnectorConfig |
connConfig
This is the configuration of the ConnectorInterface |
ConnectorInterface |
connector
This is the connector we are working with. |
protected ConnectorPool |
connPool
Holds the Connector Pool object when a pooled Connector is used |
static String |
END_OF_DATA
The key used to get the flag which is raised (it's value is set to true) when the the component wrapped by this AssemblyLineComponent is
in Iterator mode and the feed has been exhausted. |
protected AttributeMapping |
handler
This is the object performing hooks |
static String |
HOOKS_INVOKED
The key used to get the list of invoked hooks in this cycle. |
protected AttributeMapping |
imap
These are the objects performing input and output attribute mapping |
protected static String |
INITIALIZE
|
protected int |
initializeCount
How many times the component has been initialized |
static String |
LAST_CONN
The key used to get the last Entry with information from the Connector, or the last Entry that was sent to the Connector |
static String |
LAST_ERROR
The key used to get the last error that have occurred. |
protected Log |
log
This is the Log object we use for logging |
protected AttributeMapping |
modmap
|
protected String |
name
This is the connector name as given by the AssemblyLine |
static String |
NUM_ADD
The key used to get the number additions this component has made. |
static String |
NUM_CALLREPLY
The key used to get the number of call-replays operations this component has executed. |
static String |
NUM_DELETE
The key used to get the number of deletions this component has made. |
static String |
NUM_ERRORS
The key used to get the number of errors this component has made. |
static String |
NUM_GET
The key used to get the number of entries this component has gotten. |
static String |
NUM_GET_TRIES
The key used to get the number of times we tried to get an Entry. |
static String |
NUM_GETCLIENT
The key used to get the number of the clients this component has connected with. |
static String |
NUM_GETCLIENT_TRIES
The key used to get the number of times we tried to get a client |
static String |
NUM_IGNORED
The key used to get the number of ignored entries. |
static String |
NUM_LOOKUP
The key used to get the number of lookups this component has made. |
static String |
NUM_MODIFY
The key used to get the number of modifications this component has made. |
static String |
NUM_NOCHANGE
The key used to get the number of no-change entries. |
static String |
NUM_SKIPPED
The key used to get the number of skipped entries. |
protected AssemblyLine |
parent
This is the parent task (AssemblyLine) |
protected boolean |
pooledConnector
Indicates whether this Connector is got from a Connector Pool |
protected boolean |
reusingConnector
Flag to avoid closing reused connector |
protected static String |
SELECT
|
TaskStatistics |
stats
This is the statistics object for the component |
static String |
SUCCESSFUL
The key used to get the status the last operation ended with. |
Constructor Summary | |
---|---|
AssemblyLineComponent()
Empty Constructor for the AssemblyLineComponent object |
|
AssemblyLineComponent(TaskInterface parent,
String name,
ConnectorConfig config,
ConnectorInterface conn)
Constructor for the AssemblyLineComponent object |
|
AssemblyLineComponent(TaskInterface parent,
String name,
ConnectorConfig config,
ConnectorInterface conn,
boolean forceRuntime)
Constructor for the AssemblyLineComponent object |
Method Summary | |
---|---|
void |
add(Entry meta)
This method implements the AddOnly mode operation. |
void |
callreply(Entry meta)
This method implements the CallReply mode operation. |
boolean |
checkInitialize()
Checks whether the connector needs to be (re)initialized or not. |
boolean |
checkTerminate()
Checks whether the connector should be terminated (e.g. |
void |
clear()
|
void |
close()
This method closes the connector (connector.terminate()) and calls the before/after close hooks. |
boolean |
componentInitialized()
Returns true if component is initialized |
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object val)
Returns true if a key maps to this value. |
void |
debug(String msg)
Write a message to the log file prefixed by this connector's name |
void |
delete(Entry meta)
This method implements the Delete mode operation. |
void |
deleteEntry(Entry meta)
This method calls the delete method. |
void |
delta(Entry meta)
This method implements the Delta mode operation. |
void |
doConnectorInitialize()
This method calls the appropriate hooks and the connector's initialize method. |
void |
doConnectorTerminate()
This method calls the appropriate hooks and the connector's terminate method. |
void |
dumpEntry(Entry meta)
Deprecated. replaced by add(com.ibm.di.entry.Entry) |
protected void |
dumpObjects(Entry conn,
Entry work,
Entry current)
|
Set<Map.Entry> |
entrySet()
|
protected Object |
executeOperation(int operation,
Entry work,
Entry conn,
SearchCriteria search,
Entry current)
This method is used to take care of dangerous/safe operations when the AL is simulating |
void |
expandParameters(BaseConfiguration cf)
Deprecated. |
Object |
get(Object propName)
|
BaseConfiguration |
getBaseConfiguration()
|
Object |
getConfig(String param)
This method returns the configuration value for a parameter |
ConnectorConfig |
getConfiguration()
|
ConnectorInterface |
getConnector()
Returns the ConnectorInterface we are working with |
Object |
getConnectorParam(String param)
This method returns the ConnectorInterface attached to this AL component. |
SearchCriteria |
getCriteria()
This method returns the link criteria |
Entry |
getCurrent()
Gets the current entry of the AssemblyLineComponent object |
boolean |
getDebug()
This method returns the debug mode flag. |
int |
getDuplicateEntryCount()
Gets the count of duplicate Entries found by the last findEntry by the ConnectorInterface |
Entry |
getFirstDuplicateEntry()
Gets the first Duplicate Entry from the ConnectorInterface. |
AttributeMapping |
getHandler()
|
Entry |
getLastEntry()
This method returns the last entry read and mapped. |
Entry |
getLastReadEntry()
This method returns the last entry read from the connector. |
Log |
getLog()
Returns the log object |
String |
getName()
This method returns the name assigned to the Connector by the AssemblyLine. |
Entry |
getnext()
The method returns the next entry from the connector. |
Entry |
getnext(Entry work)
The method returns the next entry from the connector. |
ConnectorInterface |
getnextClient()
The method returns the next client from the connector. |
Entry |
getNextDuplicateEntry()
Gets the next Duplicate Entry from the ConnectorInterface. |
Entry |
getRestartInfoEntry()
Deprecated. |
String |
getSimulatingState()
The state of this component. |
TaskStatistics |
getStats()
Gets the stats attribute of the AssemblyLineComponent object |
int |
getType()
This method returns the mode of a Connector, or the type constant for any other type of component. |
void |
handleException(String aOper,
Throwable e,
Entry meta)
This method is called by the AssemblyLine. |
void |
handleSuccess(String oper,
Entry meta)
This method is called by the AssemblyLine if the operation oper is successful. |
void |
initialize()
This method initializes the underlying connector and registers the script beans in the ScriptEngine context. |
boolean |
isCheckpointRestartEnabled()
Deprecated. |
boolean |
isDeltaMode()
|
boolean |
isEmpty()
Returns false. |
boolean |
isEnabled()
Returns true if this Component is enabled in this AssemblyLine |
boolean |
isExceptionFatal(Exception e)
Returns true if an exception is fatal |
Set |
keySet()
|
void |
logmsg(String msg)
Write a message to the log file prefixed by this connector's name |
Entry |
lookup(Entry meta)
The method is called to lookup an entry using the configured Link Criteria. |
Entry |
lookup(String attribute,
String value)
The method is called to lookup an entry using exact matching for attribute and value. |
Entry |
mapEntry(Entry work,
Entry conn)
The method is called to map an entry using the configured input attribute map. |
void |
modify(Entry old,
Entry meta)
This method implements the Modify operation (called by Update if the entry exists) |
void |
pushback(Entry entry)
This method pushes an entry back to the connector. |
Object |
put(Object propName,
Object propValue)
|
void |
putAll(Map map)
|
boolean |
reconnect()
Cause the underlying ConnectorInterface to reconnect to it's data source |
Object |
remove(Object propName)
|
void |
reply(Entry meta)
This method is used to send a reply entry to a connector |
void |
resetStatus()
This method resets the Properties of this AssemblyLineComponent. |
void |
setConnectorParam(String param,
Object value)
This method sets the configuration value for the ConnectorInterface's parameter. |
void |
setCriteria(SearchCriteria mySearchCrit)
This method sets the link criteria for this AssemblyLineComponent |
boolean |
setCriteria(SearchCriteria mySearchCrit,
Entry work)
This method sets the link criteria template for this AssemblyLineComponent, and then expands the template using the given work Entry. |
void |
setCurrent(Entry current)
Sets the current entry of the AssemblyLineComponent object |
void |
setDebug(boolean debug)
This method sets the the debug mode flag. |
void |
setDuplicateEntryCount(int maxdup)
Sets the max number of duplicate entries for the ConnectorInterface. |
void |
setErrorObject(String oper,
String reason)
Deprecated. Not used anymore |
void |
setName(String name)
This method assigns a name to the Connector. |
void |
setRestartInfoEntry(ALState state,
Entry rsi,
int restartPoint)
Deprecated. |
void |
setSimulatingState(String state)
This methods defines the behavior of a Component when the AL is simulating |
void |
setSuccessful(boolean b)
Sets the value that will be returned from wasSuccessful(). |
int |
size()
|
String |
toString()
Returns the name and class of this component |
boolean |
trigger(String oper)
Calls the hook named oper |
boolean |
trigger(String oper,
Entry work)
Calls the hook named oper, declaring work as the corresponding bean. |
boolean |
trigger(String oper,
Entry work,
Entry conn)
Calls the hook named oper, declaring work and conn as the corresponding beans. |
protected boolean |
triggerImpl(String oper,
Entry work,
Entry conn)
Calls the hook named oper, declaring work and conn as the corresponding beans. |
void |
update(Entry meta)
This method implements the Update mode operation. |
Collection |
values()
Returns the values in this Map. |
void |
verifySchema(Entry entry,
boolean input)
Deprecated. |
boolean |
wasConfigurationModified()
|
boolean |
wasSuccessful()
Returns true if this component was successfully executed the last time it was called. |
boolean |
willExecute(Entry work)
Return true/false if this component should be executed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Field Detail |
---|
public static final String CHECKPOINT_GETS
protected static final String INITIALIZE
protected static final String SELECT
public static final String NUM_ERRORS
public static final String NUM_ADD
public static final String NUM_MODIFY
public static final String NUM_DELETE
public static final String NUM_GET
public static final String NUM_GET_TRIES
public static final String NUM_GETCLIENT
public static final String NUM_GETCLIENT_TRIES
public static final String NUM_CALLREPLY
public static final String NUM_LOOKUP
public static final String NUM_NOCHANGE
public static final String NUM_SKIPPED
public static final String NUM_IGNORED
public static final String LAST_ERROR
public static final String SUCCESSFUL
public static final String LAST_CONN
public static final String HOOKS_INVOKED
public static final String END_OF_DATA
AssemblyLineComponent
is
in Iterator mode and the feed has been exhausted.
public ConnectorInterface connector
public TaskStatistics stats
protected String name
protected AssemblyLine parent
protected boolean reusingConnector
protected AttributeMapping imap
protected AttributeMapping addmap
protected AttributeMapping modmap
protected AttributeMapping handler
protected ConnectorConfig config
protected RawConnectorConfig connConfig
protected Log log
protected boolean pooledConnector
protected ConnectorPool connPool
protected int initializeCount
Constructor Detail |
---|
public AssemblyLineComponent(TaskInterface parent, String name, ConnectorConfig config, ConnectorInterface conn) throws Exception
AssemblyLineComponent
object
parent
- The AssemblyLine using this componentname
- The name of this connectorconfig
- The configuration for this connectorconn
- An optional connector to use if we need a (runtime provided)
connector
Exception
- Any exception that might occur while loading the configpublic AssemblyLineComponent(TaskInterface parent, String name, ConnectorConfig config, ConnectorInterface conn, boolean forceRuntime) throws Exception
AssemblyLineComponent
object
parent
- The AssemblyLine using this componentname
- The name of this connectorconfig
- The configuration for this connectorconn
- An optional connector to use if we need a (runtime provided)
connectorforceRuntime
- whether to use the runtime provided connector
Exception
- Any exception that might occur while loading the configpublic AssemblyLineComponent()
Method Detail |
---|
public void setCurrent(Entry current)
AssemblyLineComponent
object
current
- The new current valuepublic void setDebug(boolean debug)
debug
- True to enable debug, false to disable@Deprecated public void setErrorObject(String oper, String reason)
oper
- The new errorObject valuereason
- The new errorObject valuepublic void setDuplicateEntryCount(int maxdup)
maxdup
- The new maximumpublic String getName()
public void setName(String name)
name
- the name to set.public String toString()
toString
in class Object
public Entry getCurrent()
public ConnectorConfig getConfiguration()
public BaseConfiguration getBaseConfiguration()
public Object getConfig(String param)
param
- The parameter name
public Object getConnectorParam(String param)
Note that this applies only to Connectors and will return null for any other type of component.
param
- The parameter name
public void setConnectorParam(String param, Object value)
param
- The parameter namevalue
- The parameter valuepublic ConnectorInterface getConnector()
public boolean getDebug()
public SearchCriteria getCriteria()
This example code demonstrates how to get, modify and set different SearchCriteria for a component.
Example:
var conCrit = input.getCriteria(); var newCrit = new com.ibm.di.server.SearchCriteria(); for (i = 0; i < conCrit.size(); i++) { var rsc = conCrit.getCriteria(i); if ((rsc.name.equals("pass")) && (rsc.match == com.ibm.di.server.SearchCriteria.SUBSTRING)) { newCrit.addTemplate("password", com.ibm.di.server.SearchCriteria.EXACT, rsc.value); } else { newCrit.addTemplate(rsc.name, rsc.match, rsc.value); } } input.setCriteria(newCrit);
public void setCriteria(SearchCriteria mySearchCrit)
mySearchCrit
- The link criteria to setpublic boolean setCriteria(SearchCriteria mySearchCrit, Entry work)
mySearchCrit
- The Criteria to setwork
- The Entry to use for expansion.
public int getType()
ServerConstants.TYPE_ITERATOR
= 0
ServerConstants.TYPE_UPDATE
= 1
ServerConstants.TYPE_LOOKUP
= 2
ServerConstants.TYPE_DELETE
= 3
ServerConstants.TYPE_ADDONLY
= 4
ServerConstants.TYPE_CALLREPLY
= 5
ServerConstants.TYPE_SCRIPT
= 6
ServerConstants.TYPE_FUNCTION
= 7
ServerConstants.TYPE_BRANCH
= 8
ServerConstants.TYPE_REPLYCHANNEL
= 9
ServerConstants.TYPE_SERVER
= 10
ServerConstants.TYPE_DELTA
= 11
ServerConstants.TYPE_LOOP
= 12
ServerConstants.TYPE_ATTRIBUTEMAP
= 13
ServerConstants.TYPE_SWITCH
= 14
ServerConstants.TYPE_CASE
= 15
public boolean isDeltaMode()
public Entry getLastReadEntry()
public Entry getLastEntry()
public ConnectorInterface getnextClient() throws Exception
Exception
- Errors that may occurpublic Entry getnext() throws Exception
Exception
- Errors that may occurpublic Entry getnext(Entry work) throws Exception
AssemblyLine
if we are working in Iterator mode.
work
- The work entry to fill in
Exception
- Errors that may occurpublic TaskStatistics getStats()
TaskStatistics
object holding the statistics for this
component.public Log getLog()
Log
objectpublic AttributeMapping getHandler()
public boolean isExceptionFatal(Exception e)
e
- The exception to check
public int getDuplicateEntryCount()
public Entry getFirstDuplicateEntry() throws Exception
Exception
- Any exceptions thrown by the connector's underlying
classespublic Entry getNextDuplicateEntry() throws Exception
Exception
- Any exceptions thrown by the connector's underlying
classespublic boolean isEnabled()
public void close() throws Exception
Exception
public boolean willExecute(Entry work) throws Exception
work
- The current work Entry
Exception
- Any exception thrown by the executed hookpublic void initialize() throws Exception
Exception
- any exception, which occurs during the initialization of
the component and is not handled by the reconnect
mechanism or the error hooks; it is also possible that the
exception is thrown by some of the initialize hookspublic void pushback(Entry entry)
entry
- The entry to push backpublic void doConnectorInitialize() throws Exception
Exception
- if the connector's initialization fails or an error in one of
the executed hooks occurred.public void doConnectorTerminate() throws Exception
Exception
- if the connector's termination fails or an error in one of
the executed hooks occurred.public Entry lookup(String attribute, String value) throws Exception
attribute
- The attribute name to searchvalue
- The attribute value
Exception
- Any exceptions thrown by the underlying connectorpublic Entry lookup(Entry meta) throws Exception
meta
- The entry object providing values for variable substitution.
Exception
- the component is not initialized or the underlying
Connector raised an error or some of the user-defined
hooks raised an errorpublic void deleteEntry(Entry meta) throws Exception
meta
- The work object to use for the link criteria
Exception
- Any Exceptiondelete(com.ibm.di.entry.Entry)
public void delete(Entry meta) throws Exception
meta
- The work object to use for the link criteria
Exception
- the component is not initialized or the underlying
Connector raised an error or some of the user-defined
hooks raised an errorpublic void update(Entry meta) throws Exception
meta
- The work entry
Exception
- the component is not initialized or the underlying
Connector raised an error or some of the user-defined
hooks raised an errorpublic void modify(Entry old, Entry meta) throws Exception
old
- The current entry in the destination systemmeta
- The new entry to use in the attribute map
Exception
- Any Exceptionpublic void add(Entry meta) throws Exception
meta
- The work entry to add
Exception
- the component is not initialized or the underlying
Connector raised an error or some of the user-defined
hooks raised an errorpublic void reply(Entry meta) throws Exception
meta
- The work entry to send back
Exception
- the component is not initialized or the underlying
Connector raised an error or some of the user-defined
hooks raised an errorpublic void callreply(Entry meta) throws Exception
meta
- The work entry to send
Exception
- the component is not initialized or the underlying
Connector raised an error or some of the user-defined
hooks raised an errorpublic void delta(Entry meta) throws Exception
meta
- The delta entry
Exception
- Any Exception@Deprecated public void dumpEntry(Entry meta) throws Exception
add(com.ibm.di.entry.Entry)
meta
- an Entry to be added to the data source by the Connector
Exception
- problem while adding the Entry to the data sourcepublic void logmsg(String msg)
msg
- The message to writepublic void debug(String msg)
msg
- The message to writepublic void handleException(String aOper, Throwable e, Entry meta) throws Exception
aOper
- Hook prefixe
- The error causing this hook to be called, or null for no errormeta
- The work entry
Exception
- Throws the parameter e if we cannot or do not want to
handle it, or an Exception from the Hooks.public void handleSuccess(String oper, Entry meta) throws Exception
oper
- Hook prefixmeta
- The work entry
Exception
- Any Exception from the Hookspublic boolean trigger(String oper, Entry work, Entry conn) throws Exception
oper
- Name of the hook to callwork
- This will be the work bean in the hookconn
- This will be the conn bean in the hook
Exception
- Any exception thrown by the execution of the hookpublic boolean trigger(String oper, Entry work) throws Exception
oper
- Name of the hook to callwork
- This will be the work bean in the hook
Exception
- Any exception thrown by the execution of the hookpublic boolean trigger(String oper) throws Exception
oper
- Name of the hook to call
Exception
- Any exception thrown by the execution of the hookprotected boolean triggerImpl(String oper, Entry work, Entry conn) throws Exception
oper
- Name of the hook to callwork
- This will be the work bean in the hook. Maybe null.conn
- This will be the conn bean in the hook. Maybe null.
Exception
- Any exception thrown by the execution of the hook@Deprecated public void expandParameters(BaseConfiguration cf) throws Exception
cf
- ignored
Exception
- never@Deprecated public void verifySchema(Entry entry, boolean input) throws Exception
entry
- - ignoredinput
- - ignored
Exception
- - never@Deprecated public Entry getRestartInfoEntry() throws Exception
Exception
- - never@Deprecated public boolean isCheckpointRestartEnabled() throws Exception
Exception
- - never@Deprecated public void setRestartInfoEntry(ALState state, Entry rsi, int restartPoint) throws Exception
state
- - ignoredrsi
- - ignoredrestartPoint
- - ignored
Exception
- - neverprotected void dumpObjects(Entry conn, Entry work, Entry current)
public boolean reconnect() throws Exception
Exception
- if an error while reconnecting occurs.public Entry mapEntry(Entry work, Entry conn) throws Exception
work
- The work entryconn
- The conn entry
Exception
- problem while mapping the entrypublic boolean checkInitialize() throws Exception
Exception
public boolean checkTerminate() throws Exception
Exception
public boolean wasConfigurationModified()
public void setSimulatingState(String state) throws Exception
state
- - possible values:SimulationConfig.SIM_ENABLED_STATE
SimulationConfig.SIM_DISABLED_STATE
SimulationConfig.SIM_SIMULATED_STATE
SimulationConfig.SIM_PROXY_STATE
SimulationConfig.SIM_SCRIPTED_STATE
Exception
- if an error occurspublic String getSimulatingState() throws Exception
SimulationConfig.SIM_ENABLED_STATE
SimulationConfig.SIM_DISABLED_STATE
SimulationConfig.SIM_SIMULATED_STATE
SimulationConfig.SIM_PROXY_STATE
SimulationConfig.SIM_SCRIPTED_STATE
Exception
- if an error occursprotected Object executeOperation(int operation, Entry work, Entry conn, SearchCriteria search, Entry current) throws Exception
operation
- the operation (the method that is called). Recognizable input
are the values putEntry, modEntry, deleteEntry, perform,
getNextClient, getNextEntry, findEntry, selectEntries,
replyEntry and queryReplywork
- The work entry. If a null is passed the method will get the
work entry from its parent (AssemblyLine) and if it still null
then a new work entry will be created. If the Proxy simulation
state is executed and the passed operation does not expect an
entry to be returned then the entry retrieved from the Proxy
AL will be merged with the work entryconn
- For the operations that expect an entry to be returned and we
are with Scripted simulation state set then the conn entry
modified in the script will be used as the returned entry.search
- The SearchCriteria
object used to locate the entry to
be modified/deletedcurrent
- The old entry found by the search criteria this would be only
available for the modEntry operation and only then will be
exposed in a script
Exception
- in case the call to one of the methods fails.
ClassCastException
- in case the parent of the AssemblyLineComponent is not an
instance of the AssemblyLine classpublic boolean componentInitialized()
public boolean wasSuccessful()
public void setSuccessful(boolean b)
b
- - The new valuepublic void resetStatus()
public int size()
size
in interface Map
public boolean isEmpty()
isEmpty
in interface Map
public boolean containsKey(Object key)
containsKey
in interface Map
public boolean containsValue(Object val)
containsValue
in interface Map
val
- The value to look for.public Object get(Object propName)
get
in interface Map
public Object put(Object propName, Object propValue)
put
in interface Map
public Object remove(Object propName)
remove
in interface Map
public void putAll(Map map)
putAll
in interface Map
public void clear()
clear
in interface Map
public Set keySet()
keySet
in interface Map
public Collection values()
values
in interface Map
public Set<Map.Entry> entrySet()
entrySet
in interface Map
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |