com.ca.jcs.sdk
Class SDKConnectionManager

java.lang.Object
  extended by com.ca.jcs.sdk.SDKConnectionManager
All Implemented Interfaces:
Activatable, ConnectionManager

public class SDKConnectionManager
extends Object
implements ConnectionManager

This class is a bit contrived as the SDK sample is not very realistic in the sense that no "connections" are really required for it to do its work (ie managing local files). However, for the purposes of explanation we implement the SDK's connection as a reference to the parent directory for the connector.

In realistic connectors connection would need to opened and closed, hopefully using to a pool of some sort (for scalability) where it is possible / sensible to implement one given the target technology for a connector. Refer to JNDIConnectionPool for example source.


Constructor Summary
SDKConnectionManager(File parentFile)
           
 
Method Summary
 void activate()
          Does nothing in the SDK's case.
 Object borrowConnection()
          Needs to be abstract for force implementers to very carefully review any exceptions that might be thrown and decide which ones are retriable soft failures (in which case should throw LdapServiceUnavailableException with code ResultCodeEnum.UNAVAILABLE) and which ones are hard failures (in which can throw LdapServiceUnavailableException with any other code, or any other NamingException variety which implements LdapException).
 void clearConnection()
          Does nothing in the SDK's case.
 void deactivate()
          Does nothing in the SDK's case.
 void returnConnection(Object connection)
          Does nothing in the SDK's case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SDKConnectionManager

public SDKConnectionManager(File parentFile)
Method Detail

activate

public void activate()
              throws NamingException
Does nothing in the SDK's case.

Specified by:
activate in interface Activatable
Throws:
NamingException

borrowConnection

public Object borrowConnection()
                        throws NamingException
Description copied from interface: ConnectionManager
Needs to be abstract for force implementers to very carefully review any exceptions that might be thrown and decide which ones are retriable soft failures (in which case should throw LdapServiceUnavailableException with code ResultCodeEnum.UNAVAILABLE) and which ones are hard failures (in which can throw LdapServiceUnavailableException with any other code, or any other NamingException variety which implements LdapException).

Specified by:
borrowConnection in interface ConnectionManager
Returns:
Non-null live connection.
Throws:
NamingException - If connection can't be borrowed, can't return null.

returnConnection

public void returnConnection(Object connection)
Does nothing in the SDK's case.

Specified by:
returnConnection in interface ConnectionManager
Parameters:
connection - Connection to be returned / closed after it is no longer required.

deactivate

public void deactivate()
Does nothing in the SDK's case.

Specified by:
deactivate in interface Activatable

clearConnection

public void clearConnection()
                     throws NamingException
Does nothing in the SDK's case.

Specified by:
clearConnection in interface ConnectionManager
Throws:
NamingException


Created 2011-07-14 13:27 EST