FTP Operator Sample

About This Sample

This operator sample illustrates the use of the TIBCO StreamBase® operator for FTP by sending an FTP client GET command to an FTP server to retrieve a file.

Running This Sample in StreamBase Studio

  1. First, ensure that you have imported the sample by following the section above: Importing This Sample into StreamBase Studio.

  2. This sample is ready to run out of the box. Click the Run button to start the application and enter the SB Test/Debug perspective.

    Enter no values and press Send Data.

  3. Press F9 or click the Stop Running Application button.

  4. Refresh your project, by selecting the project from the resource menu and pressing F5.

    You should notice that there is now a new file in your project. This was the file retrieved via the FTP GET command.

  5. Restart the application

    In the field cmd, enter the value FREE_FORM and press Send Data.

    You should see, in the Output Streams tab, that the object field contains two numbers. The first is the server response code and the second is the size of the file that you just retrieved, in bytes.

  6. Experiment with different values for cmd, local, remote and the operator properties.

    If you want to have more functionality, be sure to change the Server hostname, Username and Password operator properties to a server on which you have write access.

Importing This Sample into StreamBase Studio

In StreamBase Studio, import this sample with the following steps:

  • From the top menu, select FileLoad StreamBase Sample.

  • Select FTP Operator from the Extending StreamBase category.

  • Click OK.

StreamBase Studio creates a single project containing the sample files.

Sample Location

When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.

Important

Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.

Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:

studio-workspace/sample_ftp

See Default Installation Directories for the location of studio-workspace on your system.

In the default TIBCO StreamBase installation, this sample's files are initially installed in:

streambase-install-dir/sample/ftp

See Default Installation Directories for the default location of studio-workspace on your system.