Class LocalConnection
- java.lang.Object
-
- org.apache.cayenne.remote.BaseConnection
-
- org.apache.cayenne.remote.service.LocalConnection
-
- All Implemented Interfaces:
ClientConnection
public class LocalConnection extends BaseConnection
A ClientConnection that connects to a DataChannel. Used as an emulator of a remote service. Emulation includes serialization/deserialization of objects.- Since:
- 1.2
-
-
Field Summary
Fields Modifier and Type Field Description protected DataChannel
channel
static int
HESSIAN_SERIALIZATION
static int
JAVA_SERIALIZATION
static int
NO_SERIALIZATION
protected int
serializationPolicy
-
Fields inherited from class org.apache.cayenne.remote.BaseConnection
logger, messageId
-
-
Constructor Summary
Constructors Constructor Description LocalConnection(DataChannel handler)
Creates LocalConnector with specified handler and no serialization.LocalConnection(DataChannel handler, int serializationPolicy)
Creates a LocalConnector with specified handler and serialization policy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
beforeSendMessage(org.apache.cayenne.remote.ClientMessage message)
Does nothing.protected Object
doSendMessage(org.apache.cayenne.remote.ClientMessage message)
Dispatches a message to an internal handler.DataChannel
getChannel()
Returns wrapped DataChannel.EventBridge
getServerEventBridge()
Returns null.boolean
isSerializingMessages()
-
Methods inherited from class org.apache.cayenne.remote.BaseConnection
getProcessedMessagesCount, sendMessage
-
-
-
-
Field Detail
-
NO_SERIALIZATION
public static final int NO_SERIALIZATION
- See Also:
- Constant Field Values
-
JAVA_SERIALIZATION
public static final int JAVA_SERIALIZATION
- See Also:
- Constant Field Values
-
HESSIAN_SERIALIZATION
public static final int HESSIAN_SERIALIZATION
- See Also:
- Constant Field Values
-
channel
protected DataChannel channel
-
serializationPolicy
protected int serializationPolicy
-
-
Constructor Detail
-
LocalConnection
public LocalConnection(DataChannel handler)
Creates LocalConnector with specified handler and no serialization.
-
LocalConnection
public LocalConnection(DataChannel handler, int serializationPolicy)
Creates a LocalConnector with specified handler and serialization policy. Valid policies are defined as final static int field in this class.
-
-
Method Detail
-
isSerializingMessages
public boolean isSerializingMessages()
-
getChannel
public DataChannel getChannel()
Returns wrapped DataChannel.
-
getServerEventBridge
public EventBridge getServerEventBridge()
Returns null.- Returns:
- An EventBridge or null if server events are not supported.
-
beforeSendMessage
protected void beforeSendMessage(org.apache.cayenne.remote.ClientMessage message)
Does nothing.- Specified by:
beforeSendMessage
in classBaseConnection
-
doSendMessage
protected Object doSendMessage(org.apache.cayenne.remote.ClientMessage message) throws CayenneRuntimeException
Dispatches a message to an internal handler.- Specified by:
doSendMessage
in classBaseConnection
- Throws:
CayenneRuntimeException
-
-