Package com.nt.udc.ndk.node
Class GenericFlatFileProcessor
java.lang.Object
com.nt.udc.ndk.node.EITransport
com.nt.udc.ei.transport.FileEITransport
com.nt.udc.ndk.node.GenericFlatFileProcessor
- All Implemented Interfaces:
DataProviderIfc
,DCTransport
,FileDataProviderIfc
,Runnable
- Direct Known Subclasses:
FlatFileEIProcessor
,KnownFieldLengthFileProcessor
This is an abstract class that should be extended when
a new type of flat file processing node is requrired
- Since:
- JDK1.3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected File
protected com.nt.common.util.PosLineReader
protected boolean
protected String
protected static final String
protected static final String
protected FileInputStream
protected String
protected boolean
This flag specifies if CRLF is active as a line delimiter.protected boolean
This flag specifies if CR is active as a line delimiter.protected boolean
This flag specifies if LF is active as a line delimiter.protected long
static final String
static final String
protected String
protected DCEIRecord
Use one DCEIRecord for all data processing.protected RandomAccessFile
protected File
protected static final String
Fields inherited from class com.nt.udc.ei.transport.FileEITransport
DEFAULT_POLLING_INTERVAL, DELETE_LOCAL_FILES, deleteLocalFiles, fileLevelTransaction, fileSeqCheck, fsChecked, ioLock, isOrdered, itsFileSuffix, localDir, logger, mtChecked, MULTI_THREADED, ORDER_REQUIRED, POLLING_INTERVAL, scratchDir, useSynchronizedDirectory
Fields inherited from class com.nt.udc.ndk.node.EITransport
dataReceiver, fdChecked, filedataReceiver, fileduplicateCheck, fileToProcess, inputCount, lockFile, movedFile, node, pollingInterval, processing, processingData, running
-
Constructor Summary
ConstructorsConstructorDescriptionGenericFlatFileProcessor
(DCNode node, SynchronizedDirectory sd, String suffix, com.nt.common.util.SMGLock lock) Use this constructor when using FTP to retrieve the accounting files that need to be processed.GenericFlatFileProcessor
(DCNode node, File localdir, String suffix, com.nt.common.util.SMGLock lock) Use this constructor when the accounting files are pushed to a local directory by an outside source. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Parses a line of text (the file header) for the field names.protected void
This method is used to initialize the line delimiters, which consist of combinations of CR, LF and CRLF.protected void
processFiles
(Vector filesToProcess) Here's where we actually parse the files and extract the data of interest.protected void
processFilesOrdered
(File currFile) protected boolean
Processes scratch files in case of a abnormal shutdown.protected abstract void
processTheRecord
(String rawRecord) This call process the record.protected void
setRecordType
(DCEIRecord rec) This call is used to set the specific object type used to process the individual records that have been read in from a flat file.protected void
This skips ahead in the last file being processed before termination.protected void
This code should be overridden by nodes which are processing data which does not have a header record.Methods inherited from class com.nt.udc.ei.transport.FileEITransport
deleteLocalFiles, getActFilter, getBulkData, getData, getInputBackupDir, getLength, isDataAvailable, isHealthy, isLessThan, moveCurrentFileToBackUp, readLength, run, setActFilter, setDubCheckObj, setDupCheckFlag, setSeqCheckFlag, setSeqCheckObj, shutdown, sortFiles, writeLength, writeLength
Methods inherited from class com.nt.udc.ndk.node.EITransport
getCurrArchFile, getData, getDataReceiver, getDubCheckObj, getDupCheckFlag, getFileBulkData, getFileData, getFileDataReceiver, getFileList, getMovedFileStatus, getNode, getPollingInterval, getProcessedArchFile, handleRejectOfFile, incrementIn, incrementIn, isEndOfFile, isFileDataAvailable, isProcessing, isProcessingData, isStartOfFile, openInputFile, rejectFile, removeProcessedFile, setCountsSuspect, setDataReceiver, setFileDataReceiver, setFileToProcess, setMovedFileStatus, setNode, setPollingInterval, setProcessedArchFile, setProcessing, signalBatchCompletion, validOIMinorType
-
Field Details
-
debug
protected boolean debug -
PROCESSED_FILE_PREFIX
- See Also:
-
PROCESSED_FILE_SUFFIX
- See Also:
-
INPUT_BACKUP_DIR
- See Also:
-
record
Use one DCEIRecord for all data processing. This field should be set using the setRecordType call by the concrete class that is extending this class. -
m_bCRTerminatorEnabled
protected boolean m_bCRTerminatorEnabledThis flag specifies if CR is active as a line delimiter. -
m_bLFTerminatorEnabled
protected boolean m_bLFTerminatorEnabledThis flag specifies if LF is active as a line delimiter. -
m_bCRLFTerminatorEnabled
protected boolean m_bCRLFTerminatorEnabledThis flag specifies if CRLF is active as a line delimiter. -
actfile
-
inputStream
-
br
protected com.nt.common.util.PosLineReader br -
lineOfText
-
fileName
-
rawHeader
-
numBytes
protected long numBytes -
scratchFile
-
recoveryFile
-
FILENAME_NAR_ID
- See Also:
-
UNICODE_TRANSFORMATION_FORMAT
- See Also:
-
-
Constructor Details
-
GenericFlatFileProcessor
public GenericFlatFileProcessor(DCNode node, File localdir, String suffix, com.nt.common.util.SMGLock lock) throws NodeStartException Use this constructor when the accounting files are pushed to a local directory by an outside source.- Parameters:
node
- The EI node which is using this class.localdir
- The local directory where the target files can be foundsuffix
- The file suffix used to identify the files that need to be processed (can be null if you want to process all files in the directory)- Throws:
NodeStartException
- Used to signal the EI Node that there was a problem getting things going
-
GenericFlatFileProcessor
public GenericFlatFileProcessor(DCNode node, SynchronizedDirectory sd, String suffix, com.nt.common.util.SMGLock lock) throws NodeStartException Use this constructor when using FTP to retrieve the accounting files that need to be processed.- Parameters:
node
- The EI node which is using this class.sd
- The representation of the local directory where the target files can be foundsuffix
- The file suffix used to identify the files that need to be processed (can be null if you want to process all files in the directory)lock
-- Throws:
NodeStartException
- Used to signal the EI Node that there was a problem getting things going
-
-
Method Details
-
processFiles
Here's where we actually parse the files and extract the data of interest.- Specified by:
processFiles
in classFileEITransport
- Parameters:
filesToProcess
- list of filenames that need to be processed
-
processFilesOrdered
-
processTheRecord
This call process the record. Classes derived from this type should override this method to use there own record processing class.- Parameters:
String
- rawRecord The raw unprocessed data record.
-
setRecordType
This call is used to set the specific object type used to process the individual records that have been read in from a flat file. -
processScratchFile
protected boolean processScratchFile()Processes scratch files in case of a abnormal shutdown. -
skipAhead
protected void skipAhead()This skips ahead in the last file being processed before termination. This should be overridden for record types the don't have a header record. -
skipHeader
protected void skipHeader()This code should be overridden by nodes which are processing data which does not have a header record. Just declare a member that does nothing. -
getHeader
Parses a line of text (the file header) for the field names. -
initLineTerminators
protected void initLineTerminators()This method is used to initialize the line delimiters, which consist of combinations of CR, LF and CRLF. By default, all are active.
-