org.granite.tide.cdi
Class CDIServiceContext

java.lang.Object
  extended by org.granite.tide.TideServiceContext
      extended by org.granite.tide.cdi.CDIServiceContext
All Implemented Interfaces:
Serializable

@SessionScoped
public class CDIServiceContext
extends org.granite.tide.TideServiceContext

Author:
William DRAI
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.granite.tide.TideServiceContext
COMPONENT_ATTR, COMPONENT_CLASS_ATTR, EMPTY_ARGS
 
Constructor Summary
CDIServiceContext()
           
 
Method Summary
 void addResultEval(org.granite.tide.invocation.ContextResult result)
           
 void endSession()
          Clear current session from user events registry
protected  boolean equals(Object obj1, Object obj2)
           
 List<org.granite.tide.invocation.ContextUpdate> evaluateResults(Object target, boolean nothing)
          Evaluate results from context
 Object findComponent(String componentName, Class<?> componentClass)
          Implementation of component lookup for CDI service
 Set<Class<?>> findComponentClasses(String componentName, Class<?> componentClass)
          Implementation of component lookup for CDI service
protected  org.granite.tide.async.AsyncPublisher getAsyncPublisher()
          Factory for Seam async publisher
 Map<org.granite.tide.invocation.ContextResult,Boolean> getResultsEval()
           
protected  org.granite.tide.TidePersistenceManager getTidePersistenceManager(boolean create)
           
 void initCall()
          Determines the current sessionId for web invocations
static boolean isImmutable(Object o)
           
 org.granite.tide.IInvocationResult postCall(org.granite.messaging.service.ServiceInvocationContext context, Object result, String componentName, Class<?> componentClass)
          Builds the result object for the invocation
 void postCallFault(org.granite.messaging.service.ServiceInvocationContext context, Throwable t, String componentName, Class<?> componentClass)
          Intercepts a fault on the invocation
 void prepareCall(org.granite.messaging.service.ServiceInvocationContext context, org.granite.tide.IInvocationCall c, String componentName, Class<?> componentClass)
          Synchronizes server context with data provided by the client
 void processEvent(Object event)
          Add an event in the current context
 void restoreContext(List<org.granite.tide.invocation.ContextUpdate> updates, Object target)
          Evaluate updates in current server context
 void setLogin(boolean isLogin)
           
 void setSessionId(String sessionId)
          Initialize current sessionId and event listeners for this context
 
Methods inherited from class org.granite.tide.TideServiceContext
adjustInvokee, beforeMethodSearch, getSessionId, lazyInitialize, mergeExternal, mergeExternal, sendEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDIServiceContext

public CDIServiceContext()
Method Detail

initCall

public void initCall()
Determines the current sessionId for web invocations

Overrides:
initCall in class org.granite.tide.TideServiceContext

setSessionId

public void setSessionId(String sessionId)
Initialize current sessionId and event listeners for this context

Overrides:
setSessionId in class org.granite.tide.TideServiceContext
Parameters:
sessionId - current sessionId

endSession

@PreDestroy
public void endSession()
Clear current session from user events registry


setLogin

public void setLogin(boolean isLogin)

getResultsEval

public Map<org.granite.tide.invocation.ContextResult,Boolean> getResultsEval()

findComponent

public Object findComponent(String componentName,
                            Class<?> componentClass)
Implementation of component lookup for CDI service

Specified by:
findComponent in class org.granite.tide.TideServiceContext
Parameters:
componentName - component name

findComponentClasses

public Set<Class<?>> findComponentClasses(String componentName,
                                          Class<?> componentClass)
Implementation of component lookup for CDI service

Specified by:
findComponentClasses in class org.granite.tide.TideServiceContext
Parameters:
componentName - component name

processEvent

public void processEvent(Object event)
Add an event in the current context

Parameters:
event - the event

getAsyncPublisher

protected org.granite.tide.async.AsyncPublisher getAsyncPublisher()
Factory for Seam async publisher

Specified by:
getAsyncPublisher in class org.granite.tide.TideServiceContext
Returns:
servlet context of the current application

prepareCall

public void prepareCall(org.granite.messaging.service.ServiceInvocationContext context,
                        org.granite.tide.IInvocationCall c,
                        String componentName,
                        Class<?> componentClass)
Synchronizes server context with data provided by the client

Specified by:
prepareCall in class org.granite.tide.TideServiceContext
Parameters:
context - invocation context
c - client call
componentName - name of the component which will be invoked

postCall

public org.granite.tide.IInvocationResult postCall(org.granite.messaging.service.ServiceInvocationContext context,
                                                   Object result,
                                                   String componentName,
                                                   Class<?> componentClass)
Builds the result object for the invocation

Specified by:
postCall in class org.granite.tide.TideServiceContext
Parameters:
context - invocation context
result - result of the method invocation
componentName - name of the invoked component
Returns:
result object

postCallFault

public void postCallFault(org.granite.messaging.service.ServiceInvocationContext context,
                          Throwable t,
                          String componentName,
                          Class<?> componentClass)
Intercepts a fault on the invocation

Overrides:
postCallFault in class org.granite.tide.TideServiceContext
Parameters:
context - invocation context
t - exception thrown
componentName - name of the invoked component

addResultEval

public void addResultEval(org.granite.tide.invocation.ContextResult result)

restoreContext

public void restoreContext(List<org.granite.tide.invocation.ContextUpdate> updates,
                           Object target)
Evaluate updates in current server context

Parameters:
updates - list of updates
target - the target instance

evaluateResults

public List<org.granite.tide.invocation.ContextUpdate> evaluateResults(Object target,
                                                                       boolean nothing)
Evaluate results from context

Parameters:
target - the target instance
nothing - used by initializer to avoid interactions with context sync
Returns:
list of updates to send back to the client

getTidePersistenceManager

protected org.granite.tide.TidePersistenceManager getTidePersistenceManager(boolean create)
Specified by:
getTidePersistenceManager in class org.granite.tide.TideServiceContext

equals

protected boolean equals(Object obj1,
                         Object obj2)
Overrides:
equals in class org.granite.tide.TideServiceContext

isImmutable

public static boolean isImmutable(Object o)