public class NPLFieldProcessor extends DCFieldProcessor implements StateFreezable
| Modifier and Type | Field and Description |
|---|---|
protected RuntimeState |
currentState
State-related members
|
protected java.lang.String |
currentTransactionId |
protected boolean |
fileLevelTransaction |
protected StateFreezeHelper |
freezeHelper |
protected LoggerIfc |
logger
Object to use to log messages
|
protected NPLProgramIfc |
nplProgram |
protected java.lang.Object |
waitForInputLock
Used to pause the processing when waiting for more input
|
| Constructor and Description |
|---|
NPLFieldProcessor(java.lang.Class outputDataType,
LoggerIfc inLogger,
java.lang.String scratchDir,
java.lang.String fileName)
Calls parent's
constructor. |
NPLFieldProcessor(java.lang.Class outputDataType,
LoggerIfc inLogger,
java.lang.String scratchDir,
java.lang.String fileName,
boolean isFileLeveTranasction)
Calls parent's
constructor. |
NPLFieldProcessor(java.lang.Class outputDataType,
LoggerIfc inLogger,
java.lang.String scratchDir,
java.lang.String fileName,
IDCMethodHandler methodHandler)
Calls other constructor with 4 parameters, and then sets the
methodHandler that will be used by the NPLProgram.
|
NPLFieldProcessor(java.lang.Class outputDataType,
LoggerIfc inLogger,
java.lang.String scratchDir,
java.lang.String fileName,
IDCMethodHandler methodHandler,
boolean isFileLevelTransaction)
Calls other constructor with 4 parameters, and then sets the
methodHandler that will be used by the NPLProgram.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dataIsAvailable()
Allows a DataProvider to indicate that some data is
available for processing
|
void |
freezeState(Callback freezeCallback)
Used by the StateManager thread to halt the processing while the state of
the node is saved.
|
DCFieldContainer[] |
getBulkData()
Allows a DataReceiver to obtain the available data in a
known format.
|
java.lang.String |
getConfigValue(java.lang.String key)
Gets the value of a configuration attribute.
|
DCFieldContainer |
getData()
Allows a DataReceiver to obtain the available data in a
known format.
|
java.util.ArrayList |
getExposedFields(java.lang.String reason)
Gets a list of the fields defined in the expose clause for the reason
provided.
|
java.util.ArrayList |
getInputFields()
Gets a list of the input fields defined in the input records.
|
int |
getIntConfigValue(java.lang.String key)
Gets the value of a configuration attribute.
|
protected LoggerIfc |
getLogger()
Returns the LoggerIfc object used by this class to record log messages
|
IDCMethodHandler |
getMethodHandler(java.lang.String name)
Returns the method handler with the specified name that is being used by
this field processor's NPL program.
|
java.lang.String |
getNPLFileName() |
protected NPLProgramIfc |
getNPLProgram()
Returns the NPLProgramIfc object used by this field processor
|
java.util.ArrayList |
getOutputFields()
Gets a list of the output fields defined in the output records.
|
boolean |
getPollForData() |
long |
getSleepTime()
Returns the amount of time, in milliseconds, that will elapse before this
NPLFieldProcessor will check for data to process, if it is running.
|
protected void |
handleProcessingException(DCFieldContainer dcfc)
Writes the given data to an error file and, if configured to shutdown on
a processing error, logs a message and shuts down the FieldProcessor.
|
protected void |
handleProcessingException(DCFieldContainer[] dcfcs)
Writes the given data to an error file and, if configured to shutdown on
a processing error, logs a message and shuts down the FieldProcessor.
|
protected void |
handleProcessingException(DCFieldContainer dcfc,
java.lang.Exception ex) |
void |
handleRejectOfFile()
To handle the remaining input files when there is reject of a file
|
boolean |
isBulkProcessing()
Indicates whether this NPLFieldProcessor is retrieving and processing the
DCFieldContainers individually or in bulk.
|
boolean |
isDataAvailable()
Allows a DataReceiver to determine whether some data is
available for processing
|
boolean |
isFileLevelTransaction() |
boolean |
isRejected() |
protected boolean |
isRunning()
Indicates whether this NPLFieldProcessor is running
|
protected boolean |
isShutdown()
Indicates whether this NPLFieldProcessor has been shutdown
|
boolean |
isShutdownOnError()
Indicates whether this NPLFieldProcessor should shutdown upon
encountering an error during processing
|
void |
processData(DCFieldContainer inputData)
Manipulates the data provided by its DataProvider
|
void |
processData(DCFieldContainer[] inputData)
Manipulates the set of data provided by its DataProvider
|
boolean |
processFileData(DCFieldContainer inputData)
This is just a dummy implementation, any field processor needing the file level transaction behavior should override this method
and implement correct behavior.
|
boolean |
processFileData(DCFieldContainer[] inputData)
This is just a dummy implementation, any field processor needing the file level transaction behavior should override this method
and implement correct behavior.
|
void |
run() |
void |
setBulkProcessing(boolean bulk)
Sets the boolean which indicates whether the field processor will the
retrieve and process the DCFieldContainers individually or in bulk.
|
void |
setDataReceiver(DataReceiverIfc rec)
Sets the object to which this DataProvider will send
its data.
|
void |
setMultiThreadConfig(boolean mtChecked,
boolean mtOrderChecked,
int totalThreads) |
void |
setNPLFileName(java.lang.String fileName) |
void |
setPollForData() |
void |
setProcessingData(boolean value)
Sets the boolean indicating whether the field processor is currently
processing data.
|
protected void |
setRunning(boolean run)
Sets the boolean which indicates whether the field processor is running
|
protected void |
setShutdown(boolean stop)
Sets the boolean which indicates whether the field processor has been
shutdown
|
void |
setShutdownOnError(boolean value)
Indicates whether this NPLFieldProcessor should shutdown upon
encountering an error during processing default value is
false |
void |
setSleepTime(long timerValue)
Sets the amount of time, in milliseconds, that will elapse before this
NPLFieldProcessor will check for data to process, if it is running.
|
void |
setTransactionID(java.lang.String tID) |
void |
shutdown()
Performs all steps necessary to gracefully stop this FieldProcessor.
|
void |
unfreezeState()
Used by the StateManager thread to resume the processing previously
halted.
|
protected boolean |
writeToError(DCFieldContainer data)
Appends records containing errors to an output file
|
protected boolean |
writeToError(DCFieldContainer[] data)
Appends records containing errors to an output file
|
fileDataIsAvailable, getDataProvider, getDataReceiver, getDiscardedCounter, getFileBulkData, getFileData, getFileDataProvider, getFileDataReceiver, getOutputType, isEndOfFile, isFileDataAvailable, isStartOfFile, openInputFile, processEndOfFileData, processRejectFile, processStartOfFileData, rejectFile, setDataProvider, setDiscardedCounter, setFileDataProvider, setFileDataReceiver, setOutputTypeprotected LoggerIfc logger
protected java.lang.Object waitForInputLock
protected NPLProgramIfc nplProgram
protected RuntimeState currentState
protected StateFreezeHelper freezeHelper
protected boolean fileLevelTransaction
protected java.lang.String currentTransactionId
public NPLFieldProcessor(java.lang.Class outputDataType,
LoggerIfc inLogger,
java.lang.String scratchDir,
java.lang.String fileName)
throws NodeProcessingException
constructor.outputDataType - Class of Objects that this NPLFieldProcessor will produceinLogger - Object that will be used for logging messages from this
NPLFieldProcessor.scratchDir - Directory to write out records containingfileName - Either the name of the NPL text file or the precompiled
NPLProgram class file to useNodeProcessingExceptionpublic NPLFieldProcessor(java.lang.Class outputDataType,
LoggerIfc inLogger,
java.lang.String scratchDir,
java.lang.String fileName,
IDCMethodHandler methodHandler)
throws NodeProcessingException
outputDataType - Class of Objects that this NPLFieldProcessor will produceinLogger - Object that will be used for logging messages from this
NPLFieldProcessor.scratchDir - Directory to write out records containing errorsfileName - Either the name of the NPL text file or the precompiled
NPLProgram class file to usmethodHandler - An instance of the IDCMethodHandler interface to give to the
NPL Program.NodeProcessingExceptionpublic NPLFieldProcessor(java.lang.Class outputDataType,
LoggerIfc inLogger,
java.lang.String scratchDir,
java.lang.String fileName,
IDCMethodHandler methodHandler,
boolean isFileLevelTransaction)
throws NodeProcessingException
outputDataType - Class of Objects that this NPLFieldProcessor will produceinLogger - Object that will be used for logging messages from this
NPLFieldProcessor.scratchDir - Directory to write out records containing errorsfileName - Either the name of the NPL text file or the precompiled
NPLProgram class file to usmethodHandler - An instance of the IDCMethodHandler interface to give to the
NPL Program.isFileLevelTransaction - Specifies if this field processor can be used in File level transactionNodeProcessingExceptionpublic NPLFieldProcessor(java.lang.Class outputDataType,
LoggerIfc inLogger,
java.lang.String scratchDir,
java.lang.String fileName,
boolean isFileLeveTranasction)
throws NodeProcessingException
constructor.outputDataType - Class of Objects that this NPLFieldProcessor will produceinLogger - Object that will be used for logging messages from this
NPLFieldProcessor.scratchDir - Directory to write out records containingfileName - Either the name of the NPL text file or the precompiled
NPLProgram class file to useisFileLevelTransaction - Specifies if this field processor can be used in File level transactionNodeProcessingExceptionpublic void run()
run in interface java.lang.Runnablerun in class DCFieldProcessorpublic void shutdown()
shutdown in class DCFieldProcessorpublic boolean isDataAvailable()
DataProviderIfcisDataAvailable in interface DataProviderIfcisDataAvailable in class DCFieldProcessortrue, if data is availablepublic DCFieldContainer getData()
DataProviderIfcgetData in interface DataProviderIfcgetData in class DCFieldProcessorpublic DCFieldContainer[] getBulkData()
DataProviderIfcgetBulkData in interface DataProviderIfcpublic void setDataReceiver(DataReceiverIfc rec)
DataProviderIfcsetDataReceiver in interface DataProviderIfcsetDataReceiver in class DCFieldProcessorrec - Object which will obtain data from this
DataProviderpublic void dataIsAvailable()
DataReceiverIfcdataIsAvailable in interface DataReceiverIfcdataIsAvailable in class DCFieldProcessorpublic void processData(DCFieldContainer inputData) throws NodeProcessingException
DataReceiverIfcprocessData in interface DataReceiverIfcprocessData in class DCFieldProcessorNodeProcessingExceptionpublic boolean processFileData(DCFieldContainer inputData) throws NodeProcessingException, FileRejectException
DCFieldProcessorprocessFileData in interface FileDataReceiverIfcprocessFileData in class DCFieldProcessortrue, if data is processed successfullyNodeProcessingExceptionFileRejectExceptionpublic void processData(DCFieldContainer[] inputData) throws NodeProcessingException
DataReceiverIfcprocessData in interface DataReceiverIfcNodeProcessingExceptionpublic boolean processFileData(DCFieldContainer[] inputData) throws NodeProcessingException
DCFieldProcessorprocessFileData in interface FileDataReceiverIfcprocessFileData in class DCFieldProcessortrue, if data is processed successfullyNodeProcessingExceptionprotected LoggerIfc getLogger()
protected NPLProgramIfc getNPLProgram()
protected void setRunning(boolean run)
protected boolean isRunning()
protected void setShutdown(boolean stop)
protected boolean isShutdown()
public long getSleepTime()
public void setSleepTime(long timerValue)
timerValue - value for the sleep timer, default is 1 minute (100000).public boolean isShutdownOnError()
public void setShutdownOnError(boolean value)
falsepublic void setBulkProcessing(boolean bulk)
setBulkProcessing in class DCFieldProcessorbulk - True, if bulk processing is desiredpublic boolean isBulkProcessing()
public void setMultiThreadConfig(boolean mtChecked,
boolean mtOrderChecked,
int totalThreads)
setMultiThreadConfig in class DCFieldProcessorpublic void setPollForData()
setPollForData in class DCFieldProcessorpublic boolean getPollForData()
getPollForData in class DCFieldProcessorprotected void handleProcessingException(DCFieldContainer dcfc, java.lang.Exception ex)
protected void handleProcessingException(DCFieldContainer dcfc)
protected void handleProcessingException(DCFieldContainer[] dcfcs)
protected boolean writeToError(DCFieldContainer data)
protected boolean writeToError(DCFieldContainer[] data)
public void setProcessingData(boolean value)
public java.lang.String getNPLFileName()
public void setNPLFileName(java.lang.String fileName)
throws NodeProcessingException
NodeProcessingExceptionpublic java.util.ArrayList getInputFields()
ArrayList
are actually other ArrayLists, one for each input
record. The elements of these ArrayLists are
FieldDescriptor objects, one for each field in the
input record.public java.util.ArrayList getOutputFields()
ArrayList are actually other ArrayList
s, one for each output record. The elements of these
ArrayLists are FieldDescriptor objects,
one for each field in the output record.public java.util.ArrayList getExposedFields(java.lang.String reason)
reason - Reason the fields are being exposed.ArrayList are FieldDescriptor objects,
one for each field in the expose clause matching the reason
provided.public java.lang.String getConfigValue(java.lang.String key)
key - Configuration attribute to get the value of.public int getIntConfigValue(java.lang.String key)
key - Configuration attribute to get the value of.public IDCMethodHandler getMethodHandler(java.lang.String name)
name - name of method handler to getpublic void freezeState(Callback freezeCallback)
freezeState in interface StateFreezablefreezeCallback - Object to notify when the processing has been frozen.public void unfreezeState()
unfreezeState in interface StateFreezablepublic boolean isFileLevelTransaction()
public void handleRejectOfFile()
FileDataProviderIfchandleRejectOfFile in interface FileDataProviderIfchandleRejectOfFile in class DCFieldProcessorpublic boolean isRejected()
public void setTransactionID(java.lang.String tID)
setTransactionID in interface FileDataReceiverIfcsetTransactionID in class DCFieldProcessor