Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.remote.service
Class BaseRemoteService

    java.lang.Object
      org.apache.cayenne.remote.service.BaseRemoteService

All Implemented Interfaces:
  Remote, RemoteService

Direct Known Subclasses:
  HttpRemoteService

    public abstract class BaseRemoteService

extends Object
implements RemoteService

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

Since:
  1.2

Field Summary
`protected ObjectContextFactory` | `contextFactory`
`static String` | `EVENT_BRIDGE_FACTORY_PROPERTY`
`protected String` | `eventBridgeFactoryName`
`protected Map<String,String>` | `eventBridgeParameters`
`protected Log` | `logger`

Constructor Summary
`BaseRemoteService(ObjectContextFactory contextFactory, Map<String,String> eventBridgeProperties)`

Method Summary
`protected DataChannel` | `createChannel()` Creates a server-side channel that will handle all client requests.
`protected RemoteSession` | `createRemoteSession(String sessionId, String name, boolean enableEvents)`
`protected abstract ServerSession` | `createServerSession()` Creates a new ServerSession with a dedicated DataChannel.
`protected abstract ServerSession` | `createServerSession(String name)` Creates a new ServerSession based on a shared DataChannel.
`RemoteSession` | `establishSession()` Establishes a dedicated session with Cayenne DataChannel, returning session id.
`RemoteSession` | `establishSharedSession(String name)` Creates a new session with the specified or joins an existing one.
`String` | `getEventBridgeFactoryName()`
`Map<String,String>` | `getEventBridgeParameters()`
`protected abstract ServerSession` | `getServerSession()` Returns a ServerSession object that represents Cayenne-related state associated with the current session.
`protected void` | `initEventBridgeParameters(Map<String,String> properties)` Initializes EventBridge parameters for remote clients peer-to-peer communications.
`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 String EVENT_BRIDGE_FACTORY_PROPERTY

See Also:
  Constant Field Values

### logger

    protected final Log logger

### contextFactory

    protected ObjectContextFactory contextFactory

### eventBridgeFactoryName

    protected String eventBridgeFactoryName

### eventBridgeParameters

    protected Map<String,String> eventBridgeParameters

Constructor Detail

### BaseRemoteService

    public BaseRemoteService(ObjectContextFactory contextFactory,
                             Map<String,String> eventBridgeProperties)

Since:
  3.1

Method Detail

### getEventBridgeFactoryName

    public String getEventBridgeFactoryName()

### getEventBridgeParameters

    public Map<String,String> getEventBridgeParameters()

### createServerSession

    protected abstract ServerSession createServerSession()

  Creates a new ServerSession with a dedicated DataChannel.

### createServerSession

    protected abstract ServerSession createServerSession(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(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 Object processMessage(ClientMessage message)
                          throws 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:
    `Throwable`

### createRemoteSession

    protected RemoteSession createRemoteSession(String sessionId,
                                                String name,
                                                boolean enableEvents)

### createChannel

    protected DataChannel createChannel()

  Creates a server-side channel that will handle all client requests. For shared sessions the same channel instance is reused for the entire group of clients. For dedicated sessions, one channel per client is created.

  This implementation returns `ClientServerChannel` instance wrapping a DataContext. Subclasses may override the method to customize channel creation. For instance they may wrap channel in the custom interceptors to handle transactions or security.

### initEventBridgeParameters

    protected void initEventBridgeParameters(Map<String,String> properties)

  Initializes EventBridge parameters for remote clients peer-to-peer communications.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2010 Apache Cayenne. All Rights Reserved.