at.spardat.xma.session
Class XMASessionClient

java.lang.Object
  extended byat.spardat.xma.session.XMASession
      extended byat.spardat.xma.session.XMASessionClient
All Implemented Interfaces:
at.spardat.xma.boot.component.IRtXMASessionClient

public class XMASessionClient
extends XMASession
implements at.spardat.xma.boot.component.IRtXMASessionClient

Manages all active Components at the client that are executing in a single JVM and belong to exactly one server side application instance.


Field Summary
static int defaultKeepAliveInterval
          default intervall between keepAlive calls in seconds.
 
Constructor Summary
XMASessionClient(at.spardat.xma.boot.transport.XMA_URI uri, at.spardat.xma.boot.comp.AppContainer appcIn)
          Constructor.
 
Method Summary
 void addExternalEventListener(ExternalEventListener listener)
          Adds an ExternalEventListener to the listeners of the session.
 void addGlobalEventListener(GlobalEventListener listener)
          The added GlobalEventListener will be notifyed by server events.
 void callGlobalEventListener(java.util.Collection globalEvents)
          Calls globalEvent() at the registered listeners with the GlobalEvents from the paramter globalEvents.
 boolean contextChangeServer(javax.security.auth.Subject subject)
          Does a server side context change.
 at.spardat.xma.boot.comp.AppContainer getAppContainer()
          Get the application container used by the boot runtime to manage the component files of this application.
 byte[] getApplicationVersion()
          Application Hash-Code built from application descriptors.
 IComponentClient getComponent(java.lang.String componentName)
          Creates a Component of the same application.
 IComponentClient getComponentExtern(java.lang.String componentName)
          Creates a Component from an other application.
 java.util.Iterator getComponents()
          Returns an Iterator over the list of registered Components.
 XMAContext getContext()
          Returns the execution context of this session.
 java.lang.String getId()
          Gets the id of the session; with http-comunication this is the session cookie.
 short[] getIdsOfDeadComponents()
          Returns a newly created array of ids of dead components.
 at.spardat.xma.boot.logger.Logger getLogger()
          Get the client side logger
 PluginManager getPluginManager()
          Returns the PluginManager that must be used to retrieve client side plugin implementations.
 java.lang.String getRuntimeProperty(java.lang.String key)
          Returns the property with the specified key in the runtime properties.
 java.lang.String getRuntimeProperty(java.lang.String key, java.lang.String defaultValue)
          Returns the property with the specified key in the runtime properties.
 javax.security.auth.Subject getSubject()
          Returns the subject as supplied by the JAAS conforming login module.
 at.spardat.xma.boot.transport.XMA_URI getUri()
          Gets the application-uri
 byte[] inverseTransform(java.lang.String transform, byte[] data)
           
 boolean isAtServer()
          Returns true if this session is in the server JVM.
 boolean isNeedEncryption()
          Get if this session uses SSL-Encryption for session management calls to the server.
 boolean keepAlive()
          Does an empty server request to prevent inactivity timeout.
 java.util.Properties launchExtern(java.lang.String component, java.util.Properties input, org.eclipse.swt.widgets.Composite parent)
          Launch method for modal Components of other applications.
 java.util.Properties launchRelative(java.lang.String component, java.util.Properties input, org.eclipse.swt.widgets.Composite parent)
          Launch method for modal Components of the same application.
 boolean login()
          Does a client and server side login with the configured authentication plugin.
 boolean login(java.util.Properties props)
          Does a client and server side login with the configured authentication plugin.
 boolean loginServer(javax.security.auth.Subject subject)
          Does a server side login.
 void logout()
          Does a client and server side logout with the configured authentication plugin.
 java.util.Properties notifyExternalEvent(ExternalEvent event)
          notifies all listeners of the ExternalEvent.
 void registerComponent(ComponentClient c)
          Registers a Component with this Session.
 void removeComponent(ComponentClient c)
          Deregisters a given Component.
 void removeExternalEventListener(ExternalEventListener listener)
          Removes an ExternalEventListener to the listeners of the session.
 boolean removeGlobalEventListener(GlobalEventListener listener)
          removes the GlobalEventListener.
 void resetDeadComponentList()
          Empties the list of dead component ids.
 java.lang.Object serverGetPreLoginInfo()
          Gets the pre login information from the server.
 void setId(java.lang.String string)
          Sets the id of the session; with http-comunication this is the session cookie.
 void setNeedEncryption(boolean enc)
          Sets if SSL-Encryption is neccessary for session management calls to the server.
 
