Class BaseFileTransferConnectionImpl

  • All Implemented Interfaces:
    javax.resource.cci.Connection, org.ikasan.connector.BaseFileTransferConnection, org.ikasan.connector.listener.TransactionCommitFailureObserverable

    public abstract class BaseFileTransferConnectionImpl
    extends java.lang.Object
    implements org.ikasan.connector.BaseFileTransferConnection, javax.resource.cci.Connection
    A Base implementation for File transfer connections
    Author:
    Ikasan Development Team
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.xml.bind.JAXBContext jaxbContext  
      protected java.util.List<org.ikasan.connector.listener.TransactionCommitFailureListener> listeners  
      protected javax.xml.bind.Marshaller marshaller  
      protected static java.lang.String REFERENCE_PAYLOAD_ATTRIBUTE  
      protected javax.xml.bind.Unmarshaller unmarshaller  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(org.ikasan.connector.listener.TransactionCommitFailureListener listener)  
      protected void addListenersToCommand​(org.ikasan.connector.base.command.TransactionalResourceCommand command)  
      javax.resource.cci.Interaction createInteraction()
      Connection Methods
      void deliverInputStream​(java.io.InputStream inputStream, java.lang.String fileName, java.lang.String outputDir, boolean overwrite, java.lang.String renameExtension, boolean checksumDelivered, boolean unzip, boolean createParentDirectory, java.lang.String tempFileName)
      Deliver the InputStream TODO Add in the checksumDelivered feature
      protected abstract org.ikasan.connector.base.command.ExecutionOutput executeCommand​(org.ikasan.connector.base.command.TransactionalResourceCommand deliveryCommand, org.ikasan.connector.base.command.ExecutionContext executionContext)
      Execute the command
      protected org.ikasan.filetransfer.Payload fileChunkHeaderToPayload​(org.ikasan.connector.util.chunking.model.FileChunkHeader header)
      Method used to map an FTPMappedRecord object to a Payload object.
      javax.resource.cci.LocalTransaction getLocalTransaction()  
      javax.resource.cci.ConnectionMetaData getMetaData()  
      javax.resource.cci.ResultSetInfo getResultSetInfo()  
      protected boolean isChunkReference​(org.ikasan.filetransfer.Payload payload)
      Determines if we need to handle this as a chunk reference
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.ikasan.connector.BaseFileTransferConnection

        deliverPayload, getDiscoveredFile, getManagedConnection, housekeep, setManagedConnection
      • Methods inherited from interface javax.resource.cci.Connection

        close
    • Field Detail

      • REFERENCE_PAYLOAD_ATTRIBUTE

        protected static final java.lang.String REFERENCE_PAYLOAD_ATTRIBUTE
        See Also:
        Constant Field Values
      • listeners

        protected java.util.List<org.ikasan.connector.listener.TransactionCommitFailureListener> listeners
      • jaxbContext

        protected javax.xml.bind.JAXBContext jaxbContext
      • unmarshaller

        protected javax.xml.bind.Unmarshaller unmarshaller
      • marshaller

        protected javax.xml.bind.Marshaller marshaller
    • Constructor Detail

      • BaseFileTransferConnectionImpl

        public BaseFileTransferConnectionImpl()
    • Method Detail

      • deliverInputStream

        public void deliverInputStream​(java.io.InputStream inputStream,
                                       java.lang.String fileName,
                                       java.lang.String outputDir,
                                       boolean overwrite,
                                       java.lang.String renameExtension,
                                       boolean checksumDelivered,
                                       boolean unzip,
                                       boolean createParentDirectory,
                                       java.lang.String tempFileName)
                                throws javax.resource.ResourceException
        Deliver the InputStream TODO Add in the checksumDelivered feature
        Specified by:
        deliverInputStream in interface org.ikasan.connector.BaseFileTransferConnection
        Parameters:
        inputStream - to deliver
        fileName - The name of the file
        outputDir - The output directory to deliver to
        overwrite - Whether to overwrite or not
        renameExtension - The extension for renaming the file
        checksumDelivered - A flag to see if we check the checksum on delivery
        unzip - flag
        Throws:
        javax.resource.ResourceException - - Exception from the JCA connector
      • executeCommand

        protected abstract org.ikasan.connector.base.command.ExecutionOutput executeCommand​(org.ikasan.connector.base.command.TransactionalResourceCommand deliveryCommand,
                                                                                            org.ikasan.connector.base.command.ExecutionContext executionContext)
                                                                                     throws javax.resource.ResourceException
        Execute the command
        Parameters:
        deliveryCommand - The command to execute
        executionContext - The execution context
        Returns:
        The output of that Execution
        Throws:
        javax.resource.ResourceException - The Exception from the JCA connector
      • fileChunkHeaderToPayload

        protected org.ikasan.filetransfer.Payload fileChunkHeaderToPayload​(org.ikasan.connector.util.chunking.model.FileChunkHeader header)
        Method used to map an FTPMappedRecord object to a Payload object. TODO Is there any other Payload stuff to set here?
        Parameters:
        header - The record as returned from the FileTransferProtocolClient
        Returns:
        A payload constructed from the record.
      • isChunkReference

        protected boolean isChunkReference​(org.ikasan.filetransfer.Payload payload)
        Determines if we need to handle this as a chunk reference
        Parameters:
        payload - - The payload to check
        Returns:
        true if the payload is simply a reference to a set of chunks
      • addListenersToCommand

        protected void addListenersToCommand​(org.ikasan.connector.base.command.TransactionalResourceCommand command)
        Parameters:
        command -
      • addListener

        public void addListener​(org.ikasan.connector.listener.TransactionCommitFailureListener listener)
        Specified by:
        addListener in interface org.ikasan.connector.listener.TransactionCommitFailureObserverable
      • createInteraction

        public javax.resource.cci.Interaction createInteraction()
        Connection Methods
        Specified by:
        createInteraction in interface javax.resource.cci.Connection
      • getLocalTransaction

        public javax.resource.cci.LocalTransaction getLocalTransaction()
                                                                throws javax.resource.ResourceException
        Specified by:
        getLocalTransaction in interface javax.resource.cci.Connection
        Throws:
        javax.resource.ResourceException
      • getMetaData

        public javax.resource.cci.ConnectionMetaData getMetaData()
        Specified by:
        getMetaData in interface javax.resource.cci.Connection
      • getResultSetInfo

        public javax.resource.cci.ResultSetInfo getResultSetInfo()
        Specified by:
        getResultSetInfo in interface javax.resource.cci.Connection