Creating Adapter Startup and Shutdown Java Services
1. Create adapter startup and shutdown Java Service.
![*](chapterTOC_bullet.png)
Create Java class for adapter startup and shutdown, which is used to generate corresponding Java Services using jcode utility.
![*](chapterTOC_bullet.png)
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.
![*](chapterTOC_bullet.png)
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.
![*](chapterTOC_bullet.png)
Create adapter startup and shutdown Java Service using
Designer.
![*](chapterTOC_bullet.png)
Open
Designer.
![*](chapterTOC_bullet.png)
Select the
webMethods package you created using
Designer.
![*](chapterTOC_bullet.png)
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.
![*](chapterTOC_bullet.png)
Create a new Java Service for adapter startup. In the example, the Java Service created is
startUp.
![*](chapterTOC_bullet.png)
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.
![*](chapterTOC_bullet.png)
Create a new Java Service for adapter shutdown. In the example, the Java Service created is
shutDown.
![*](chapterTOC_bullet.png)
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.