@Named public class ServerSession extends Object implements ContextAware
ServerSession serverSession = tideContext.set(new ServerSession("/myapp", "localhost", 8080));
| Modifier and Type | Class and Description |
|---|---|
static class |
ServerSession.DefaultStatus |
static interface |
ServerSession.ServiceFactory
Internal SPI to define how remoting/messaging elements are created
|
static interface |
ServerSession.Status
Status notified of network related events
|
static interface |
ServerSession.TransportExceptionListener |
static interface |
ServerSession.TransportIOListener |
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTEXT_FAULT |
static String |
CONTEXT_RESULT |
static String |
LOGIN |
static String |
LOGOUT |
protected Map<String,org.granite.client.messaging.RemoteService> |
remoteServices |
static String |
SERVER_TIME_TAG |
static String |
SESSION_EXP_TAG |
static String |
SESSION_EXPIRED |
static String |
SESSION_ID_TAG |
protected Map<String,org.granite.client.messaging.TopicAgent> |
topicAgents |
| Constructor and Description |
|---|
ServerSession() |
ServerSession(org.granite.client.messaging.ServerApp serverApp)
Create a server session for the specified server app
|
ServerSession(String contextRoot,
boolean secure,
String serverName,
int serverPort)
Create a server session for the specified context root and server
|
ServerSession(String contextRoot,
String serverName,
int serverPort)
Create a server session for the specified context root and server
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ServerSession.TransportExceptionListener listener) |
void |
addListener(ServerSession.TransportIOListener listener) |
void |
addRemoteAliasPackage(String packageName)
Add a package name to scan for remote aliases
|
void |
afterLogin()
Called by
Identity after login has succeeded |
void |
checkWaitForLogout()
Notify the framework that it should wait for a async operation before effectively logging out.
|
Object |
convert(Object value,
Type expectedType) |
org.granite.client.messaging.Consumer |
getConsumer(String destination,
String topic)
Build a consumer for the default channel type and destination
|
org.granite.client.messaging.Consumer |
getConsumer(String destination,
String topic,
String channelType)
Build a consumer for the specified channel type and destination
|
org.granite.util.ContentType |
getContentType()
Serialization type (default is JMF)
|
Context |
getContext()
Current Tide context
|
org.granite.client.messaging.channel.MessagingChannel |
getMessagingChannel(String channelType)
Return a messaging channel for the specified type
|
org.granite.client.messaging.transport.Transport |
getMessagingTransport()
Current messaging transport
|
org.granite.client.messaging.Producer |
getProducer(String destination,
String topic)
Build a producer for the default channel type and destination
|
org.granite.client.messaging.Producer |
getProducer(String destination,
String topic,
String channelType)
Build a producer for the specified channel type and destination
|
org.granite.client.messaging.RemoteService |
getRemoteService()
Returns remote service for the internal destination
Should generally not be used except for very advanced use, use
Component instead |
org.granite.client.messaging.RemoteService |
getRemoteService(String destination)
Returns a remote service for the specified destination
Should generally not be used except for very advanced use, use
Component instead |
org.granite.client.messaging.transport.Transport |
getRemotingTransport()
Current remoting transport
|
String |
getSessionId()
Current remote session id
|
ServerSession.Status |
getStatus()
Status implementation
|
boolean |
isLogoutInProgress()
Is logging out ?
|
void |
login(String username,
String password)
Implementation of login
Should not be called directly, called by
Identity.login(java.lang.String, java.lang.String, org.granite.client.tide.server.TideResponder<java.lang.String>) |
void |
login(String username,
String password,
Charset charset)
Implementation of login using a specific charset for username/password encoding
Should not be called directly, called by
Identity.login(java.lang.String, java.lang.String, org.granite.client.tide.server.TideResponder<java.lang.String>) |
void |
logout(Observer logoutObserver)
Implementation of logout
Should not be called directly, called by
Identity.logout(org.granite.client.tide.server.TideResponder<java.lang.Void>) |
void |
notifyExceptionListeners(org.granite.client.messaging.transport.TransportException e) |
void |
notifyIOListeners(boolean busy) |
void |
onFaultEvent(org.granite.client.messaging.events.FaultEvent event,
org.granite.client.messaging.messages.responses.FaultMessage emsg)
Callback called when a remoting fault is received
|
void |
onIssueEvent(org.granite.client.messaging.events.IssueEvent event)
Callback called when a remoting failure is received
|
void |
onResultEvent(org.granite.client.messaging.events.Event event)
Callback called when a remoting response is received
|
void |
removeListener(ServerSession.TransportExceptionListener listener) |
void |
removeListener(ServerSession.TransportIOListener listener) |
void |
sessionExpired()
Called by
Identity after session has expired |
void |
setChannelFactoryClass(Class<? extends org.granite.client.messaging.channel.ChannelFactory> channelFactoryClass)
Set a custom channel factory class
|
void |
setContentType(org.granite.util.ContentType contentType)
Set the serialization type
|
void |
setContext(Context context)
Set the Tide context for this server session
(internal method, should be set by the context itself)
|
void |
setDefaultChannelBuilder(org.granite.client.messaging.channel.ChannelBuilder channelBuilder)
Set the default channel builder
|
void |
setDefaultChannelType(String channelType)
Set the default channel type for messaging
|
void |
setDefaultTimeToLive(long timeToLive)
Set default time to live on all channels
|
void |
setMessagingTransport(String channelType,
org.granite.client.messaging.transport.Transport transport)
Set the messaging transport for the specified channel type
|
void |
setMessagingTransport(org.granite.client.messaging.transport.Transport transport)
Set the default messaging transport
|
void |
setPlatformContext(Object platformContext)
Set the platform context for this server session
|
void |
setRemoteAliasPackages(Set<String> packageNames)
Reset all package names to scan for remote aliases
|
void |
setRemotingTransport(org.granite.client.messaging.transport.Transport transport)
Set the remoting transport
|
void |
setServerApp(org.granite.client.messaging.ServerApp serverApp)
Set the server app for this server session
|
void |
setServiceFactory(ServerSession.ServiceFactory serviceFactory)
Set a custom service factory to create producer/consumers and remote services
|
void |
setStatus(ServerSession.Status status)
Set an implementation of the Status interface to be notified of server related information
|
void |
start()
Configure and start the server session
|
void |
stop()
Stop the server session and cleanup resources
|
void |
tryLogout()
Called after all remote operations on a component are finished.
|
public static final String SERVER_TIME_TAG
public static final String SESSION_ID_TAG
public static final String SESSION_EXP_TAG
public static final String CONTEXT_RESULT
public static final String CONTEXT_FAULT
public static final String LOGIN
public static final String LOGOUT
public static final String SESSION_EXPIRED
protected Map<String,org.granite.client.messaging.RemoteService> remoteServices
protected Map<String,org.granite.client.messaging.TopicAgent> topicAgents
public ServerSession() throws Exception
Exceptionpublic ServerSession(String contextRoot, String serverName, int serverPort)
contextRoot - context rootserverName - server host nameserverPort - server portExceptionpublic ServerSession(String contextRoot, boolean secure, String serverName, int serverPort)
contextRoot - context rootsecure - server app is secured (https/wss/...)serverName - server host nameserverPort - server portExceptionpublic ServerSession(org.granite.client.messaging.ServerApp serverApp)
serverApp - server application definitionpublic org.granite.util.ContentType getContentType()
public void setContentType(org.granite.util.ContentType contentType)
contentType - serialization typepublic void setDefaultChannelBuilder(org.granite.client.messaging.channel.ChannelBuilder channelBuilder)
channelBuilder - channel builderpublic void setDefaultChannelType(String channelType)
channelType - channel typepublic void setChannelFactoryClass(Class<? extends org.granite.client.messaging.channel.ChannelFactory> channelFactoryClass)
channelFactoryClass - channel factory classpublic void setServerApp(org.granite.client.messaging.ServerApp serverApp)
serverApp - server application definitionpublic void setContext(Context context)
setContext in interface ContextAwarecontext - Tide contextContextAwarepublic Context getContext()
public void setPlatformContext(Object platformContext)
platformContext - public void setStatus(ServerSession.Status status)
status - statuspublic ServerSession.Status getStatus()
public void setRemotingTransport(org.granite.client.messaging.transport.Transport transport)
transport - remoting transportpublic void setMessagingTransport(org.granite.client.messaging.transport.Transport transport)
transport - messaging transportpublic void setMessagingTransport(String channelType, org.granite.client.messaging.transport.Transport transport)
channelType - channel typepublic void addRemoteAliasPackage(String packageName)
packageName - package namepublic void setRemoteAliasPackages(Set<String> packageNames)
packageNames - package namespublic void stop() throws Exception
Exceptionpublic void setServiceFactory(ServerSession.ServiceFactory serviceFactory)
serviceFactory - service factorypublic org.granite.client.messaging.RemoteService getRemoteService()
Component insteadpublic org.granite.client.messaging.RemoteService getRemoteService(String destination)
Component insteaddestination - destination namepublic org.granite.client.messaging.channel.MessagingChannel getMessagingChannel(String channelType)
channelType - channel typeChannelTypepublic org.granite.client.messaging.Consumer getConsumer(String destination, String topic, String channelType)
destination - destination nametopic - subtopicchannelType - channel typepublic org.granite.client.messaging.Consumer getConsumer(String destination, String topic)
destination - destination nametopic - subtopicpublic org.granite.client.messaging.Producer getProducer(String destination, String topic, String channelType)
destination - destination nametopic - subtopicchannelType - channel typepublic org.granite.client.messaging.Producer getProducer(String destination, String topic)
destination - destination nametopic - subtopicpublic String getSessionId()
public boolean isLogoutInProgress()
public void onResultEvent(org.granite.client.messaging.events.Event event)
event - eventpublic void onFaultEvent(org.granite.client.messaging.events.FaultEvent event, org.granite.client.messaging.messages.responses.FaultMessage emsg)
event - fault eventemsg - fault messagepublic void onIssueEvent(org.granite.client.messaging.events.IssueEvent event)
event - failure eventpublic org.granite.client.messaging.transport.Transport getRemotingTransport()
public org.granite.client.messaging.transport.Transport getMessagingTransport()
public void login(String username, String password)
Identity.login(java.lang.String, java.lang.String, org.granite.client.tide.server.TideResponder<java.lang.String>)username - user namepassword - passwordpublic void login(String username, String password, Charset charset)
Identity.login(java.lang.String, java.lang.String, org.granite.client.tide.server.TideResponder<java.lang.String>)username - user namepassword - passwordcharset - charset used for encodingpublic void afterLogin()
Identity after login has succeededpublic void sessionExpired()
Identity after session has expiredpublic void logout(Observer logoutObserver)
Identity.logout(org.granite.client.tide.server.TideResponder<java.lang.Void>)logoutObserver - observer that will be notified of logout resultpublic void checkWaitForLogout()
public void tryLogout()
public void setDefaultTimeToLive(long timeToLive)
timeToLive - time to live in millisecondspublic void addListener(ServerSession.TransportIOListener listener)
public void removeListener(ServerSession.TransportIOListener listener)
public void addListener(ServerSession.TransportExceptionListener listener)
public void removeListener(ServerSession.TransportExceptionListener listener)
public void notifyIOListeners(boolean busy)
public void notifyExceptionListeners(org.granite.client.messaging.transport.TransportException e)