org.apache.qpid.contrib.hessian
Class AMQPHessianProxyFactory

java.lang.Object
  extended by org.apache.qpid.contrib.hessian.AMQPHessianProxyFactory

public class AMQPHessianProxyFactory
extends Object

Factory for creating Hessian client stubs. The returned stub will call the remote object for all methods.

 HelloHome hello = (HelloHome) factory.create(HelloHome.class, null);
 
After creation, the stub can be like a regular Java class. Because it makes remote calls, it can throw more exceptions than a Java class. In particular, it may throw protocol exceptions. This class is derived from HessianProxyFactory.

Author:
Emmanuel Bourg, Scott Ferguson

Constructor Summary
AMQPHessianProxyFactory()
          Creates the new proxy factory.
 
Method Summary
<T> T
create(Class<T> api, String urlName)
          Creates a new proxy with the specified URL.
<T> T
create(Class<T> api, String urlName, ClassLoader loader)
          Creates a new proxy with the specified URL.
 long getConnectTimeout()
          Returns the socket timeout on connect in milliseconds.
 String getQueuePrefix()
          Returns the prefix of the queue that receives the hessian requests.
 long getReadTimeout()
          Returns the socket timeout on requests in milliseconds.
 HessianRemoteResolver getRemoteResolver()
          Returns the remote resolver.
 SerializerFactory getSerializerFactory()
          Gets the serializer factory.
 boolean isCompressed()
          Indicates if the requests/responses should be compressed.
 boolean isDebug()
          Gets the debug mode.
 boolean isOverloadEnabled()
          Returns true if overloaded methods are allowed (using mangling)
protected  org.apache.qpid.transport.Connection openConnection()
          Creates the URL connection.
 void setCompressed(boolean compressed)
          Specifies if the requests/responses should be compressed.
 void setConnectTimeout(long _connecTimeout)
          Sets the socket timeout on connect in milliseconds.
 void setDebug(boolean isDebug)
          Sets the debug mode.
 void setHessian2Reply(boolean isHessian2)
          True if the proxy can read Hessian 2 responses.
 void setHessian2Request(boolean isHessian2)
          True if the proxy should send Hessian 2 requests.
 void setOverloadEnabled(boolean isOverloadEnabled)
          set true if overloaded methods are allowed (using mangling)
 void setPassword(String password)
          Sets the password of the user connecting to the AMQP server.
 void setQueuePrefix(String queuePrefix)
          Sets the prefix of the queue that receives the hessian requests.
 void setReadTimeout(long timeout)
          Sets the socket timeout on requests in milliseconds.
 void setSerializerFactory(SerializerFactory factory)
          Sets the serializer factory.
 void setUser(String user)
          Sets the user connecting to the AMQP server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AMQPHessianProxyFactory

public AMQPHessianProxyFactory()
Creates the new proxy factory.

Method Detail

setUser

public void setUser(String user)
Sets the user connecting to the AMQP server.


setPassword

public void setPassword(String password)
Sets the password of the user connecting to the AMQP server.


getQueuePrefix

public String getQueuePrefix()
Returns the prefix of the queue that receives the hessian requests.


setQueuePrefix

public void setQueuePrefix(String queuePrefix)
Sets the prefix of the queue that receives the hessian requests.


setDebug

public void setDebug(boolean isDebug)
Sets the debug mode.


isDebug

public boolean isDebug()
Gets the debug mode.


isOverloadEnabled

public boolean isOverloadEnabled()
Returns true if overloaded methods are allowed (using mangling)


setOverloadEnabled

public void setOverloadEnabled(boolean isOverloadEnabled)
set true if overloaded methods are allowed (using mangling)


getReadTimeout

public long getReadTimeout()
Returns the socket timeout on requests in milliseconds.


setReadTimeout

public void setReadTimeout(long timeout)
Sets the socket timeout on requests in milliseconds.


getConnectTimeout

public long getConnectTimeout()
Returns the socket timeout on connect in milliseconds.


setConnectTimeout

public void setConnectTimeout(long _connecTimeout)
Sets the socket timeout on connect in milliseconds.


isCompressed

public boolean isCompressed()
Indicates if the requests/responses should be compressed.


setCompressed

public void setCompressed(boolean compressed)
Specifies if the requests/responses should be compressed.


setHessian2Reply

public void setHessian2Reply(boolean isHessian2)
True if the proxy can read Hessian 2 responses.


setHessian2Request

public void setHessian2Request(boolean isHessian2)
True if the proxy should send Hessian 2 requests.


getRemoteResolver

public HessianRemoteResolver getRemoteResolver()
Returns the remote resolver.


setSerializerFactory

public void setSerializerFactory(SerializerFactory factory)
Sets the serializer factory.


getSerializerFactory

public SerializerFactory getSerializerFactory()
Gets the serializer factory.


openConnection

protected org.apache.qpid.transport.Connection openConnection()
                                                       throws IOException
Creates the URL connection.

Throws:
IOException

create

public <T> T create(Class<T> api,
                    String urlName)
         throws MalformedURLException
Creates a new proxy with the specified URL. The returned object is a proxy with the interface specified by api.
 String url = "amqp://user:password@localhost:5672/vhost/queue");
 HelloHome hello = (HelloHome) factory.create(HelloHome.class, url);
 

Parameters:
api - the interface the proxy class needs to implement
urlName - the URL where the client object is located.
Returns:
a proxy to the object with the specified interface.
Throws:
MalformedURLException

create

public <T> T create(Class<T> api,
                    String urlName,
                    ClassLoader loader)
         throws MalformedURLException
Creates a new proxy with the specified URL. The returned object is a proxy with the interface specified by api.
 String url = "amqp://user:password@localhost:5672/vhost/queue");
 HelloHome hello = (HelloHome) factory.create(HelloHome.class, url);
 

Parameters:
api - the interface the proxy class needs to implement
urlName - the URL where the client object is located.
Returns:
a proxy to the object with the specified interface.
Throws:
MalformedURLException


Copyright © 2010-2012. All Rights Reserved.