Adapter Development Kit 9.12 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Usage Scenarios | How to create an adapter service implementation? | How to create a basic adapter service implementation without any elements?
 
How to create a basic adapter service implementation without any elements?
1. Start the editor to create Java files for the adapter service implementation.
2. Create directories corresponding to your Java package structure in the webMethods package you created using Designer. For example: com\mycompany\adapter\myAdapter\services. In the example, the folder created is com\wm\MyAdapter\services.
Note:
You should create your Java package and classes in the adapterPackageName\code\source folder in the webMethods package you created using Designer.
3. Create a class by extending the com.wm.adk.cci.interaction.WmAdapterService base class.
In the example, created MockDbUpdate class:
package com.wm.MyAdapter.services;

import com.wm.adk.cci.interaction.WmAdapterService;
import com.wm.adk.cci.record.WmRecord;
import com.wm.adk.cci.record.WmRecordFactory;
import com.wm.adk.connection.WmManagedConnection;
import com.wm.adk.metadata.WmTemplateDescriptor;

import java.util.Hashtable;
import java.util.Locale;
import javax.resource.ResourceException;

import com.wm.MyAdapter.MyAdapter;


public class MockDbUpdate extends WmAdapterService {
public void fillWmTemplateDescriptor(WmTemplateDescriptor d,Locale l)
throws ResourceException {
}
public WmRecord execute(WmManagedConnection connection, WmRecord input)
throws ResourceException {
return null;
}

}
4. Update the resource bundle implementation class to add the display name and description of the adapter service.
In the example, updated MyAdapterResource class:
package com.wm.MyAdapter;
..
..

import com.wm.MyAdapter.services.MockDbUpdate;

public class MyAdapterResource extends ListResourceBundle implements MyAdapterConstants{
..
..
static final Object[][] _contents = {
..
..
//Adapter Services
,{MockDbUpdate.class.getName() + ADKGLOBAL.RESOURCEBUNDLEKEY_DISPLAYNAME,
"Mock Update Service"}
,{MockDbUpdate.class.getName() + ADKGLOBAL.RESOURCEBUNDLEKEY_DESCRIPTION,
"Simulates a database update service"}
}
protected Object[][] getContents() {
// TODO Auto-generated method stub
return _contents;
}
}
5. Register the adapter service by updating your fillResourceAdapterMetadataInfo method in your WmManagedConnectionFactory connection factory implementation class.
In the example, the MockDbUpdate class is registered using fillResourceAdapterMetadataInfo method in the SimpleConnectionFactory connection factory class:
package com.wm.MyAdapter.connections;

import com.wm.adk.connection.WmManagedConnectionFactory;
import com.wm.adk.connection.WmManagedConnection;
import com.wm.adk.info.ResourceAdapterMetadataInfo;
import com.wm.adk.metadata.WmDescriptor;
import com.wm.adk.error.AdapterException;

import java.util.Locale;

import com.wm.MyAdapter.MyAdapter;
import com.wm.MyAdapter.MyAdapterConstants;
import com.wm.MyAdapter.services.MockDbUpdate;

public class SimpleConnectionFactory extends WmManagedConnectionFactory implements MyAdapterConstants {
..
..
..
public void fillResourceAdapterMetadataInfo(ResourceAdapterMetadataInfo info, Locale locale) {
info.addServiceTemplate(MockDbUpdate.class.getName());
}
}
6. Execute the ANT script created in the adapter definition to compile, and deploy the adapter in Integration Server.
Use the files build.xml and build.properties.
ant deploy
7. Restart Integration Server.
8. Start Integration Server Administrator.
9. Select Adapters > MyAdapter > Connections.
The screen lists the adapters' connection configured:
10. In the Adapters > MyAdapter > Connections screen, select Configure New Connection.
The screen lists the adapters' connection types:
11. In the Adapters > MyAdapter > Connection Types screen, select the connection type Simple Connection.
The screen lists the adapters' connection properties to configure:
12. In the Adapters > MyAdapter > Configure Connection Type screen, add the details and click Save Connection.
The Adapters > MyAdapter > Connections screen lists the connection you added.
13. In the Adapters > MyAdapter > Connections screen, click No in the Enabled column for the connection you added.
The Enabled column now shows Yes.
14. In Designer, create the adapter service.
a. In Package Navigator, select the Default package.
b. Select File > New > Folder.
c. Enter the Folder name. For example: TestMyAdapter.
d. In the Package Navigator, select the Default > TestMyAdapter.
e. Select File > New > Adapter Service.
f. Enter the Element name and click Next. For example: TestMyAdapterService.
g. In the Select Adapter Type, select an adapter type for which you want to create the service. For example: MyAdapter.
h. In the Select an Adapter Connection Alias, select an adapter connection. For example: TestMyAdapter:Conn1.
i. In the Select a Template, select an adapter template and click Finish. For example: Mock Update Service.
A new adapter service of type MyAdapter is created. You will see the following tabs:
1. MockDbUpdate.
2. Adapter Settings
3. Input/Output
4. Logged Fields
5. Comments