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 newFileOITransportto be used within the specifiedOINode, receiving its data from the given DataProvider.FileOITransport(OINode oiNode, DataProviderIfc dp, OIFileFormatter oiFileFormatter, AbstractOIFtpPusher oiFtpPusher) Construct a newFileOITransportto be used within the specifiedOINode, receiving its data from the given DataProvider.FileOITransport(OINode oiNode, OIFileFormatter oiFileFormatter) Construct a newFileOITransportto be used within the specifiedOINode.FileOITransport(OINode oiNode, OIFileFormatter oiFileFormatter, AbstractOIFtpPusher oiFtpPusher) Construct a newFileOITransportto be used within the specifiedOINode. -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method allows the transport's DataProvider to tell the transport that data is waiting to be 'picked up'.booleanThis method is used to check if the transport is fully functional.booleanIndicates whether transport should shutdown upon processing errorvoidprocessData(DCFieldContainer record) Accept aDCFieldContainerto be written to the output file.voidprocessData(DCFieldContainer[] records) Accept someDCFieldContainerobjects to be written to the output file.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[] 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.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.voidrun()This method is used when the OITransport runs within its own thread.voidsetShutdownOnError(boolean flag) Indicates whether transport should shutdown upon processing errorvoidsetTransactionID(String tID) voidshutdown()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 newFileOITransportto be used within the specifiedOINode. TheOIFileFormatter()object will create the output files.- Parameters:
oiNode- Reference to theOINodecontaining 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 newFileOITransportto 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 theOINodecontaining 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 newFileOITransportto be used within the specifiedOINode, receiving its data from the given DataProvider. TheOIFileFormatter()object will create the output files.- Parameters:
oiNode- Reference to theOINodecontaining 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 newFileOITransportto 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 theOINodecontaining 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:
dataIsAvailablein interfaceDataReceiverIfc- Specified by:
dataIsAvailablein 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:
runin interfaceRunnable- Specified by:
runin 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:
shutdownin interfaceDCTransport- Specified by:
shutdownin classOITransport
-
processData
Accept aDCFieldContainerto be written to the output file. Pass the record along to the file formatter to be output to the file.- Specified by:
processDatain interfaceDataReceiverIfc- Specified by:
processDatain classOITransport- Parameters:
record-DCFieldContainercontaining the data.- Throws:
NodeProcessingException
-
processData
Accept someDCFieldContainerobjects to be written to the output file. Pass the record along to the file formatter to be output to the file.- Parameters:
record-DCFieldContainercontaining the data.- Throws:
NodeProcessingException
-
processFileData
Description copied from class:OITransportThis 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- Overrides:
processFileDatain classOITransport- Parameters:
dcfContainer-DCFieldContainerobject containing the data.- Returns:
true, if data is processed successfully- Throws:
NodeProcessingException
-
processFileData
Description copied from class:OITransportManipulates 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- Overrides:
processFileDatain classOITransport- Returns:
true, if data is processed successfully- Throws:
NodeProcessingException
-
processRejectFile
public boolean processRejectFile()Description copied from class:OITransportAllows 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- Overrides:
processRejectFilein classOITransport- Returns:
true, if processed successfully
-
processStartOfFileData
Description copied from class:OITransportAllows 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- Overrides:
processStartOfFileDatain classOITransport- Returns:
true, if data is available
-
processEndOfFileData
Description copied from class:OITransportAllows 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- Overrides:
processEndOfFileDatain classOITransport- Returns:
true, if processed successfully
-
isHealthy
public boolean isHealthy()This method is used to check if the transport is fully functional.- Specified by:
isHealthyin interfaceDCTransport- Overrides:
isHealthyin classOITransport- Returns:
- true if the transport is healthy, false otherwise
-
setTransactionID
- Specified by:
setTransactionIDin interfaceFileDataReceiverIfc- Overrides:
setTransactionIDin classOITransport
-