com.ibm.di.server
Class LoopComponent

java.lang.Object
  extended by com.ibm.di.server.AssemblyLineComponent
      extended by com.ibm.di.server.BranchingComponent
          extended by com.ibm.di.server.LoopComponent

public class LoopComponent
extends BranchingComponent

This class is used by an AssemblyLine to mark the beginning of a loop


Field Summary
 
Fields inherited from class com.ibm.di.server.BranchingComponent
parent, psc, value
 
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
LoopComponent(AssemblyLine parent, String name, LoopConfig config)
          Constructor for the LoopComponent object
 
Method Summary
 void add(Entry meta)
          If necessary, move a value from the stored Attribute values to the work Entry
 void checkConnectorInit(Entry work)
          Check what to do with our connector when we enter the loop.
 void checkLoopAttribute(Entry work)
          Copy values from work entry attribute
 void close()
          Releases resource
 int componentCount()
          Returns the number of components contained in this branch.
 ConnectorInterface getConnector()
          Returns the Connector we are working with if this is a Connector loop
 int getLoopType()
          Returns the source for this loop component (e.g.
 Entry getNextEntry(Entry meta)
          Returns the next Entry if this is a Connector loop
 int getType()
          Returns the type of this component.
 void initialize()
          This method initializes the LoopComponent
 void setConnectorParams(Entry work)
          Executes the attribute map for the connector params
 void setFirstLoop(boolean value)
          Set the internal firstLoop variable to the parameter value.
 boolean willExecute(Entry work)
          This method will execute the Loop condition/connector and determine whether there are more loops to do.
 
Methods inherited from class com.ibm.di.server.BranchingComponent
add1, checkWillExecute, evaluateCondition, evaluateConditions, getBaseConfiguration, getBranchType, getConfiguration, isExecuted, trigger, trigger, trigger
 
Methods inherited from class com.ibm.di.server.AssemblyLineComponent
callreply, checkInitialize, checkTerminate, debug, delete, deleteEntry, delta, doConnectorInitialize, doConnectorTerminate, dumpEntry, dumpObjects, expandParameters, getConfig, 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
 

Constructor Detail

LoopComponent

public LoopComponent(AssemblyLine parent,
                     String name,
                     LoopConfig config)
              throws Exception
Constructor for the LoopComponent object

Parameters:
parent - The AssemblyLine this LoopComponent belongs in
name - The name of this LoopComponent
config - The configuration for this LoopComponent
Throws:
Exception - Any Exception that might be thrown
Method Detail

initialize

public void initialize()
                throws Exception
This method initializes the LoopComponent

Overrides:
initialize in class BranchingComponent
Throws:
Exception - If this is a Collection Loop, and attribute names are missing

getConnector

public ConnectorInterface getConnector()
Returns the Connector we are working with if this is a Connector loop

Overrides:
getConnector in class AssemblyLineComponent
Returns:
the ConnectorInterface

getNextEntry

public Entry getNextEntry(Entry meta)
                   throws Exception
Returns the next Entry if this is a Connector loop

Parameters:
meta - The work Entry
Returns:
The next Entry
Throws:
Exception - Any Exception thrown by the Connector

componentCount

public int componentCount()
Returns the number of components contained in this branch. This is used by the AL to find out how many components to skip when willExec is false. We then add one to this count for our "invisible" endloop component.

Overrides:
componentCount in class BranchingComponent

setFirstLoop

public void setFirstLoop(boolean value)
Set the internal firstLoop variable to the parameter value. Used to decide if this LoopComponent should begin a new Loop, or continue the old Loop

Parameters:
value - The value to set

getLoopType

public int getLoopType()
Returns the source for this loop component (e.g. LoopConfig.LOOP_CONDITIONS/CONNECTOR_FC/COLLECTION)

Returns:
An int containing the loop type.

willExecute

public boolean willExecute(Entry work)
                    throws Exception
This method will execute the Loop condition/connector and determine whether there are more loops to do.

Overrides:
willExecute in class BranchingComponent
Parameters:
work - The work Entry
Returns:
true if there are more loops to do
Throws:
Exception - Any Exception that might be thrown

getType

public int getType()
Returns the type of this component.

Overrides:
getType in class BranchingComponent
Returns:
ServerConstants.TYPE_LOOP

checkLoopAttribute

public void checkLoopAttribute(Entry work)
Copy values from work entry attribute

Parameters:
work - The work Entry

checkConnectorInit

public void checkConnectorInit(Entry work)
                        throws Exception
Check what to do with our connector when we enter the loop.

Parameters:
work - The work Entry
Throws:
Exception

setConnectorParams

public void setConnectorParams(Entry work)
                        throws Exception
Executes the attribute map for the connector params

Parameters:
work - The work Entry
Throws:
Exception

add

public void add(Entry meta)
         throws Exception
If necessary, move a value from the stored Attribute values to the work Entry

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

close

public void close()
           throws Exception
Releases resource

Overrides:
close in class BranchingComponent
Throws:
Exception