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
|
void |
processData(DCFieldContainer inputData,
java.lang.String eof) |
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 |
setbulkIOConfig(boolean bulkio) |
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, getCurrArchFile, getData, getDataProvider, getDataReceiver, getDiscardedCounter, getFileBulkData, getFileData, getFileDataProvider, getFileDataReceiver, getOutputType, getProcessedArchFile, isEndOfFile, isFileDataAvailable, isStartOfFile, openInputFile, processEndOfFileData, processRejectFile, processStartOfFileData, rejectFile, removeProcessedFile, setDataProvider, setDiscardedCounter, setFileDataProvider, setFileDataReceiver, setOutputType, setProcessedArchFile, signalBatchCompletion, validOIMinorType
protected 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 useNodeProcessingException
public 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.NodeProcessingException
public 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 transactionNodeProcessingException
public 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 transactionNodeProcessingException
public void run()
run
in interface java.lang.Runnable
run
in class DCFieldProcessor
public void shutdown()
shutdown
in class DCFieldProcessor
public boolean isDataAvailable()
DataProviderIfc
isDataAvailable
in interface DataProviderIfc
isDataAvailable
in class DCFieldProcessor
true
, if data is availablepublic DCFieldContainer getData()
DataProviderIfc
getData
in interface DataProviderIfc
getData
in class DCFieldProcessor
public DCFieldContainer[] getBulkData()
DataProviderIfc
getBulkData
in interface DataProviderIfc
public void setDataReceiver(DataReceiverIfc rec)
DataProviderIfc
setDataReceiver
in interface DataProviderIfc
setDataReceiver
in class DCFieldProcessor
rec
- Object which will obtain data from this
DataProviderpublic void dataIsAvailable()
DataReceiverIfc
dataIsAvailable
in interface DataReceiverIfc
dataIsAvailable
in class DCFieldProcessor
public void processData(DCFieldContainer inputData) throws NodeProcessingException
DataReceiverIfc
processData
in interface DataReceiverIfc
processData
in class DCFieldProcessor
NodeProcessingException
public void processData(DCFieldContainer inputData, java.lang.String eof) throws NodeProcessingException
NodeProcessingException
public boolean processFileData(DCFieldContainer inputData) throws NodeProcessingException, FileRejectException
DCFieldProcessor
processFileData
in interface FileDataReceiverIfc
processFileData
in class DCFieldProcessor
true
, if data is processed successfullyNodeProcessingException
FileRejectException
public void processData(DCFieldContainer[] inputData) throws NodeProcessingException
DataReceiverIfc
processData
in interface DataReceiverIfc
NodeProcessingException
public boolean processFileData(DCFieldContainer[] inputData) throws NodeProcessingException
DCFieldProcessor
processFileData
in interface FileDataReceiverIfc
processFileData
in class DCFieldProcessor
true
, if data is processed successfullyNodeProcessingException
protected 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)
false
public void setBulkProcessing(boolean bulk)
setBulkProcessing
in class DCFieldProcessor
bulk
- True
, if bulk processing is desiredpublic boolean isBulkProcessing()
public void setMultiThreadConfig(boolean mtChecked, boolean mtOrderChecked, int totalThreads)
setMultiThreadConfig
in class DCFieldProcessor
public void setbulkIOConfig(boolean bulkio)
setbulkIOConfig
in class DCFieldProcessor
public void setPollForData()
setPollForData
in class DCFieldProcessor
public boolean getPollForData()
getPollForData
in class DCFieldProcessor
protected 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
NodeProcessingException
public java.util.ArrayList getInputFields()
ArrayList
are actually other ArrayList
s, one for each input
record. The elements of these ArrayList
s 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
ArrayList
s 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 StateFreezable
freezeCallback
- Object to notify when the processing has been frozen.public void unfreezeState()
unfreezeState
in interface StateFreezable
public boolean isFileLevelTransaction()
public void handleRejectOfFile()
FileDataProviderIfc
handleRejectOfFile
in interface FileDataProviderIfc
handleRejectOfFile
in class DCFieldProcessor
public boolean isRejected()
public void setTransactionID(java.lang.String tID)
setTransactionID
in interface FileDataReceiverIfc
setTransactionID
in class DCFieldProcessor