IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > Adapter Toolkit > Implementing code from the IBM WebSphere Adapter Toolkit > Outbound support > Implementing outbound support

WBIManagedConnection

WBIManagedconnection is an abstract class which implements javax.resource.spi.ManagedConnection. A javax.resource.spi.ManagedConnection instance represents a physical connection to the underlying EIS. The WBIManagedConnection instance implements methods that enable the JCA container to monitor its status and manage its lifecycle.


Subclass methods to implement

  1. public ManagedConnection(WBIManagedConnectionFactory mcf, Subject subject, WBIConnectionRequestInfo)

    This constructor should connect to the EIS instance and maintain a handle to the connection as a property in the ManagedConnection. This method also must call "super" to ensure that the credentials are present for later matching.

  2. ManagedConnectionMetaData getMetaData()

    Create and return a new instance of WBIManagedConnectionMetadata by passing the EIS-specific details such as product name, product version, maximum connections, and user name.

    To:public ManagedConnectionMetaData getMetaData() throws ResourceException {
    		return new WBIManagedConnectionMetaData("VTA", "VTA", 1,"VTA");
    	}
  3. Object getWBIConnection(PasswordCredential, boolean)

    If reauthentication is supported, implementation should perform an EIS-specific sign-on based on the credentials passed. Otherwise, it should return a CCI handle to this managed connection.

    public Object getWBIConnection(PasswordCredential arg0, boolean arg1)
    throws ResourceException {
    		if (logUtils.isTraceEnabled(Level.FINE))
    			logUtils.traceMethodEntrance(EISSAConstants.VTAMANAGEDCONN,  "getWBIConnection");
    		
    		if(rmiSession == null){
    			String host = factory.getHostname();
    			String port = factory.getPortnumber();
    			if (logUtils.isTraceEnabled(Level.FINE)) {
    				logUtils.trace(Level.FINEST, EISSAConstants.VTAEVENTSTOREXID,  "EISSAEventStoreWithXid",  "The host name is " + host);
    				logUtils.trace(Level.FINEST, EISSAConstants.VTAEVENTSTOREXID, 
    "EISSAEventStoreWithXid",  "The port is " + port);
    			} 			if(host!=null && host.length()>0 && port != null && port.length()>0){
    				try{
    					rmiSession = new RMIObjectClient(host, Integer.parseInt(port));
    				}catch(Exception e){//fail to establish the connection.
    					logUtils.log(LogLevel.FATAL, LogUtilConstants.ADAPTER_RBUNDLE,  EISSAConstants.VTAMANAGEDCONN,"
    getWBIConnection", "6011");
    					throw new CommException("The adapter failed to establish the connection with EIS Mocker.",e);
    				} 			}else{
    			} 		} 		
    		if (logUtils.isTraceEnabled(Level.FINE))
    			logUtils.traceMethodExit(EISSAConstants.VTAMANAGEDCONN, "getWBIConnection");
    
    		return new EISSAConnection(this);
    	}
  4. destroy()

    This method should close this connection to the EIS and release any resources.


Best practices

Implementing outbound support


Related concepts:

WBIManagedConnectionFactory

WBIConnectionFactory

WBIConnection

javax.resource.cci.ConnectionSpec

WBIInteraction

WBIInteractionSpec

WBIConnectionRequestInfo

javax.resource.cci.ConnectionMetadata