Package com.nt.udc.ndk.node
Class EITransport
java.lang.Object
com.nt.udc.ndk.node.EITransport
- All Implemented Interfaces:
DataProviderIfc
,DCTransport
,FileDataProviderIfc
,Runnable
- Direct Known Subclasses:
FileEITransport
,FileEITransport
,FtpEITransport
,GenericUdpEITransport
,IPDRTransport
,JDBCEITransport
,OpenFileEITransport
,SoapXmlEITransport
,Sol42EITransport
,TcpEITransport
,UdpEITransport
,XMLTransport
public abstract class EITransport
extends Object
implements DCTransport, DataProviderIfc, FileDataProviderIfc
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DataReceiverIfc
Reference to the DataReceiver of the transport.boolean
protected FileDataReceiverIfc
Reference to the FileDataReceiver of the transport.protected File
protected InputStatisticsMonitorIfc
Input record count object.protected boolean
protected DCNode
Reference to theEINode
to which the transport is associated.protected long
Time interval at which the node will check for data.protected boolean
protected boolean
protected boolean
Indicates whether the transport is running. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DCFieldContainer[]
This method is used by the DataReceiver to fetch a set of DCFieldContainer objects.Allows a DataReceiver to obtain the currently processing .arch fileabstract DCFieldContainer
getData()
This method is used by the DataReceiver to fetch a singleAllows a DataReceiver to obtain the available data in a known format.Gets the object that is retrieving data from this DataProviderboolean
This method is used by the FileDataReceiver to fetch a set of This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.This method is used by the FileDataReceiver to fetch a single This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.Gets the object that is retrieving data from this FileDataProvidergetFileList
(File dir, DirectoryStream.Filter<Path> filter) boolean
getNode()
Returns theEINode
containing this transport.long
Returns the time interval between polls for available data.Allows a DataReceiver to obtain the last processed .arch filevoid
To handle the remaining input files when there is reject of a fileprotected void
protected void
incrementIn
(int count) abstract boolean
This method is used by the DataReceiver to ask this provider if data is available.boolean
Determines if record received is an End of file indication This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.boolean
This method is used by the FileDataReceiver to ask this provider if data is available.boolean
This method is used to check the transport's state of health.boolean
boolean
boolean
Determines if the record received is start of file indication This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.void
moveCurrentFileToBackUp
(File currentFile, String newFilename) This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.boolean
This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.void
removeProcessedFile
(File currArchFile) Allows a DataReceiver to remove .arch file once processed currArchFile - processed .arch fileabstract void
run()
This method is used to control processing for fetching data from the EI's source.protected void
Set a flag to indicate to the Record Statistics feature that there is something not trusted in the input counts.void
setDataReceiver
(DataReceiverIfc receiver) Sets the object to which this DataProvider will send its data.void
setFileDataReceiver
(FileDataReceiverIfc receiver) Sets the object to which this FileDataProvider will send its data.void
setFileToProcess
(File filetoProcess) void
setMovedFileStatus
(boolean fileMoved) void
Sets the node within which thisEITransport
is contained.void
setPollingInterval
(long interval) Sets the time interval between polls for available data.void
setProcessedArchFile
(String file) Sets the processed .arch file absolute pathvoid
setProcessing
(boolean isProcessing) abstract void
shutdown()
This method is used to provide a means of shutting down the transport in an orderly fashion.void
signalBatchCompletion
(String batch) Allows a DataReceiver to know that the nars under the specified batch are completed and handed over to the Data receiverboolean
Allows a DataReceiver to check if Minor Type supported for disaster recovery
-
Field Details
-
node
Reference to theEINode
to which the transport is associated. -
dataReceiver
Reference to the DataReceiver of the transport. -
filedataReceiver
Reference to the FileDataReceiver of the transport. -
running
protected boolean runningIndicates whether the transport is running. -
processing
protected boolean processing -
movedFile
protected boolean movedFile -
pollingInterval
protected long pollingIntervalTime interval at which the node will check for data. Default is 20 seconds. -
inputCount
Input record count object. Although initialized to a do-nothing object, subclasses should set its value to the result of the call DCNode.getInputStatsProcessor(). this.setNode() will also set this object. -
processingData
protected boolean processingData -
fileToProcess
-
lockFile
-
fdChecked
public boolean fdChecked -
fileduplicateCheck
-
-
Constructor Details
-
EITransport
public EITransport()
-
-
Method Details
-
setDataReceiver
Sets the object to which this DataProvider will send its data.- Specified by:
setDataReceiver
in interfaceDataProviderIfc
- Parameters:
receiver
- Object which needs data sent to it.
-
setFileDataReceiver
Sets the object to which this FileDataProvider will send its data.- Specified by:
setFileDataReceiver
in interfaceFileDataProviderIfc
- Parameters:
receiver
- Object which needs data sent to it.
-
getDataReceiver
Description copied from interface:DataProviderIfc
Gets the object that is retrieving data from this DataProvider- Specified by:
getDataReceiver
in interfaceDataProviderIfc
- Returns:
- Returns the object to which this DataProvider will send data.
-
getFileDataReceiver
Description copied from interface:FileDataProviderIfc
Gets the object that is retrieving data from this FileDataProvider- Specified by:
getFileDataReceiver
in interfaceFileDataProviderIfc
- Returns:
- Returns the object to which this DataProvider will send data.
-
isDataAvailable
public abstract boolean isDataAvailable()This method is used by the DataReceiver to ask this provider if data is available.- Specified by:
isDataAvailable
in interfaceDataProviderIfc
- Returns:
true
, if data is available
-
isFileDataAvailable
public boolean isFileDataAvailable()This method is used by the FileDataReceiver to ask this provider if data is available. This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
isFileDataAvailable
in interfaceFileDataProviderIfc
- Returns:
true
, if data is available
-
getData
This method is used by the DataReceiver to fetch a single- Specified by:
getData
in interfaceDataProviderIfc
- Returns:
- DCFieldContainer.
-
getData
Description copied from interface:DataProviderIfc
Allows a DataReceiver to obtain the available data in a known format. batch - The nars read will be grouped under the specified batch- Specified by:
getData
in interfaceDataProviderIfc
- Returns:
- DCFieldContainer object containing the data that is available for processing
-
signalBatchCompletion
Description copied from interface:DataProviderIfc
Allows a DataReceiver to know that the nars under the specified batch are completed and handed over to the Data receiver- Specified by:
signalBatchCompletion
in interfaceDataProviderIfc
-
removeProcessedFile
Description copied from interface:DataProviderIfc
Allows a DataReceiver to remove .arch file once processed currArchFile - processed .arch file- Specified by:
removeProcessedFile
in interfaceDataProviderIfc
-
getCurrArchFile
Description copied from interface:DataProviderIfc
Allows a DataReceiver to obtain the currently processing .arch file- Specified by:
getCurrArchFile
in interfaceDataProviderIfc
- Returns:
- currently processing .arch file
-
getProcessedArchFile
Description copied from interface:DataProviderIfc
Allows a DataReceiver to obtain the last processed .arch file- Specified by:
getProcessedArchFile
in interfaceDataProviderIfc
- Returns:
- currently processing .arch file absolute path
-
validOIMinorType
public boolean validOIMinorType()Description copied from interface:DataProviderIfc
Allows a DataReceiver to check if Minor Type supported for disaster recovery- Specified by:
validOIMinorType
in interfaceDataProviderIfc
- Returns:
- true if valid
-
setProcessedArchFile
Description copied from interface:DataProviderIfc
Sets the processed .arch file absolute path- Specified by:
setProcessedArchFile
in interfaceDataProviderIfc
- Parameters:
file
- absolute path of processed .arch file
-
getFileData
This method is used by the FileDataReceiver to fetch a single This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
getFileData
in interfaceFileDataProviderIfc
- Returns:
- DCFieldContainer.
-
isEndOfFile
public boolean isEndOfFile()Determines if record received is an End of file indication This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
isEndOfFile
in interfaceFileDataProviderIfc
- Returns:
true
, if data is available
-
isStartOfFile
public boolean isStartOfFile()Determines if the record received is start of file indication This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
isStartOfFile
in interfaceFileDataProviderIfc
- Returns:
-
getBulkData
This method is used by the DataReceiver to fetch a set of DCFieldContainer objects.- Specified by:
getBulkData
in interfaceDataProviderIfc
- Returns:
- DCFieldContainer object array, containing the data that is for processing
-
getFileBulkData
This method is used by the FileDataReceiver to fetch a set of This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
getFileBulkData
in interfaceFileDataProviderIfc
- Returns:
- DCFieldContainer objects.
-
run
public abstract void run()This method is used to control processing for fetching data from the EI's source. -
shutdown
public abstract void shutdown()This method is used to provide a means of shutting down the transport in an orderly fashion.- Specified by:
shutdown
in interfaceDCTransport
-
setNode
Sets the node within which thisEITransport
is contained.- Parameters:
einode
- TheEINode
which contains this transport.
-
getNode
Returns theEINode
containing this transport.- Returns:
- Returns the
EINode
of this transport.
-
setPollingInterval
public void setPollingInterval(long interval) Sets the time interval between polls for available data.- Parameters:
interval
- Number of milliseconds to wait.
-
getPollingInterval
public long getPollingInterval()Returns the time interval between polls for available data.- Returns:
- Returns the polling interval.
-
isHealthy
public boolean isHealthy()This method is used to check the transport's state of health. By default it returns true. It is to be overridden by subclasses.- Specified by:
isHealthy
in interfaceDCTransport
- Returns:
- true if the transport is healthy, false otherwise
-
incrementIn
protected void incrementIn() -
incrementIn
protected void incrementIn(int count) -
setCountsSuspect
protected void setCountsSuspect()Set a flag to indicate to the Record Statistics feature that there is something not trusted in the input counts. Usual example is if the file parser chokes on a record in the middle of a file. -
isProcessingData
public boolean isProcessingData() -
setFileToProcess
-
isProcessing
public boolean isProcessing() -
setProcessing
public void setProcessing(boolean isProcessing) -
getMovedFileStatus
public boolean getMovedFileStatus() -
setMovedFileStatus
public void setMovedFileStatus(boolean fileMoved) -
openInputFile
This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.- Specified by:
openInputFile
in interfaceFileDataProviderIfc
- Returns:
- Throws:
Exception
-
rejectFile
This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior. Indicates data provider to stop reading from the input file and reject it- Specified by:
rejectFile
in interfaceFileDataProviderIfc
- Returns:
true
for successful rejection of input file
- Throws:
Exception
-
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
-
getDupCheckFlag
public boolean getDupCheckFlag() -
getDubCheckObj
-
getFileList
public static List<File> getFileList(File dir, DirectoryStream.Filter<Path> filter) throws Exception - Throws:
Exception
-
moveCurrentFileToBackUp
- Throws:
IOException
-