com.codemonster.surinam.routing
Class FullyDynamicNoCacheInvocationRouterImpl
java.lang.Object
com.codemonster.surinam.routing.FullyDynamicNoCacheInvocationRouterImpl
- All Implemented Interfaces:
- InterceptorLifecycle, ServiceInvocationRouter, InvocationHandler
public class FullyDynamicNoCacheInvocationRouterImpl
- extends Object
- implements ServiceInvocationRouter
This is the primary interceptor for the framework, it holds a reference to the ServiceBlock which
is used to acquire invocation targets at runtime.
FullyDynamicNoCacheInvocationRouterImpl
public FullyDynamicNoCacheInvocationRouterImpl(ServiceBlock serviceBlock,
Class serviceInterface)
throws UnknownServiceException,
UnavailableServiceException,
InvocationTargetException
- Parameters:
serviceBlock
- The Service Block that this interceptor is integrated with.serviceInterface
- The service interface is the unique identifier that specifies the service we want to use.
- Throws:
UnknownServiceException
- Thrown if we are asking for a service that is not registered.
UnavailableServiceException
- Thrown if we are asking for a service that is not available.
InvocationTargetException
- Thrown if there is an internal problem.
FullyDynamicNoCacheInvocationRouterImpl
public FullyDynamicNoCacheInvocationRouterImpl(ServiceBlock serviceBlock,
String serviceInterfaceName)
throws UnknownServiceException,
UnavailableServiceException,
InvocationTargetException,
ClassNotFoundException
- Parameters:
serviceBlock
- The Service Block that this interceptor is integrated with.serviceInterfaceName
- The service interface is the unique identifier that specifies the service we want
to use.
- Throws:
UnknownServiceException
- Thrown if we are asking for a service that is not registered.
UnavailableServiceException
- Thrown if we are asking for a service that is not available.
InvocationTargetException
- Thrown if there is an internal problem.
ClassNotFoundException
- Thrown if the given class name cannot be converted to a Class object.
invoke
public Object invoke(Object proxy,
Method method,
Object[] args)
throws UnknownServiceException,
InvocationTargetException,
UnavailableServiceException,
IllegalAccessException
- This is a fully-dynamic router. By definition, each invocation will see a lookup performed to ensure that
there is absolutely no service caching involved in the invocation.
This signature is dictated by Java for interception. Note that Surinam does not require that interfaces
(i.e. Software Service Contracts) declare these exceptions for every invocation... but they are possible.
- Specified by:
invoke
in interface InvocationHandler
- Parameters:
proxy
- This is the object upon which the original invocation was made, which we ignore.method
- this is the method that we want to call.args
- these are the parameters for the invocation.
- Returns:
- returns whatever this method call normally returns.
- Throws:
UnknownServiceException
- thrown if the service being retrieved is unknown to the system.
InvocationTargetException
- thrown if there is a problem with the mechanics of the invocation.
UnavailableServiceException
- thrown if the service is offline.
IllegalAccessException
- thrown by Java if there is a security violation.
invalidateReferences
public void invalidateReferences()
- Since this interceptor is fully dynamic, there is no cached reference to invalidate.
- Specified by:
invalidateReferences
in interface InterceptorLifecycle
Copyright © 2010. All Rights Reserved.