org.granite.client.tide.server
Class ServerSession

java.lang.Object
  extended by org.granite.client.tide.server.ServerSession
All Implemented Interfaces:
ContextAware

@Named
public class ServerSession
extends Object
implements ContextAware

Author:
William DRAI

Nested Class Summary
static class ServerSession.DefaultStatus
           
static interface ServerSession.ServiceFactory
           
static interface ServerSession.Status
           
static interface ServerSession.TransportExceptionListener
           
static interface ServerSession.TransportIOListener
           
 
Field Summary
static String CONTEXT_FAULT
           
static String CONTEXT_RESULT
           
static String CONVERSATION_PROPAGATION_TAG
           
static String CONVERSATION_TAG
           
static String IS_FIRST_CALL_TAG
           
static String IS_FIRST_CONVERSATION_CALL_TAG
           
static String IS_LONG_RUNNING_CONVERSATION_TAG
           
static String LOGIN
           
static String LOGOUT
           
protected  Map<String,RemoteService> remoteServices
           
static String SERVER_TIME_TAG
           
static String SESSION_EXP_TAG
           
static String SESSION_EXPIRED
           
static String SESSION_ID_TAG
           
protected  Map<String,TopicAgent> topicAgents
           
static String WAS_LONG_RUNNING_CONVERSATION_CREATED_TAG
           
static String WAS_LONG_RUNNING_CONVERSATION_ENDED_TAG
           
 
Constructor Summary
ServerSession()
           
ServerSession(String contextRoot, String serverName, int serverPort)
           
ServerSession(String contextRoot, String serverName, int serverPort, String graniteUrlMapping, String gravityUrlMapping)
           
ServerSession(String destination, String contextRoot, String serverName, int serverPort)
           
ServerSession(String destination, String contextRoot, String serverName, int serverPort, String graniteUrlMapping, String gravityUrlMapping)
           
ServerSession(String destination, String protocol, String contextRoot, String serverName, int serverPort, String graniteUrlMapping, String gravityUrlMapping)
           
 
Method Summary
 void addListener(ServerSession.TransportExceptionListener listener)
           
 void addListener(ServerSession.TransportIOListener listener)
           
 void addRemoteClassPackage(String packageName)
           
 void afterLogin()
           
 void checkWaitForLogout()
          Notify the framework that it should wait for a async operation before effectively logging out.
 Consumer getConsumer(String destination, String topic)
           
 org.granite.util.ContentType getContentType()
           
 org.granite.messaging.amf.io.convert.Converters getConverters()
           
 Producer getProducer(String destination, String topic)
           
 RemoteService getRemoteService()
           
 RemoteService getRemoteService(String destination)
           
 String getSessionId()
           
 ServerSession.Status getStatus()
           
 TrackingContext getTrackingContext()
           
 void handleFault(Context context, String componentName, String operation, FaultMessage emsg)
           
 void handleFaultEvent(FaultEvent event, FaultMessage emsg)
           
 void handleResult(Context context, String componentName, String operation, org.granite.tide.invocation.InvocationResult invocationResult, Object result, Object mergeWith)
           
 void handleResultEvent(Event event)
           
 boolean isFirstCall()
           
 boolean isLogoutInProgress()
           
 void login(String username, String password)
           
 void logout(Observer logoutObserver)
           
 void notifyExceptionListeners(TransportException e)
           
 void notifyIOListeners(boolean busy)
           
 void removeListener(ServerSession.TransportExceptionListener listener)
           
 void removeListener(ServerSession.TransportIOListener listener)
           
 void sessionExpired()
           
 void setConfiguration(Configuration configuration)
           
 void setContentType(org.granite.util.ContentType contentType)
           
 void setContext(Context context)
           
 void setContextRoot(String contextRoot)
           
 void setDestination(String destination)
           
 void setGraniteUrlMapping(String graniteUrlMapping)
           
 void setGravityUrlMapping(String gravityUrlMapping)
           
 void setMessagingTransport(Transport transport)
           
 void setProtocol(String protocol)
           
 void setRemoteClassPackage(Set<String> packageNames)
           
 void setRemotingTransport(Transport transport)
           
 void setServerName(String serverName)
           
 void setServerPort(int serverPort)
           
 void setServiceFactory(ServerSession.ServiceFactory serviceFactory)
           
 void setStatus(ServerSession.Status status)
           
 void setUseWebSocket(boolean useWebSocket)
           
 void start()
           
 void stop()
           
 void trackCall()
           
 void tryLogout()
          Try logout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_TIME_TAG

public static final String SERVER_TIME_TAG
See Also:
Constant Field Values

SESSION_ID_TAG

public static final String SESSION_ID_TAG
See Also:
Constant Field Values

SESSION_EXP_TAG

public static final String SESSION_EXP_TAG
See Also:
Constant Field Values

CONVERSATION_TAG

public static final String CONVERSATION_TAG
See Also:
Constant Field Values

CONVERSATION_PROPAGATION_TAG

public static final String CONVERSATION_PROPAGATION_TAG
See Also:
Constant Field Values

IS_LONG_RUNNING_CONVERSATION_TAG

public static final String IS_LONG_RUNNING_CONVERSATION_TAG
See Also:
Constant Field Values

WAS_LONG_RUNNING_CONVERSATION_ENDED_TAG

public static final String WAS_LONG_RUNNING_CONVERSATION_ENDED_TAG
See Also:
Constant Field Values

WAS_LONG_RUNNING_CONVERSATION_CREATED_TAG

public static final String WAS_LONG_RUNNING_CONVERSATION_CREATED_TAG
See Also:
Constant Field Values

IS_FIRST_CALL_TAG

public static final String IS_FIRST_CALL_TAG
See Also:
Constant Field Values

