Adapter Development Kit 6.5 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Connections | Creating a WmManagedConnection Implementation Class | Example WmManagedConnection Implementation Class
 
Example WmManagedConnection Implementation Class
The following example is very simple; it reflects no interaction with an adapter resource. Instead of showing a wrapped connection to an adapter resource, this WmManagedConnection implementation only prints debug messages to indicate that it has been created. The connection receives the appropriate parameter information from its factory. The constructor arguments pass values for the metadata parameters from the factory to the individual connection.
Note:
The methods that support metadata for services and notifications are described in Adapter Services, and Polling Notifications.
package com.mycompany.adapter.myadapter.connections;
import com.wm.adk.connection.WmManagedConnection;
import com.wm.adk.metadata.*;
import com.mycompany.adapter.myadapter.MyAdapter;
public class SimpleConnection extends WmManagedConnection
{
String _parm1;
int _parm2;
public SimpleConnection(String configParm1, int configParm2)
{
super();
_parm1 = configParm1;
_parm2 = configParm2;
MyAdapter.getLogger().logDebug(9999,
"Simple Connection created with parm1 = "
+ _parm1 + "and parm2 = " +
Integer.toString(_parm2));
}
public void destroyConnection()
{
MyAdapter.getLogger().logDebug(9999,"Simple Connection
Destroyed");
}
// The remaining methods support metadata for related services, etc.
// Implement content as needed.
public void registerResourceDomain(WmAdapterAccess access)
{
}

public Boolean adapterCheckValue( String serviceName,
String resourceDomainName,
String[][] values,
String testValue)
{
return null;
}
public ResourceDomainValues[] adapterResourceDomainLookup(String
serviceName, String resourceDomainName, String[][] values)
{
return null;
}
}
Important:
You can make a callback to the factory using WmManagedConnection.getFactory. If you do this, do not call the parameter "set" methods on the factory. Doing this will produce unpredictable results.