com.ibm.di.server
Class BranchingComponent

java.lang.Object
  extended by com.ibm.di.server.AssemblyLineComponent
      extended by com.ibm.di.server.BranchingComponent
All Implemented Interfaces:
java.util.Map
Direct Known Subclasses:
LoopComponent, SwitchComponent

public class BranchingComponent
extends AssemblyLineComponent

This class is used by the AssemblyLine for branches


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
protected  BranchingConfig branchingConfig
          The configuration
protected  ParameterSubstitutionCache psc
          Helper object for parameter substitutions
 java.lang.Object value
          The return value from script execution
 
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
BranchingComponent()
          Constructor.
BranchingComponent(AssemblyLine parent, java.lang.String name, BranchingConfig config)
          Constructor for the BranchingComponent object
 
Method Summary
 void add(Entry meta)
          Do nothing in the add method
 void add1(Entry meta)
          This method executes the script.
 boolean checkWillExecute(Entry work)
          Evaluates the expression in this branch
 void close()
          This method closes the script engine.
 int componentCount()
          Deprecated.  
 boolean evaluateCondition(Entry work, BranchCondition c, int index)
          Returns the result of a single condition
 boolean evaluateConditions(Entry work)
          Returns the result of the test conditions
 BaseConfiguration getBaseConfiguration()
          This method returns the BaseConfiguration
 int getBranchType()
          Returns the branch type.
 ConnectorConfig getConfiguration()
          This method returns the Connector configuration
 int getType()
          Gets the type attribute of the BranchingComponent object
 void initialize()
          Initializes the component.
 boolean isExecuted()
          Determines whether the component has been executed.
 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 or false, depending on what the expression in the branch evaluates to This method is called by the AssemblyLine.
 
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, 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
 
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

branchingConfig

protected BranchingConfig branchingConfig
The configuration


value

public java.lang.Object value
The return value from script execution


psc

protected ParameterSubstitutionCache psc
Helper object for parameter substitutions

Constructor Detail

BranchingComponent

public BranchingComponent()
Constructor.


BranchingComponent

public BranchingComponent(AssemblyLine parent,
                          java.lang.String name,
                          BranchingConfig config)
                   throws java.lang.Exception
Constructor for the BranchingComponent object

Parameters:
parent - The AssemblyLine that contains this BranchingComponent
name - The name of this BranchingComponent
config - The configuration for this BranchingComponent
Throws:
java.lang.Exception - if problem occurs
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Initializes the component.

Overrides:
initialize in class AssemblyLineComponent
Throws:
java.lang.Exception - Not really, but subclasses may throw Exceptions

close

public void close()
           throws java.lang.Exception
This method closes the script engine.

Overrides:
close in class AssemblyLineComponent
Throws:
java.lang.Exception - if problem occurs

getConfiguration

public ConnectorConfig getConfiguration()
This method returns the Connector configuration

Overrides:
getConfiguration in class AssemblyLineComponent
Returns:
null

getBaseConfiguration

public BaseConfiguration getBaseConfiguration()
This method returns the BaseConfiguration

Overrides:
getBaseConfiguration in class AssemblyLineComponent
Returns:
The configuration for this component

getType

public int getType()
Gets the type attribute of the BranchingComponent object

Overrides:
getType in class AssemblyLineComponent
Returns:
ServerConstants.TYPE_BRANCH

willExecute

public boolean willExecute(Entry work)
                    throws java.lang.Exception
Return true or false, depending on what the expression in the branch evaluates to This method is called by the AssemblyLine.

Overrides:
willExecute in class AssemblyLineComponent
Parameters:
work - The work Entry
Returns:
The boolean value of the expression
Throws:
java.lang.Exception - Any Exception that might be thrown

checkWillExecute

public boolean checkWillExecute(Entry work)
                         throws java.lang.Exception
Evaluates the expression in this branch

Parameters:
work - The work Entry
Returns:
The boolean value of the expression
Throws:
java.lang.Exception - Any Exception that might be thrown during script execution

evaluateConditions

public boolean evaluateConditions(Entry work)
                           throws java.lang.Exception
Returns the result of the test conditions

Parameters:
work - The work Entry
Returns:
The evaluation of the simple test conditions *
Throws:
java.lang.Exception - if problem occurs

evaluateCondition

public boolean evaluateCondition(Entry work,
                                 BranchCondition c,
                                 int index)
                          throws java.lang.Exception
Returns the result of a single condition

Parameters:
work - The work Entry
c - One BranchCondition
index - The number of this BranchCondition, for error messages throws Exception if the left hand side of the condition is null
Returns:
the result of the conditions
Throws:
java.lang.Exception - if problem occurs

componentCount

public int componentCount()
Deprecated. 

Returns:
an int count

add

public void add(Entry meta)
         throws java.lang.Exception
Do nothing in the add method

Overrides:
add in class AssemblyLineComponent
Parameters:
meta - parameter
Throws:
java.lang.Exception - if problem occurs

add1

public void add1(Entry meta)
          throws java.lang.Exception
This method executes the script.

Parameters:
meta - the work Entry
Throws:
java.lang.Exception - if problem occurs

trigger

public boolean trigger(java.lang.String oper)
Calls the hook named oper.

Overrides:
trigger in class AssemblyLineComponent
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 class AssemblyLineComponent
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 class AssemblyLineComponent
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.

getBranchType

public int getBranchType()
Returns the branch type.

Returns:
an int representing the configuration branch type, if the configuration is null returns -1.

isExecuted

public boolean isExecuted()
Determines whether the component has been executed.

Returns:
true if the component has been executed otherwise false.