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 display elements in an adapter service?
 
How to display elements in an adapter service?
1. Update the com.wm.adk.cci.interaction.WmAdapterService implementation class.
a. Create a class attribute, and a corresponding set method for each metadata parameter. For example, a class attribute _tableName, and a corresponding set method setTableName for the parameter table name.
Class Attribute Name
Class Attribute Set Method Name
_tableName
setTableName
_columnNames
setColumnNames
_columnTypes
setColumnTypes
_repeating
setRepeating
_overrideTypes
setOverrideTypes
For example class MockDbUpdate:
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 {
private String _tableName;
private String[] _columnNames;
private String[] _columnTypes;
private boolean _repeating;
private String[] _overrideTypes;

public static final String TABLE_NAME_PARM = "tableName";
public static final String COLUMN_NAMES_PARM = "columnNames";
public static final String COLUMN_TYPES_PARM = "columnTypes";
public static final String REPEATING_PARM = "repeating";
public static final String OVERRIDE_TYPES_PARM = "overrideTypes";

public void setTableName(String val){ _tableName = val;}
public void setColumnNames(String[] val){ _columnNames = val;}
public void setColumnTypes(String[] val){ _columnTypes = val;}
public void setRepeating(boolean val){ _repeating = val;}
public void setOverrideTypes(String[] val){_overrideTypes = val;}

public void fillWmTemplateDescriptor(WmTemplateDescriptor d,Locale l)
throws ResourceException
{ }

public WmRecord execute(WmManagedConnection connection, WmRecord input)
throws ResourceException
{
return null;
}
}
2. Update the resource bundle implementation class to add the display name and description of the adapter service.
In the example, the class is MyAdapterResource:
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;
}
}
3. Register the adapter service by updating your fillResourceAdapterMetadataInfo method in your WmManagedConnectionFactory implementation class.
In the example, the adapter service MockDbUpdate is registered using the method fillResourceAdapterMetadataInfo in the connection factory class SimpleConnectionFactory 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());
}
}
4. 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
5. Restart Integration Server.
6. Start Integration Server Administrator.
7. In Designer, create the adapter service.
A new adapter service of type MyAdapter is created with the metadata parameters as shown in the MockDBUpdate tab below: