Package org.apache.camel.component.file
Class FileEndpoint
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<File>
org.apache.camel.component.file.FileEndpoint
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.CamelContextAware
,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.HasId
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="1.0.0",
scheme="file",
title="File",
syntax="file:directoryName",
category={FILE,CORE},
headersClass=FileConstants.class)
public class FileEndpoint
extends GenericFileEndpoint<File>
Read and write files.
-
Field Summary
Fields inherited from class org.apache.camel.component.file.GenericFileEndpoint
allowNullBody, antExclude, antFilter, antFilterCaseSensitive, antInclude, appendChars, autoCreate, bufferSize, charset, configuration, 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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
chmodPermissionsAreValid
(String chmod) Chmod value must be between 000 and 777; If there is a leading digit like in 0755 we will ignore it.createConsumer
(org.apache.camel.Processor processor) protected String
org.apache.camel.Exchange
createExchange
(GenericFile<File> file) protected GenericFileProcessStrategy<File>
A strategy method to lazily create the file strategyorg.apache.camel.PollingConsumer
getChmod()
getFile()
char
boolean
isAbsolute
(String name) boolean
boolean
boolean
boolean
boolean
boolean
boolean
protected FileConsumer
newFileConsumer
(org.apache.camel.Processor processor, GenericFileOperations<File> operations) Strategy to create a newFileConsumer
void
Specify the file permissions which is sent by the producer, the chmod value must be between 000 and 777; If there is a leading digit like in 0755 we will ignore it.void
setChmodDirectory
(String chmodDirectory) Specify the directory permissions used when the producer creates missing directories, the chmod value must be between 000 and 777; If there is a leading digit like in 0755 we will ignore it.void
setCopyAndDeleteOnRenameFail
(boolean copyAndDeleteOnRenameFail) Whether to fallback and do a copy and delete file, in case the file could not be renamed directly.void
setDirectoryMustExist
(boolean directoryMustExist) Similar to the startingDirectoryMustExist option but this applies during polling (after starting the consumer).void
setExtendedAttributes
(String extendedAttributes) To define which file attributes of interest.void
The starting directoryvoid
setForceWrites
(boolean forceWrites) Whether to force syncing writes to the file system.void
setProbeContentType
(boolean probeContentType) Whether to enable probing of the content type.void
setRenameUsingCopy
(boolean renameUsingCopy) Perform rename operations using a copy and delete strategy.void
setStartingDirectoryMustExist
(boolean startingDirectoryMustExist) Whether the starting directory must exist.void
setStartingDirectoryMustHaveAccess
(boolean startingDirectoryMustHaveAccess) Whether the starting directory has access permissions.Methods inherited from class org.apache.camel.component.file.GenericFileEndpoint
configureExchange, configureMessage, configureMoveOrPreMoveExpression, createDoneFileName, doInit, doStart, doStop, getAntExclude, getAntFilter, getAntInclude, getAppendChars, getBufferSize, getCharset, getConfiguration, 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, getParamsAsMap, getPreMove, getProcessStrategy, getReadLock, getReadLockCheckInterval, getReadLockIdempotentReleaseAsyncPoolSize, getReadLockIdempotentReleaseDelay, getReadLockIdempotentReleaseExecutorService, getReadLockLoggingLevel, getReadLockMinAge, getReadLockMinLength, getReadLockTimeout, getSortBy, getSorter, getTempFileName, getTempPrefix, isAllowNullBody, isAntFilterCaseSensitive, isAutoCreate, isDelete, isDoneFile, isEagerDeleteTargetFile, isEagerMaxMessagesPerPoll, isFlatten, isIdempotent, isIdempotentSet, isJailStartingDirectory, isKeepLastModified, isNoop, isPreSort, isReadLockDeleteOrphanLockFiles, isReadLockIdempotentReleaseAsync, isReadLockMarkerFile, isReadLockRemoveOnCommit, isReadLockRemoveOnRollback, isRecursive, isShuffle, isSynchronous, setAllowNullBody, setAntExclude, setAntFilterCaseSensitive, setAntInclude, setAppendChars, setAutoCreate, setBufferSize, setCharset, setConfiguration, 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, 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.Endpoint
configureProperties, createAsyncProducer, createExchange, createExchange, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isLenientProperties, isSingletonProducer, 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
-
Constructor Details
-
FileEndpoint
public FileEndpoint() -
FileEndpoint
-
-
Method Details
-
createConsumer
- Specified by:
createConsumer
in interfaceorg.apache.camel.Endpoint
- Specified by:
createConsumer
in classGenericFileEndpoint<File>
- Throws:
Exception
-
createPollingConsumer
- Specified by:
createPollingConsumer
in interfaceorg.apache.camel.Endpoint
- Overrides:
createPollingConsumer
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
createProducer
- Specified by:
createProducer
in interfaceorg.apache.camel.Endpoint
- Specified by:
createProducer
in classGenericFileEndpoint<File>
- Throws:
Exception
-
createExchange
- Specified by:
createExchange
in classGenericFileEndpoint<File>
-
newFileConsumer
protected FileConsumer newFileConsumer(org.apache.camel.Processor processor, GenericFileOperations<File> operations) Strategy to create a newFileConsumer
- Parameters:
processor
- the given processoroperations
- file operations- Returns:
- the created consumer
-
createGenericFileStrategy
Description copied from class:GenericFileEndpoint
A strategy method to lazily create the file strategy- Specified by:
createGenericFileStrategy
in classGenericFileEndpoint<File>
-
getFile
-
setFile
The starting directory -
getScheme
- Specified by:
getScheme
in classGenericFileEndpoint<File>
-
createEndpointUri
- Overrides:
createEndpointUri
in classorg.apache.camel.support.DefaultEndpoint
-
getFileSeparator
public char getFileSeparator()- Specified by:
getFileSeparator
in classGenericFileEndpoint<File>
-
isAbsolute
- Specified by:
isAbsolute
in classGenericFileEndpoint<File>
-
isCopyAndDeleteOnRenameFail
public boolean isCopyAndDeleteOnRenameFail() -
setCopyAndDeleteOnRenameFail
public void setCopyAndDeleteOnRenameFail(boolean copyAndDeleteOnRenameFail) Whether to fallback and do a copy and delete file, in case the file could not be renamed directly. This option is not available for the FTP component. -
isRenameUsingCopy
public boolean isRenameUsingCopy() -
setRenameUsingCopy
public void setRenameUsingCopy(boolean renameUsingCopy) Perform rename operations using a copy and delete strategy. This is primarily used in environments where the regular rename operation is unreliable (e.g. across different file systems or networks). This option takes precedence over the copyAndDeleteOnRenameFail parameter that will automatically fall back to the copy and delete strategy, but only after additional delays. -
isStartingDirectoryMustExist
public boolean isStartingDirectoryMustExist() -
setStartingDirectoryMustExist
public void setStartingDirectoryMustExist(boolean startingDirectoryMustExist) Whether the starting directory must exist. Mind that the autoCreate option is default enabled, which means the starting directory is normally auto created if it doesn't exist. You can disable autoCreate and enable this to ensure the starting directory must exist. Will thrown an exception if the directory doesn't exist. -
isStartingDirectoryMustHaveAccess
public boolean isStartingDirectoryMustHaveAccess() -
setStartingDirectoryMustHaveAccess
public void setStartingDirectoryMustHaveAccess(boolean startingDirectoryMustHaveAccess) Whether the starting directory has access permissions. Mind that the startingDirectoryMustExist parameter must be set to true in order to verify that the directory exists. Will thrown an exception if the directory doesn't have read and write permissions. -
isDirectoryMustExist
public boolean isDirectoryMustExist() -
setDirectoryMustExist
public void setDirectoryMustExist(boolean directoryMustExist) Similar to the startingDirectoryMustExist option but this applies during polling (after starting the consumer). -
isForceWrites
public boolean isForceWrites() -
setForceWrites
public void setForceWrites(boolean forceWrites) Whether to force syncing writes to the file system. You can turn this off if you do not want this level of guarantee, for example if writing to logs / audit logs etc; this would yield better performance. -
isProbeContentType
public boolean isProbeContentType() -
setProbeContentType
public void setProbeContentType(boolean probeContentType) Whether to enable probing of the content type. If enable then the consumer usesFiles.probeContentType(java.nio.file.Path)
to determine the content-type of the file, and store that as a header with keyExchange.FILE_CONTENT_TYPE
on theMessage
. -
getExtendedAttributes
-
setExtendedAttributes
To define which file attributes of interest. Like posix:permissions,posix:owner,basic:lastAccessTime, it supports basic wildcard like posix:*, basic:lastAccessTime -
chmodPermissionsAreValid
Chmod value must be between 000 and 777; If there is a leading digit like in 0755 we will ignore it. -
getPermissions
-
getChmod
-
setChmod
Specify the file permissions which is sent by the producer, the chmod value must be between 000 and 777; If there is a leading digit like in 0755 we will ignore it. -
getDirectoryPermissions
-
getChmodDirectory
-
setChmodDirectory
Specify the directory permissions used when the producer creates missing directories, the chmod value must be between 000 and 777; If there is a leading digit like in 0755 we will ignore it.
-