Package com.nt.udc.ei.transport
Class UdpEITransport
java.lang.Object
com.nt.udc.ndk.node.EITransport
com.nt.udc.ei.transport.UdpEITransport
- All Implemented Interfaces:
DataProviderIfc
,DCTransport
,FileDataProviderIfc
,Runnable
This class will create a socket on the given port and listen for incoming
DatagramPacket
objects. Each packet will be placed within a
QueuedUdpPacket
object and stored in a queue until the
transport's DataReceiver requests data via the getData()
or
getBulkData()
method. At that time, a
QueuedUdpPacket
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
ConstructorsConstructorDescriptionUdpEITransport
(EINode einode, DCRecordFactoryIfc factory, int prt) Construct a new UdpEITransport to be used within the specified EINode.UdpEITransport
(EINode einode, DCRecordFactoryIfc factory, int prt, int pktSize) Construct a new UdpEITransport to be used within the specified EINode.UdpEITransport
(EINode einode, DCRecordFactoryIfc factory, int prt, int pktSize, int socketBufSize) Construct a new UdpEITransport to be used within the specified EINode.UdpEITransport
(EINode einode, DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, int prt, int pktSize) Construct a new UdpEITransport to be used within the specified EINode.UdpEITransport
(EINode einode, DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, String host, int prt, int pktSize) Construct a new UdpEITransport to be used within the specified EINode.UdpEITransport
(EINode einode, DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, String host, int prt, int pktSize, int idleRecWriteTime) Construct a new UdpEITransport to be used within the specified EINode.UdpEITransport
(EINode einode, DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, String host, int prt, int pktSize, int idleRecWriteTime, int socketBufSize) Construct a new UdpEITransport to be used within the specified EINode.UdpEITransport
(EINode einode, DCRecordFactoryIfc factory, String host, int prt) Construct a new UdpEITransport to be used within the specified EINode.UdpEITransport
(EINode einode, DCRecordFactoryIfc factory, String host, int prt, int pktSize) Construct a new UdpEITransport to be used within the specified EINode. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets this transport into a reconfiguration state.void
Ends reconfiguration state, allowing data to be accessed again.This method is used by the DataReceiver to fetch a set of DCFieldContainer objects.getData()
This method is used by the DataReceiver to fetch a singleprotected void
initMesManager
(int idleRecWriteTime) boolean
This method is used by the DataReceiver to ask this provider if data is available.boolean
This method is used to check if the transport is fully functional.boolean
Returns value of reconfiguring flag.boolean
Indicates whether transport should shutdown upon processing errorvoid
reconfigure
(DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, int radius_port) Reconfigures the record factory and queue size of this UDP transport.void
reconfigure
(DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, int port, int idleRecWrTime) void
Resets state for conditionally logged messages.void
run()
This method is used when the EITransport runs within its own thread.void
send
(DatagramPacket response) This method is used to send the given datagram packet back to the originator of the incoming data.void
setShutdownOnError
(boolean flag) Indicates whether transport should shutdown upon processing errorvoid
shutdown()
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
-
UdpEITransport
Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given port on the local host and use the given factory to generate EIRecord() objects.- Parameters:
einode
- Reference to the EINode containing the transportfactory
- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.prt
- The port number to listen on- Throws:
NodeStartException
-
UdpEITransport
public UdpEITransport(EINode einode, DCRecordFactoryIfc factory, String host, int prt) throws NodeStartException Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given remote host/port and use the given factory to generate EIRecord() objects.- 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 toprt
- The port number to listen on- Throws:
NodeStartException
-
UdpEITransport
public UdpEITransport(EINode einode, DCRecordFactoryIfc factory, int prt, int pktSize) throws NodeStartException Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given port on the local host and use the given factory to generate EIRecord() objects.- Parameters:
einode
- Reference to the EINode containing the transportfactory
- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.prt
- The port number to listen onpktSize
- Number of bytes in a data 'packet' (default 4096)- Throws:
NodeStartException
-
UdpEITransport
public UdpEITransport(EINode einode, DCRecordFactoryIfc factory, int prt, int pktSize, int socketBufSize) throws NodeStartException Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given port on the local host and use the given factory to generate EIRecord() objects.- Parameters:
einode
- Reference to the EINode containing the transportfactory
- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.prt
- The port number to listen onpktSize
- Number of bytes in a data 'packet' (default 4096)socketBufSize
- Socket buffer size (default 65536)- Throws:
NodeStartException
-
UdpEITransport
public UdpEITransport(EINode einode, DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, int prt, int pktSize) throws NodeStartException Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given port on the local host and use the given factory to generate EIRecord() objects.- Parameters:
einode
- Reference to the EINode containing the transportfactory
- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.prt
- The port number to listen onpktSize
- Number of bytes in a data 'packet' (default 4096)- Throws:
NodeStartException
-
UdpEITransport
public UdpEITransport(EINode einode, DCRecordFactoryIfc factory, String host, int prt, int pktSize) throws NodeStartException Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given remote host/port and use the given factory to generate EIRecord() objects.- 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 toprt
- The port number to listen onpktSize
- Number of bytes in a data 'packet' (default 4096)- Throws:
NodeStartException
-
UdpEITransport
public UdpEITransport(EINode einode, DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, String host, int prt, int pktSize) throws NodeStartException Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given remote host/port and use the given factory to generate EIRecord() objects.- Parameters:
einode
- Reference to the EINode containing the transportfactory
- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.responseFactory
- Factory object to construct the response datagramhost
- The host name / IP address to listen toprt
- The port number to listen onpktSize
- Number of bytes in a data 'packet' (default 4096)- Throws:
NodeStartException
-
UdpEITransport
public UdpEITransport(EINode einode, DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, String host, int prt, int pktSize, int idleRecWriteTime) throws NodeStartException Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given remote host/port and use the given factory to generate EIRecord() objects.- Parameters:
einode
- Reference to the EINode containing the transportfactory
- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.responseFactory
- Factory object to construct the response datagramhost
- The host name / IP address to listen toprt
- The port number to listen onpktSize
- Number of bytes in a data 'packet' (default 4096)idleRecWriteTime
- Idle record write time is made configurable (default 10 seconds)- Throws:
NodeStartException
-
UdpEITransport
public UdpEITransport(EINode einode, DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, String host, int prt, int pktSize, int idleRecWriteTime, int socketBufSize) throws NodeStartException Construct a new UdpEITransport to be used within the specified EINode. The transport will create a socket on the given remote host/port and use the given factory to generate EIRecord() objects.- Parameters:
einode
- Reference to the EINode containing the transportfactory
- DCRecordFactoryIfc() object used to generate the desired EIRecord() objects.responseFactory
- Factory object to construct the response datagramhost
- The host name / IP address to listen toprt
- The port number to listen onpktSize
- Number of bytes in a data 'packet' (default 4096)idleRecWriteTime
- Idle record write time is made configurable (default 10 seconds)socketBufSize
- Socket buffer size (default 65536)- Throws:
NodeStartException
-
-
Method Details
-
initMesManager
protected void initMesManager(int idleRecWriteTime) -
isDataAvailable
public boolean isDataAvailable()This method is used by the DataReceiver to ask this provider if data is available.- Specified by:
isDataAvailable
in interfaceDataProviderIfc
- Specified by:
isDataAvailable
in classEITransport
- Returns:
true
, if data is available
-
getData
Description copied from class:EITransport
This method is used by the DataReceiver to fetch a single- Specified by:
getData
in interfaceDataProviderIfc
- Specified by:
getData
in classEITransport
- Returns:
- DCFieldContainer.
-
getBulkData
Description copied from class:EITransport
This method is used by the DataReceiver to fetch a set of DCFieldContainer objects.- Specified by:
getBulkData
in interfaceDataProviderIfc
- Specified by:
getBulkData
in 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. EachDatagramPacket
object that is received will be placed in aQueuedUdpPacket
object and stored in a queue until the data is requested by the transport's DataReceiver.- Specified by:
run
in interfaceRunnable
- Specified by:
run
in 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:
shutdown
in interfaceDCTransport
- Specified by:
shutdown
in 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
.
-
send
This method is used to send the given datagram packet back to the originator of the incoming data.- Parameters:
response
- The datagram packet to be sent
-
beginReconfigure
public void beginReconfigure()Sets this transport into a reconfiguration state. While in the reconfiguration state, data is not accessible (even if available). Specifically,isDataAvailable()
will always return false andgetData()
andgetBulkData()
will always return null while this transport is being reconfigured. Packets will still be read off the line while the transport is reconfigured. -
endReconfigure
public void endReconfigure()Ends reconfiguration state, allowing data to be accessed again. -
isReconfiguring
public boolean isReconfiguring()Returns value of reconfiguring flag. -
reconfigure
public void reconfigure(DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, int radius_port) Reconfigures the record factory and queue size of this UDP transport.- Parameters:
factory
- DCRecordFactoryIfc object used to generate the desired EI record objectsresponseFactory
-radius_port
- The Radius port number
-
reconfigure
public void reconfigure(DCRecordFactoryIfc factory, ResponseDatagramFactory responseFactory, int port, int idleRecWrTime) -
isHealthy
public boolean isHealthy()This method is used to check if the transport is fully functional.- Specified by:
isHealthy
in interfaceDCTransport
- Overrides:
isHealthy
in classEITransport
- Returns:
- true if the transport is healthy, false otherwise
-
resetLoggingState
public void resetLoggingState()Resets state for conditionally logged messages. This method should be called from the node'sclearStatus()
method.
-