public abstract class AbstractClientSession extends org.eclipse.scout.rt.platform.reflect.AbstractPropertyObserver implements IClientSession, IExtensibleObject
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractClientSession.LocalClientSessionExtension<OWNER extends AbstractClientSession>
The extension delegating to the local methods.
|
propertySupport
PROP_LOCALE
Constructor and Description |
---|
AbstractClientSession(boolean autoInitConfig) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(ISessionListener sessionListener) |
protected void |
cancelRunningJobs() |
Object |
computeDataIfAbsent(String key,
Callable<?> producer) |
protected IClientSessionExtension<? extends AbstractClientSession> |
createLocalExtension() |
protected void |
execLoadSession()
Initialize the properties of the client session.
|
protected void |
execStoreSession()
This method is called just before the session is stopped and can be overwritten to persist properties of the client
session
|
protected void |
fireSessionChangedEvent(SessionEvent event) |
List<? extends IClientSessionExtension<? extends AbstractClientSession>> |
getAllExtensions() |
URI |
getBrowserURI() |
protected boolean |
getConfiguredSingleThreadSession() |
Object |
getData(String key) |
IDesktop |
getDesktop() |
IDesktop |
getDesktopElseVirtualDesktop() |
int |
getExitCode() |
<T extends IExtension<?>> |
getExtension(Class<T> c) |
String |
getId() |
Locale |
getLocale() |
IMemoryPolicy |
getMemoryPolicy()
see
IMemoryPolicy |
org.eclipse.scout.rt.platform.job.IExecutionSemaphore |
getModelJobSemaphore()
Returns the one-permit
IExecutionSemaphore to run model jobs of this session in sequence, meaning
that only one model job is active at any given time for this session. |
protected <T> T |
getSharedContextVariable(String name,
Class<T> type)
Do not use this method directly.
|
Map<String,Object> |
getSharedVariableMap() |
Object |
getStateLock()
Monitor can be used to wait for changes of the states 'active' and 'loaded'
|
Subject |
getSubject()
Consumers can query for the
Subject of a IClientSession |
ScoutTexts |
getTexts()
Returns the
ScoutTexts instance assigned to the type (class) of the current ClientSession. |
UserAgent |
getUserAgent() |
String |
getUserId()
Returns the userId of the subject holding the current session
|
IDesktop |
getVirtualDesktop() |
protected void |
inactivateSession() |
protected void |
initConfig() |
protected void |
initializeSharedVariables()
Pings the server to get the initial shared variables.
|
protected void |
initializeSharedVariables(long timeout,
TimeUnit unit) |
protected void |
interceptInitConfig() |
protected void |
interceptLoadSession() |
protected void |
interceptStoreSession() |
boolean |
isActive() |
boolean |
isStopping() |
void |
removeListener(ISessionListener sessionListener) |
void |
replaceSharedVariableMapInternal(SharedVariableMap newMap)
replace the shared variable map with a new version.
|
protected URI |
resolveBrowserUri()
Resolves the browser URI, or
null if could not be resolved. |
protected IMemoryPolicy |
resolveMemoryPolicy()
Returns the memory policy to be used.
|
void |
setData(String key,
Object value) |
void |
setDesktop(IDesktop desktop)
Sets the desktop model associated with this client session.
|
void |
setLocale(Locale locale)
Sets the given
Locale to the session and NlsLocale.CURRENT . |
void |
setMemoryPolicy(IMemoryPolicy memoryPolicy)
see
IMemoryPolicy |
void |
setSubject(Subject subject) |
void |
setUserAgent(UserAgent userAgent)
Sets the given
UserAgent to the session and UserAgent.CURRENT . |
void |
start(String sessionId) |
void |
stop()
Close the session
|
void |
stop(int exitCode) |
String |
toString() |
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getSpecificPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
public final List<? extends IClientSessionExtension<? extends AbstractClientSession>> getAllExtensions()
getAllExtensions
in interface IExtensibleObject
public <T extends IExtension<?>> T getExtension(Class<T> c)
getExtension
in interface IExtensibleObject
protected IClientSessionExtension<? extends AbstractClientSession> createLocalExtension()
protected final void interceptInitConfig()
protected boolean getConfiguredSingleThreadSession()
public String getUserId()
public ScoutTexts getTexts()
ScoutTexts
instance assigned to the type (class) of the current ClientSession.
Override this method to set the application specific texts implementation
public final Locale getLocale()
getLocale
in interface IClientSession
Locale
or null
if not set.public final void setLocale(Locale locale)
IClientSession
Locale
to the session and NlsLocale.CURRENT
.setLocale
in interface IClientSession
locale
- Locale to be set.public UserAgent getUserAgent()
getUserAgent
in interface IClientSession
UserAgent
; is never null
; contains information about the UI.public void setUserAgent(UserAgent userAgent)
IClientSession
UserAgent
to the session and UserAgent.CURRENT
.setUserAgent
in interface IClientSession
userAgent
- UserAgent
to be set.public URI getBrowserURI()
getBrowserURI
in interface IClientSession
URI
in the browser which hosts this application (typically ending in /index.html or
similar)public Map<String,Object> getSharedVariableMap()
getSharedVariableMap
in interface ISession
protected <T> T getSharedContextVariable(String name, Class<T> type)
getUserId()
)
Returns the variables shared with the server. Shared variables are automatically updated on the client by client notifications when changed on the server.
public final Object getStateLock()
IClientSession
getStateLock
in interface IClientSession
protected void initConfig()
protected URI resolveBrowserUri()
null
if could not be resolved.
The default implementation looks in the current calling context for the URL. Typically, that URL is set only during session initialization.
org.eclipse.scout.rt.ui.html.UiSession#createAndStartClientSession()
protected IMemoryPolicy resolveMemoryPolicy()
public void replaceSharedVariableMapInternal(SharedVariableMap newMap)
replaceSharedVariableMapInternal
in interface IClientSession
newMap
- protected void initializeSharedVariables(long timeout, TimeUnit unit)
protected void initializeSharedVariables()
org.eclipse.scout.rt.platform.exception.ProcessingException
- if interrupted (and the variables are not initialized)protected void execLoadSession()
protected void execStoreSession()
public IDesktop getVirtualDesktop()
getVirtualDesktop
in interface IClientSession
Before a desktop is set using IClientSession.setDesktop(IDesktop)
this is a virtual desktop ONLY used to early
register observers.
Once a desktop has been set, this is the same as calling IClientSession.getDesktop()
public IDesktop getDesktop()
getDesktop
in interface IClientSession
Desktop is available only after ISession.start(String)
and
public IDesktop getDesktopElseVirtualDesktop()
getDesktopElseVirtualDesktop
in interface IClientSession
IDesktop
associated with this IClientSession
, or a virtual IDesktop
with
limited functionality if not set yet.public void setDesktop(IDesktop desktop)
IClientSession
setDesktop
in interface IClientSession
public void stop()
stop
in interface IClientSession
stop
in interface ISession
public void stop(int exitCode)
stop
in interface IClientSession
protected void cancelRunningJobs()
protected void inactivateSession()
public boolean isStopping()
isStopping
in interface IClientSession
true
if session shutdown is in progress (i.g. IClientSession.stop()
was called). While shutting
down, the session is still considered "active".public int getExitCode()
getExitCode
in interface IClientSession
public IMemoryPolicy getMemoryPolicy()
IClientSession
IMemoryPolicy
getMemoryPolicy
in interface IClientSession
public void setMemoryPolicy(IMemoryPolicy memoryPolicy)
IClientSession
IMemoryPolicy
setMemoryPolicy
in interface IClientSession
public Subject getSubject()
IClientSession
Subject
of a IClientSession
The IServiceTunnel
used by IClientSession#getServiceTunnel()
checks for the Subject under which the
session is running and creates a WSSE security element.
The subject is set when this object is created from Subject.getSubject(java.security.AccessControlContext)
getSubject
in interface IClientSession
public void setSubject(Subject subject)
setSubject
in interface IClientSession
public Object computeDataIfAbsent(String key, Callable<?> producer)
computeDataIfAbsent
in interface ISession
protected final void interceptStoreSession()
protected final void interceptLoadSession()
public void addListener(ISessionListener sessionListener)
addListener
in interface ISession
public void removeListener(ISessionListener sessionListener)
removeListener
in interface ISession
public org.eclipse.scout.rt.platform.job.IExecutionSemaphore getModelJobSemaphore()
IClientSession
IExecutionSemaphore
to run model jobs of this session in sequence, meaning
that only one model job is active at any given time for this session.getModelJobSemaphore
in interface IClientSession
protected void fireSessionChangedEvent(SessionEvent event)
Copyright © 2010–2017. All rights reserved.