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 RuntimeState
State-related membersprotected String
protected boolean
protected StateFreezeHelper
protected LoggerIfc
Object to use to log messagesprotected NPLProgramIfc
protected Object
Used 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 TypeMethodDescriptionvoid
Allows a DataProvider to indicate that some data is available for processingvoid
freezeState
(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.int
getIntConfigValue
(String key) Gets the value of a configuration attribute.protected LoggerIfc
Returns 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 NPLProgramIfc
Returns the NPLProgramIfc object used by this field processorGets a list of the output fields defined in the output records.boolean
long
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
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
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
void
To handle the remaining input files when there is reject of a fileboolean
Indicates whether this NPLFieldProcessor is retrieving and processing the DCFieldContainers individually or in bulk.boolean
Allows a DataReceiver to determine whether some data is available for processingboolean
boolean
protected boolean
Indicates whether this NPLFieldProcessor is runningprotected boolean
Indicates whether this NPLFieldProcessor has been shutdownboolean
Indicates whether this NPLFieldProcessor should shutdown upon encountering an error during processingvoid
processData
(DCFieldContainer inputData) Manipulates the data provided by its DataProvidervoid
processData
(DCFieldContainer[] inputData) Manipulates the set of data provided by its DataProvidervoid
processData
(DCFieldContainer inputData, 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
Sets the object to which this DataProvider will send its data.void
setMultiThreadConfig
(boolean mtChecked, boolean mtOrderChecked, int totalThreads) void
setNPLFileName
(String fileName) void
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 runningprotected void
setShutdown
(boolean stop) Sets the boolean which indicates whether the field processor has been shutdownvoid
setShutdownOnError
(boolean value) Indicates whether this NPLFieldProcessor should shutdown upon encountering an error during processing default value isfalse
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
(String tID) void
shutdown()
Performs all steps necessary to gracefully stop this FieldProcessor.void
Used by the StateManager thread to resume the processing previously halted.protected boolean
writeToError
(DCFieldContainer data) Appends records containing errors to an output fileprotected boolean
writeToError
(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:
run
in interfaceRunnable
- Specified by:
run
in classDCFieldProcessor
-
shutdown
public void shutdown()Performs all steps necessary to gracefully stop this FieldProcessor.- Specified by:
shutdown
in classDCFieldProcessor
-
isDataAvailable
public boolean isDataAvailable()Description copied from interface:DataProviderIfc
Allows a DataReceiver to determine whether some data is available for processing- Specified by:
isDataAvailable
in interfaceDataProviderIfc
- Specified by:
isDataAvailable
in classDCFieldProcessor
- Returns:
true
, if data is available
-
getData
Description copied from interface:DataProviderIfc
Allows a DataReceiver to obtain the available data in a known format.- Specified by:
getData
in interfaceDataProviderIfc
- Specified by:
getData
in classDCFieldProcessor
- Returns:
- DCFieldContainer object containing the data that is available for processing
-
getBulkData
Description copied from interface:DataProviderIfc
Allows a DataReceiver to obtain the available data in a known format.- Specified by:
getBulkData
in interfaceDataProviderIfc
- Returns:
- DCFieldContainer object array, containing the data that is for processing
-
setDataReceiver
Description copied from interface:DataProviderIfc
Sets the object to which this DataProvider will send its data.- Specified by:
setDataReceiver
in interfaceDataProviderIfc
- Overrides:
setDataReceiver
in classDCFieldProcessor
- Parameters:
rec
- Object which will obtain data from this DataProvider
-
dataIsAvailable
public void dataIsAvailable()Description copied from interface:DataReceiverIfc
Allows a DataProvider to indicate that some data is available for processing- Specified by:
dataIsAvailable
in interfaceDataReceiverIfc
- Specified by:
dataIsAvailable
in classDCFieldProcessor
-
processData
Description copied from interface:DataReceiverIfc
Manipulates the data provided by its DataProvider- Specified by:
processData
in interfaceDataReceiverIfc
- Specified by:
processData
in classDCFieldProcessor
- Throws:
NodeProcessingException
-
processData
- Throws:
NodeProcessingException
-
processFileData
public boolean processFileData(DCFieldContainer inputData) throws NodeProcessingException, FileRejectException Description copied from class:DCFieldProcessor
This is just a dummy implementation, any field processor needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
processFileData
in interfaceFileDataReceiverIfc
- Overrides:
processFileData
in classDCFieldProcessor
- Returns:
true
, if data is processed successfully- Throws:
NodeProcessingException
FileRejectException
-
processData
Description copied from interface:DataReceiverIfc
Manipulates the set of data provided by its DataProvider- Specified by:
processData
in interfaceDataReceiverIfc
- Throws:
NodeProcessingException
-
processFileData
Description copied from class:DCFieldProcessor
This is just a dummy implementation, any field processor needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
processFileData
in interfaceFileDataReceiverIfc
- Overrides:
processFileData
in 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:
setBulkProcessing
in 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:
setMultiThreadConfig
in classDCFieldProcessor
-
setbulkIOConfig
public void setbulkIOConfig(boolean bulkio) - Overrides:
setbulkIOConfig
in classDCFieldProcessor
-
setPollForData
public void setPollForData()- Overrides:
setPollForData
in classDCFieldProcessor
-
getPollForData
public boolean getPollForData()- Overrides:
getPollForData
in 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
ArrayList
are actually otherArrayList
s, one for each input record. The elements of theseArrayList
s areFieldDescriptor
objects, 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
ArrayList
are actually otherArrayList
s, one for each output record. The elements of theseArrayList
s areFieldDescriptor
objects, 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
ArrayList
areFieldDescriptor
objects, 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:
freezeState
in 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:
unfreezeState
in interfaceStateFreezable
-
isFileLevelTransaction
public boolean isFileLevelTransaction() -
handleRejectOfFile
public void handleRejectOfFile()Description copied from interface:FileDataProviderIfc
To handle the remaining input files when there is reject of a file- Specified by:
handleRejectOfFile
in interfaceFileDataProviderIfc
- Overrides:
handleRejectOfFile
in classDCFieldProcessor
-
isRejected
public boolean isRejected() -
setTransactionID
- Specified by:
setTransactionID
in interfaceFileDataReceiverIfc
- Overrides:
setTransactionID
in classDCFieldProcessor
-