com.sibvisions.rad.server
Class DefaultObjectProvider

java.lang.Object
  extended by javax.rad.server.AbstractObjectProvider
      extended by com.sibvisions.rad.server.DefaultObjectProvider
All Implemented Interfaces:
ISessionListener

public class DefaultObjectProvider
extends AbstractObjectProvider
implements ISessionListener

The DefaultObjectProvider manages the remote accessible objects. It compiles source files and offers always the current object.


Constructor Summary
protected DefaultObjectProvider(Server pServer)
          Creates an instance of AbstractObjectProvider.
 
Method Summary
protected  Map createInstance(ClassLoader pLoader, AbstractSession pSession, String pInstanceName, Map pParent)
          Creates a new Map instance with a specific class name and, if possible, sets a parent object.
protected  Map getApplicationObject(AbstractSession pSession)
          Gets the life-cycle object for an application.
 Object getObject(ISession pSession, String pObjectName)
          Returns an object from the life-cycle object container for an ISession.
 IObjectAccessController getObjectAccessController()
          Gets the object access controller.
 Server getServer()
          Gets the associated IServer.
protected  Map getSessionObject(ISession pSession)
          Gets the life-cycle object for a session.
protected  Map getSessionObjectInternal(ISession pSession)
          Gets te life-cycle object for a session from the cache if it is available.
 Object invoke(ISession pSession, String pObjectName, String pMethodName, Object... pParams)
          Invokes a method from a specific life-cycle object.
 Object putObject(ISession pSession, String pObjectName, Object pObject)
          Puts an object to the life-cycle object container for an ISession.
 void sessionCreated(ISession pSession)
          Invoked when a session was created and is ready to use.
 void sessionDestroyed(ISession pSession)
          Invoked when a session was destroyed an can not be used anymore.
 void setObjectAccessController(IObjectAccessController pController)
          Sets the object access controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultObjectProvider

protected DefaultObjectProvider(Server pServer)
Creates an instance of AbstractObjectProvider.

Parameters:
pServer - communication server
Method Detail

sessionCreated

public void sessionCreated(ISession pSession)
Invoked when a session was created and is ready to use.

Specified by:
sessionCreated in interface ISessionListener
Parameters:
pSession - the newly created session

sessionDestroyed

public void sessionDestroyed(ISession pSession)
Invoked when a session was destroyed an can not be used anymore.

Specified by:
sessionDestroyed in interface ISessionListener
Parameters:
pSession - the destroyed session

getObject

public Object getObject(ISession pSession,
                        String pObjectName)
                 throws Throwable
Returns an object from the life-cycle object container for an ISession.

Specified by:
getObject in class AbstractObjectProvider
Parameters:
pSession - the session
pObjectName - the object name (can be an EL)
Returns:
the object for the session or null for the life-cycle object container
Throws:
Throwable - if the life-cycle object is not available

putObject

public Object putObject(ISession pSession,
                        String pObjectName,
                        Object pObject)
                 throws Throwable
Puts an object to the life-cycle object container for an ISession.

Specified by:
putObject in class AbstractObjectProvider
Parameters:
pSession - the session
pObjectName - the object name
pObject - the object or null to remove the object
Returns:
null if there was no object under the specified name, otherwise the previous object for the specified name
Throws:
Throwable - if the life-cycle object is not available

invoke

public Object invoke(ISession pSession,
                     String pObjectName,
                     String pMethodName,
                     Object... pParams)
              throws Throwable
Invokes a method from a specific life-cycle object.

Specified by:
invoke in class AbstractObjectProvider
Parameters:
pSession - the session
pObjectName - the object name
pMethodName - the method to invoke
pParams - the method parameters
Returns:
the return value of the invoked method
Throws:
Throwable - if the life-cycle object is not available or the method was not found

getServer

public Server getServer()
Gets the associated IServer.

Overrides:
getServer in class AbstractObjectProvider
Returns:
the server

getSessionObject

protected Map getSessionObject(ISession pSession)
                        throws Exception
Gets the life-cycle object for a session.

Parameters:
pSession - the accessing session
Returns:
the life-cycle object for the session
Throws:
Exception - if the life-cycle object can not be created

getSessionObjectInternal

protected Map getSessionObjectInternal(ISession pSession)
Gets te life-cycle object for a session from the cache if it is available. This method does NOT create a new object if it is not available. Only for internal use.

Parameters:
pSession - the session
Returns:
the life-cycle object or null if the session has no life-cycle object

getApplicationObject

protected Map getApplicationObject(AbstractSession pSession)
                            throws Exception
Gets the life-cycle object for an application.

Parameters:
pSession - the accessing session
Returns:
the life-cycle object for the application
Throws:
Exception - if the life-cycle object can not be created

createInstance

protected Map createInstance(ClassLoader pLoader,
                             AbstractSession pSession,
                             String pInstanceName,
                             Map pParent)
                      throws Exception
Creates a new Map instance with a specific class name and, if possible, sets a parent object.

Parameters:
pLoader - the class loader for instance creation
pSession - the calling session
pInstanceName - the full qualified class name for the instance
pParent - the parent map instance
Returns:
the new instance
Throws:
Exception - if the instance can not be created

setObjectAccessController

public void setObjectAccessController(IObjectAccessController pController)
Sets the object access controller.

Parameters:
pController - the controller

getObjectAccessController

public IObjectAccessController getObjectAccessController()
Gets the object access controller.

Returns:
the controller


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.