Package com.nt.udc.ndk.node
Class OITransport
java.lang.Object
com.nt.udc.ndk.node.OITransport
- All Implemented Interfaces:
DataReceiverIfc
,DCTransport
,FileDataReceiverIfc
,Runnable
- Direct Known Subclasses:
FileOITransport
,JDBCOITransport
,RadiusOITransport
,TcpOITransport
,UdpOITransport
public abstract class OITransport
extends Object
implements DCTransport, DataReceiverIfc, FileDataReceiverIfc
This is the base class for all OI transports. It provides methods to
set the transport's DataReceiver and other configuration attributes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DataProviderIfc
Reference to the DataProvider of the transport.protected FileDataProviderIfc
Reference to the FileDataProvider of the transport.protected OINode
Reference to theOINode
to which the transport is associated.protected long
Time interval at which the node will check for data.protected boolean
Indicates whether the transport is running. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
This method is used by the DataProvider to tell the receiver that data is available.void
This method is used by the FileDataProvider to tell the receiver that data is available.Returns the object from which this DataReceiver is receiving data.Returns the object from which this FileDataReceiver is receiving data.getNode()
Returns theOINode
containing this transport.long
Returns the time interval between polls for available data.long
protected void
Subclasses should call this whenever a record is written out successfully.boolean
This method is used to check the transport's state of health.abstract void
processData
(DCFieldContainer dcfContainer) This method should be overridden with the transport-specific logic to accept aDCFieldContainer
object and send the information out through the desired protocol.boolean
processEndOfFileData
(String transactionID) Allows FileDataProvider to indicate end of file record This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.boolean
processFileData
(DCFieldContainer dcfContainer) This method should be overridden with the transport-specific logic to accept aDCFieldContainer
object and send the information out through the desired protocol.boolean
processFileData
(DCFieldContainer[] data) Manipulates the set of data provided by its DataProvider This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.boolean
Allows FileDataProvider to indicate rejection of the file This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.boolean
processStartOfFileData
(String originalFileName) Allows FileDataProvider to indicate start of file This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.abstract void
run()
This method is used to control processing when the receiver 'pulls' the data from the DataProvider as it becomes available.void
setDataProvider
(DataProviderIfc provider) Sets the object from which this DataReceiver will obtain its data.void
setFileDataProvider
(FileDataProviderIfc provider) Sets the object from which this FileDataReceiver will obtain its data.void
Sets the node within which thisOITransport
is contained.void
setPollingInterval
(long interval) Sets the time interval between polls for available data.void
setTransactionID
(String tID) abstract void
shutdown()
This method is used to provide a means of shutting down the transport in an orderly fashion.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.nt.udc.ndk.node.DataReceiverIfc
processData
-
Field Details
-
node
Reference to theOINode
to which the transport is associated. -
dataProvider
Reference to the DataProvider of the transport. -
filedataProvider
Reference to the FileDataProvider of the transport. -
running
protected boolean runningIndicates whether the transport is running. -
pollingInterval
protected long pollingIntervalTime interval at which the node will check for data. Default is 20 seconds.
-
-
Constructor Details
-
OITransport
public OITransport()
-
-
Method Details
-
setDataProvider
Sets the object from which this DataReceiver will obtain its data.- Specified by:
setDataProvider
in interfaceDataReceiverIfc
- Parameters:
provider
- Object which has data that needs to be retrieved by this DataReceiver
-
setFileDataProvider
Sets the object from which this FileDataReceiver will obtain its data.- Specified by:
setFileDataProvider
in interfaceFileDataReceiverIfc
- Parameters:
provider
- Object which has data that needs to be retrieved by this DataReceiver
-
getDataProvider
Returns the object from which this DataReceiver is receiving data.- Specified by:
getDataProvider
in interfaceDataReceiverIfc
- Returns:
- Returns the DataProvider of this receiver.
-
getFileDataProvider
Returns the object from which this FileDataReceiver is receiving data.- Specified by:
getFileDataProvider
in interfaceFileDataReceiverIfc
- Returns:
- Returns the FileDataProvider of this receiver.
-
dataIsAvailable
public abstract void dataIsAvailable()This method is used by the DataProvider to tell the receiver that data is available. It is then the receiver's responsibility to obtain the data and process it. This method should be used when the intent is for the DataProvider to 'push' the data to the receiver.- Specified by:
dataIsAvailable
in interfaceDataReceiverIfc
-
fileDataIsAvailable
public void fileDataIsAvailable()This method is used by the FileDataProvider to tell the receiver that data is available. It is then the receiver's responsibility to obtain the data and process it. This method should be used when the intent is for the DataProvider to 'push' the data to the receiver. This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.- Specified by:
fileDataIsAvailable
in interfaceFileDataReceiverIfc
-
processData
This method should be overridden with the transport-specific logic to accept aDCFieldContainer
object and send the information out through the desired protocol.- Specified by:
processData
in interfaceDataReceiverIfc
- Parameters:
dcfContainer
-DCFieldContainer
object containing the data.- Throws:
NodeProcessingException
-
processFileData
This method should be overridden with the transport-specific logic to accept aDCFieldContainer
object and send the information out through the desired protocol. This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.- Specified by:
processFileData
in interfaceFileDataReceiverIfc
- Parameters:
dcfContainer
-DCFieldContainer
object containing the data.- Returns:
true
, if data is processed successfully- Throws:
NodeProcessingException
-
processFileData
Manipulates the set of data provided by its DataProvider This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.- Specified by:
processFileData
in interfaceFileDataReceiverIfc
- Returns:
true
, if data is processed successfully- Throws:
NodeProcessingException
-
processStartOfFileData
Allows FileDataProvider to indicate start of file This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.- Specified by:
processStartOfFileData
in interfaceFileDataReceiverIfc
- Returns:
true
, if data is available- Throws:
NodeProcessingException
-
processEndOfFileData
Allows FileDataProvider to indicate end of file record This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.- Specified by:
processEndOfFileData
in interfaceFileDataReceiverIfc
- Returns:
true
, if processed successfully- Throws:
NodeProcessingException
-
processRejectFile
Allows FileDataProvider to indicate rejection of the file This is just a dummy implementation, any transport needing to have file level transaction, should override this method and provide implementation.- Specified by:
processRejectFile
in interfaceFileDataReceiverIfc
- Returns:
true
, if processed successfully- Throws:
NodeProcessingException
-
run
public abstract void run()This method is used to control processing when the receiver 'pulls' the data from the DataProvider as it becomes available. -
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 thisOITransport
is contained.- Parameters:
oinode
- TheOINode
which contains this transport.
-
getNode
Returns theOINode
containing this transport.- Returns:
- Returns the
OINode
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
-
getRealNarsOut
public long getRealNarsOut()- Returns:
- The output count, since the node was last restarted, as recorded in the field realNarsOut.
-
incrementOut
protected void incrementOut()Subclasses should call this whenever a record is written out successfully. -
setTransactionID
- Specified by:
setTransactionID
in interfaceFileDataReceiverIfc
-