|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.granite.messaging.service.ServiceInvoker<T>
@TransientReference public abstract class ServiceInvoker<T extends ServiceFactory>
Abstract base class for all service's methods calls. This class mainly implements a final invocation method which deals with parameter conversions, security and listeners.
ServiceFactory,
ServiceInvocationListener,
ServiceExceptionHandler| Field Summary | |
|---|---|
protected Destination |
destination
|
protected T |
factory
|
protected List<ServiceInvocationListener> |
invocationListeners
|
protected Object |
invokee
|
| Constructor Summary | |
|---|---|
protected |
ServiceInvoker(Destination destination,
T factory)
Constructs a new ServiceInvoker. |
| Method Summary | |
|---|---|
protected Object |
adjustInvokee(RemotingMessage request,
String methodName,
Object[] args)
Called at the beginning of the invoke(RemotingMessage) method. |
protected Object |
afterInvocation(ServiceInvocationContext context,
Object result)
Called after a successful invocation of the service's method. |
protected void |
afterInvocationError(ServiceInvocationContext context,
Throwable error)
Called after a failed invocation of the service's method, possibly after a new attempt (see retryInvocation(ServiceInvocationContext, Throwable). |
protected void |
beforeInvocation(ServiceInvocationContext context)
Called before the invocation of the services method. |
protected Object[] |
beforeMethodSearch(Object invokee,
String methodName,
Object[] args)
Called before the invoke(RemotingMessage) method starts to search for a method named methodName
with the arguments args on the invokee object. |
Object |
invoke(RemotingMessage request)
Call a service's method according to the informations contained in the given remoting message. |
protected boolean |
retryInvocation(ServiceInvocationContext context,
Throwable t)
Called after a failed invocation of the service's method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final List<ServiceInvocationListener> invocationListeners
protected final Destination destination
protected final T extends ServiceFactory factory
protected Object invokee
| Constructor Detail |
|---|
protected ServiceInvoker(Destination destination,
T factory)
throws ServiceException
ServiceFactory.
destination - the remote destination of this service (services-config.xml).factory - the factory that have called this constructor.
ServiceException - if anything goes wrong.| Method Detail |
|---|
protected Object adjustInvokee(RemotingMessage request,
String methodName,
Object[] args)
throws ServiceException
invoke(RemotingMessage) method. Give a chance to modify the
the services (invokee) about to be called. Does nothing by default. The default invokee object is
created by actual implementations of this abstract class.
request - the current remoting message (sent from Flex).methodName - the name of the method to be called.args - the method parameter values.
ServiceException - if anything goes wrong.
protected Object[] beforeMethodSearch(Object invokee,
String methodName,
Object[] args)
invoke(RemotingMessage) method starts to search for a method named methodName
with the arguments args on the invokee object. Give a chance to modify the method name or the paramaters.
Does nothing by default.
invokee - the service instance used for searching the method with the specified arguments.methodName - the method name.args - the arguments of the method.
protected void beforeInvocation(ServiceInvocationContext context)
context - the current invocation context.
protected boolean retryInvocation(ServiceInvocationContext context,
Throwable t)
context - the current invocation context.t - the exception that caused the invocation failure.
protected void afterInvocationError(ServiceInvocationContext context,
Throwable error)
retryInvocation(ServiceInvocationContext, Throwable). Does nothing by default.
context - the current invocation context.error - the exception that caused the invocation failure.
protected Object afterInvocation(ServiceInvocationContext context,
Object result)
context - the current invocation context.result - the result of the invocation (returned by the called method).
public final Object invoke(RemotingMessage request)
throws ServiceException
request - the remoting message containing informations about the call.
ServiceException - if anything goes wrong (security, invocation target exception, etc.)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||