Package com.nt.udc.ei.transport
Class TcpEITransport
java.lang.Object
com.nt.udc.ndk.node.EITransport
com.nt.udc.ei.transport.TcpEITransport
- All Implemented Interfaces:
DataProviderIfc,DCTransport,FileDataProviderIfc,Runnable
This class will create a socket on the given host/port and listen for
incoming data via TCP. The bytes read from the socket will be placed
within a
QueuedTcpPacket object and stored in a queue until
the transport's DataReceiver requests data via the getData()
or getBulkData() method. At that time, a
QueuedTcpPacket is popped off the queue and given to the
transport's DCRecordFactoryIfc object via the factory's
getRecords() method. The DCFieldContainer
objects returned from the factory will then be supplied to the DataReceiver.-
Field Summary
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
ConstructorsConstructorDescriptionTcpEITransport(EINode einode, DCRecordFactoryIfc factory, String host, int prt) Construct a new TcpEITransport to be used within the specified EINode.TcpEITransport(EINode einode, DCRecordFactoryIfc factory, String host, int prt, int pktSize, int qSize) Construct a new TcpEITransport to be used within the specified EINode. -
Method Summary
Modifier and TypeMethodDescriptionThis method is used by the DataReceiver to fetch a set of DCFieldContainers.getData()This method is used by the DataReceiver to fetch a single DCFieldContainer.booleanThis method is used by the DataReceiver to ask this provider if data is available.booleanThis method is used to check if the transport is fully functional.booleanIndicates whether transport should shutdown upon processing errorvoidrun()This method is used when the EITransport runs within its own thread.voidsetShutdownOnError(boolean flag) Indicates whether transport should shutdown upon processing errorvoidshutdown()Stop the transport.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, moveCurrentFileToBackUp, openInputFile, rejectFile, removeProcessedFile, setCountsSuspect, setDataReceiver, setFileDataReceiver, setFileToProcess, setMovedFileStatus, setNode, setPollingInterval, setProcessedArchFile, setProcessing, signalBatchCompletion, validOIMinorType
-
Constructor Details
-
TcpEITransport
public TcpEITransport(EINode einode, DCRecordFactoryIfc factory, String host, int prt) throws NodeStartException Construct a new TcpEITransport to be used within the specified EINode. The transport will create a socket on the given host/port and generate TcpEIRecord() objects of the specified type.- Parameters:
einode- Reference to the EINode containing the transportfactory- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.host- The host name / IP address to listen toport- The port number to listen on- Throws:
NodeStartException
-
TcpEITransport
public TcpEITransport(EINode einode, DCRecordFactoryIfc factory, String host, int prt, int pktSize, int qSize) throws NodeStartException Construct a new TcpEITransport to be used within the specified EINode. The transport will create a socket on the given host/port and generate TcpEIRecord() objects of the specified type.- Parameters:
einode- Reference to the EINode containing the transportfactory- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.host- The host name / IP address to listen topktSize- The number of bytes in an incoming data 'packet'qSize- The maximum number of 'packets' allowed in the queueport- The port number to listen on- Throws:
NodeStartException
-
-
Method Details
-
isDataAvailable
public boolean isDataAvailable()This method is used by the DataReceiver to ask this provider if data is available.- Specified by:
isDataAvailablein interfaceDataProviderIfc- Specified by:
isDataAvailablein classEITransport- Returns:
true, if data is available
-
getData
This method is used by the DataReceiver to fetch a single DCFieldContainer.- Specified by:
getDatain interfaceDataProviderIfc- Specified by:
getDatain classEITransport- Returns:
- DCFieldContainer.
-
getBulkData
This method is used by the DataReceiver to fetch a set of DCFieldContainers.- Specified by:
getBulkDatain interfaceDataProviderIfc- Specified by:
getBulkDatain classEITransport- Returns:
- DCFieldContainer object array, containing the data that is for processing
-
run
public void run()This method is used when the EITransport runs within its own thread. Each 'packet' of bytes that is read from the socket will be placed in aQueuedTcpPacketobject and stored in a queue until the data is requested by the transport's DataReceiver.- Specified by:
runin interfaceRunnable- Specified by:
runin classEITransport
-
shutdown
public void shutdown()Stop the transport. To ensure no loss of data, the transport should continue to supply any queued data to its DataReceiver.- Specified by:
shutdownin interfaceDCTransport- Specified by:
shutdownin classEITransport
-
isShutdownOnError
public boolean isShutdownOnError()Indicates whether transport should shutdown upon processing error -
setShutdownOnError
public void setShutdownOnError(boolean flag) Indicates whether transport should shutdown upon processing error- Parameters:
flag-true, if error should cause a shutdown. Default isfalse.
-
isHealthy
public boolean isHealthy()This method is used to check if the transport is fully functional.- Specified by:
isHealthyin interfaceDCTransport- Overrides:
isHealthyin classEITransport- Returns:
- true if the transport is healthy, false otherwise
-