Install and build code samples
3 minute read
Install the code samples
Your installation of API Gateway includes code samples to demonstrate some of the tasks discussed in this guide, such as adding a custom filter or adding a message listener to API Gateway. The code samples are available in the INSTALL_DIR/apigateway/samples/developer_guide
directory.
Alternatively, the associated code samples are available from Axway Support as a zip file.
This section describes how to install the code samples.
Prerequisites
Before you install the code samples:
- You must install the API Gateway core server and Policy Studio, as the samples require certain classes that ship with these components to be on the CLASSPATH.
- To write custom message filters for API Gateway, you must install the samples on the same machine as API Gateway.
Unzip the downloaded zip file
If you downloaded the samples from Axway Support as a zip file, the zip file contains the following directory structure:
developer-guide-7.7/samples/developer_guide
Use your preferred zip utility to unzip the file to a suitable location.
Location of code samples
The location DEVELOPER_SAMPLES
is used throughout this guide to refer to the location of the code samples:
- If you have installed API Gateway,
DEVELOPER_SAMPLES
refers to theINSTALL_DIR/apigateway/samples/developer_guide
directory. - If you have installed the code samples from a zip file,
DEVELOPER_SAMPLES
refers to the location where you installed the samples (for example, the/home/samples/developer-guide-7.7/samples/developer_guide
directory).
Build the code samples
API Gateway is built with JDK 1.8. To avoid BadClassVersion
errors that might arise when deploying your sample classes with the API Gateway, you must also build the code samples with JDK 1.8.
This section describes how to build the code samples.
Build the samples
Complete the following steps to build the samples:
-
Set the
VORDEL_HOME
environment variable to point to the root of your Axway API Gateway installation.For example, if you installed API Gateway in
/opt/Axway-7.7/apigateway
, setVORDEL_HOME
to this directory. -
Set the
POLICYSTUDIO_HOME
environment variable to point to the root of your Policy Studio installation.For example, if you installed Policy Studio in
/opt/Axway-7.7/policystudio
, setPOLICYSTUDIO_HOME
to this directory. -
Set the
JAVA_HOME
environment variable to point to the root of a JDK 1.8 installation.For example,
/opt/jdk1.8.0_07
-
Set the
JUNIT_HOME
environment variable to point to the directory containing your JUnit JAR file. The required version is 4.8.2.For example,
junit_4.8.2.jar
-
Add Apache Ant to your
PATH
environment variable. For example, if Apache Ant is installed in/opt/ant
, add/opt/ant/bin
to yourPATH
. See the Apache Ant website for more information on Apache Ant. -
Change to the directory where the sample is installed. Each sample is installed under
DEVELOPER_SAMPLES/SAMPLE_NAME
(for example,DEVELOPER_SAMPLES/FilterInterceptorLoadableModule
). -
Open the
README.TXT
file and follow the instructions to build and run the sample.
Description of samples
The following code samples are included:
DEVELOPER_SAMPLES/FilterInterceptorLoadableModule
– Sample classes that implement Java interfaces. For more information, see Java interfaces for extending API Gateway.