org.apache.cayenne.remote.hessian
Class HessianConnection

java.lang.Object
  extended by org.apache.cayenne.remote.BaseConnection
      extended by org.apache.cayenne.remote.hessian.HessianConnection
All Implemented Interfaces:
ClientConnection

public class HessianConnection
extends BaseConnection

An ClientConnection that passes messages to a remotely deployed HessianService. It supports HTTP BASIC authentication. HessianConnection serializes messages using Hessian binary web service protocol over HTTP. For more info on Hessian see Caucho site at http://www.caucho.com/resin-3.0/protocols/hessian.xtp. HessianConnection supports logging of message traffic via Jakarta commons-logging API.

Since:
1.2
Author:
Andrus Adamchik

Field Summary
static java.lang.String[] CLIENT_SERIALIZER_FACTORIES
           
protected  java.lang.String password
           
protected  RemoteService service
           
protected  RemoteSession session
           
protected  java.lang.String sharedSessionName
           
protected  java.lang.String url
           
protected  java.lang.String userName
           
 
Fields inherited from class org.apache.cayenne.remote.BaseConnection
logger, messageId
 
Constructor Summary
HessianConnection(java.lang.String url)
          Creates HessianConnection that will establish dedicated session and will not use HTTP basic authentication.
HessianConnection(java.lang.String url, java.lang.String userName, java.lang.String password, java.lang.String sharedSessionName)
          Creates a HessianConnection.
 
Method Summary
protected  void beforeSendMessage(ClientMessage message)
          Establishes server session if needed.
protected  void connect()
          Establishes a session with remote service.
protected  java.lang.Object doSendMessage(ClientMessage message)
          Sends a message to remote Cayenne Hessian service.
 java.lang.String getPassword()
          Returns password that is used for basic authentication when connecting to the cayenne server.
 EventBridge getServerEventBridge()
          Returns an EventBridge that receives remote server events.
 java.lang.String getSharedSessionName()
           
 java.lang.String getUrl()
          Returns a URL of Cayenne service used by this connector.
 java.lang.String getUserName()
          Returns user name that is used for basic authentication when connecting to the cayenne server.
 
Methods inherited from class org.apache.cayenne.remote.BaseConnection
getProcessedMessagesCount, sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT_SERIALIZER_FACTORIES

public static final java.lang.String[] CLIENT_SERIALIZER_FACTORIES

url

protected java.lang.String url

userName

protected java.lang.String userName

password

protected java.lang.String password

sharedSessionName

protected java.lang.String sharedSessionName

session

protected RemoteSession session

service

protected RemoteService service
Constructor Detail

HessianConnection

public HessianConnection(java.lang.String url)
Creates HessianConnection that will establish dedicated session and will not use HTTP basic authentication.


HessianConnection

public HessianConnection(java.lang.String url,
                         java.lang.String userName,
                         java.lang.String password,
                         java.lang.String sharedSessionName)
Creates a HessianConnection. This constructor can optionally setup basic authentication credentials and configure shared session. url is the only required parameter.

Method Detail

getUrl

public java.lang.String getUrl()
Returns a URL of Cayenne service used by this connector.


getUserName

public java.lang.String getUserName()
Returns user name that is used for basic authentication when connecting to the cayenne server.


getPassword

public java.lang.String getPassword()
Returns password that is used for basic authentication when connecting to the cayenne server.


getSharedSessionName

public java.lang.String getSharedSessionName()

getServerEventBridge

public EventBridge getServerEventBridge()
                                 throws CayenneRuntimeException
Description copied from interface: ClientConnection
Returns an EventBridge that receives remote server events. Caller would normally register returned bridge with a local EventManager, thus allowing local listeners to receive server events.

Returns:
An EventBridge or null if server events are not supported.
Throws:
CayenneRuntimeException

beforeSendMessage

protected void beforeSendMessage(ClientMessage message)
                          throws CayenneRuntimeException
Establishes server session if needed.

Specified by:
beforeSendMessage in class BaseConnection
Throws:
CayenneRuntimeException

doSendMessage

protected java.lang.Object doSendMessage(ClientMessage message)
                                  throws CayenneRuntimeException
Sends a message to remote Cayenne Hessian service.

Specified by:
doSendMessage in class BaseConnection
Throws:
CayenneRuntimeException

connect

protected void connect()
                throws CayenneRuntimeException
Establishes a session with remote service.

Throws:
CayenneRuntimeException


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