Adapter Development Kit 9.12 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Runtime Activities | Runtime Connection Allocation for Adapter Services | Implementing Partitioned Connection Pools
 
Implementing Partitioned Connection Pools
 
Implementing WmConnectionRequestInfo
Implementing WmConnectionSpec
Updating the Connection Factory
In order to support partitioned connection pools in an adapter, the adapter developer must perform the following:
*Create a class that defines the partition by extending the com.wm.adk.connection.WmConnectionRequestInfo base class.
*Create a class to hold any required information gathered from an adapter service invocation by extending the com.wm.adk.connection.WmConnectionSpec base class.
*Implement the getConnectionRequestInfo method in the adapter's WmManagedConnectionFactory implementation.
*Implement the getConnectionSpec method in the adapter's WmAdapterService implementation.
For example, MegaBank is a company, regularly acquiring and absorbing the customer base of smaller banks. A customer acquired in this way is assigned a new MegaBank user name with which the customer can access the accounts as well as other services provided by the larger bank. Since MegaBank has adapters for most major banking systems, MegaBank is able to seamlessly integrate the new bank's system very quickly by mapping the customer's new MegaBank user name with login information already present in the acquired bank's system. Using partitioned pools, connections are established using authentication information already known to the backend.
Example WmConnectionRequestInfo
public class MbConnectionRequestInfo extends WmConnectionRequestInfo
{

private final String userId;
private final String mbUserName;
private final Credentials credentials;
private final String logName;

/**
* Sole constructor. verifies all fields populated.
*
* @param mbUserName - common user name used across the integration
* @param userId - name of user as known to the backend system
* @param credentials - credentials required for this user to access
* the backend system
* @throws IllegalArgumentException - if any argument is null
*/
public MbConnectionRequestInfo(String mbUserName, String userId,
Credentials credentials) throws IllegalArgumentException
{
if (mbUserName == null || userId == null || credentials == null)
{
throw new IllegalArgumentException();
}
this.userId = userId;
this.mbUserName = mbUserName;
this.credentials = credentials;
this.logName = mbUserName + "(" + userId + ")";
}

public Credentials getCredentials()
{
return credentials;
}
public String getMbUserName()
{
return mbUserName;
}
public String getUserId()
{
return userId;
}

/**
* Name used by the connection pool when creating log entries relevant
* to the partition identified by this object.
*/
public String getLoggableName()
{
return logName;
}
/**
* In a ConnectionRequestInfo object the hashCode of objects that
* identifythe same partion must be the same, so we use only the
* hashcode of the userId String.
*/
public int hashCode()
{
return this.userId.hashCode();
}
/**
* If two ConnectionRequestInfo objects identify the same partition,
* then the equals method must return true. We compare the userIds of
* the two object rather than allow the default equals implementation
* which only checks if they are the same object instance.
* @param obj - object being compared to this.
*/
public boolean equals(Object obj)
{
boolean isEqual = false;
if(obj instanceof MbConnectionRequestInfo)
{
isEqual = this.userId.equals(((MbConnectionRequestInfo)obj).userId);
}
return isEqual;
}
Example WmConnectionSpec
public class MbConnectionSpec extends WmConnectionSpec
{
private String mbUserName;
public MbConnectionSpec()
{
super();
}
public String getMbUserName()
{
return mbUserName;
}
public void setMbUserName(String mbUserName)
{
this.mbUserName = mbUserName;
}
}