org.jcoderz.commons.connector.http
Class HttpManagedConnectionImpl

java.lang.Object
  extended by org.jcoderz.commons.connector.http.HttpManagedConnectionImpl
All Implemented Interfaces:
ManagedConnection

public class HttpManagedConnectionImpl
extends Object
implements ManagedConnection

This class defines the managed connection maintained by the application server and triggered via the non-managed connection.


Constructor Summary
HttpManagedConnectionImpl(HttpManagedConnectionFactoryImpl mcf, ConnectionRequestInfo cri)
          Constructor.
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener listener)
          
 void associateConnection(Object connection)
          
 void cleanup()
          
 void destroy()
          
 Object getConnection(Subject subject, ConnectionRequestInfo cri)
          
 LocalTransaction getLocalTransaction()
          
 PrintWriter getLogWriter()
          
 HttpManagedConnectionFactoryImpl getManagedConnectionFactory()
          Gets the managed connection factory of this managed connection.
 ManagedConnectionMetaData getMetaData()
          
protected  Url getUrl()
           
 XAResource getXAResource()
          
 void removeConnectionEventListener(ConnectionEventListener listener)
          
 byte[] sendAndReceive(byte[] message)
          This method is used by the HttpConnection Implementation class to send and receive an HTTP request/response using the commons-httpclient library.
 void setEventListener(HttpConnectorEventListener listener, ConnectorContext context)
          Sets the event listener used for SLA logs.
 void setLogWriter(PrintWriter out)
          
 void setRequestResponseHeader(HttpRequestResponseHeader header)
          Sets the header set for sending and validate whilst receiving.
 String toString()
          Gets the string representation of the HttpManagedConnection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpManagedConnectionImpl

public HttpManagedConnectionImpl(HttpManagedConnectionFactoryImpl mcf,
                                 ConnectionRequestInfo cri)
Constructor.

Parameters:
mcf - the HttpManagedConnectionFactoryImpl associated with
cri - the ConnectionRequestInfo specifying the requested connection
Method Detail

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener listener)

Specified by:
addConnectionEventListener in interface ManagedConnection

associateConnection

public void associateConnection(Object connection)

Specified by:
associateConnection in interface ManagedConnection

cleanup

public void cleanup()

Specified by:
cleanup in interface ManagedConnection

destroy

public void destroy()

Specified by:
destroy in interface ManagedConnection

getConnection

public Object getConnection(Subject subject,
                            ConnectionRequestInfo cri)

Specified by:
getConnection in interface ManagedConnection

getLocalTransaction

public LocalTransaction getLocalTransaction()
                                     throws ResourceException

Specified by:
getLocalTransaction in interface ManagedConnection
Throws:
ResourceException

getLogWriter

public PrintWriter getLogWriter()

Specified by:
getLogWriter in interface ManagedConnection

setLogWriter

public void setLogWriter(PrintWriter out)

Specified by:
setLogWriter in interface ManagedConnection

getMetaData

public ManagedConnectionMetaData getMetaData()

Specified by:
getMetaData in interface ManagedConnection

getXAResource

public XAResource getXAResource()
                         throws ResourceException

Specified by:
getXAResource in interface ManagedConnection
Throws:
ResourceException

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)

Specified by:
removeConnectionEventListener in interface ManagedConnection

sendAndReceive

public byte[] sendAndReceive(byte[] message)
                      throws HttpConnectionException
This method is used by the HttpConnection Implementation class to send and receive an HTTP request/response using the commons-httpclient library.

Parameters:
message - the message body to send via HTTP.
Returns:
the response received.
Throws:
HttpConnectionException - for all types of connection failures

setRequestResponseHeader

public void setRequestResponseHeader(HttpRequestResponseHeader header)
Sets the header set for sending and validate whilst receiving.

Parameters:
header - header to set and to validate

setEventListener

public void setEventListener(HttpConnectorEventListener listener,
                             ConnectorContext context)
Sets the event listener used for SLA logs. This listener will be set at the

Parameters:
listener - the listener to set
context - the context to set

getUrl

protected Url getUrl()

getManagedConnectionFactory

public HttpManagedConnectionFactoryImpl getManagedConnectionFactory()
Gets the managed connection factory of this managed connection.

Returns:
ManagedPaymentProtocolConnectionFactory the factory in use

toString

public String toString()
Gets the string representation of the HttpManagedConnection.

Overrides:
toString in class Object
Returns:
the string representation


Copyright 2007 The jCoderZ Project.