Package com.nt.udc.oi.transport
Class FileOITransport
java.lang.Object
com.nt.udc.ndk.node.OITransport
com.nt.udc.oi.transport.FileOITransport
- All Implemented Interfaces:
DataReceiverIfc
,DCTransport
,FileDataReceiverIfc
,Runnable
This transport can be used as a generic transport for the creation and
management of files created by an OI node. Constructed with an
OIFileFormatter() object, this transport will obtain OI records from its
DataProvider and pass them along to the formatter to be processed.
-
Field Summary
FieldsFields inherited from class com.nt.udc.ndk.node.OITransport
dataProvider, filedataProvider, node, pollingInterval, running
-
Constructor Summary
ConstructorsConstructorDescriptionFileOITransport
(OINode oiNode, DataProviderIfc dp, OIFileFormatter oiFileFormatter) Construct a newFileOITransport
to be used within the specifiedOINode
, receiving its data from the given DataProvider.FileOITransport
(OINode oiNode, DataProviderIfc dp, OIFileFormatter oiFileFormatter, AbstractOIFtpPusher oiFtpPusher) Construct a newFileOITransport
to be used within the specifiedOINode
, receiving its data from the given DataProvider.FileOITransport
(OINode oiNode, OIFileFormatter oiFileFormatter) Construct a newFileOITransport
to be used within the specifiedOINode
.FileOITransport
(OINode oiNode, OIFileFormatter oiFileFormatter, AbstractOIFtpPusher oiFtpPusher) Construct a newFileOITransport
to be used within the specifiedOINode
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method allows the transport's DataProvider to tell the transport that data is waiting to be 'picked up'.boolean
This method is used to check if the transport is fully functional.boolean
Indicates whether transport should shutdown upon processing errorvoid
processData
(DCFieldContainer record) Accept aDCFieldContainer
to be written to the output file.void
processData
(DCFieldContainer[] records) Accept someDCFieldContainer
objects to be written to the output file.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[] records) 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.void
run()
This method is used when the OITransport runs within its own thread.void
setShutdownOnError
(boolean flag) Indicates whether transport should shutdown upon processing errorvoid
setTransactionID
(String tID) void
shutdown()
Stop the transport.Methods inherited from class com.nt.udc.ndk.node.OITransport
fileDataIsAvailable, getDataProvider, getFileDataProvider, getNode, getPollingInterval, getRealNarsOut, incrementOut, setDataProvider, setFileDataProvider, setNode, setPollingInterval
-
Field Details
-
pusher
-
-
Constructor Details
-
FileOITransport
Construct a newFileOITransport
to be used within the specifiedOINode
. TheOIFileFormatter()
object will create the output files.- Parameters:
oiNode
- Reference to theOINode
containing the transport.oiFileFormatter
-OIFileFormatter()
object responsible for file output and managing the output files.
-
FileOITransport
public FileOITransport(OINode oiNode, OIFileFormatter oiFileFormatter, AbstractOIFtpPusher oiFtpPusher) Construct a newFileOITransport
to be used within the specifiedOINode
. TheOIFileFormatter()
object will create the output files. TheAbstractOIFtpPusher()
object will transfer the completed files to the remote host.- Parameters:
oiNode
- Reference to theOINode
containing the transport.oiFileFormatter
-OIFileFormatter()
object responsible for file output and managing the output files.abstractOiFtpPusher
-AbastractOIFtpPusher()
object responsible for transferring completed files to the remote host.
-
FileOITransport
Construct a newFileOITransport
to be used within the specifiedOINode
, receiving its data from the given DataProvider. TheOIFileFormatter()
object will create the output files.- Parameters:
oiNode
- Reference to theOINode
containing the transport.dp
- Reference to the transport's DataProvider.oiFileFormatter
-OIFileWriter()
object responsible for file output and managing the output files.
-
FileOITransport
public FileOITransport(OINode oiNode, DataProviderIfc dp, OIFileFormatter oiFileFormatter, AbstractOIFtpPusher oiFtpPusher) Construct a newFileOITransport
to be used within the specifiedOINode
, receiving its data from the given DataProvider. TheOIFileFormatter()
object will create the output files. TheAbstractOIFtpPusher()
object will transfer the completed files to the remote host.- Parameters:
oiNode
- Reference to theOINode
containing the transport.dp
- Reference to the transport's DataProvider.oiFileFormatter
-OIFileFormatter()
object responsible for file output and managing the output files.AbstractoiFtpPusher
-AbstractOIFtpPusher()
object responsible for transferring completed files to the remote host.
-
-
Method Details
-
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
.
-
dataIsAvailable
public void dataIsAvailable()This method allows the transport's DataProvider to tell the transport that data is waiting to be 'picked up'. It is then the responsibility of the transport to retrieve the data and process it via the provider'sgetData()
method and the receiver'sprocessData()
method.- Specified by:
dataIsAvailable
in interfaceDataReceiverIfc
- Specified by:
dataIsAvailable
in classOITransport
-
run
public void run()This method is used when the OITransport runs within its own thread. The method will retrieve the data from the transport's DataProvider and pass the DCFieldContainer() objects on to the processData() method.- Specified by:
run
in interfaceRunnable
- Specified by:
run
in classOITransport
-
shutdown
public void shutdown()Stop the transport. To ensure no loss of data, this method will wait for the transport to obtain and process all pending data from its DataProvider, unless it is shutting down due to a processing error.Upon shutdown, the currently open output file will be closed and a final check will be made for any output files which have exceeded the configured time threshold. Such files will be tagged with the appropriate file extension indicated by the 'processedfileextension' configuration parameter.
- Specified by:
shutdown
in interfaceDCTransport
- Specified by:
shutdown
in classOITransport
-
processData
Accept aDCFieldContainer
to be written to the output file. Pass the record along to the file formatter to be output to the file.- Specified by:
processData
in interfaceDataReceiverIfc
- Specified by:
processData
in classOITransport
- Parameters:
record
-DCFieldContainer
containing the data.- Throws:
NodeProcessingException
-
processData
Accept someDCFieldContainer
objects to be written to the output file. Pass the record along to the file formatter to be output to the file.- Parameters:
record
-DCFieldContainer
containing the data.- Throws:
NodeProcessingException
-
processFileData
Description copied from class:OITransport
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
- Overrides:
processFileData
in classOITransport
- Parameters:
dcfContainer
-DCFieldContainer
object containing the data.- Returns:
true
, if data is processed successfully- Throws:
NodeProcessingException
-
processFileData
Description copied from class:OITransport
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
- Overrides:
processFileData
in classOITransport
- Returns:
true
, if data is processed successfully- Throws:
NodeProcessingException
-
processRejectFile
public boolean processRejectFile()Description copied from class:OITransport
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
- Overrides:
processRejectFile
in classOITransport
- Returns:
true
, if processed successfully
-
processStartOfFileData
Description copied from class:OITransport
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
- Overrides:
processStartOfFileData
in classOITransport
- Returns:
true
, if data is available
-
processEndOfFileData
Description copied from class:OITransport
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
- Overrides:
processEndOfFileData
in classOITransport
- Returns:
true
, if processed successfully
-
isHealthy
public boolean isHealthy()This method is used to check if the transport is fully functional.- Specified by:
isHealthy
in interfaceDCTransport
- Overrides:
isHealthy
in classOITransport
- Returns:
- true if the transport is healthy, false otherwise
-
setTransactionID
- Specified by:
setTransactionID
in interfaceFileDataReceiverIfc
- Overrides:
setTransactionID
in classOITransport
-