com.ca.jcs.processor
Class ConnectorProcessorProxyHandler

java.lang.Object
  extended by com.ca.jcs.processor.ConnectorProcessorProxyHandler
All Implemented Interfaces:
InvocationHandler
Direct Known Subclasses:
AssocAttributeOpProcessorProxy, JDBCExceptionMappingProxy, MetaOpBindingsProxyHandler, RetryOpProcessorProxy

public abstract class ConnectorProcessorProxyHandler
extends Object
implements InvocationHandler

Base class for all proxies wrapping all styles of op processor implemented for a connector, for instance for use in implementing resilient connectivity (ability to recover when communication is lost to the managed target system temporarily) or for translating exceptions from the connector domain to the LdapNamingException domain.


Constructor Summary
ConnectorProcessorProxyHandler(Connector connector, AttributeStyleOpProcessor opProcessor)
           
ConnectorProcessorProxyHandler(Connector connector, MethodStyleOpProcessor methodStyleOpProcessor)
           
ConnectorProcessorProxyHandler(Connector connector, ScriptStyleOpProcessor scriptStyleOpProcessor)
           
 
Method Summary
static ProxyChainEntry createAttributeStyleOpProcessorProxy(Class<? extends ConnectorProcessorProxyHandler> proxyClass, Connector conn, AttributeStyleOpProcessor proc)
          Helper method that wraps the OpProcessor for the provided connector in an instance of the provided proxy class.
static MethodStyleOpProcessor createMethodStyleOpProcessorProxy(Class proxyClass, Connector conn, MethodStyleOpProcessor proc)
          Helper method that wraps the MethodStyleOpProcessor for the provided connector in an instance of the provided proxy class.
static ScriptStyleOpProcessor createScriptStyleOpProcessorProxy(Class proxyClass, Connector conn, ScriptStyleOpProcessor proc)
          Helper method that wraps the ScriptStyleOpProcessor for the provided connector in an instance of the provided proxy class.
 Connector getConnector()
           
static Operation getOperation(Method method)
          Map a method to the corresponding operation
 Object getTarget()
           
 AttributeStyleOpProcessor getTargetAttributeStyleOpProcessor()
           
 MethodStyleOpProcessor getTargetMethodStyleOpProcessor()
           
 ScriptStyleOpProcessor getTargetScriptStyleOpProcessor()
           
abstract  Object invoke(Object proxy, Method method, Object[] args)
          This is where the wrapping logic (resiliency etc) is actually implemented...
 void logError(Method method, Throwable th)
           
 String proxyToString(String extraText)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectorProcessorProxyHandler

public ConnectorProcessorProxyHandler(Connector connector,
                                      AttributeStyleOpProcessor opProcessor)

ConnectorProcessorProxyHandler

public ConnectorProcessorProxyHandler(Connector connector,
                                      MethodStyleOpProcessor methodStyleOpProcessor)

ConnectorProcessorProxyHandler

public ConnectorProcessorProxyHandler(Connector connector,
                                      ScriptStyleOpProcessor scriptStyleOpProcessor)
Method Detail

getConnector

public Connector getConnector()

getTargetAttributeStyleOpProcessor

public AttributeStyleOpProcessor getTargetAttributeStyleOpProcessor()

getTargetMethodStyleOpProcessor

public MethodStyleOpProcessor getTargetMethodStyleOpProcessor()

getTargetScriptStyleOpProcessor

public ScriptStyleOpProcessor getTargetScriptStyleOpProcessor()

getTarget

public Object getTarget()

createAttributeStyleOpProcessorProxy

public static ProxyChainEntry createAttributeStyleOpProcessorProxy(Class<? extends ConnectorProcessorProxyHandler> proxyClass,
                                                                   Connector conn,
                                                                   AttributeStyleOpProcessor proc)
                                                            throws NoSuchMethodException,
                                                                   IllegalAccessException,
                                                                   InvocationTargetException,
                                                                   InstantiationException
Helper method that wraps the OpProcessor for the provided connector in an instance of the provided proxy class.

Parameters:
proxyClass - Class implementing proxy.
conn - Connector with service to be wrapped by proxy.
Returns:
Details of proxy (and proxy handler) wrapping processor.
Throws:
NoSuchMethodException
IllegalAccessException
InvocationTargetException
InstantiationException

createMethodStyleOpProcessorProxy

public static MethodStyleOpProcessor createMethodStyleOpProcessorProxy(Class proxyClass,
                                                                       Connector conn,
                                                                       MethodStyleOpProcessor proc)
                                                                throws NoSuchMethodException,
                                                                       IllegalAccessException,
                                                                       InvocationTargetException,
                                                                       InstantiationException
Helper method that wraps the MethodStyleOpProcessor for the provided connector in an instance of the provided proxy class.

Parameters:
proxyClass - Class implementing proxy.
conn - Connector with service to be wrapped by proxy.
Returns:
Proxy wrapping connector.
Throws:
NoSuchMethodException
IllegalAccessException
InvocationTargetException
InstantiationException

createScriptStyleOpProcessorProxy

public static ScriptStyleOpProcessor createScriptStyleOpProcessorProxy(Class proxyClass,
                                                                       Connector conn,
                                                                       ScriptStyleOpProcessor proc)
                                                                throws NoSuchMethodException,
                                                                       IllegalAccessException,
                                                                       InvocationTargetException,
                                                                       InstantiationException
Helper method that wraps the ScriptStyleOpProcessor for the provided connector in an instance of the provided proxy class.

Parameters:
proxyClass - Class implementing proxy.
conn - Connector with service to be wrapped by proxy.
Returns:
Proxy wrapping connector.
Throws:
NoSuchMethodException
IllegalAccessException
InvocationTargetException
InstantiationException

getOperation

public static Operation getOperation(Method method)
Map a method to the corresponding operation


logError

public void logError(Method method,
                     Throwable th)

proxyToString

public String proxyToString(String extraText)

invoke

public abstract Object invoke(Object proxy,
                              Method method,
                              Object[] args)
                       throws Throwable
This is where the wrapping logic (resiliency etc) is actually implemented...

Specified by:
invoke in interface InvocationHandler
Throws:
Throwable


Created 2011-07-14 13:27 EST