Package org.apache.synapse.commons.vfs
Class VFSUtils
java.lang.Object
org.apache.synapse.commons.vfs.VFSUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanacquireLock(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso, boolean isListener) Acquires a file item lock before processing the item, guaranteing that the file is not processed while it is being uploaded and/or the item is not processed by two listenersstatic booleanacquireLock(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, VFSParamDTO paramDTO, org.apache.commons.vfs2.FileSystemOptions fso, boolean isListener) Acquires a file item lock before processing the item, guaranteing that the file is not processed while it is being uploaded and/or the item is not processed by two listenersstatic org.apache.commons.vfs2.FileSystemOptionsattachFileSystemOptions(Map<String, String> options, org.apache.commons.vfs2.FileSystemManager fsManager) static StringgetFileName(org.apache.axis2.context.MessageContext msgCtx, VFSOutTransportInfo vfsOutInfo) static LonggetLastModified(org.apache.axis2.context.MessageContext msgCtx) Helper method to get last modified date from msgCtxstatic StringgetProperty(org.apache.commons.vfs2.FileContent message, String property) Get a String property from FileContent messagestatic StringgetSystemTime(String dateFormat) static booleanisFailRecord(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo) static booleanisFailRecord(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso) static booleanisReadyToRead(org.apache.commons.vfs2.FileObject fo, Long waitTimeBeforeRead) static voidmarkFailRecord(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo) static voidmarkFailRecord(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso) static StringmaskURLPassword(String url) Mask the password of the connection url with ***parseSchemeFileOptions(String fileURI, Properties vfsProperties) parseSchemeFileOptions(String fileURI, org.apache.axis2.description.ParameterInclude params) static voidreleaseFail(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo) static voidreleaseFail(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso) static voidreleaseLock(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso) Release a file item lock acquired either by the VFS listener or a senderstatic StringresolveUriHost(String uri) Function to resolve hostname of the vfs uristatic StringresolveUriHost(String uri, StringBuilder strBuilder) Function to resolve the hostname of uri to ip for following vfs protocols.validateAndGetDiskShareAccessMask(String diskShareAccessMask)
-
Field Details
-
PASSIVE_MODE
Passive mode- See Also:
-
IMPLICIT_MODE
FTPS implicit mode- See Also:
-
PROTECTION_MODE
- See Also:
-
DISK_SHARE_ACCESS_MASK
- See Also:
-
DISK_SHARE_ACCESS_MASK_MAX_ALLOWED
- See Also:
-
-
Method Details
-
getProperty
Get a String property from FileContent message- Parameters:
message- the File messageproperty- property name- Returns:
- property value
-
getFileName
public static String getFileName(org.apache.axis2.context.MessageContext msgCtx, VFSOutTransportInfo vfsOutInfo) -
acquireLock
public static boolean acquireLock(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso, boolean isListener) Acquires a file item lock before processing the item, guaranteing that the file is not processed while it is being uploaded and/or the item is not processed by two listeners- Parameters:
fsManager- used to resolve the processing filefo- representing the processing file itemfso- represents file system options used when resolving file from file system manager.- Returns:
- boolean true if the lock has been acquired or false if not
-
acquireLock
public static boolean acquireLock(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, VFSParamDTO paramDTO, org.apache.commons.vfs2.FileSystemOptions fso, boolean isListener) Acquires a file item lock before processing the item, guaranteing that the file is not processed while it is being uploaded and/or the item is not processed by two listeners- Parameters:
fsManager- used to resolve the processing filefo- representing the processing file itemfso- represents file system options used when resolving file from file system manager.- Returns:
- boolean true if the lock has been acquired or false if not
-
releaseLock
public static void releaseLock(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso) Release a file item lock acquired either by the VFS listener or a sender- Parameters:
fsManager- which is used to resolve the processed filefo- representing the processed filefso- represents file system options used when resolving file from file system manager.
-
maskURLPassword
Mask the password of the connection url with ***- Parameters:
url- the actual url- Returns:
- the masked url
-
getSystemTime
-
getLastModified
Helper method to get last modified date from msgCtx- Parameters:
msgCtx-- Returns:
- lastModifiedDate
-
markFailRecord
public static void markFailRecord(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo) -
markFailRecord
public static void markFailRecord(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso) -
isFailRecord
public static boolean isFailRecord(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo) -
isFailRecord
public static boolean isFailRecord(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso) -
isReadyToRead
- Parameters:
fo- representing the processed filewaitTimeBeforeRead- representing the time period in milliseconds to wait before reading the file- Returns:
- boolean true if the can be processed or false if not
-
releaseFail
public static void releaseFail(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo) -
releaseFail
public static void releaseFail(org.apache.commons.vfs2.FileSystemManager fsManager, org.apache.commons.vfs2.FileObject fo, org.apache.commons.vfs2.FileSystemOptions fso) -
parseSchemeFileOptions
-
parseSchemeFileOptions
-
attachFileSystemOptions
public static org.apache.commons.vfs2.FileSystemOptions attachFileSystemOptions(Map<String, String> options, org.apache.commons.vfs2.FileSystemManager fsManager) throws org.apache.commons.vfs2.FileSystemException- Throws:
org.apache.commons.vfs2.FileSystemException
-
resolveUriHost
public static String resolveUriHost(String uri) throws org.apache.commons.vfs2.FileSystemException, UnknownHostException Function to resolve hostname of the vfs uri- Parameters:
uri- URI need to resolve- Returns:
- hostname resolved uri
- Throws:
org.apache.commons.vfs2.FileSystemException- Unable to decode due to malformed URIUnknownHostException- Error occurred while resolving hostname of URI
-
resolveUriHost
public static String resolveUriHost(String uri, StringBuilder strBuilder) throws org.apache.commons.vfs2.FileSystemException, UnknownHostException Function to resolve the hostname of uri to ip for following vfs protocols. if not the protocol listed, return same uri provided for {uri} Protocols resolved : SMB- Parameters:
uri- URI need to resolvestrBuilder- string builder to use to build the resulting uri- Returns:
- hostname resolved uri
- Throws:
org.apache.commons.vfs2.FileSystemException- Unable to decode due to malformed URIUnknownHostException- Error occurred while resolving hostname of URI
-