com.ibm.di.server
Class BranchingComponent

java.lang.Object
  extended by com.ibm.di.server.AssemblyLineComponent
      extended by com.ibm.di.server.BranchingComponent
Direct Known Subclasses:
LoopComponent, SwitchComponent

public class BranchingComponent
extends AssemblyLineComponent

This class is used by the AssemblyLine for branches


Field Summary
protected  BranchingConfig config
          The configuration
protected  AssemblyLine parent
          The AssemblyLine this BranchingComponent is part of
protected  ParameterSubstitutionCache psc
          Helper object for param substitutions
 Object value
          The return value from script execution
 
Fields inherited from class com.ibm.di.server.AssemblyLineComponent
addmap, CHECKPOINT_GETS, connConfig, connector, connPool, handler, imap, INITIALIZE, log, modmap, name, pooledConnector, restartCycle, reusingConnector, SELECT, stats
 
Constructor Summary
BranchingComponent()
           
BranchingComponent(AssemblyLine parent, 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()
          Returns the number of components contained in this branch.
 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()
           
 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()
           
 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.
 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, debug, delete, deleteEntry, delta, doConnectorInitialize, doConnectorTerminate, dumpEntry, dumpObjects, expandParameters, getConfig, getConnector, getConnectorParam, getCriteria, getCurrent, getDebug, getDuplicateEntryCount, getFirstDuplicateEntry, getHandler, getLastEntry, getLastReadEntry, getLog, getName, getnext, getnext, getnextClient, getNextDuplicateEntry, getRestartInfoEntry, getStats, handleException, handleSuccess, isCheckpointRestartEnabled, isDeltaMode, isEnabled, isExceptionFatal, logmsg, lookup, lookup, mapEntry, modify, pushback, reconnect, reply, setConnectorParam, setCriteria, setCriteria, setCurrent, setDebug, setDuplicateEntryCount, setErrorObject, setName, setRestartInfoEntry, update, verifySchema, wasConfigurationModified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected BranchingConfig config
The configuration


parent

protected AssemblyLine parent
The AssemblyLine this BranchingComponent is part of


value

public Object value
The return value from script execution


psc

protected ParameterSubstitutionCache psc
Helper object for param substitutions

Constructor Detail

BranchingComponent

public BranchingComponent()

BranchingComponent

public BranchingComponent(AssemblyLine parent,
                          String name,
                          BranchingConfig config)
                   throws 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:
Exception
Method Detail

initialize

public void initialize()
                throws Exception
Initializes the component.

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

close

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

Overrides:
close in class AssemblyLineComponent
Throws:
Exception

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 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:
Exception - Any Exception that might be thrown

checkWillExecute

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

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

evaluateConditions

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

Parameters:
work - The work Entry
Returns:
The evaluation of the simple test conditions
Throws:
Exception

evaluateCondition

public boolean evaluateCondition(Entry work,
                                 BranchCondition c,
                                 int index)
                          throws 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
Throws:
Exception

componentCount

public int componentCount()
Returns the number of components contained in this branch. This is used by the AssemblyLine to find out how many components to skip when willExec is false.


add

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

Overrides:
add in class AssemblyLineComponent
Parameters:
meta - The work entry to add
Throws:
Exception - the component is not initialized or the underlying Connector raised an error or some of the user-defined hooks raised an error

add1

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

Parameters:
meta - the work Entry
Throws:
Exception

trigger

public boolean trigger(String oper)
Description copied from class: AssemblyLineComponent
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(String oper,
                       Entry work)
Description copied from class: AssemblyLineComponent
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(String oper,
                       Entry work,
                       Entry conn)
Description copied from class: AssemblyLineComponent
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()

isExecuted

public boolean isExecuted()