...
Code Block |
---|
|
<fileconnector.archives>
<source>{$ctx:source}</source>
<destination>{$ctx:destination}</destination>
<inputContent>{$ctx:inputContent}</inputContent>
<fileName>{$ctx:fileName}</fileName>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
<includeSubdirectories><includeSubDirectories>{$ctx:includeSubdirectoriesincludeSubDirectories}</includeSubdirectories>includeSubDirectories>
</fileconnector.archives> |
Properties
source
: The location of the file. This can be a file on the local physical file system or a file on an FTP server.
For local files, the URI format is [file://]absolute-path
,where absolute-path
is a valid absolute file name for the local platform. UNC names are supported under Windows (e.g., file:///home/user/test
or file:///C:/Windows
).
For files on a FTP server, the URI format is ftp://[ username[: password]@] hostname[: port][ relative-path]
(e.g., ftp://myusername:mypassword@somehost/pub/downloads/test.txt
).destination
: The location of the archived file with the file name. (e.g., file:///home/user/test /test.zip
)inputContent
: The input content which needs to be archived.fileName
: The name of the file where input content needs to be archived.setTimeout
[optional]: The timeout value on the JSC(Java Secure Channel) session in milliseconds. e.g., 100000.setPassiveMode
[optional]: Set to true
if you want to enable passive mode.setSoTimeout
[optional]: The socket timeout value for the FTP client. e.g., 100000.setUserDirIsRoot
[optional]: Set to true
if you want to use root as the user directory.setStrictHostKeyChecking
[optional]: Sets the host key checking to use .e.g., no. includeSubdirectories
includeSubDirectories
[optional] : Set to true if you want to include the sub directories.
...
Code Block |
---|
language | xml |
---|
title | Sample Request for archives |
---|
|
{
"source":"/home/vive/Desktop/file",
"destination":"/home/user/test/file.zip",
"includeSubdirectoriesincludeSubDirectories":"true"
} |
Copying a file
...
Code Block |
---|
|
<fileconnector.copy>
<source>{$ctx:source}</source>
<destination>{$ctx:destination}</destination>
<filePattern>{$ctx:filePattern}</filePattern>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
<includeParentDirectory>{$ctx:includeParentDirectory}</includeParentDirectory>
<includeSubdirectories><includeSubDirectories>{$ctx:includeSubdirectoriesincludeSubDirectories}</includeSubdirectories>includeSubDirectories>
</fileconnector.copy> |
Properties
Sample request
Following is a sample REST/JSON request that can be handled by the copy
operation.
Code Block |
---|
language | xml |
---|
title | Sample Request for copy |
---|
|
{
"source":"/home/vive/Desktop/file",
"destination":"/home/user/test/fileCopy",
"filePattern":".*\.xml",
"includeParentDirectory":"false",
"includeSubdirectoriesincludeSubDirectories":"false"
} |
Creating a file or folder...
Code Block |
---|
|
<fileconnector.create>
<filePath>{$ctx:filePath}</filePath>
<inputContent>{$ctx:inputContent}</inputContent>
<encoding>{$ctx:encoding}</encoding>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
</fileconnector.create> |
Properties
- filePath: The location of the file. This can be a file on the local physical file system or a file on an FTP server.
For local files, the URI format is [file://] absolute-path, where absolute-path is a valid absolute file name for the local platform. UNC names are supported under Windows (e.g., file:///home/user/test/test.txt or file:///C:/Windows ).
For files on an FTP server, the URI format is ftp://[ username[: password]@] hostname[: port][ relative-path] (e.g., ftp://myusername:mypassword@somehost/pub/downloads/test.txt). For creating a file, the file path should have extension (e.g. , file:///home/user/test/test.txt) inputContent
[optional] : The content of the file.encoding
[optional] : The encoding that is supported. Possible values are US-ASCII ,UTF-8 and UTF-16 .setTimeout
[optional]: The timeout value on the JSC(Java Secure Channel) session in milliseconds. e.g., 100000.setPassiveMode
[optional]: Set to true
if you want to enable passive mode.setSoTimeout
[optional]: The socket timeout value for the FTP client. e.g., 100000.setUserDirIsRoot
[optional]: Set to true
if you want to use root as the user directory.setStrictHostKeyChecking
[optional]: Sets the host key checking to use .e.g., no.
...
Code Block |
---|
|
<fileconnector.delete>
<source>{$ctx:source}</source>
<filePattern>{$ctx:filePattern}</filePattern>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
<includeSubdirectories><includeSubDirectories>{$ctx:includeSubdirectoriesincludeSubDirectories}</includeSubdirectories>includeSubDirectories>
</fileconnector.delete> |
Properties
source
: The location of the file. This can be a file on the local physical file system or a file on an FTP server.
For local files, the URI format is [file://] absolute-path, where absolute-path is a valid absolute file name for the local platform. UNC names are supported under Windows (e.g., file:///home/user/test/test.zip or file:///C:/Windows ).
For files on an FTP server, the URI format is ftp://[ username[: password]@] hostname[: port][ relative-path] (e.g., ftp://myusername:mypassword@somehost/pub/downloads/test.txt).filePattern
: The pattern of the files to be deleted.(e.g., [a-zA-Z][a-zA-Z]*.(txt|xml|jar)).setTimeout
[optional]: Sets the timeout value on Jsch(Java Secure Channel) session. e.g., 100000.setPassiveMode
[optional]: Sets the passive mode to enter into passive mode. e.g., true.setSoTimeout
[optional]: Sets the socket timeout for the FTP client. e.g., 100000.setUserDirIsRoot
[optional]: Sets the whether to use the user directory as root. e.g., flase.setStrictHostKeyChecking
[optional]: Sets the host key checking to use .e.g., no. includeSubdirectories
includeSubDirectories
[optional] : Set to true if you want to include the sub directories.
...
Code Block |
---|
language | xml |
---|
title | Sample Request for delete |
---|
|
{
"source":"/home/vive/Desktop/file",
"filePattern":".*\.txt",
"includeSubdirectoriesincludeSubDirectories":"true"
} |
Checking the existence of a file
...
Code Block |
---|
language | xml |
---|
title | listFileZip |
---|
|
<fileconnector.listFileZip>
<source>{$ctx:source}</source>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
</fileconnector.listFileZip> |
Properties
source
: The location of the file. This can be a file on the local physical file system or a file on an FTP server.
For local files, the URI format is [file://] absolute-path, where absolute-path is a valid absolute file name for the local platform. UNC names are supported under Windows (e.g., file:///home/user/test/test.zip or file:///C:/Windows ).
For files on an FTP server, the URI format is ftp://[ username[: password]@] hostname[: port][ relative-path] (e.g., ftp://myusername:mypassword@somehost/pub/downloads/test.zip).setTimeout
[optional]: Sets the timeout value on Jsch(Java Secure Channel) session. e.g., 100000.setPassiveMode
[optional]: Sets the passive mode to enter into passive mode. e.g., true.setSoTimeout
[optional]: Sets the socket timeout for the FTP client. e.g., 100000.setUserDirIsRoot
[optional]: Sets the whether to use the user directory as root. e.g., flase.setStrictHostKeyChecking
[optional]: Sets the host key checking to use .e.g., no.
...
Code Block |
---|
|
<fileconnector.move>
<source>{$ctx:source}</source>
<destination>{$ctx:destination}</destination>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
<filePattern>{$ctx:filePattern}</filePattern>
<includeParentDirectory>{$ctx:includeParentDirectory}</includeParentDirectory>
<includeSubdirectories><includeSubDirectories>{$ctx:includeSubdirectoriesincludeSubDirectories}</includeSubdirectories>includeSubDirectories>
</fileconnector.move> |
Properties
source
: The location of the file. This can be a file on the local physical file system, or a file on an FTP server.
For local files, the URI format is [file://] absolute-path where absolute-path is a valid absolute file name for the local platform. UNC names are supported under Windows (e.g., file:///home/user/test or file:///C:/Windows ).
For files on an FTP server, the URI format is ftp://[ username[: password]@] hostname[: port][ relative-path] (e.g., ftp://myusername:mypassword@somehost/pub/downloads/test.txt).destination
: The location where the file has to be moved to.setTimeout
[optional]: The timeout value on the JSC(Java Secure Channel) session in milliseconds. e.g., 100000.setPassiveMode
[optional]: Set to true
if you want to enable passive mode.setSoTimeout
[optional]: The socket timeout value for the FTP client. e.g., 100000.setUserDirIsRoot
[optional]: Set to true
if you want to use root as the user directory.setStrictHostKeyChecking
[optional]: Sets the host key checking to use .e.g., no. filePattern
[optional] : The pattern of the files to be copied. (e.g [a-zA-Z][a-zA-Z]*.(txt|xml|jar)) includeParentDirectory
[optional] : Set to true
if you want to include the parent directory.
includeSubdirectories
includeSubDirectories
[optional] : Set to true if you want to include the sub directories.
...
Code Block |
---|
language | xml |
---|
title | Sample Request for move |
---|
|
{
"source":"/home/vive/Desktop/file",
"destination":"/home/vive/Desktop/move",
"filePattern":".*\.txt",
"includeParentDirectory":"true",
"includeSubdirectoriesincludeSubDirectories":"true"
} |
Reading content from a file
...
Code Block |
---|
|
<fileconnector.read>
<source>{$ctx:source}</source>
<filePattern>{$ctx:filePattern}</filePattern>
<contentType>{$ctx:contentType}</contentType>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
</fileconnector.read> |
Properties
source
: The location of the file. This can be a file on the local physical file system or a file on an FTP server.
For local files, the URI format is [file://] absolute-path, where absolute-path is a valid absolute file name for the local platform. UNC names are supported under Windows (e.g., file:///home/user/test/test.xml or file:///C:/Windows/me.txt ). For files on an FTP server, the URI format is ftp://[ username[: password]@] hostname[: port][ relative-path] (e.g., ftp://myusername:mypassword@somehost/pub/downloads/test.txt).filePattern
: The pattern of the file to be read.contentType
: Content type of the files processsed by the connector. streaming
[optional]: The streaming mode, This can be either true or false.setTimeout
[optional]: Sets the timeout value on Jsch(Java Secure Channel) session. e.g., 100000.setPassiveMode
[optional]: Sets the passive mode to enter into passive mode. e.g., true.setSoTimeout
[optional]: Sets the socket timeout for the FTP client. e.g., 100000.setUserDirIsRoot
[optional]: Sets the whether to use the user directory as root. e.g., flase.setStrictHostKeyChecking
[optional]: Sets the host key checking to use .e.g., no.
...
Code Block |
---|
|
<fileconnector.search>
<source>{$ctx:source}</source>
<filePattern>{$ctx:filePattern}</filePattern>
<recursiveSearch>{$ctx:recursiveSearch}</recursiveSearch>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
</fileconnector.search> |
Properties
source
: The location of the file. This can be a file on the local physical file system or a file on an FTP server.
For local files, the URI format is [file://] absolute-path, where absolute-path is a valid absolute file name for the local platform. UNC names are supported under Windows (e.g., file:///home/user/test/ or file:///C:/Windows ).
For files on an FTP server, the URI format is ftp://[ username[: password]@] hostname[: port][ relative-path] (e.g., ftp://myusername:mypassword@somehost/pub/downloads/).filePattern
: The pattern of the file to be searched (e.g., [a-zA-Z][a-zA-Z]*.(txt|xml|jar)). recursiveSearch
: Whether you are searching recursively (The possible values are True or False).
setTimeout
[optional]: Sets the timeout value on Jsch(Java Secure Channel) session. e.g., 100000.setPassiveMode
[optional]: Sets the passive mode to enter into passive mode. e.g., true.setSoTimeout
[optional]: Sets the socket timeout for the FTP client. e.g., 100000.setUserDirIsRoot
[optional]: Sets the whether to use the user directory as root. e.g., flase.setStrictHostKeyChecking
[optional]: Sets the host key checking to use .e.g., no.
...
Code Block |
---|
|
<fileconnector.unzip>
<source>{$ctx:source}</source>
<destination>{$ctx:destination}</destination>
<setTimeout>{$ctx:setTimeout}</setTimeout>
<setPassiveMode>{$ctx:setPassiveMode}</setPassiveMode>
<setSoTimeout>{$ctx:setSoTimeout}</setSoTimeout>
<setUserDirIsRoot>{$ctx:setUserDirIsRoot}</setUserDirIsRoot>
<setStrictHostKeyChecking>{$ctx:setStrictHostKeyChecking}</setStrictHostKeyChecking>
</fileconnector.unzip> |
Properties
source
: The location of the file. This can be a file on the local physical file system or a file on an FTP server.
For local files, the URI format is [file://] absolute-path, where absolute-path is a valid absolute file name for the local platform. UNC names are supported under Windows (e.g., file:///home/user/test/test.zip or file:///C:/Windows/test.zip ). For files on an FTP server, the URI format is ftp://[ username[: password]@] hostname[: port][ relative-path] (e.g., ftp://myusername:mypassword@somehost/pub/downloads/test.zip).destination
: The location of the decompressed file.setTimeout
[optional]: Sets the timeout value on Jsch(Java Secure Channel) session. e.g., 100000.setPassiveMode
[optional]: Sets the passive mode to enter into passive mode. e.g., true.setSoTimeout
[optional]: Sets the socket timeout for the FTP client. e.g., 100000.setUserDirIsRoot
[optional]: Sets the whether to use the user directory as root. e.g., flase.setStrictHostKeyChecking
[optional]: Sets the host key checking to use .e.g., no.
...
Code Block |
---|
language | xml |
---|
title | ftpOverProxy |
---|
|
<fileconnector.ftpOverProxy>
<proxyHost>{$ctx:proxyHost}</proxyHost>
<proxyPort>{$ctx:proxyPort}</proxyPort>
<proxyUsername>{$ctx:proxyUsername}</proxyUsername>
<proxyPassword>{$ctx:proxyPassword}</proxyPassword>
<ftpUsername>{$ctx:ftpUsername}</ftpUsername>
<ftpPassword>{$ctx:ftpPassword}</ftpPassword>
<ftpServer>{$ctx:ftpServer}</ftpServer>
<ftpPort>{$ctx:ftpPort}</ftpPort>
<targetPath>{$ctx:targetPath}</targetPath>
<targetFile>{$ctx:targetFile}</targetFile>
<keepAliveTimeout>{$ctx:keepAliveTimeout}</keepAliveTimeout>
<controlKeepAliveReplyTimeout>{$ctx:controlKeepAliveReplyTimeout}</controlKeepAliveReplyTimeout>
<binaryTransfer>{$ctx:binaryTransfer}</binaryTransfer>
<localActive>{$ctx:localActive}</localActive>
</fileconnector.ftpOverProxy> |
Properties
proxyHost
: The host name of the proxy.
proxyPort
: The port number of the proxy.
proxyUsername
: The user name of the proxy.
proxyPassword
: The password of the proxy.
ftpUsername
: The username of the FTP server.
ftpPassword
: The password of the FTP server.
ftpServer
: The FTP server name.
ftpPort
: The port number of the FTP server.
targetPath
: The target path. For example, if the file path is ftp://myusername:mypassword@somehost/pub/downloads/testProxy.txt
, the targetPath
will be pub/downloads/
targetFile
: The name of the file.(e.g., If the path is like "ftp://myusername:mypassword@somehost/pub/downloads/testProxy.txt", then targetPath will be "testProxy.txt")
keepAliveTimeout
[optional]: The time to wait between sending control connection keep alive messages when processing file upload or download.
controlKeepAliveReplyTimeout
[optional]: The time to wait for control keep-alive message replies.
binaryTransfer
[optional]: Set the file type to be transferred.
localActive
[optional]: Set the current data connection mode to either ACTIVE_LOCAL_DATA_CONNECTION_MODE or PASSIVE_LOCAL_DATA_CONNECTION_MODE.
Sample request
Following is a sample REST/JSON request that can be handled by the ftpOverProxy
operation.
Code Block |
---|
language | xml |
---|
title | Sample Request for ftpOverProxy |
---|
|
{
"proxyHost":"SampleProxy",
"proxyPort":"3128",
"proxyUsername":"wso2",
"proxyPassword":"Password",
"ftpUsername":"master",
"ftpPassword":"Password",
"ftpServer":"192.168.56.6",
"ftpPort":"21",
"targetFile":"/home/master/res"
} |
...