IS_FIRST_CONVERSATION_CALL_TAG

public static final String IS_FIRST_CONVERSATION_CALL_TAG
See Also:
Constant Field Values

CONTEXT_RESULT

public static final String CONTEXT_RESULT
See Also:
Constant Field Values

CONTEXT_FAULT

public static final String CONTEXT_FAULT
See Also:
Constant Field Values

LOGIN

public static final String LOGIN
See Also:
Constant Field Values

LOGOUT

public static final String LOGOUT
See Also:
Constant Field Values

SESSION_EXPIRED

public static final String SESSION_EXPIRED
See Also:
Constant Field Values

remoteServices

protected Map<String,RemoteService> remoteServices

topicAgents

protected Map<String,TopicAgent> topicAgents
Constructor Detail

ServerSession

public ServerSession()
              throws Exception
Throws:
Exception

ServerSession

public ServerSession(String contextRoot,
                     String serverName,
                     int serverPort)
              throws Exception
Throws:
Exception

ServerSession

public ServerSession(String contextRoot,
                     String serverName,
                     int serverPort,
                     String graniteUrlMapping,
                     String gravityUrlMapping)
              throws Exception
Throws:
Exception

ServerSession

public ServerSession(String destination,
                     String contextRoot,
                     String serverName,
                     int serverPort)
              throws Exception
Throws:
Exception

ServerSession

public ServerSession(String destination,
                     String contextRoot,
                     String serverName,
                     int serverPort,
                     String graniteUrlMapping,
                     String gravityUrlMapping)
              throws Exception
Throws:
Exception

ServerSession

public ServerSession(String destination,
                     String protocol,
                     String contextRoot,
                     String serverName,
                     int serverPort,
                     String graniteUrlMapping,
                     String gravityUrlMapping)
              throws Exception
Throws:
Exception
Method Detail

getContentType

public org.granite.util.ContentType getContentType()

setContentType

public void setContentType(org.granite.util.ContentType contentType)

setContextRoot

public void setContextRoot(String contextRoot)

setProtocol

public void setProtocol(String protocol)

setServerName

public void setServerName(String serverName)

setServerPort

public void setServerPort(int serverPort)

setGraniteUrlMapping

public void setGraniteUrlMapping(String graniteUrlMapping)

setGravityUrlMapping

public void setGravityUrlMapping(String gravityUrlMapping)

setDestination

public void setDestination(String destination)

setContext

public void setContext(Context context)
Specified by:
setContext in interface ContextAware

getTrackingContext

public TrackingContext getTrackingContext()

setStatus

public void setStatus(ServerSession.Status status)

getStatus

public ServerSession.Status getStatus()

setUseWebSocket

public void setUseWebSocket(boolean useWebSocket)

setRemotingTransport

public void setRemotingTransport(Transport transport)

setMessagingTransport

public void setMessagingTransport(Transport transport)

setConfiguration

public void setConfiguration(Configuration configuration)

addRemoteClassPackage

public void addRemoteClassPackage(String packageName)

setRemoteClassPackage

public void setRemoteClassPackage(Set<String> packageNames)

getConverters

public org.granite.messaging.amf.io.convert.Converters getConverters()

start

@PostConstruct
public void start()
           throws Exception
Throws:
Exception

stop

@PreDestroy
public void stop()
          throws Exception
Throws:
Exception

setServiceFactory

public void setServiceFactory(ServerSession.ServiceFactory serviceFactory)

getRemoteService

public RemoteService getRemoteService()

getRemoteService

public RemoteService getRemoteService(String destination)

getConsumer

public Consumer getConsumer(String destination,
                            String topic)

getProducer

public Producer getProducer(String destination,
                            String topic)

isFirstCall

public boolean isFirstCall()

getSessionId

public String getSessionId()

isLogoutInProgress

public boolean isLogoutInProgress()

trackCall

public void trackCall()

handleResultEvent

public void handleResultEvent(Event event)

handleFaultEvent

public void handleFaultEvent(FaultEvent event,
                             FaultMessage emsg)

login

public void login(String username,
                  String password)
Parameters:
component - component proxy
op - remote operation
args - array of operation arguments
responder - Tide responder
withContext - send additional context with the call
handler - optional operation handler

afterLogin

public void afterLogin()

sessionExpired

public void sessionExpired()

logout

public void logout(Observer logoutObserver)
Parameters:
ctx - current context
componentName - component name of identity

checkWaitForLogout

public void checkWaitForLogout()
Notify the framework that it should wait for a async operation before effectively logging out. Only if a logout has been requested.


tryLogout

public void tryLogout()
Try logout. Should be called after all remote operations on a component are finished. The effective logout is done when all remote operations on all components have been notified as finished.


handleResult

public void handleResult(Context context,
                         String componentName,
                         String operation,
                         org.granite.tide.invocation.InvocationResult invocationResult,
                         Object result,
                         Object mergeWith)
Parameters:
componentName - name of the target component
operation - name of the called operation
ires - invocation result object
result - result object
mergeWith - previous value with which the result will be merged

handleFault

public void handleFault(Context context,
                        String componentName,
                        String operation,
                        FaultMessage emsg)
Parameters:
componentName - name of the target component
operation - name of the called operation
emsg - error message

addListener

public void addListener(ServerSession.TransportIOListener listener)

removeListener

public void removeListener(ServerSession.TransportIOListener listener)

addListener

public void addListener(ServerSession.TransportExceptionListener listener)

removeListener

public void removeListener(ServerSession.TransportExceptionListener listener)

notifyIOListeners

public void notifyIOListeners(boolean busy)

notifyExceptionListeners

public void notifyExceptionListeners(TransportException e)