org.apache.hivemind.impl
Class ProxyUtils

java.lang.Object
  extended by org.apache.hivemind.impl.ProxyUtils

public final class ProxyUtils
extends java.lang.Object

Contains some common code used to create proxies that defer to a service model method for thier service.

Author:
Howard Lewis Ship

Field Summary
static java.lang.String DELEGATE_ACCESSOR_METHOD_NAME
           
static java.lang.String SERVICE_ACCESSOR_METHOD_NAME
           
 
Method Summary
static java.lang.Object createDelegatingProxy(java.lang.String type, ServiceModel serviceModel, java.lang.String delegationMethodName, ServicePoint servicePoint)
          Creates a class that implements the service interface.
static RegistryShutdownListener createOuterProxy(java.lang.Object delegate, ServicePoint servicePoint)
          Constructs an outer proxy (for the threaded or pooled service).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_ACCESSOR_METHOD_NAME

public static final java.lang.String SERVICE_ACCESSOR_METHOD_NAME
See Also:
Constant Field Values

DELEGATE_ACCESSOR_METHOD_NAME

public static final java.lang.String DELEGATE_ACCESSOR_METHOD_NAME
See Also:
Constant Field Values
Method Detail

createDelegatingProxy

public static java.lang.Object createDelegatingProxy(java.lang.String type,
                                                     ServiceModel serviceModel,
                                                     java.lang.String delegationMethodName,
                                                     ServicePoint servicePoint)
Creates a class that implements the service interface. Implements a private synchronized method, _service(), that constructs the service as needed, and has each service interface method re-invoke on _service(). Adds a toString() method if the service interface does not define toString().


createOuterProxy

public static RegistryShutdownListener createOuterProxy(java.lang.Object delegate,
                                                        ServicePoint servicePoint)
Constructs an outer proxy (for the threaded or pooled service). The outer proxy listens to the shutdown coordinator, and delegates from the declared interface (which may in fact be a bean) to the service interface.

The outer proxy is a RegistryShutdownListener; it can be registered for notifications and will respond by throwing an exception when service methods are invoked.

Parameters:
delegate - An object, implementing the service interface, that the proxy should delegate to.
servicePoint - for which the proxy is being constructed
Since:
1.1