Class FtpEndpoint<T extends org.apache.commons.net.ftp.FTPFile>

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.support.ScheduledPollEndpoint
org.apache.camel.component.file.GenericFileEndpoint<T>
org.apache.camel.component.file.remote.RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile>
org.apache.camel.component.file.remote.FtpEndpoint<T>
All Implemented Interfaces:
AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.ComponentAware, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.BrowsableEndpoint, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.HasId, org.apache.camel.StatefulService, org.apache.camel.SuspendableService
Direct Known Subclasses:
FtpsEndpoint

@UriEndpoint(firstVersion="1.1.0", scheme="ftp", extendsScheme="file", title="FTP", syntax="ftp:host:port/directoryName", alternativeSyntax="ftp:username:password@host:port/directoryName", category=FILE, headersClass=FtpConstants.class) @Metadata(excludeProperties="appendChars,readLockIdempotentReleaseAsync,readLockIdempotentReleaseAsyncPoolSize,readLockIdempotentReleaseDelay,readLockIdempotentReleaseExecutorService,directoryMustExist,extendedAttributes,probeContentType,startingDirectoryMustExist,startingDirectoryMustHaveAccess,chmodDirectory,forceWrites,copyAndDeleteOnRenameFail,renameUsingCopy,synchronous") @ManagedResource(description="Managed FtpEndpoint") public class FtpEndpoint<T extends org.apache.commons.net.ftp.FTPFile> extends RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile>
Upload and download files to/from FTP servers.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    protected int
     
    protected org.apache.commons.net.ftp.FTPClient
     
    protected org.apache.commons.net.ftp.FTPClientConfig
     
    protected Map<String,Object>
     
    protected Map<String,Object>
     
    protected boolean
     
    protected int
     
    protected int
     
    protected org.apache.camel.LoggingLevel
     
    protected boolean
     

    Fields inherited from class org.apache.camel.component.file.GenericFileEndpoint

    allowNullBody, antExclude, antFilter, antFilterCaseSensitive, antInclude, appendChars, autoCreate, bufferSize, charset, DEFAULT_IDEMPOTENT_CACHE_SIZE, DEFAULT_IN_PROGRESS_CACHE_SIZE, delete, doneFileName, eagerDeleteTargetFile, eagerMaxMessagesPerPoll, exclude, excludeExt, exclusiveReadLockStrategy, fileExist, fileName, filter, filterDirectory, filterFile, flatten, idempotent, idempotentKey, idempotentRepository, include, includeExt, inProgressRepository, jailStartingDirectory, keepLastModified, localWorkDirectory, maxDepth, maxMessagesPerPoll, minDepth, move, moveExisting, moveExistingFileStrategy, moveFailed, noop, onCompletionExceptionHandler, preMove, preSort, processStrategy, readLock, readLockCheckInterval, readLockDeleteOrphanLockFiles, readLockIdempotentReleaseAsync, readLockIdempotentReleaseAsyncPoolSize, readLockIdempotentReleaseDelay, readLockIdempotentReleaseExecutorService, readLockLoggingLevel, readLockMarkerFile, readLockMinAge, readLockMinLength, readLockRemoveOnCommit, readLockRemoveOnRollback, readLockTimeout, recursive, shuffle, sortBy, sorter, tempFileName, tempPrefix

    Fields inherited from class org.apache.camel.support.service.BaseService

    BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    FtpEndpoint(String uri, RemoteFileComponent<org.apache.commons.net.ftp.FTPFile> component, FtpConfiguration configuration)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected RemoteFileConsumer<org.apache.commons.net.ftp.FTPFile>
    buildConsumer(org.apache.camel.Processor processor)
    Remote File Endpoints, impl this method to create a custom consumer specific to their "protocol" etc.
    protected org.apache.camel.component.file.GenericFileProducer<org.apache.commons.net.ftp.FTPFile>
    Remote File Endpoints, impl this method to create a custom producer specific to their "protocol" etc.
    RemoteFileConsumer<org.apache.commons.net.ftp.FTPFile>
    createConsumer(org.apache.camel.Processor processor)
     
    protected org.apache.commons.net.ftp.FTPClient
    Create the FTP client
    protected org.apache.camel.component.file.GenericFileProcessStrategy<org.apache.commons.net.ftp.FTPFile>
     
    RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
    Creates the operations to be used by the consumer or producer.
     
    int
     
    char
     
    org.apache.commons.net.ftp.FTPClient
     
    org.apache.commons.net.ftp.FTPClientConfig
     
     
     
     
    int
     
    int
     
    org.apache.camel.LoggingLevel
     
     
    boolean
     
    boolean
     
    void
    setConfiguration(org.apache.camel.component.file.GenericFileConfiguration configuration)
     
    void
    setDataTimeout(int dataTimeout)
    Sets the data timeout on the FTP client.
    void
    setFtpClient(org.apache.commons.net.ftp.FTPClient ftpClient)
    To use a custom instance of FTPClient
    void
    setFtpClientConfig(org.apache.commons.net.ftp.FTPClientConfig ftpClientConfig)
    To use a custom instance of FTPClientConfig to configure the FTP client the endpoint should use.
    void
    setResumeDownload(boolean resumeDownload)
    Configures whether resume download is enabled.
    void
    setSoTimeout(int soTimeout)
    Sets the soTimeout on the FTP client.
    void
    setTransferLoggingIntervalSeconds(int transferLoggingIntervalSeconds)
    Configures the interval in seconds to use when logging the progress of upload and download operations that are in-flight.
    void
    setTransferLoggingLevel(org.apache.camel.LoggingLevel transferLoggingLevel)
    Configure the logging level to use when logging the progress of upload and download operations.
    void
    setTransferLoggingLevelName(String transferLoggingLevel)
     
    void
    setTransferLoggingVerbose(boolean transferLoggingVerbose)
    Configures whether the perform verbose (fine grained) logging of the progress of upload and download operations.

    Methods inherited from class org.apache.camel.component.file.GenericFileEndpoint

    configureExchange, configureMessage, configureMoveOrPreMoveExpression, createDoneFileName, doInit, doStart, doStop, getAntExclude, getAntFilter, getAntInclude, getAppendChars, getBufferSize, getCharset, getDoneFileName, getExchanges, getExclude, getExcludeExt, getExcludePattern, getExclusiveReadLockStrategy, getFileExist, getFileName, getFilter, getFilterDirectory, getFilterFile, getGeneratedFileName, getIdempotent, getIdempotentKey, getIdempotentRepository, getInclude, getIncludeExt, getIncludePattern, getInProgressRepository, getLocalWorkDirectory, getMaxDepth, getMaxMessagesPerPoll, getMinDepth, getMove, getMoveExisting, getMoveExistingFileStrategy, getMoveFailed, getOnCompletionExceptionHandler, getPreMove, getProcessStrategy, getReadLock, getReadLockCheckInterval, getReadLockIdempotentReleaseAsyncPoolSize, getReadLockIdempotentReleaseDelay, getReadLockIdempotentReleaseExecutorService, getReadLockLoggingLevel, getReadLockMinAge, getReadLockMinLength, getReadLockTimeout, getSortBy, getSorter, getTempFileName, getTempPrefix, isAllowNullBody, isAntFilterCaseSensitive, isAutoCreate, isDelete, isDoneFile, isEagerDeleteTargetFile, isEagerMaxMessagesPerPoll, isFlatten, isHiddenFilesEnabled, isIdempotent, isIdempotentSet, isJailStartingDirectory, isKeepLastModified, isNoop, isPreSort, isReadLockDeleteOrphanLockFiles, isReadLockIdempotentReleaseAsync, isReadLockMarkerFile, isReadLockRemoveOnCommit, isReadLockRemoveOnRollback, isRecursive, isShuffle, isSynchronous, setAllowNullBody, setAntExclude, setAntFilterCaseSensitive, setAntInclude, setAppendChars, setAutoCreate, setBufferSize, setCharset, setDelete, setDoneFileName, setEagerDeleteTargetFile, setEagerMaxMessagesPerPoll, setExclude, setExcludeExt, setExclusiveReadLockStrategy, setFileExist, setFileName, setFileName, setFilter, setFilterDirectory, setFilterDirectory, setFilterFile, setFilterFile, setFlatten, setIdempotent, setIdempotentKey, setIdempotentKey, setIdempotentRepository, setInclude, setIncludeExt, setInProgressRepository, setJailStartingDirectory, setKeepLastModified, setLocalWorkDirectory, setMaxDepth, setMaxMessagesPerPoll, setMinDepth, setMove, setMove, setMoveExisting, setMoveExisting, setMoveExistingFileStrategy, setMoveFailed, setMoveFailed, setNoop, setOnCompletionExceptionHandler, setPreMove, setPreMove, setPreSort, setProcessStrategy, setReadLock, setReadLockCheckInterval, setReadLockDeleteOrphanLockFiles, setReadLockIdempotentReleaseAsync, setReadLockIdempotentReleaseAsyncPoolSize, setReadLockIdempotentReleaseDelay, setReadLockIdempotentReleaseExecutorService, setReadLockLoggingLevel, setReadLockMarkerFile, setReadLockMinAge, setReadLockMinLength, setReadLockRemoveOnCommit, setReadLockRemoveOnRollback, setReadLockTimeout, setRecursive, setShuffle, setSortBy, setSortBy, setSortBy, setSorter, setSynchronous, setTempFileName, setTempFileName, setTempPrefix

    Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint

    configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay

    Methods inherited from class org.apache.camel.support.DefaultEndpoint

    configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString

    Methods inherited from class org.apache.camel.support.service.BaseService

    build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.camel.ComponentAware

    getComponent, getComponent, setComponent

    Methods inherited from interface org.apache.camel.Endpoint

    configureProperties, createAsyncProducer, createExchange, createExchange, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isLenientProperties, setCamelContext

    Methods inherited from interface org.apache.camel.IsSingleton

    isSingleton

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods inherited from interface org.apache.camel.SuspendableService

    isSuspended, resume, suspend
  • Field Details

    • soTimeout

      protected int soTimeout
    • dataTimeout

      protected int dataTimeout
    • configuration

      @UriParam protected FtpConfiguration configuration
    • ftpClientConfig

      @UriParam(label="advanced") protected org.apache.commons.net.ftp.FTPClientConfig ftpClientConfig
    • ftpClientConfigParameters

      @UriParam(label="advanced", prefix="ftpClientConfig.", multiValue=true) protected Map<String,Object> ftpClientConfigParameters
    • ftpClientParameters

      @UriParam(label="advanced", prefix="ftpClient.", multiValue=true) protected Map<String,Object> ftpClientParameters
    • ftpClient

      @UriParam(label="advanced") protected org.apache.commons.net.ftp.FTPClient ftpClient
    • transferLoggingLevel

      @UriParam(label="common", defaultValue="DEBUG") protected org.apache.camel.LoggingLevel transferLoggingLevel
    • transferLoggingIntervalSeconds

      @UriParam(label="common", defaultValue="5") protected int transferLoggingIntervalSeconds
    • transferLoggingVerbose

      @UriParam(label="common") protected boolean transferLoggingVerbose
    • resumeDownload

      @UriParam(label="consumer") protected boolean resumeDownload
  • Constructor Details

  • Method Details

    • getScheme

      public String getScheme()
      Specified by:
      getScheme in class org.apache.camel.component.file.GenericFileEndpoint<org.apache.commons.net.ftp.FTPFile>
    • createConsumer

      public RemoteFileConsumer<org.apache.commons.net.ftp.FTPFile> createConsumer(org.apache.camel.Processor processor) throws Exception
      Specified by:
      createConsumer in interface org.apache.camel.Endpoint
      Overrides:
      createConsumer in class RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile>
      Throws:
      Exception
    • buildConsumer

      protected RemoteFileConsumer<org.apache.commons.net.ftp.FTPFile> buildConsumer(org.apache.camel.Processor processor)
      Description copied from class: RemoteFileEndpoint
      Remote File Endpoints, impl this method to create a custom consumer specific to their "protocol" etc.
      Specified by:
      buildConsumer in class RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile>
      Parameters:
      processor - the processor
      Returns:
      the created consumer
    • buildProducer

      protected org.apache.camel.component.file.GenericFileProducer<org.apache.commons.net.ftp.FTPFile> buildProducer()
      Description copied from class: RemoteFileEndpoint
      Remote File Endpoints, impl this method to create a custom producer specific to their "protocol" etc.
      Specified by:
      buildProducer in class RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile>
      Returns:
      the created producer
    • createGenericFileStrategy

      protected org.apache.camel.component.file.GenericFileProcessStrategy<org.apache.commons.net.ftp.FTPFile> createGenericFileStrategy()
      Specified by:
      createGenericFileStrategy in class org.apache.camel.component.file.GenericFileEndpoint<org.apache.commons.net.ftp.FTPFile>
    • createRemoteFileOperations

      public RemoteFileOperations<org.apache.commons.net.ftp.FTPFile> createRemoteFileOperations() throws Exception
      Description copied from class: RemoteFileEndpoint
      Creates the operations to be used by the consumer or producer.
      Specified by:
      createRemoteFileOperations in class RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile>
      Returns:
      a new created operations
      Throws:
      Exception - is thrown if error creating operations.
    • createFtpClient

      protected org.apache.commons.net.ftp.FTPClient createFtpClient() throws Exception
      Create the FTP client
      Throws:
      Exception - may throw client-specific exceptions if the client cannot be created
    • getConfiguration

      public FtpConfiguration getConfiguration()
      Overrides:
      getConfiguration in class RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile>
    • setConfiguration

      public void setConfiguration(org.apache.camel.component.file.GenericFileConfiguration configuration)
      Overrides:
      setConfiguration in class org.apache.camel.component.file.GenericFileEndpoint<org.apache.commons.net.ftp.FTPFile>
    • getFtpClient

      public org.apache.commons.net.ftp.FTPClient getFtpClient()
    • setFtpClient

      public void setFtpClient(org.apache.commons.net.ftp.FTPClient ftpClient)
      To use a custom instance of FTPClient
    • getFtpClientConfig

      public org.apache.commons.net.ftp.FTPClientConfig getFtpClientConfig()
    • setFtpClientConfig

      public void setFtpClientConfig(org.apache.commons.net.ftp.FTPClientConfig ftpClientConfig)
      To use a custom instance of FTPClientConfig to configure the FTP client the endpoint should use.
    • getFtpClientParameters

      public Map<String,Object> getFtpClientParameters()
    • getFtpClientConfigParameters

      public Map<String,Object> getFtpClientConfigParameters()
    • getSoTimeout

      public int getSoTimeout()
    • setSoTimeout

      public void setSoTimeout(int soTimeout)
      Sets the soTimeout on the FTP client.
    • getDataTimeout

      public int getDataTimeout()
    • setDataTimeout

      public void setDataTimeout(int dataTimeout)
      Sets the data timeout on the FTP client.
    • getTransferLoggingLevel

      public org.apache.camel.LoggingLevel getTransferLoggingLevel()
    • setTransferLoggingLevel

      public void setTransferLoggingLevel(org.apache.camel.LoggingLevel transferLoggingLevel)
      Configure the logging level to use when logging the progress of upload and download operations.
    • setTransferLoggingLevelName

      @ManagedAttribute(description="Logging level to use when logging the progress of upload and download operations") public void setTransferLoggingLevelName(String transferLoggingLevel)
    • getTransferLoggingLevelName

      @ManagedAttribute public String getTransferLoggingLevelName()
    • getTransferLoggingIntervalSeconds

      @ManagedAttribute public int getTransferLoggingIntervalSeconds()
    • setTransferLoggingIntervalSeconds

      @ManagedAttribute(description="Interval in seconds to use when logging the progress of upload and download operations that are in-flight") public void setTransferLoggingIntervalSeconds(int transferLoggingIntervalSeconds)
      Configures the interval in seconds to use when logging the progress of upload and download operations that are in-flight. This is used for logging progress when operations takes longer time.
    • isTransferLoggingVerbose

      @ManagedAttribute public boolean isTransferLoggingVerbose()
    • setTransferLoggingVerbose

      @ManagedAttribute(description="Whether the perform verbose (fine grained) logging of the progress of upload and download operations") public void setTransferLoggingVerbose(boolean transferLoggingVerbose)
      Configures whether the perform verbose (fine grained) logging of the progress of upload and download operations.
    • isResumeDownload

      public boolean isResumeDownload()
    • setResumeDownload

      public void setResumeDownload(boolean resumeDownload)
      Configures whether resume download is enabled. This must be supported by the FTP server (almost all FTP servers support it). In addition the options localWorkDirectory must be configured so downloaded files are stored in a local directory, and the option binary must be enabled, which is required to support resuming of downloads.
    • getFileSeparator

      public char getFileSeparator()
      Overrides:
      getFileSeparator in class RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile>