org.apache.cayenne.remote.service
Class BaseRemoteService

java.lang.Object
  extended by org.apache.cayenne.remote.service.BaseRemoteService
All Implemented Interfaces:
java.rmi.Remote, RemoteService
Direct Known Subclasses:
HttpRemoteService

public abstract class BaseRemoteService
extends java.lang.Object
implements RemoteService

A generic implementation of an RemoteService. Subclasses can be customized to work with different remoting mechanisms, such as Hessian or JAXRPC.

Since:
1.2
Author:
Andrus Adamchik

Field Summary
protected  DataDomain domain
           
static java.lang.String EVENT_BRIDGE_FACTORY_PROPERTY
           
protected  java.lang.String eventBridgeFactoryName
           
protected  java.util.Map eventBridgeParameters
           
 
Constructor Summary
BaseRemoteService()
           
 
Method Summary
protected  DataChannel createChannel()
           
protected  RemoteSession createRemoteSession(java.lang.String sessionId, java.lang.String name, boolean enableEvents)
           
protected abstract  ServerSession createServerSession()
          Creates a new ServerSession with a dedicated DataChannel.
protected abstract  ServerSession createServerSession(java.lang.String name)
          Creates a new ServerSession based on a shared DataChannel.
protected  void destroyService()
          Shuts down this service.
 RemoteSession establishSession()
          Establishes a dedicated session with Cayenne DataChannel, returning session id.
 RemoteSession establishSharedSession(java.lang.String name)
          Creates a new session with the specified or joins an existing one.
 java.lang.String getEventBridgeFactoryName()
           
 java.util.Map getEventBridgeParameters()
           
 DataChannel getRootChannel()
          Returns a DataChannel that is a parent of all session DataChannels.
protected abstract  ServerSession getServerSession()
          Returns a ServerSession object that represents Cayenne-related state associated with the current session.
protected  void initCayenneStack(java.util.Map properties)
          Sets up Cayenne stack.
protected  void initEventBridgeParameters(java.util.Map properties)
          Initializes EventBridge parameters for remote clients peer-to-peer communications.
protected  void initService(java.util.Map properties)
          A method that sets up a service, initializing Cayenne stack.
 java.lang.Object processMessage(ClientMessage message)
          Processes message on a remote server, returning the result of such processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_BRIDGE_FACTORY_PROPERTY

public static final java.lang.String EVENT_BRIDGE_FACTORY_PROPERTY
See Also:
Constant Field Values

domain

protected DataDomain domain

eventBridgeFactoryName

protected java.lang.String eventBridgeFactoryName

eventBridgeParameters

protected java.util.Map eventBridgeParameters
Constructor Detail

BaseRemoteService

public BaseRemoteService()
Method Detail

getEventBridgeFactoryName

public java.lang.String getEventBridgeFactoryName()

getEventBridgeParameters

public java.util.Map getEventBridgeParameters()

initService

protected void initService(java.util.Map properties)
                    throws CayenneRuntimeException
A method that sets up a service, initializing Cayenne stack. Should be invoked by subclasses from their appropriate service lifecycle methods.

Throws:
CayenneRuntimeException

destroyService

protected void destroyService()
Shuts down this service. Should be invoked by subclasses from their appropriate service lifecycle methods.


getRootChannel

public DataChannel getRootChannel()
Returns a DataChannel that is a parent of all session DataChannels.


createServerSession

protected abstract ServerSession createServerSession()
Creates a new ServerSession with a dedicated DataChannel.


createServerSession

protected abstract ServerSession createServerSession(java.lang.String name)
Creates a new ServerSession based on a shared DataChannel.

Parameters:
name - shared session name used to lookup a shared DataChannel.

getServerSession

protected abstract ServerSession getServerSession()
Returns a ServerSession object that represents Cayenne-related state associated with the current session. If ServerSession hasn't been previously saved, returns null.


establishSession

public RemoteSession establishSession()
Description copied from interface: RemoteService
Establishes a dedicated session with Cayenne DataChannel, returning session id.

Specified by:
establishSession in interface RemoteService

establishSharedSession

public RemoteSession establishSharedSession(java.lang.String name)
Description copied from interface: RemoteService
Creates a new session with the specified or joins an existing one. This method is used to bootstrap collaborating clients of a single "group chat".

Specified by:
establishSharedSession in interface RemoteService

processMessage

public java.lang.Object processMessage(ClientMessage message)
                                throws java.lang.Throwable
Description copied from interface: RemoteService
Processes message on a remote server, returning the result of such processing.

Specified by:
processMessage in interface RemoteService
Throws:
java.lang.Throwable

createRemoteSession

protected RemoteSession createRemoteSession(java.lang.String sessionId,
                                            java.lang.String name,
                                            boolean enableEvents)

createChannel

protected DataChannel createChannel()

initCayenneStack

protected void initCayenneStack(java.util.Map properties)
Sets up Cayenne stack.


initEventBridgeParameters

protected void initEventBridgeParameters(java.util.Map properties)
Initializes EventBridge parameters for remote clients peer-to-peer communications.



Copyright © 2001-2006 Apache.org All Rights Reserved.