Errai 3.0.1-SNAPSHOT

org.jboss.errai.cdi.server.events
Class EventConversationContext

java.lang.Object
  extended by org.jboss.errai.cdi.server.events.EventConversationContext

public class EventConversationContext
extends Object

An context control helper for handling Errai conversations within CDI. Internally, this class uses a ThreadLocal to store its state. Thus, conversational scopes within Errai are dependent upon single-threaded dispatch within the CDI container.

Author:
Mike Brock

Nested Class Summary
static class EventConversationContext.Context
           
 
Constructor Summary
EventConversationContext()
           
 
Method Summary
static void activate(Message message)
          Convenience method to active the conversation scope from a Errai Message object, by extracting the session ID referenced within.
static void activate(Object o, QueueSession session)
          Activate the conversation scope.
static void activate(QueueSession session)
          Activate a conversations scope.
static void deactivate()
          Deactivate any current scope.
static EventConversationContext.Context get()
          Get the current scope.
static boolean isEventObjectInContext(Object event)
          Checks to see if the specified event reference is the same event reference that initiated the conversation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventConversationContext

public EventConversationContext()
Method Detail

activate

public static void activate(Object o,
                            QueueSession session)
Activate the conversation scope. If there is a currently active scope, it is replaced with this new scope.

Parameters:
o - reference to the event object which is opening the scope.
session - the bus session ID of the scope.

activate

public static void activate(QueueSession session)
Activate a conversations scope. If there is a currently active scope, it is replaced with this new scope.

Parameters:
session - the bus session ID of the scope.

activate

public static void activate(Message message)
Convenience method to active the conversation scope from a Errai Message object, by extracting the session ID referenced within.

Parameters:
message - An Errai message.

deactivate

public static void deactivate()
Deactivate any current scope.


get

public static EventConversationContext.Context get()
Get the current scope.

Returns:
isntance of the context.

isEventObjectInContext

public static boolean isEventObjectInContext(Object event)
Checks to see if the specified event reference is the same event reference that initiated the conversation.

Parameters:
event - the event instance
Returns:
boolean indicating if the event object is the same instance

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.