public abstract class BaseRemoteService extends Object implements RemoteService
Modifier and Type | Field and Description |
---|---|
protected ObjectContextFactory |
contextFactory |
protected String |
eventBridgeFactoryName |
protected Map<String,String> |
eventBridgeParameters |
protected org.slf4j.Logger |
logger |
Constructor and Description |
---|
BaseRemoteService(ObjectContextFactory contextFactory,
Map<String,String> eventBridgeProperties) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close remote service resources.
|
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.
|
protected final org.slf4j.Logger logger
protected ObjectContextFactory contextFactory
protected String eventBridgeFactoryName
public BaseRemoteService(ObjectContextFactory contextFactory, Map<String,String> eventBridgeProperties)
public String getEventBridgeFactoryName()
protected abstract ServerSession createServerSession()
protected abstract ServerSession createServerSession(String name)
name
- shared session name used to lookup a shared DataChannel.protected abstract ServerSession getServerSession()
public RemoteSession establishSession()
RemoteService
establishSession
in interface RemoteService
public RemoteSession establishSharedSession(String name)
RemoteService
establishSharedSession
in interface RemoteService
public Object processMessage(ClientMessage message) throws Throwable
RemoteService
processMessage
in interface RemoteService
Throwable
public void close() throws RemoteException
RemoteService
close
in interface RemoteService
RemoteException
protected RemoteSession createRemoteSession(String sessionId, String name, boolean enableEvents)
protected DataChannel createChannel()
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.
Copyright © 2001–2018 Apache Cayenne. All rights reserved.