com.sibvisions.rad.server
Class Server

java.lang.Object
  extended by com.sibvisions.rad.server.Server
All Implemented Interfaces:
IDirectServer, IServer

public class Server
extends Object
implements IDirectServer

The Server is the general remote server implementation. It's independent of the communication protocol and handles client requests.

The configuration of the server will be made in the

server.xml
file. It contains the database connect information.


Constructor Summary
Server()
          Creates a new Server instance.
 
Method Summary
 Object createSession(ChangedHashtable<String,Object> pProperties)
          Creates a new session for an application.
 Object createSubSession(Object pSessionId, ChangedHashtable<String,Object> pProperties)
          Creates a sub session of an application.
 void destroySession(Object pSessionId)
          Destroyes a session of an application.
 Object execute(Object pSessionId, String pObjectName, String pMethod, Object... pParams)
          Executes a method call.
 Object executeAction(Object pSessionId, String pAction, Object... pParams)
          Executes an action call.
 void executeActionCallBack(Object pSessionId, ICallBackListener pCallBackListener, String pAction, Object... pParams)
          Executes an asynchronous action call.
 void executeActionCallBack(Object pSessionId, Object pCallBackId, String pAction, Object... pParams)
          Executes an asynchronous action call.
 void executeCallBack(Object pSessionId, ICallBackListener pCallBackListener, String pObjectName, String pMethod, Object... pParams)
          Executes an asynchronous method call.
 void executeCallBack(Object pSessionId, Object pCallBackId, String pObjectName, String pMethod, Object... pParams)
          Executes an asynchronous method call.
 List<ResultObject> getCallBackResults(Object pSessionId)
          Returns all available objects of an asynchronous execution.
static Server getInstance()
          Gets the current server instance as singleton.
 Monitoring getMonitoring()
          Returns the monitoring object for this server.
 AbstractObjectProvider getObjectProvider()
          Gets the AbstractObjectProvider.
 ChangedHashtable<String,Object> getProperties(Object pSessionId)
          Gets all session properties.
 Object getProperty(Object pSessionId, String pName)
          Gets the value of a session property.
 DefaultSessionManager getSessionManager()
          Gets the AbstractSessionManager.
 ISession process(IRequest pRequest, IResponse pResponse)
          Processes client requests which uses the communication protocol.
 Object[] setAndCheckAlive(Object pSessionId, Object... pSubSessionId)
          Sets the alive state for a session and validates the alive state of sub sessions.
 void setNewPassword(Object pSessionId, String pOldPassword, String pNewPassword)
          Sets a new password for the user of a session.
 void setProperty(Object pSessionId, String pName, Object pValue)
          Sets a session property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Server

public Server()
Creates a new Server instance.

Method Detail

getInstance

public static Server getInstance()
Gets the current server instance as singleton.

Returns:
the singleton server instance

getSessionManager

public final DefaultSessionManager getSessionManager()
Gets the AbstractSessionManager.

Specified by:
getSessionManager in interface IServer
Returns:
the session manager.

getObjectProvider

public final AbstractObjectProvider getObjectProvider()
Gets the AbstractObjectProvider.

Specified by:
getObjectProvider in interface IServer
Returns:
the object provider.

createSession

public Object createSession(ChangedHashtable<String,Object> pProperties)
                     throws Throwable
Creates a new session for an application. The credentials are stored in the properties.

Specified by:
createSession in interface IServer
Parameters:
pProperties - the initial session properties
Returns:
session identifier of newly created Session
Throws:
Throwable - if the session can not be created

createSubSession

public Object createSubSession(Object pSessionId,
                               ChangedHashtable<String,Object> pProperties)
                        throws Throwable
Creates a sub session of an application. The name/alias of the sub session is stored in the properties.

Specified by:
createSubSession in interface IServer
Parameters:
pSessionId - session identifier
pProperties - the initial session properties
Returns:
session identifier of newly created SubSession
Throws:
Throwable - if the session can not be created

destroySession

public void destroySession(Object pSessionId)
Destroyes a session of an application.

Specified by:
destroySession in interface IServer
Parameters:
pSessionId - session identifier

execute

public Object execute(Object pSessionId,
                      String pObjectName,
                      String pMethod,
                      Object... pParams)
               throws Throwable
Executes a method call.

Specified by:
execute in interface IServer
Parameters:
pSessionId - session identifier
pObjectName - server object name/alias
pMethod - method name which should be called
pParams - parameters for the method call
Returns:
result of method call
Throws:
Throwable - if an error occurs during execution

executeCallBack

public void executeCallBack(Object pSessionId,
                            Object pCallBackId,
                            String pObjectName,
                            String pMethod,
                            Object... pParams)
                     throws Throwable