Methods inherited from class at.spardat.xma.session.XMASession
checkPermission, getApplicationVersionShort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultKeepAliveInterval

public static final int defaultKeepAliveInterval
default intervall between keepAlive calls in seconds. It is only used if the property boot.session.keepalive_interval cannot be read from at.spardat.xma.boot.bootcfg.properties or is not a number.

See Also:
Constant Field Values
Constructor Detail

XMASessionClient

public XMASessionClient(at.spardat.xma.boot.transport.XMA_URI uri,
                        at.spardat.xma.boot.comp.AppContainer appcIn)
Constructor.

Method Detail

login

public boolean login()
Does a client and server side login with the configured authentication plugin.

Specified by:
login in interface at.spardat.xma.boot.component.IRtXMASessionClient
Returns:
true if the login succeeded, false otherwise
Throws:
at.spardat.enterprise.exc.SysException - if the authentication plugin does not provide exactly one XMAContext, or some Exception occured in the authentication plugin.

login

public boolean login(java.util.Properties props)
Does a client and server side login with the configured authentication plugin.

Specified by:
login in interface at.spardat.xma.boot.component.IRtXMASessionClient
Parameters:
props - input data for the login module; will be propagated as options to initialize.
Returns:
true if the login succeeded, false otherwise
Throws:
at.spardat.enterprise.exc.SysException - if the authentication plugin does not provide exactly one XMAContext, or some Exception occured in the authentication plugin.

getContext

public XMAContext getContext()
Returns the execution context of this session. All callers of this method may rely on the fact that the information stored in the XMAContext remain stable, i.e., won't change over the lifetime of this session. This pertains to the authenticated user, the mandant and the environment.

Specified by:
getContext in class XMASession
Returns:
context never null.

getSubject

public javax.security.auth.Subject getSubject()
Returns the subject as supplied by the JAAS conforming login module.

Specified by:
getSubject in class XMASession
Returns:
the subject provided by the login module.

registerComponent

public void registerComponent(ComponentClient c)
Registers a Component with this Session. Must only be called from class ComponentClient.

Parameters:
c - the Component to register.

removeComponent

public void removeComponent(ComponentClient c)
Deregisters a given Component. The same component must have been registered before. Must only be called from class ComponentClient.

Parameters:
c - the Component to deregister.

getIdsOfDeadComponents

public short[] getIdsOfDeadComponents()
Returns a newly created array of ids of dead components.

Returns:
an array of component ids. The length of the array may be zero if there are no dead components.

resetDeadComponentList

public void resetDeadComponentList()
Empties the list of dead component ids.


getComponents

public java.util.Iterator getComponents()
Returns an Iterator over the list of registered Components.


getId

public java.lang.String getId()
Gets the id of the session; with http-comunication this is the session cookie.

Specified by:
getId in interface at.spardat.xma.boot.component.IRtXMASessionClient
Returns:
the id of the session

setId

public void setId(java.lang.String string)
Sets the id of the session; with http-comunication this is the session cookie. This method must only be called by the runtime!

Specified by:
setId in interface at.spardat.xma.boot.component.IRtXMASessionClient
Parameters:
string - the new session id.

getUri

public at.spardat.xma.boot.transport.XMA_URI getUri()
Gets the application-uri

Returns:
the uri of the corresponding server application

getPluginManager

public PluginManager getPluginManager()
Returns the PluginManager that must be used to retrieve client side plugin implementations.

Specified by:
getPluginManager in class XMASession
Returns:
a PluginManagerClient that is never null.

logout

public void logout()
Does a client and server side logout with the configured authentication plugin. This method must only be called by the runtime!

Specified by:
logout in interface at.spardat.xma.boot.component.IRtXMASessionClient

loginServer

public boolean loginServer(javax.security.auth.Subject subject)
Does a server side login. This creates an authenticated Session on the server on success. This method must only be called by the login module or the runtime!

Returns:
true if the login succeeds
false otherwise

serverGetPreLoginInfo

public java.lang.Object serverGetPreLoginInfo()
Gets the pre login information from the server. This method must only be called by the login module or the runtime!

Returns:
the information send by the server

keepAlive

public boolean keepAlive()
Does an empty server request to prevent inactivity timeout.

Returns:
true on success
false in case of communication problems

contextChangeServer

public boolean contextChangeServer(javax.security.auth.Subject subject)
Does a server side context change. This changes the subject in the server side session on success. This method must only be called by the login module or the runtime!

