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 DataProviderIfcReference to the DataProvider of the transport.protected FileDataProviderIfcReference to the FileDataProvider of the transport.protected OINodeReference to theOINodeto which the transport is associated.protected longTime interval at which the node will check for data.protected booleanIndicates whether the transport is running. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidThis method is used by the DataProvider to tell the receiver that data is available.voidThis 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 theOINodecontaining this transport.longReturns the time interval between polls for available data.longprotected voidSubclasses should call this whenever a record is written out successfully.booleanThis method is used to check the transport's state of health.abstract voidprocessData(DCFieldContainer dcfContainer) This method should be overridden with the transport-specific logic to accept aDCFieldContainerobject and send the information out through the desired protocol.booleanprocessEndOfFileData(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.booleanprocessFileData(DCFieldContainer dcfContainer) This method should be overridden with the transport-specific logic to accept aDCFieldContainerobject and send the information out through the desired protocol.booleanprocessFileData(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.booleanAllows 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.booleanprocessStartOfFileData(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 voidrun()This method is used to control processing when the receiver 'pulls' the data from the DataProvider as it becomes available.voidsetDataProvider(DataProviderIfc provider) Sets the object from which this DataReceiver will obtain its data.voidsetFileDataProvider(FileDataProviderIfc provider) Sets the object from which this FileDataReceiver will obtain its data.voidSets the node within which thisOITransportis contained.voidsetPollingInterval(long interval) Sets the time interval between polls for available data.voidsetTransactionID(String tID) abstract voidshutdown()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, waitMethods inherited from interface com.nt.udc.ndk.node.DataReceiverIfc
processData
-
Field Details
-
node
Reference to theOINodeto 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:
setDataProviderin 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:
setFileDataProviderin 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:
getDataProviderin interfaceDataReceiverIfc- Returns:
- Returns the DataProvider of this receiver.
-
getFileDataProvider
Returns the object from which this FileDataReceiver is receiving data.- Specified by:
getFileDataProviderin 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:
dataIsAvailablein 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:
fileDataIsAvailablein interfaceFileDataReceiverIfc
-
processData
This method should be overridden with the transport-specific logic to accept aDCFieldContainerobject and send the information out through the desired protocol.- Specified by:
processDatain interfaceDataReceiverIfc- Parameters:
dcfContainer-DCFieldContainerobject containing the data.- Throws:
NodeProcessingException
-
processFileData
This method should be overridden with the transport-specific logic to accept aDCFieldContainerobject 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:
processFileDatain interfaceFileDataReceiverIfc- Parameters:
dcfContainer-DCFieldContainerobject 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:
processFileDatain 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:
processStartOfFileDatain 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:
processEndOfFileDatain 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:
processRejectFilein 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:
shutdownin interfaceDCTransport
-
setNode
Sets the node within which thisOITransportis contained.- Parameters:
oinode- TheOINodewhich contains this transport.
-
getNode
Returns theOINodecontaining this transport.- Returns:
- Returns the
OINodeof 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:
isHealthyin 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:
setTransactionIDin interfaceFileDataReceiverIfc
-