SFTP Connection
Note
SFTP connection is available since Process17.0.0
To set up a connection to a server :
-
From the connection properties form, fill in the definition of the connection: the label, possibly a description, the connection’s attachment organization and the System name.
-
Enter the connection settings :
- Hostname
- Port Number: The default port for an FTP connection is 22. The field is initialized to this value, but you can change it if needed
- Connection time out : expressed in seconds and the field is initialized to 30 seconds, but you can change it if needed
- Protocol : none, basic or OAuth 2.0 (since Process2025.1.0)
- Login or ID by which Process will connect to the server
- Server login password by which Process will connect to the server
- Base folder : path to the desired base folder
Example: agent listing the files in a folder
package com.axemble.vdoc.core.agents;
import com.jcraft.jsch.ChannelSftp;
import java.util.Vector;
import com.axemble.vdoc.VDocManagers;
import com.axemble.vdoc.connector.domain.ConnectionDefinition;
import com.axemble.vdoc.sdk.agent.base.BaseAgent;
public class TestAgent extends BaseAgent
{
@Override
protected void execute()
{
ConnectionDefinition<ChannelSftp> connectionDomain = VDocManagers.getConnectorManager().getConnectionDefinitionByName("SFTPTest");
ChannelSftp channelSftp = connectionDomain.getConnection();
try {
Vector<ChannelSftp.LsEntry> list = channelSftp.ls("*");
for(ChannelSftp.LsEntry entry : list) {
getReport().addInfo(entry.getFilename());
}
} catch (Exception e) {
e.printStackTrace();
channelSftp.disconnect();
}
}
}