Returns:
true if the login succeeds
false otherwise

getAppContainer

public at.spardat.xma.boot.comp.AppContainer getAppContainer()
Get the application container used by the boot runtime to manage the component files of this application.

Specified by:
getAppContainer in interface at.spardat.xma.boot.component.IRtXMASessionClient
Returns:
the application container of this session.

getComponent

public IComponentClient getComponent(java.lang.String componentName)
Creates a Component of the same application. The implementation of the component is located and downloaded if necessary.

Parameters:
componentName - the relative uri of the desired component. relative uris are relative to the uri of this session (see getUri()).
Returns:
the initialized Component

getComponentExtern

public IComponentClient getComponentExtern(java.lang.String componentName)
Creates a Component from an other application. The implementation of the component is located and downloaded if necessary.

Parameters:
componentName - the absolute uri of the desired component in another webapplication.
Returns:
the initialized Component

launchRelative

public java.util.Properties launchRelative(java.lang.String component,
                                           java.util.Properties input,
                                           org.eclipse.swt.widgets.Composite parent)
Launch method for modal Components of the same application.

Parameters:
component - relative name of the component within the application
input - input properties
Returns:
Properties

launchExtern

public java.util.Properties launchExtern(java.lang.String component,
                                         java.util.Properties input,
                                         org.eclipse.swt.widgets.Composite parent)
Launch method for modal Components of other applications.

Parameters:
component - abslute uri of the component
input - input properties
Returns:
Properties

getLogger

public at.spardat.xma.boot.logger.Logger getLogger()
Get the client side logger

Returns:
the client side logger

getApplicationVersion

public byte[] getApplicationVersion()
Application Hash-Code built from application descriptors.

Specified by:
getApplicationVersion in class XMASession
Returns:
Application Version Hash-Code

isNeedEncryption

public boolean isNeedEncryption()
Get if this session uses SSL-Encryption for session management calls to the server. (login, logoff, prelogininfo, contextchange)

Returns:
if SSL-Encryption will be used
Since:
1.4.0

setNeedEncryption

public void setNeedEncryption(boolean enc)
Sets if SSL-Encryption is neccessary for session management calls to the server. (login, logoff, prelogininfo, contextchange)

Parameters:
enc - true means use SSL-Encryption
Since:
1.4.0

getRuntimeProperty

public java.lang.String getRuntimeProperty(java.lang.String key)
Returns the property with the specified key in the runtime properties. The method returns null if the property is not found.

Parameters:
key - the hashtable key.
Returns:
the value for the specified key.

getRuntimeProperty

public java.lang.String getRuntimeProperty(java.lang.String key,
                                           java.lang.String defaultValue)
Returns the property with the specified key in the runtime properties. The method returns the default value argument if the property is not found.

Parameters:
key - the hashtable key.
defaultValue - a default value.
Returns:
the value for the specified key.

inverseTransform

public byte[] inverseTransform(java.lang.String transform,
                               byte[] data)
Specified by:
inverseTransform in interface at.spardat.xma.boot.component.IRtXMASessionClient

addExternalEventListener

public void addExternalEventListener(ExternalEventListener listener)
Adds an ExternalEventListener to the listeners of the session.

Parameters:
listener -
Since:
version_number

removeExternalEventListener

public void removeExternalEventListener(ExternalEventListener listener)
Removes an ExternalEventListener to the listeners of the session.

Parameters:
listener -
Since:
version_number

notifyExternalEvent

public java.util.Properties notifyExternalEvent(ExternalEvent event)
notifies all listeners of the ExternalEvent.

Parameters:
event -
Returns:
null if there are not return values
Since:
version_number

isAtServer

public boolean isAtServer()
Description copied from class: XMASession
Returns true if this session is in the server JVM.

Specified by:
isAtServer in class XMASession
See Also:
XMASession.isAtServer()

addGlobalEventListener

public void addGlobalEventListener(GlobalEventListener listener)
The added GlobalEventListener will be notifyed by server events. (by pollServerSideEvents()).


removeGlobalEventListener

public boolean removeGlobalEventListener(GlobalEventListener listener)
removes the GlobalEventListener.


callGlobalEventListener

public void callGlobalEventListener(java.util.Collection globalEvents)
Calls globalEvent() at the registered listeners with the GlobalEvents from the paramter globalEvents. The listeners are called by display.asyncExec().

Parameters:
globalEvents - Collection with GlobalEvents.
Since:
version_number