Class EITransport

java.lang.Object
com.nt.udc.ndk.node.EITransport
All Implemented Interfaces:
DataProviderIfc, DCTransport, FileDataProviderIfc, Runnable
Direct Known Subclasses:
FileEITransport, FileEITransport, FtpEITransport, GenericUdpEITransport, IPDRTransport, JDBCEITransport, OpenFileEITransport, SoapXmlEITransport, Sol42EITransport, TcpEITransport, UdpEITransport, XMLTransport

public abstract class EITransport extends Object implements DCTransport, DataProviderIfc, FileDataProviderIfc
  • Field Details

    • node

      protected DCNode node
      Reference to the EINode to which the transport is associated.
    • dataReceiver

      protected DataReceiverIfc dataReceiver
      Reference to the DataReceiver of the transport.
    • filedataReceiver

      protected FileDataReceiverIfc filedataReceiver
      Reference to the FileDataReceiver of the transport.
    • running

      protected boolean running
      Indicates whether the transport is running.
    • processing

      protected boolean processing
    • movedFile

      protected boolean movedFile
    • pollingInterval

      protected long pollingInterval
      Time interval at which the node will check for data. Default is 20 seconds.
    • inputCount

      protected InputStatisticsMonitorIfc inputCount
      Input record count object. Although initialized to a do-nothing object, subclasses should set its value to the result of the call DCNode.getInputStatsProcessor(). this.setNode() will also set this object.
    • processingData

      protected boolean processingData
    • fileToProcess

      protected File fileToProcess
    • lockFile

      public File lockFile
    • fdChecked

      public boolean fdChecked
    • fileduplicateCheck

      public FileEIDuplicateCheck fileduplicateCheck
  • Constructor Details

    • EITransport

      public EITransport()
  • Method Details

    • setDataReceiver

      public void setDataReceiver(DataReceiverIfc receiver)
      Sets the object to which this DataProvider will send its data.
      Specified by:
      setDataReceiver in interface DataProviderIfc
      Parameters:
      receiver - Object which needs data sent to it.
    • setFileDataReceiver

      public void setFileDataReceiver(FileDataReceiverIfc receiver)
      Sets the object to which this FileDataProvider will send its data.
      Specified by:
      setFileDataReceiver in interface FileDataProviderIfc
      Parameters:
      receiver - Object which needs data sent to it.
    • getDataReceiver

      public DataReceiverIfc getDataReceiver()
      Description copied from interface: DataProviderIfc
      Gets the object that is retrieving data from this DataProvider
      Specified by:
      getDataReceiver in interface DataProviderIfc
      Returns:
      Returns the object to which this DataProvider will send data.
    • getFileDataReceiver

      public FileDataReceiverIfc getFileDataReceiver()
      Description copied from interface: FileDataProviderIfc
      Gets the object that is retrieving data from this FileDataProvider
      Specified by:
      getFileDataReceiver in interface FileDataProviderIfc
      Returns:
      Returns the object to which this DataProvider will send data.
    • isDataAvailable

      public abstract boolean isDataAvailable()
      This method is used by the DataReceiver to ask this provider if data is available.
      Specified by:
      isDataAvailable in interface DataProviderIfc
      Returns:
      true, if data is available
    • isFileDataAvailable

      public boolean isFileDataAvailable()
      This method is used by the FileDataReceiver to ask this provider if data is available. This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.
      Specified by:
      isFileDataAvailable in interface FileDataProviderIfc
      Returns:
      true, if data is available
    • getData

      public abstract DCFieldContainer getData()
      This method is used by the DataReceiver to fetch a single
      Specified by:
      getData in interface DataProviderIfc
      Returns:
      DCFieldContainer.
    • getData

      public DCFieldContainer getData(String batch)
      Description copied from interface: DataProviderIfc
      Allows a DataReceiver to obtain the available data in a known format. batch - The nars read will be grouped under the specified batch
      Specified by:
      getData in interface DataProviderIfc
      Returns:
      DCFieldContainer object containing the data that is available for processing
    • signalBatchCompletion

      public void signalBatchCompletion(String batch)
      Description copied from interface: DataProviderIfc
      Allows a DataReceiver to know that the nars under the specified batch are completed and handed over to the Data receiver
      Specified by:
      signalBatchCompletion in interface DataProviderIfc
    • removeProcessedFile

      public void removeProcessedFile(File currArchFile)
      Description copied from interface: DataProviderIfc
      Allows a DataReceiver to remove .arch file once processed currArchFile - processed .arch file
      Specified by:
      removeProcessedFile in interface DataProviderIfc
    • getCurrArchFile

      public File getCurrArchFile()
      Description copied from interface: DataProviderIfc
      Allows a DataReceiver to obtain the currently processing .arch file
      Specified by:
      getCurrArchFile in interface DataProviderIfc
      Returns:
      currently processing .arch file
    • getProcessedArchFile

      public String getProcessedArchFile()
      Description copied from interface: DataProviderIfc
      Allows a DataReceiver to obtain the last processed .arch file
      Specified by:
      getProcessedArchFile in interface DataProviderIfc
      Returns:
      currently processing .arch file absolute path
    • validOIMinorType

      public boolean validOIMinorType()
      Description copied from interface: DataProviderIfc
      Allows a DataReceiver to check if Minor Type supported for disaster recovery
      Specified by:
      validOIMinorType in interface DataProviderIfc
      Returns:
      true if valid
    • setProcessedArchFile

      public void setProcessedArchFile(String file)
      Description copied from interface: DataProviderIfc
      Sets the processed .arch file absolute path
      Specified by:
      setProcessedArchFile in interface DataProviderIfc
      Parameters:
      file - absolute path of processed .arch file
    • getFileData

      public DCFieldContainer getFileData()
      This method is used by the FileDataReceiver to fetch a single This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.
      Specified by:
      getFileData in interface FileDataProviderIfc
      Returns:
      DCFieldContainer.
    • isEndOfFile

      public boolean isEndOfFile()
      Determines if record received is an End of file indication This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.
      Specified by:
      isEndOfFile in interface FileDataProviderIfc
      Returns:
      true, if data is available
    • isStartOfFile

      public boolean isStartOfFile()
      Determines if the record received is start of file indication This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.
      Specified by:
      isStartOfFile in interface FileDataProviderIfc
      Returns:
    • getBulkData

      public abstract DCFieldContainer[] getBulkData()
      This method is used by the DataReceiver to fetch a set of DCFieldContainer objects.
      Specified by:
      getBulkData in interface DataProviderIfc
      Returns:
      DCFieldContainer object array, containing the data that is for processing
    • getFileBulkData

      public DCFieldContainer[] getFileBulkData()
      This method is used by the FileDataReceiver to fetch a set of This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.
      Specified by:
      getFileBulkData in interface FileDataProviderIfc
      Returns:
      DCFieldContainer objects.
    • run

      public abstract void run()
      This method is used to control processing for fetching data from the EI's source.
      Specified by:
      run in interface Runnable
    • 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 interface DCTransport
    • setNode

      public void setNode(DCNode einode)
      Sets the node within which this EITransport is contained.
      Parameters:
      einode - The EINode which contains this transport.
    • getNode

      public DCNode getNode()
      Returns the EINode containing this transport.
      Returns:
      Returns the EINode 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 interface DCTransport
      Returns:
      true if the transport is healthy, false otherwise
    • incrementIn

      protected void incrementIn()
    • incrementIn

      protected void incrementIn(int count)
    • setCountsSuspect

      protected void setCountsSuspect()
      Set a flag to indicate to the Record Statistics feature that there is something not trusted in the input counts. Usual example is if the file parser chokes on a record in the middle of a file.
    • isProcessingData

      public boolean isProcessingData()
    • setFileToProcess

      public void setFileToProcess(File filetoProcess)
    • isProcessing

      public boolean isProcessing()
    • setProcessing

      public void setProcessing(boolean isProcessing)
    • getMovedFileStatus

      public boolean getMovedFileStatus()
    • setMovedFileStatus

      public void setMovedFileStatus(boolean fileMoved)
    • openInputFile

      public String openInputFile() throws Exception
      This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior.
      Specified by:
      openInputFile in interface FileDataProviderIfc
      Returns:
      Throws:
      Exception
    • rejectFile

      public boolean rejectFile() throws Exception
      This is just a dummy implementation, any transport needing the file level transaction behavior should override this method and implement correct behavior. Indicates data provider to stop reading from the input file and reject it
      Specified by:
      rejectFile in interface FileDataProviderIfc
      Returns:
      true for successful rejection of input file
      Throws:
      Exception
    • handleRejectOfFile

      public void handleRejectOfFile()
      Description copied from interface: FileDataProviderIfc
      To handle the remaining input files when there is reject of a file
      Specified by:
      handleRejectOfFile in interface FileDataProviderIfc
    • getDupCheckFlag

      public boolean getDupCheckFlag()
    • getDubCheckObj

      public FileEIDuplicateCheck getDubCheckObj()
    • getFileList

      public static List<File> getFileList(File dir, DirectoryStream.Filter<Path> filter) throws Exception
      Throws:
      Exception
    • moveCurrentFileToBackUp

      public void moveCurrentFileToBackUp(File currentFile, String newFilename) throws IOException
      Throws:
      IOException