×

Please give details of the problem

Docs

Find

SEC-FTP Adapter

The "FTP Adapter" is used to Get files, Add files, List files and folders, Delete files, Rename files and folders, create directories and remove directories. It requires the "Connector agent" and the "Protocol Manager" to be installed and running. Please follow the SEC - Installation Guide.

For this guide the following is assumed :

  • The SEC manager is running on the server and a tunnel is open and configured. You can find instructions on how to install and configure the SEC here.
  • The server has Java installed.
  • The ping port on the manager is 4444 (this can be configured in the adapter and the manager).
  • The manager is running on the same server as the adapter (127.0.0.1).

Install and Configure the Adapter

  • Download and unzip the SEC FTP zip file on your local server.
  • You must navigate to [install-path]/configFiles and modify the handler.config and the FTP.config files.

NOTE: It is recommended that the Adapter be installed in a "Adapters" folder inside the SEC installation path.

The handler.config file should look like this :

1
2
3
4
5
6
7
8
#Generic Protocol Configuration
protocol = FTP
protocolClass = org.runmyprocess.sec.FTP
handlerHost = 127.0.0.1
connectionPort = 5832
managerHost = 127.0.0.1
managerPort = 4444
pingFrequency = 300

Where :

  • protocol is the name to identify our Adapter.
  • protocolClass is the class of the Adapter.
  • handlerHost is where the Adapter is running.
  • connectionPort is the port of the adapter where data will be received and returned.
  • managerHost is where the SEC is running.
  • managerPort is the port where the SEC is listening for ping registrations.
  • pingFrequency is the frequency in which the manager will be pinged (at least three times shorter than what's configured in the manager).

The FTP.config file should look like this :

1
2
3
#FTP Configuration
host=127.0.0.1
port=2121

Where :

  • host is the host name or IP of your FTP.
  • port is the connection port of your FTP.

Note: The host should be just the name or IP address of your FTP without "ftp://".

Running and Testing the Adapter

You can now run the Adapter by executing the FTPAdapter.jar in the installed path :

1
java -jar FTPAdapter.jar

Note: Make sure that you have launched the [Protocol Manager] (/Integration_Guide/SEC/Installation_Guide) and it is running on port 8080.

If everything is configured correctly, you can now access your FTP through RunMyProcess. You can follow the examples shown below to manage your FTP server:

POST on http://127.0.0.1:8080/

Content-Type: application/json

Accept: application/json

Content (example): LIST

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 {
"protocol":"FTP",
"data":{
           "task":"LIST",
           "path":"Ubuntu One/appartment/",
        "user":"myUser",
        "password":"MyPassword"

    } 
}

PUT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 {
"protocol":"FTP",
"data":{
           "task":"PUT",
           "path":"Ubuntu One/appartment/",
        "user":"myUser",
        "password":"MyPassword",
           "files":[
                        {
                      "name":"I AM THE WALLRUS 6!",
                      "content":"SEVMTE8gV09STEQ=" 
                      },
                      {
                      "name":"I AM THE WALLRUS 7!",
                      "content":"SEVMTE8gV09STEQ=" 
                      }
                     ]

    } 
}

DELETE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 {
"protocol":"FTP",
"data":{
           "task":"DELETE",
           "path":"Ubuntu One/appartment/",
        "user":"myUser",
        "password":"MyPassword",
           "files":[
            "Ubuntu One/appartment/I AM THE WALLRUS 6!",
            "Ubuntu One/appartment/I AM THE WALLRUS 7!"
                     ]

    } 
}

MKDIR

1
2
3
4
5
6
7
8
9
 {
"protocol":"FTP",
"data":{
           "task":"MKDIR",
           "path":"Ubuntu One/appartment/WhoIsTheWallrusDir",
        "user":"myUser",
        "password":"MyPassword"
    } 
}

RMDIR

1
2
3
4
5
6
7
8
9
 {
"protocol":"FTP",
"data":{
           "task":"RMDIR",
           "path":"Ubuntu One/appartment/WhoIsTheWallrusDir",
        "user":"myUser",
        "password":"MyPassword"
    } 
}

RENAME

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 {
"protocol":"FTP",
"data":{
           "task":"RENAME",
        "user":"myUser",
        "password":"MyPassword",
           "original":"Ubuntu One/appartment/I AM THE WALLRUS 6!",
           "new":"Ubuntu One/appartment/I AM THE WALLRUS 6.5!"

    } 
}

Where "file" contains the return information and "file.file" is the file content base64 encoded.

Note: if you are having problems, make sure that:

  • the Protocol Manager and the FTP Adapter have the same ping port configuration (4444 by default).
  • the Protocol Manager is running on the port you are posting to (8080 by default) with no errors on the console.
  • navigating to http://127.0.0.1:8080/ on your browser returns a success message and the a list of the running adapters.