org.granite.tide
Class TideServiceInvoker<T extends ServiceFactory>

java.lang.Object
  extended by org.granite.messaging.service.ServiceInvoker<T>
      extended by org.granite.tide.TideServiceInvoker<T>

public class TideServiceInvoker<T extends ServiceFactory>
extends ServiceInvoker<T>

Base class for Tide service invokers Adapts the Tide invocation model with Granite

Author:
William DRAI

Field Summary
static String VALIDATOR_CLASS_NAME
           
static String VALIDATOR_KEY
           
static String VALIDATOR_NAME
           
static String VALIDATOR_NOT_AVAILABLE
           
 
Fields inherited from class org.granite.messaging.service.ServiceInvoker
destination, factory, invocationListeners, invokee
 
Constructor Summary
TideServiceInvoker(Destination destination, T factory)
           
TideServiceInvoker(Destination destination, T factory, TideServiceContext tideContext)
           
 
Method Summary
protected  Object adjustInvokee(RemotingMessage request, String methodName, Object[] args)
          Called at the beginning of the ServiceInvoker.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 ServiceInvoker.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 ServiceInvoker.invoke(RemotingMessage) method starts to search for a method named methodName with the arguments args on the invokee object.
protected  TideServiceContext getTideContext()
           
 Object initializeObject(Object parent, String[] propertyNames)
           
protected  void initValidator()
           
 void login()
           
 void logout()
           
protected  TideServiceContext lookupContext()
           
protected  void prepareDataObserver(DataEnabled dataEnabled)
           
protected  void publishDataUpdates()
           
 void resyncContext()
           
 InvalidValue[] validateObject(Object entity, String propertyName, Object value)
           
 
Methods inherited from class org.granite.messaging.service.ServiceInvoker
invoke, retryInvocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_KEY

public static final String VALIDATOR_KEY
See Also:
Constant Field Values

VALIDATOR_NOT_AVAILABLE

public static final String VALIDATOR_NOT_AVAILABLE
See Also:
Constant Field Values

VALIDATOR_NAME

public static final String VALIDATOR_NAME
See Also:
Constant Field Values

VALIDATOR_CLASS_NAME

public static final String VALIDATOR_CLASS_NAME
See Also:
Constant Field Values
Constructor Detail

TideServiceInvoker

public TideServiceInvoker(Destination destination,
                          T factory)
                   throws ServiceException
Throws:
ServiceException

TideServiceInvoker

public TideServiceInvoker(Destination destination,
                          T factory,
                          TideServiceContext tideContext)
                   throws ServiceException
Throws:
ServiceException
Method Detail

initializeObject

public Object initializeObject(Object parent,
                               String[] propertyNames)

initValidator

protected void initValidator()

validateObject

public InvalidValue[] validateObject(Object entity,
                                     String propertyName,
                                     Object value)

login

public void login()

logout

public void logout()

resyncContext

public void resyncContext()

lookupContext

protected TideServiceContext lookupContext()

getTideContext

protected TideServiceContext getTideContext()

adjustInvokee

protected Object adjustInvokee(RemotingMessage request,
                               String methodName,
                               Object[] args)
                        throws ServiceException
Description copied from class: ServiceInvoker
Called at the beginning of the ServiceInvoker.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.

Overrides:
adjustInvokee in class ServiceInvoker<T extends ServiceFactory>
Parameters:
request - the current remoting message (sent from Flex).
methodName - the name of the method to be called.
args - the method parameter values.
Returns:
the (possibly adjusted) invokee object.
Throws:
ServiceException - if anything goes wrong.

beforeMethodSearch

protected Object[] beforeMethodSearch(Object invokee,
                                      String methodName,
                                      Object[] args)
Description copied from class: ServiceInvoker
Called before the ServiceInvoker.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.

Overrides:
beforeMethodSearch in class ServiceInvoker<T extends ServiceFactory>
Parameters:
invokee - the service instance used for searching the method with the specified arguments.
methodName - the method name.
args - the arguments of the method.
Returns:
an array of containing the (possibly adjusted) method name and its arguments.

beforeInvocation

protected void beforeInvocation(ServiceInvocationContext context)
Description copied from class: ServiceInvoker
Called before the invocation of the services method. Does nothing by default.

Overrides:
beforeInvocation in class ServiceInvoker<T extends ServiceFactory>
Parameters:
context - the current invocation context.

prepareDataObserver

protected void prepareDataObserver(DataEnabled dataEnabled)

afterInvocation

protected Object afterInvocation(ServiceInvocationContext context,
                                 Object result)
Description copied from class: ServiceInvoker
Called after a successful invocation of the service's method. Does nothing by default.

Overrides:
afterInvocation in class ServiceInvoker<T extends ServiceFactory>
Parameters:
context - the current invocation context.
result - the result of the invocation (returned by the called method).

publishDataUpdates

protected void publishDataUpdates()

afterInvocationError

protected void afterInvocationError(ServiceInvocationContext context,
                                    Throwable error)
Description copied from class: ServiceInvoker
Called after a failed invocation of the service's method, possibly after a new attempt (see ServiceInvoker.retryInvocation(ServiceInvocationContext, Throwable). Does nothing by default.

Overrides:
afterInvocationError in class ServiceInvoker<T extends ServiceFactory>
Parameters:
context - the current invocation context.
error - the exception that caused the invocation failure.