Creating Java Classes for Adapter Startup and Shutdown
1. Create a folder structure for the Java package for adapter admin class. For example: adapterPackageName\code\source\wm\mycompany\adapteradmin. In the example, the Java package created is adapterPackageName\code\source\wm\MyAdapter.
Note:
You must create your Java package and classes in the adapterPackageName\code\source folder in the webMethods package you created using Designer.
2. Create adapter admin Java class.
In the example, class MyAdapterAdmin is created:
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.