Package com.ibm.di.server
Class ScriptComponent
- java.lang.Object
-
- com.ibm.di.server.AssemblyLineComponent
-
- com.ibm.di.server.ScriptComponent
-
- All Implemented Interfaces:
java.util.Map
public class ScriptComponent extends AssemblyLineComponent
This class is used by the AssemblyLine for scripts.
-
-
Field Summary
-
Fields inherited from class com.ibm.di.server.AssemblyLineComponent
addmap, CHECKPOINT_GETS, config, connConfig, connector, connPool, END_OF_DATA, handler, HOOKS_INVOKED, imap, INITIALIZE, initializeCount, LAST_CONN, LAST_ERROR, log, modmap, name, NUM_ADD, NUM_CALLREPLY, NUM_DELETE, NUM_ERRORS, NUM_GET, NUM_GET_TRIES, NUM_GETCLIENT, NUM_GETCLIENT_TRIES, NUM_IGNORED, NUM_LOOKUP, NUM_MODIFY, NUM_NOCHANGE, NUM_SKIPPED, parent, pooledConnector, SELECT, stats, SUCCESSFUL
-
-
Constructor Summary
Constructors Constructor Description ScriptComponent(AssemblyLine parent, java.lang.String name, ConnectorConfig config, ConnectorInterface conn)
Constructor for the script component object.ScriptComponent(AssemblyLine parent, java.lang.String name, ScriptConfig config, ConnectorInterface conn)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Entry meta)
This method executes the script.void
add1(Entry meta)
This method executes the script.void
close()
This method closes the script engine.ConnectorConfig
getConfiguration()
This method returns the Connector configurationScriptConfig
getScriptConfiguration()
This method returns the Script configuration.int
getType()
Returns ServerConstants.TYPE_SCRIPTvoid
initialize()
This method initializes the script engine.boolean
trigger(java.lang.String oper)
Calls the hook named oper.boolean
trigger(java.lang.String oper, Entry work)
Calls the hook named oper, declaring work as the corresponding bean.boolean
trigger(java.lang.String oper, Entry work, Entry conn)
Calls the hook named oper, declaring work and conn as the corresponding beans.boolean
willExecute(Entry work)
Return true/false if this component should be executed.-
Methods inherited from class com.ibm.di.server.AssemblyLineComponent
callreply, checkInitialize, checkTerminate, clear, componentInitialized, containsKey, containsValue, debug, delete, deleteEntry, delta, doConnectorInitialize, doConnectorTerminate, doConnectorTerminate, dumpEntry, dumpObjects, entrySet, executeOperation, expandParameters, failBack, failOver, get, getBaseConfiguration, getConfig, getConnector, getConnectorParam, getCriteria, getCurrent, getDebug, getDuplicateEntryCount, getFirstDuplicateEntry, getHandler, getLastEntry, getLastReadEntry, getLog, getName, getnext, getnext, getnextClient, getNextDuplicateEntry, getRestartInfoEntry, getSimulatingState, getStats, handleException, handleSuccess, isCheckpointRestartEnabled, isDeltaMode, isEmpty, isEnabled, isExceptionFatal, isFailOvered, keySet, logmsg, lookup, lookup, mapEntry, modify, pushback, put, putAll, reconnect, remove, reply, resetStatus, setConnectorParam, setCriteria, setCriteria, setCurrent, setDebug, setDuplicateEntryCount, setErrorObject, setName, setRestartInfoEntry, setSimulatingState, setSuccessful, size, toString, triggerImpl, update, useAttributeMap, useAttributeMap, useAttributeMap, useInputMap, useMap, useMap, useOutputMap, values, verifySchema, wasConfigurationModified, wasSuccessful
-
-
-
-
Constructor Detail
-
ScriptComponent
public ScriptComponent(AssemblyLine parent, java.lang.String name, ScriptConfig config, ConnectorInterface conn) throws java.lang.Exception
Constructor.- Parameters:
parent
- the AssemblyLine using this componentname
- the name of hte componentconfig
- script configuration of this componentconn
- an optional connector to use if needed- Throws:
java.lang.Exception
- if problem occurs
-
ScriptComponent
public ScriptComponent(AssemblyLine parent, java.lang.String name, ConnectorConfig config, ConnectorInterface conn) throws java.lang.Exception
Constructor for the script component object.- Parameters:
parent
- the parent AssemblyLine.name
- the component's name given by the AssemblyLine.config
- the configuration.conn
- an optional connector to use if needed- Throws:
java.lang.Exception
- if problem occurs
-
-
Method Detail
-
initialize
public void initialize() throws java.lang.Exception
This method initializes the script engine.- Overrides:
initialize
in classAssemblyLineComponent
- Throws:
java.lang.Exception
- if initialization encounters problems
-
close
public void close()
This method closes the script engine.- Overrides:
close
in classAssemblyLineComponent
-
getConfiguration
public ConnectorConfig getConfiguration()
This method returns the Connector configuration- Overrides:
getConfiguration
in classAssemblyLineComponent
- Returns:
- the connector configuration.
-
getScriptConfiguration
public ScriptConfig getScriptConfiguration()
This method returns the Script configuration.- Returns:
- the script configuration
- Since:
- 7.0
-
getType
public int getType()
Returns ServerConstants.TYPE_SCRIPT- Overrides:
getType
in classAssemblyLineComponent
- Returns:
- the
ServerConstants.TYPE_SCRIPT
value
-
add
public void add(Entry meta) throws java.lang.Exception
This method executes the script. If an error occurs, it will also declare the error bean.- Overrides:
add
in classAssemblyLineComponent
- Parameters:
meta
- Entry parameter- Throws:
java.lang.Exception
- if error occurs
-
add1
public void add1(Entry meta) throws java.lang.Exception
This method executes the script.- Parameters:
meta
- Entry parameter- Throws:
java.lang.Exception
- if error occurs
-
trigger
public boolean trigger(java.lang.String oper)
Calls the hook named oper.- Overrides:
trigger
in classAssemblyLineComponent
- Parameters:
oper
- Name of the hook to call.- Returns:
- True if the hook was executed, false if the hook is not defined or disabled.
-
trigger
public boolean trigger(java.lang.String oper, Entry work)
Calls the hook named oper, declaring work as the corresponding bean. The trigger function calls one of the AssemblyLine hooks defined for this Connector using the provided work.- Overrides:
trigger
in classAssemblyLineComponent
- Parameters:
oper
- Name of the hook to call.work
- This will be the work bean in the hook.- Returns:
- True if the hook was executed, false if the hook is not defined or disabled.
-
trigger
public boolean trigger(java.lang.String oper, Entry work, Entry conn)
Calls the hook named oper, declaring work and conn as the corresponding beans. The trigger function calls one of the AssemblyLine hooks defined for this Connector using the provided conn/work.- Overrides:
trigger
in classAssemblyLineComponent
- Parameters:
oper
- Name of the hook to call.work
- This will be the work bean in the hook.conn
- This will be the conn bean in the hook- Returns:
- True if the hook was executed, false if the hook is not defined or disabled.
-
willExecute
public boolean willExecute(Entry work) throws java.lang.Exception
Return true/false if this component should be executed.- Overrides:
willExecute
in classAssemblyLineComponent
- Parameters:
work
- the work Entry object- Returns:
true
if this component should be executed, otherwise false- Throws:
java.lang.Exception
- if problem occurs
-
-