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 > Structured record implementation

Set managed connection method

This method passes the ManagedConnection handle to the record implementation, allowing the record to get access to the physical connection to the backend application to perform processing. public void setManagedConnection( ManagedConnection managedConnection) throws ResourceException


Purpose of the set managed connection method

This method is called after initializeInput().

Implement this only if there is a need for to build a component on the backend EIS to perform an adapter function.

For example, if the backend application needs to initialize a corresponding component on the backend EIS, use this method to initialize that component.


Sample code

Here is a coding sample on how to implement the setManagedConnection method:
public void setManagedConnection(
			ManagedConnection managedConnection) throws ResourceException {

		try {
			this.managedConnection = managedConnection;
			if (this.getEISRepresentation() == null) {
				//get the handle to physical connection 			BackEndConnection conn =
	managedConnection.getBackEndHandle();
				Object object = conn.create(name);
				if (object == null) {
					throw new ResourceException("Invalid metadata defined for the input Data.");
		} 		//set the instantiated object, would be accessed later
				this.setEISRepresentation(object);
			} 		} catch (Exception e) {
			throw new ResourceException("Failed in creating object " + name); 
		} 	}

Structured record implementation