Adapter Development Kit 9.12 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Connections | Overview
 
Overview
An adapter connection connects to an adapter resource. This chapter describes the classes provided by the ADK to support connections, and how to create an adapter connection implementation.
Connection Factories
The ADK's adapter connection model uses a factory method pattern in which a connection factory object is responsible for creating connection objects. In many cases, both the factory and its connections wrap comparable functionality provided in the resource's libraries. For example, an adapter connection factory may wrap a data source class provided by a database vendor, from which it creates the database connections and wraps them in an adapter connection object produced by the factory.
Each connection factory in an adapter implementation constitutes a connection type on the adapter's administrative interface. You can define one or more connection types for an adapter. If you need a different set of configuration parameters, create another connection type. For example, if you have a request that requires special security requirements, create a separate connection type for it.
A connection factory is also responsible for defining implementation-specific parameters and for making them available to the connection. The adapter uses these parameters at design time, when the users of the adapter create connection namespace nodes. For example, note the following connection type configuration window of the Sample Adapter.
Connection Management Properties
Each field in the Connection Management Properties section shown in the adapter's administrative interface has a corresponding metadata parameter provided by the associated connection factory. At run time, the node passes the user of the adapters' settings for these fields to the connection factory, which is then used for each connection that the factory creates.
The two fields in Connection Management Properties section that pertain to initializing the connection pool at startup are as follows:
*Startup Retry Count specifies the number of times that the system attempts to initialize the connection pool at startup if the initial attempt fails, before issuing an AdapterConnectionException.
*Startup Backoff Timeout specifies the number of seconds to wait between each attempt to initialize the connection pool.
These fields provide flexibility in managing connections in environments where network anomalies are commonplace. They are significant in the following situations:
*When a new connection is enabled; when Integration Server starts.
*When the package containing a previously enabled connection node is reloaded.
For information about other connection management parameters, see Configuring and Testing Connection Nodes.
Connection Management
Integration Server includes a connection management service that dynamically manages connections and connection pools based on the settings stored in the connection namespace node (such as the connection pooling and timeout fields specified in the Connection Management Properties section shown in the adapter's administrative interface).
When a connection namespace node is enabled, Integration Server uses the connection factory to initialize the pool, creating a number of connection instances equal to the minimum configured pool size.
*When a connection is needed by an adapter service or notification, the ADK provides a connection from the pool.
*If no connections are available in the pool, and the maximum pool size has not been reached, a new connection is retrieved from the connection factory.
*If the pool is full, the requesting thread blocks the amount indicated in the Block Timeout field until a connection becomes available.
For information about configuring your connection pool, see Configuring and Testing Connection Nodes.
Creating Connection Implementation
To create a connection implementation, you perform the following tasks:
*Create an adapter connection class by extending the com.wm.adk.connection.WmManagedConnection base class. In this class, create methods that:
*Wrap the connection to your resource.
*Instantiates the class on receiving information from the connection factory.
*Access the resource. Accessing the resource is your responsibility.
*Create an adapter connection factory class by extending the com.wm.adk.connection.WmManagedConnectionFactory base class. In this class, you create services and methods that::
*Construct a new connection object.
*Identify all adapter service templates supported by the factory's connections.
*Specify the transactional capabilities of the factory's connections.
*Create webMethods metadata for the connection factory.
For more information, see Creating a WmManagedConnectionFactory Implementation Class.
*Update the adapter's resource bundle with display names and other display-oriented data for the connection implementation and its parameters.
*Register the connection type in the adapter.
*Compile and reload your adapter.
*Configure and test the connection.