Adapter Development Kit 9.12 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Usage Scenarios | How to register an adapter with the Integration Server? | Creating Adapter Startup and Shutdown Java Services
 
Creating Adapter Startup and Shutdown Java Services
1. Create adapter startup and shutdown Java Service.
*Create Java class for adapter startup and shutdown, which is used to generate corresponding Java Services using jcode utility.
*Create a folder structure for the Java package for adapter admin class. For example: adapterPackageName\wm\mycompany\adapteradmin. In the example, the Java package created is adapterPackageName\wm\MyAdapter.
*Create adapter admin Java class.

package wm.MyAdapter;

//--- <<IS-START-IMPORTS>> ---
import com.wm.MyAdapter.*;
import com.wm.adk.admin.AdapterAdmin;
import com.wm.app.b2b.server.ServiceException;
import com.wm.data.IData;
//--- <<IS-END-IMPORTS>> ---

public class MyAdapterAdmin {

public static final void startUp (IData pipeline)
throws ServiceException
{
// --- <<IS-START(startUp)>> ---
AdapterAdmin.registerAdapter(MyAdapter.getInstance());
// --- <<IS-END>> ---
}
public static final void shutDown (IData pipeline)
throws ServiceException
{
// --- <<IS-START(shutDown)>> ---
MyAdapter instance = MyAdapter.getInstance();
instance.cleanup();
AdapterAdmin.unregisterAdapter(instance);
// --- <<IS-END>> ---
}
}
Note:
Tags are used to mark the beginning and end of imports and methods. For more information, see webMethods Service Development Help.
*Create adapter startup and shutdown Java Service using Designer.
*Open Designer.
*Select the webMethods package you created using Designer.
*Create a folder structure for the Java package for adapter admin Java Services. For example: wm\mycompanyname\adapteradmin. In the example, the folder structure created is wm\MyAdapter.
*Create a new Java Service for adapter startup. In the example, the Java Service created is startUp.
*Add the following Java code.
public static final void startUp(IData pipeline) throws ServiceException {
// --- <<IS-START(startUp)>> ---
AdapterAdmin.registerAdapter(MyAdapter.getInstance());
// --- <<IS-END>> ---
}
Note:
Tags are used to mark the beginning and end of imports and methods. For more information, see webMethods Service Development Help.
*Create a new Java Service for adapter shutdown. In the example, the Java Service created is shutDown.
*Add the following Java code.
public static final void shutDown(IData pipeline) throws ServiceException {
// --- <<IS-START(shutDown)>> ---
MyAdapter instance = MyAdapter.getInstance();
instance.cleanup();
AdapterAdmin.unregisterAdapter(instance);
// --- <<IS-END>> ---
}
Note:
Tags are used to mark the beginning and end of imports and methods. For more information, see webMethods Service Development Help.
The Java classes for adapter admin are created.