Executes an asynchronous method call.

Specified by:
executeCallBack in interface IServer
Parameters:
pSessionId - session identifier
pCallBackId - the callback identifier
pObjectName - server object name/alias
pMethod - method name which should be called
pParams - parameters for the method call
Throws:
Throwable - if an error occurs during execution

executeCallBack

public void executeCallBack(Object pSessionId,
                            ICallBackListener pCallBackListener,
                            String pObjectName,
                            String pMethod,
                            Object... pParams)
                     throws Throwable
Executes an asynchronous method call.

Specified by:
executeCallBack in interface IDirectServer
Parameters:
pSessionId - session identifier
pCallBackListener - the callback listener
pObjectName - server object name/alias
pMethod - method name which should be called
pParams - parameters for the method call
Throws:
Throwable - if an error occurs during execution

executeAction

public Object executeAction(Object pSessionId,
                            String pAction,
                            Object... pParams)
                     throws Throwable
Executes an action call.

Specified by:
executeAction in interface IServer
Parameters:
pSessionId - session identifier
pAction - action which should be called
pParams - parameters for the action call
Returns:
result of action call
Throws:
Throwable - if an error occurs during execution

executeActionCallBack

public void executeActionCallBack(Object pSessionId,
                                  Object pCallBackId,
                                  String pAction,
                                  Object... pParams)
                           throws Throwable
Executes an asynchronous action call.

Specified by:
executeActionCallBack in interface IServer
Parameters:
pSessionId - session identifier
pCallBackId - the callback identifier
pAction - action which should be called
pParams - parameters for the action call
Throws:
Throwable - if an error occurs during execution

executeActionCallBack

public void executeActionCallBack(Object pSessionId,
                                  ICallBackListener pCallBackListener,
                                  String pAction,
                                  Object... pParams)
                           throws Throwable
Executes an asynchronous action call.

Specified by:
executeActionCallBack in interface IDirectServer
Parameters:
pSessionId - session identifier
pCallBackListener - the callback listener
pAction - action which should be called
pParams - parameters for the action call
Throws:
Throwable - if an error occurs during execution

setProperty

public void setProperty(Object pSessionId,
                        String pName,
                        Object pValue)
                 throws Throwable
Sets a session property.

Specified by:
setProperty in interface IServer
Parameters:
pSessionId - the session identifier
pName - the property name
pValue - the value of the property or null to delete the property
Throws:
Throwable - if an error occurs during execution

getProperty

public Object getProperty(Object pSessionId,
                          String pName)
                   throws Throwable
Gets the value of a session property.

Specified by:
getProperty in interface IServer
Parameters:
pSessionId - the session identifier
pName - the property name
Returns:
the value of the property or null if the property is not available
Throws:
Throwable - if an error occurs during execution

getProperties

public ChangedHashtable<String,Object> getProperties(Object pSessionId)
                                              throws Throwable
Gets all session properties.

Specified by:
getProperties in interface IServer
Parameters:
pSessionId - the session identifier
Returns:
a ChangedHashtable with property names and values
Throws:
Throwable - if an error occurs during execution

getCallBackResults

public List<ResultObject> getCallBackResults(Object pSessionId)
                                      throws Throwable
Returns all available objects of an asynchronous execution.

Specified by:
getCallBackResults in interface IServer
Parameters:
pSessionId - session identifier
Returns:
result objects or null if there are no result objects
Throws:
Throwable - if an error occurs during execution

setAndCheckAlive

public Object[] setAndCheckAlive(Object pSessionId,
                                 Object... pSubSessionId)
                          throws Throwable
Sets the alive state for a session and validates the alive state of sub sessions.

Specified by:
setAndCheckAlive in interface IServer
Parameters:
pSessionId - the session id
pSubSessionId - the sub session ids
Returns:
the invalid/expired sub session ids
Throws:
Throwable - if an error occurs during execution

setNewPassword

public void setNewPassword(Object pSessionId,
                           String pOldPassword,
                           String pNewPassword)
                    throws Throwable
Sets a new password for the user of a session.

Specified by:
setNewPassword in interface IServer
Parameters:
pSessionId - the session id
pOldPassword - the old password
pNewPassword - the new password
Throws:
Throwable - if an error occurs during execution

process

public ISession process(IRequest pRequest,
                        IResponse pResponse)
                 throws Exception
Processes client requests which uses the communication protocol.

Parameters:
pRequest - the request
pResponse - the response
Returns:
the accessed session or null if the session is not available
Throws:
Exception - if a problem occurs while accessing the in- or output stream

getMonitoring

public final Monitoring getMonitoring()
Returns the monitoring object for this server.

Returns:
the monitoring object


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.