Package com.nt.udc.ndk.node
Class NPLFieldProcessor
java.lang.Object
com.nt.udc.ndk.node.DCFieldProcessor
com.nt.udc.ndk.node.NPLFieldProcessor
- All Implemented Interfaces:
DataProviderIfc,DataReceiverIfc,FileDataProviderIfc,FileDataReceiverIfc,StateFreezable,Runnable
- Direct Known Subclasses:
FlexibleAggregatorFieldProcessor,HCDeDupFieldProcessor,JDBCOIFieldProcessor,MXNPLFieldProcessor,Sol42FieldProcessor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RuntimeStateState-related membersprotected Stringprotected booleanprotected StateFreezeHelperprotected LoggerIfcObject to use to log messagesprotected NPLProgramIfcprotected ObjectUsed to pause the processing when waiting for more input -
Constructor Summary
ConstructorsConstructorDescriptionNPLFieldProcessor(Class outputDataType, LoggerIfc inLogger, String scratchDir, String fileName) Calls parent'sconstructor.NPLFieldProcessor(Class outputDataType, LoggerIfc inLogger, String scratchDir, String fileName, boolean isFileLeveTranasction) Calls parent'sconstructor.NPLFieldProcessor(Class outputDataType, LoggerIfc inLogger, String scratchDir, String fileName, IDCMethodHandler methodHandler) Calls other constructor with 4 parameters, and then sets the methodHandler that will be used by the NPLProgram.NPLFieldProcessor(Class outputDataType, LoggerIfc inLogger, String scratchDir, String fileName, IDCMethodHandler methodHandler, boolean isFileLevelTransaction) Calls other constructor with 4 parameters, and then sets the methodHandler that will be used by the NPLProgram. -
Method Summary
Modifier and TypeMethodDescriptionvoidAllows a DataProvider to indicate that some data is available for processingvoidfreezeState(Callback freezeCallback) Used by the StateManager thread to halt the processing while the state of the node is saved.Allows a DataReceiver to obtain the available data in a known format.getConfigValue(String key) Gets the value of a configuration attribute.getData()Allows a DataReceiver to obtain the available data in a known format.getExposedFields(String reason) Gets a list of the fields defined in the expose clause for the reason provided.Gets a list of the input fields defined in the input records.intgetIntConfigValue(String key) Gets the value of a configuration attribute.protected LoggerIfcReturns the LoggerIfc object used by this class to record log messagesgetMethodHandler(String name) Returns the method handler with the specified name that is being used by this field processor's NPL program.protected NPLProgramIfcReturns the NPLProgramIfc object used by this field processorGets a list of the output fields defined in the output records.booleanlongReturns the amount of time, in milliseconds, that will elapse before this NPLFieldProcessor will check for data to process, if it is running.protected voidWrites 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 voidWrites 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 voidvoidTo handle the remaining input files when there is reject of a filebooleanIndicates whether this NPLFieldProcessor is retrieving and processing the DCFieldContainers individually or in bulk.booleanAllows a DataReceiver to determine whether some data is available for processingbooleanbooleanprotected booleanIndicates whether this NPLFieldProcessor is runningprotected booleanIndicates whether this NPLFieldProcessor has been shutdownbooleanIndicates whether this NPLFieldProcessor should shutdown upon encountering an error during processingvoidprocessData(DCFieldContainer inputData) Manipulates the data provided by its DataProvidervoidprocessData(DCFieldContainer[] inputData) Manipulates the set of data provided by its DataProvidervoidprocessData(DCFieldContainer inputData, String eof) booleanprocessFileData(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.booleanprocessFileData(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.voidrun()voidsetbulkIOConfig(boolean bulkio) voidsetBulkProcessing(boolean bulk) Sets the boolean which indicates whether the field processor will the retrieve and process the DCFieldContainers individually or in bulk.voidSets the object to which this DataProvider will send its data.voidsetMultiThreadConfig(boolean mtChecked, boolean mtOrderChecked, int totalThreads) voidsetNPLFileName(String fileName) voidvoidsetProcessingData(boolean value) Sets the boolean indicating whether the field processor is currently processing data.protected voidsetRunning(boolean run) Sets the boolean which indicates whether the field processor is runningprotected voidsetShutdown(boolean stop) Sets the boolean which indicates whether the field processor has been shutdownvoidsetShutdownOnError(boolean value) Indicates whether this NPLFieldProcessor should shutdown upon encountering an error during processing default value isfalsevoidsetSleepTime(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.voidsetTransactionID(String tID) voidshutdown()Performs all steps necessary to gracefully stop this FieldProcessor.voidUsed by the StateManager thread to resume the processing previously halted.protected booleanwriteToError(DCFieldContainer data) Appends records containing errors to an output fileprotected booleanwriteToError(DCFieldContainer[] data) Appends records containing errors to an output fileMethods inherited from class com.nt.udc.ndk.node.DCFieldProcessor
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
-
Field Details
-
logger
Object to use to log messages -
waitForInputLock
Used to pause the processing when waiting for more input -
nplProgram
-
currentState
State-related members -
freezeHelper
-
fileLevelTransaction
protected boolean fileLevelTransaction -
currentTransactionId
-
-
Constructor Details
-
NPLFieldProcessor
public NPLFieldProcessor(Class outputDataType, LoggerIfc inLogger, String scratchDir, String fileName) throws NodeProcessingException Calls parent'sconstructor.- Parameters:
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 use- Throws:
NodeProcessingException
-
NPLFieldProcessor
public NPLFieldProcessor(Class outputDataType, LoggerIfc inLogger, String scratchDir, String fileName, IDCMethodHandler methodHandler) throws NodeProcessingException Calls other constructor with 4 parameters, and then sets the methodHandler that will be used by the NPLProgram.- Parameters:
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.- Throws:
NodeProcessingException
-
NPLFieldProcessor
public NPLFieldProcessor(Class outputDataType, LoggerIfc inLogger, String scratchDir, String fileName, IDCMethodHandler methodHandler, boolean isFileLevelTransaction) throws NodeProcessingException Calls other constructor with 4 parameters, and then sets the methodHandler that will be used by the NPLProgram.- Parameters:
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 transaction- Throws:
NodeProcessingException
-
NPLFieldProcessor
public NPLFieldProcessor(Class outputDataType, LoggerIfc inLogger, String scratchDir, String fileName, boolean isFileLeveTranasction) throws NodeProcessingException Calls parent'sconstructor.- Parameters:
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 transaction- Throws:
NodeProcessingException
-
-
Method Details
-
run
public void run()- Specified by:
runin interfaceRunnable- Specified by:
runin classDCFieldProcessor
-
shutdown
public void shutdown()Performs all steps necessary to gracefully stop this FieldProcessor.- Specified by:
shutdownin classDCFieldProcessor
-
isDataAvailable
public boolean isDataAvailable()Description copied from interface:DataProviderIfcAllows a DataReceiver to determine whether some data is available for processing- Specified by:
isDataAvailablein interfaceDataProviderIfc- Specified by:
isDataAvailablein classDCFieldProcessor- Returns:
true, if data is available
-
getData
Description copied from interface:DataProviderIfcAllows a DataReceiver to obtain the available data in a known format.- Specified by:
getDatain interfaceDataProviderIfc- Specified by:
getDatain classDCFieldProcessor- Returns:
- DCFieldContainer object containing the data that is available for processing
-
getBulkData
Description copied from interface:DataProviderIfcAllows a DataReceiver to obtain the available data in a known format.- Specified by:
getBulkDatain interfaceDataProviderIfc- Returns:
- DCFieldContainer object array, containing the data that is for processing
-
setDataReceiver
Description copied from interface:DataProviderIfcSets the object to which this DataProvider will send its data.- Specified by:
setDataReceiverin interfaceDataProviderIfc- Overrides:
setDataReceiverin classDCFieldProcessor- Parameters:
rec- Object which will obtain data from this DataProvider
-
dataIsAvailable
public void dataIsAvailable()Description copied from interface:DataReceiverIfcAllows a DataProvider to indicate that some data is available for processing- Specified by:
dataIsAvailablein interfaceDataReceiverIfc- Specified by:
dataIsAvailablein classDCFieldProcessor
-
processData
Description copied from interface:DataReceiverIfcManipulates the data provided by its DataProvider- Specified by:
processDatain interfaceDataReceiverIfc- Specified by:
processDatain classDCFieldProcessor- Throws:
NodeProcessingException
-
processData
- Throws:
NodeProcessingException
-
processFileData
public boolean processFileData(DCFieldContainer inputData) throws NodeProcessingException, FileRejectException Description copied from class:DCFieldProcessorThis is just a dummy implementation, any field processor needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
processFileDatain interfaceFileDataReceiverIfc- Overrides:
processFileDatain classDCFieldProcessor- Returns:
true, if data is processed successfully- Throws:
NodeProcessingExceptionFileRejectException
-
processData
Description copied from interface:DataReceiverIfcManipulates the set of data provided by its DataProvider- Specified by:
processDatain interfaceDataReceiverIfc- Throws:
NodeProcessingException
-
processFileData
Description copied from class:DCFieldProcessorThis is just a dummy implementation, any field processor needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
processFileDatain interfaceFileDataReceiverIfc- Overrides:
processFileDatain classDCFieldProcessor- Returns:
true, if data is processed successfully- Throws:
NodeProcessingException
-
getLogger
Returns the LoggerIfc object used by this class to record log messages- Returns:
- The LoggerIfc object used by this field processor
-
getNPLProgram
Returns the NPLProgramIfc object used by this field processor- Returns:
- The NPLProgramIfc object used by this field processor
-
setRunning
protected void setRunning(boolean run) Sets the boolean which indicates whether the field processor is running -
isRunning
protected boolean isRunning()Indicates whether this NPLFieldProcessor is running -
setShutdown
protected void setShutdown(boolean stop) Sets the boolean which indicates whether the field processor has been shutdown -
isShutdown
protected boolean isShutdown()Indicates whether this NPLFieldProcessor has been shutdown -
getSleepTime
public 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.- Returns:
- sleep timer value, default is 1 minute (100000).
-
setSleepTime
public 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.- Parameters:
timerValue- value for the sleep timer, default is 1 minute (100000).
-
isShutdownOnError
public boolean isShutdownOnError()Indicates whether this NPLFieldProcessor should shutdown upon encountering an error during processing -
setShutdownOnError
public void setShutdownOnError(boolean value) Indicates whether this NPLFieldProcessor should shutdown upon encountering an error during processing default value isfalse -
setBulkProcessing
public void setBulkProcessing(boolean bulk) Sets the boolean which indicates whether the field processor will the retrieve and process the DCFieldContainers individually or in bulk.- Overrides:
setBulkProcessingin classDCFieldProcessor- Parameters:
bulk-True, if bulk processing is desired
-
isBulkProcessing
public boolean isBulkProcessing()Indicates whether this NPLFieldProcessor is retrieving and processing the DCFieldContainers individually or in bulk. -
setMultiThreadConfig
public void setMultiThreadConfig(boolean mtChecked, boolean mtOrderChecked, int totalThreads) - Overrides:
setMultiThreadConfigin classDCFieldProcessor
-
setbulkIOConfig
public void setbulkIOConfig(boolean bulkio) - Overrides:
setbulkIOConfigin classDCFieldProcessor
-
setPollForData
public void setPollForData()- Overrides:
setPollForDatain classDCFieldProcessor
-
getPollForData
public boolean getPollForData()- Overrides:
getPollForDatain classDCFieldProcessor
-
handleProcessingException
-
handleProcessingException
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. -
handleProcessingException
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. -
writeToError
Appends records containing errors to an output file -
writeToError
Appends records containing errors to an output file -
setProcessingData
public void setProcessingData(boolean value) Sets the boolean indicating whether the field processor is currently processing data. -
getNPLFileName
-
setNPLFileName
- Throws:
NodeProcessingException
-
getInputFields
Gets a list of the input fields defined in the input records.- Returns:
- List of input fields. The elements in this
ArrayListare actually otherArrayLists, one for each input record. The elements of theseArrayLists areFieldDescriptorobjects, one for each field in the input record.
-
getOutputFields
Gets a list of the output fields defined in the output records.- Returns:
- List of output fields. The elements in this
ArrayListare actually otherArrayLists, one for each output record. The elements of theseArrayLists areFieldDescriptorobjects, one for each field in the output record.
-
getExposedFields
Gets a list of the fields defined in the expose clause for the reason provided.- Parameters:
reason- Reason the fields are being exposed.- Returns:
- List of exposed fields. The elements in the
ArrayListareFieldDescriptorobjects, one for each field in the expose clause matching the reason provided.
-
getConfigValue
Gets the value of a configuration attribute.- Parameters:
key- Configuration attribute to get the value of.- Returns:
- Value of the attribute. Returns null if the attribute does not exist.
-
getIntConfigValue
Gets the value of a configuration attribute.- Parameters:
key- Configuration attribute to get the value of.- Returns:
- Value of the attribute. Returns -1 if the attribute does not exist.
-
getMethodHandler
Returns the method handler with the specified name that is being used by this field processor's NPL program. Use the name "Java" to retrieve the method handler imported by NPL. For method handlers declared using the JavaHook declaration, use the name given to identify the method handler in the JavaHook declaration.- Parameters:
name- name of method handler to get- Returns:
- method handler with given name or null if no method handler with given name
-
freezeState
Used by the StateManager thread to halt the processing while the state of the node is saved.- Specified by:
freezeStatein interfaceStateFreezable- Parameters:
freezeCallback- Object to notify when the processing has been frozen.
-
unfreezeState
public void unfreezeState()Used by the StateManager thread to resume the processing previously halted.- Specified by:
unfreezeStatein interfaceStateFreezable
-
isFileLevelTransaction
public boolean isFileLevelTransaction() -
handleRejectOfFile
public void handleRejectOfFile()Description copied from interface:FileDataProviderIfcTo handle the remaining input files when there is reject of a file- Specified by:
handleRejectOfFilein interfaceFileDataProviderIfc- Overrides:
handleRejectOfFilein classDCFieldProcessor
-
isRejected
public boolean isRejected() -
setTransactionID
- Specified by:
setTransactionIDin interfaceFileDataReceiverIfc- Overrides:
setTransactionIDin classDCFieldProcessor
-