Package org.apache.camel.component.file
Class GenericFileHelper
java.lang.Object
org.apache.camel.component.file.GenericFileHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringasExclusiveReadLockKey(String path, String key) static StringasExclusiveReadLockKey(GenericFile file, String key) static <T> org.apache.camel.ExchangecreateDummy(GenericFileEndpoint<T> endpoint, org.apache.camel.Exchange dynamic) static <T> org.apache.camel.ExchangecreateDummy(GenericFileEndpoint<T> endpoint, org.apache.camel.Exchange dynamic, Supplier<GenericFile<T>> file) static booleanisWithinDirectory(String compactTarget, String compactDir) Determines whether a compacted target path is contained within a compacted directory path, using a path-segment boundary comparison.static voidjailToLocalWorkDirectory(File target, File localWorkDirectory) Ensures the resolved local work file stays within the configured local work directory.
-
Method Details
-
jailToLocalWorkDirectory
Ensures the resolved local work file stays within the configured local work directory. The remote file name used to build the local work file path may contain../sequences that would otherwise resolve to a path outside the work directory.- Parameters:
target- the resolved local work file (or its in-progress temp file)localWorkDirectory- the local work directory the file must stay within- Throws:
GenericFileOperationFailedException- if the target resolves outside the local work directory
-
isWithinDirectory
Determines whether a compacted target path is contained within a compacted directory path, using a path-segment boundary comparison. Unlike a bare string prefix test, a sibling directory whose name merely extends the directory name (for example/workversus/workspace) is not considered contained. A trailing separator on the directory is tolerated, and an empty directory imposes no boundary.- Parameters:
compactTarget- the compacted target path (seeFileUtil.compactPath(String))compactDir- the compacted directory the target must stay within- Returns:
trueif the target is the directory itself or a path inside it
-
asExclusiveReadLockKey
-
asExclusiveReadLockKey
-
createDummy
public static <T> org.apache.camel.Exchange createDummy(GenericFileEndpoint<T> endpoint, org.apache.camel.Exchange dynamic, Supplier<GenericFile<T>> file) -
createDummy
public static <T> org.apache.camel.Exchange createDummy(GenericFileEndpoint<T> endpoint, org.apache.camel.Exchange dynamic)
-