This Java sample program demonstrates how to use faspex 3.0 in conjunction with the FASPManager APIs to create and send a package to recipients as well as how monitor the package. This useful all in one example is a great starting point for your projects and to allow you to quickly build your own program by building off of this example. This document will provide the option to download the full program, system requirements and a quick overview of the different classes used. For more information on specific API calls please see the API guides on the left.
To begin you will need to download the Java Sample code. This code will need to be compiled and can be either imported into your favorite Java IDE or be compiled using a command prompt.
In order to run this program you will need to ensure the machine meets the following conditions:
- Has the Java Runtime Environment version 1.5 or higher
- Has ascp installed and on the system path
- Has a copy of the asperaweb_id_dsa.putty private key in the .ssh directory in the user's home folder (this is needed for token based authentication)
To help you get started we will cover the main components of this program and what they are for. This will help you quickly find the sections pertinent to what you are trying to accomplish. When you download the sample from below you will find all of the Java files in the src directory and all of the dependent library files in the libs directory. Some of the more pertinent Java files are seen below.
This class is the driving force for the application. It handles most operations and more importantly contains the variables that you need to set for your application to talk to your faspex server. If transferFromLocal is set to true then a client to server upload is performed via FASPManager, however, if false then a server to server transfer will take place with the source being the ID that corresponds to sourceShareID. It should be noted that even with a server to server transfer we are still able to monitor the progress of the transfer.
This class contains the helper methods used to create the JSON package request that describes the faspex package that will be sent to the faspex 3.0 send API.
This class is used to transfer the files using the FASPManager API based on the result of the faspex send API that was performed in SendData.java.