Adapter Development Kit 9.12 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | The Adapter Definition | Deploying the adapter | Compiling the Adapter
 
Compiling the Adapter
Before you load your adapter, you must compile your implementation classes and construct the Java Service nodes for your startup and shutdown services.
1. Create an ANT script to compile the adapter implementation and admin classes, and deploy these classes in Integration Server as Java Services. In the example, the ANT script created is build.xml and build.properties.
Note:
You must create your ANT script in the adapterPackageName\code\source folder in the webMethods package you created using Designer.
For example build.properties:
# The Site Name
debug=on
optimize=off
deprecation=off
webM.home=C:/softwareag/912
server.home=${webM.home}/IntegrationServer
package=MyAdapter
instance_name=default
srcdir=${server.home}/instances/${instance_name}/packages/${package}/code/source
destdir=${server.home}/instances/${instance_name}/packages/${package}/code/classes
For example build.xml:
<?xml version="1.0"?>
<project name="Adapter using ADK" default="deploy" basedir=".">
<property file="build.properties" />
<!-- classes belonging to this package -->
<path id="this.package.classpath">
<fileset dir="${server.home}/instances/${instance_name}/packages/${package}/">
<include name="code/classes"/>
</fileset>
</path>

<!-- All classes that need to be found by this script -->
<path id="total.classpath">
<pathelement location="${server.home}/instances/${instance_name}/packages/WmART/code/jars/wmart.jar"/>
<pathelement location="${server.home}/lib/wm-isserver.jar"/>
<pathelement location="${webM.home}/common/lib/wm-isclient.jar"/>
<pathelement location="${webM.home}/common/lib/glassfish/gf.jakarta.resource.jar"/>
<pathelement location="${server.home}/instances/${instance_name}/packages/WmART/code/classes/"/>
<path refid="this.package.classpath"/>
</path>
<!-- Compile the java files of this package -->
<target name="createclasses" depends="init">
<echo>Creating classes</echo>
<mkdir dir="${destdir}/"/>
<javac debug="${debug}" optimize="${optimize}"
deprecation="${deprecation}" srcdir="${srcdir}"
destdir="${destdir}">
<classpath>
<path refid="total.classpath"/>
</classpath>
</javac>
</target>

<!-- Execute jcode -->
<target name="execjcode" depends="createclasses">
<echo>Deploying classes</echo>
<exec executable="${server.home}/instances/${instance_name}/bin/jcode"
vmlauncher="false" failonerror="true">
<arg value="fragall" />
<arg value="${package}" />
</exec>
</target>

<!-- delete .class files built in this package -->
<target name="cleanclasses">
<echo>Cleaning classes</echo>
<mkdir dir="${destdir}"/>
<delete quiet="false">
<fileset dir="${destdir}" includes="**/*.class"/>
</delete>
</target>

<!-- if this package depends on classes found in other packages,
add targets to build those classes here. -->
<target name="init">
<tstamp/>
</target>

<target name="packageDependencies" depends="" />
<target name="clean" depends="cleanclasses" />
<target name="classes" depends="cleanclasses, createclasses" />
<target name="deploy" depends="execjcode" />
<target name="all" depends="packageDependencies, cleanclasses, execjcode" />
<target name="remake" depends="packageDependencies, cleanclasses, createclasses" />

</project>
2. Set the classpath in total.classpath in the ANT script.
The JAR files required to compile your source code are as follows:
*Software AG_directory \common\lib\wm-isclient.jar
*Software AG_directory \common\lib\glassfish\gf.jakarta.resource.jar
*Integration Server_directory \lib\wm-isserver.jar
*Integration Server_directory \instances\<instance_name>\packages\WmART\code\jars\wmart.jar
The folder containing the class files required to compile your source code is as follows:
*Integration Server_directory \instances\<instance_name>\packages\WmART\code\classes
Software AG_directory is the folder in which webMethods components are installed and Integration Server_directory is the folder in which Integration Server is installed.
Note: 
*Add the required folders location to your classpath, or package all folders in a JAR and then add the JAR to your classpath.
*You must specify JDK version 1.8 or higher in your classpath.
3. Run the ANT script to compile the Java classes.
ant classes
4. Compile the classes and deploy in Integration Server..
a. Run the ANT script to create classes and deploy in Integration Server as Java Services.
ant deploy
Note:
If you have created adapter admin Java class for adapter startup and shutdown, then the corresponding Java Services are deployed using jcode utility. The jcode utility is provided with Integration Server. For more information, see webMethods Service Development Help.
b. If you have created Startup and Shutdown Java Services using Designer, you must compile it using Integration Server Administrator.
*Start Integration Server Administrator.
*Select Settings > Extended > Edit Extended Settings.
*Set the property watt.server.compile to include the path to Java compiler and the classpath to include the wmart.jar in Integration Server_directory \instances\<instance_name>\packages\WmART\code\jars\wmart.jar. For example:
watt.server.compile=C:\softwareag\912\jvm\jvm\bin\javac
-classpath {0};C:\softwareag\912\IntegrationServer\instances\default\packages\
WmART\code\jars\wmart.jar; -d {1} {2}
5. Restart Integration Server.
If your startup and shutdown Java Services do not appear in the adapter package, there has been an error either in compiling your code or in creating the Java Services.