org.objectweb.joram.client.connector
Class ManagedConnectionFactoryImpl

java.lang.Object
  extended by org.objectweb.joram.client.connector.ManagedConnectionFactoryImpl
All Implemented Interfaces:
java.io.Serializable, javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation, javax.resource.spi.ValidatingManagedConnectionFactory
Direct Known Subclasses:
ManagedQueueConnectionFactoryImpl, ManagedTopicConnectionFactoryImpl

public class ManagedConnectionFactoryImpl
extends java.lang.Object
implements javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation, javax.resource.spi.ValidatingManagedConnectionFactory, java.io.Serializable

A ManagedConnectionFactoryImpl instance manages outbound connectivity to a given JORAM server.

See Also:
Serialized Form

Field Summary
 boolean asyncSend
          Determines whether the produced messages are asynchronously sent or not (without or with acknowledgement) Default is false (with ack).
 int cnxPendingTimer
          Period in milliseconds between two ping requests sent by the client connection to the server; if the server does not receive any ping request during more than 2 * cnxPendingTimer, the connection is considered as dead and processed as required.
(package private)  boolean collocated
          true for collocated outbound connectivity.
 int connectingTimer
          Duration in seconds during which connecting is attempted (connecting might take time if the server is temporarily not reachable); the 0 value is set for connecting only once and aborting if connecting failed.
(package private)  java.lang.String hostName
          Underlying JORAM server host name.
(package private)  java.lang.String identityClass
          Default identityClass
private  java.lang.String inInterceptors
          Comma separated list of IN interceptors.
(package private)  boolean isHa
          true for ha mode
 boolean multiThreadSync
          Determines whether client threads which are using the same connection are synchronized in order to group together the requests they send.
 int multiThreadSyncDelay
          The maximum time the threads hang if 'multiThreadSync' is true.
protected  java.io.PrintWriter out
          Out stream for error logging and tracing.
private  java.lang.String outInterceptors
          Comma separated list of OUT interceptors.
 java.lang.String outLocalAddress
          This is the local IP address on which the TCP connection is activated.
 int outLocalPort
          This is the local IP address port on which the TCP connection is activated
(package private)  java.lang.String password
          Default user password.
(package private)  JoramAdapter ra
          Resource adapter central authority.
private static long serialVersionUID
          Define serialVersionUID for interoperability.
(package private)  int serverPort
          Underlying JORAM server port number.
 int txPendingTimer
          Duration in seconds during which a JMS transacted (non XA) session might be pending; above that duration the session is rolled back and closed; the 0 value means "no timer".
(package private)  java.lang.String userName
          Default user identification.
 
Constructor Summary
ManagedConnectionFactoryImpl()
          Constructs a ManagedConnectionFactoryImpl instance.
 
Method Summary
 java.lang.Object createConnectionFactory()
          Method called in the non managed case for creating an OutboundConnectionFactory instance.
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
          Method called by an application server (managed case) for creating an OutboundConnectionFactory instance.
 javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequest)
          Creates a new physical connection to the underlying JORAM server, and returns a ManagedConnectionImpl instance for a managed environment.
 boolean equals(java.lang.Object o)
          Compares managed factories according to their configuration.
 int getCnxPendingTimer()
           
 java.lang.Boolean getCollocated()
           
 int getConnectingTimer()
           
 java.lang.String getHostName()
           
 java.lang.String getIdentityClass()
           
 java.util.Set getInvalidConnections(java.util.Set connectionSet)
          From a set of managed connections, returns the set of invalid ones.
 java.io.PrintWriter getLogWriter()
          Gets the log writer of this ManagedConnectionFactoryImpl instance.
 int getMultiThreadSyncDelay()
           
 java.lang.String getOutLocalAddress()
           
 java.lang.Integer getOutLocalPort()
           
 java.lang.String getPassword()
           
 javax.resource.spi.ResourceAdapter getResourceAdapter()
          Returns the resource adapter central authority instance.
 java.lang.Integer getServerPort()
           
 int getTxPendingTimer()
           
 java.lang.String getUserName()
           
 int hashCode()
          Returns a code depending on the managed factory configuration.
 boolean isAsyncSend()
           
 boolean isMultiThreadSync()
           
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequest)
          Finds a matching connection from the candidate set of connections and returns a ManagedConnectionImpl instance.
private  void readObject(java.io.ObjectInputStream in)
          Deserializing method.
 void setCollocated(java.lang.Boolean collocated)
           
 void setHostName(java.lang.String hostName)
           
 void setIdentityClass(java.lang.String identityClass)
           
 void setInInterceptors(java.lang.String inInterceptors)
           
 void setLogWriter(java.io.PrintWriter out)
          Sets the log writer for this ManagedConnectionFactoryImpl instance.
 void setOutInterceptors(java.lang.String outInterceptors)
           
 void setOutLocalAddress(java.lang.String outLocalAddress)
           
 void setOutLocalPort(java.lang.Integer outLocalPort)
           
protected  void setParameters(java.lang.Object factory)
           
 void setPassword(java.lang.String password)
           
 void setResourceAdapter(javax.resource.spi.ResourceAdapter ra)
          Sets the resource adapter central authority.
 void setServerPort(java.lang.Integer serverPort)
           
 void setUserName(java.lang.String userName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Define serialVersionUID for interoperability.

See Also:
Constant Field Values

out

protected transient java.io.PrintWriter out
Out stream for error logging and tracing.


ra

transient JoramAdapter ra
Resource adapter central authority.


collocated

boolean collocated
true for collocated outbound connectivity.


isHa

boolean isHa
true for ha mode


hostName

java.lang.String hostName
Underlying JORAM server host name.


serverPort

int serverPort
Underlying JORAM server port number.


userName

java.lang.String userName
Default user identification.


password

java.lang.String password
Default user password.


identityClass

java.lang.String identityClass
Default identityClass


connectingTimer

public int connectingTimer
Duration in seconds during which connecting is attempted (connecting might take time if the server is temporarily not reachable); the 0 value is set for connecting only once and aborting if connecting failed.


txPendingTimer

public int txPendingTimer
Duration in seconds during which a JMS transacted (non XA) session might be pending; above that duration the session is rolled back and closed; the 0 value means "no timer".


cnxPendingTimer

public int cnxPendingTimer
Period in milliseconds between two ping requests sent by the client connection to the server; if the server does not receive any ping request during more than 2 * cnxPendingTimer, the connection is considered as dead and processed as required.


asyncSend

public boolean asyncSend
Determines whether the produced messages are asynchronously sent or not (without or with acknowledgement) Default is false (with ack).


multiThreadSync

public boolean multiThreadSync
Determines whether client threads which are using the same connection are synchronized in order to group together the requests they send.


multiThreadSyncDelay

public int multiThreadSyncDelay
The maximum time the threads hang if 'multiThreadSync' is true. Either they wake up (wait time out) or they are notified (by the first woken up thread).


outLocalAddress

public java.lang.String outLocalAddress
This is the local IP address on which the TCP connection is activated. The value can either be a machine name, such as "java.sun.com", or a textual representation of its IP address.


outLocalPort

public int outLocalPort
This is the local IP address port on which the TCP connection is activated


inInterceptors

private java.lang.String inInterceptors
Comma separated list of IN interceptors.


outInterceptors

private java.lang.String outInterceptors
Comma separated list of OUT interceptors.

Constructor Detail

ManagedConnectionFactoryImpl

public ManagedConnectionFactoryImpl()
Constructs a ManagedConnectionFactoryImpl instance.

Method Detail

getConnectingTimer

public int getConnectingTimer()

getCnxPendingTimer

public int getCnxPendingTimer()

getTxPendingTimer

public int getTxPendingTimer()

isAsyncSend

public boolean isAsyncSend()

isMultiThreadSync

public boolean isMultiThreadSync()

getMultiThreadSyncDelay

public int getMultiThreadSyncDelay()

setParameters

protected void setParameters(java.lang.Object factory)

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
                                         throws javax.resource.ResourceException
Method called by an application server (managed case) for creating an OutboundConnectionFactory instance.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
cxManager - Application server's connections pooling manager.
Throws:
javax.resource.ResourceException - Never thrown.

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Method called in the non managed case for creating an OutboundConnectionFactory instance.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException - Never thrown.

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cxRequest)
                                                             throws javax.resource.ResourceException
Creates a new physical connection to the underlying JORAM server, and returns a ManagedConnectionImpl instance for a managed environment.

Specified by:
createManagedConnection in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
subject - Security data, not taken into account.
cxRequest - User identification data, may be null.
Throws:
javax.resource.spi.CommException - If the JORAM server is not reachable.
javax.resource.spi.SecurityException - If the connecting is not allowed.
javax.jms.IllegalStateException - If the central Joram adapter state is invalid.
javax.resource.ResourceException - If the provided user info is invalid, or if connecting fails for any other reason.

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cxRequest)
                                                             throws javax.resource.ResourceException
Finds a matching connection from the candidate set of connections and returns a ManagedConnectionImpl instance.

Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
connectionSet - Set of connections to test.
subject - Security data, not taken into account.
cxRequest - User identification data, may be null.
Throws:
javax.resource.ResourceException - If the provided connection request info is invalid.

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws javax.resource.ResourceException
Sets the log writer for this ManagedConnectionFactoryImpl instance.

Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Gets the log writer of this ManagedConnectionFactoryImpl instance.

Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Throws:
javax.resource.ResourceException

hashCode

public int hashCode()
Returns a code depending on the managed factory configuration.

Specified by:
hashCode in interface javax.resource.spi.ManagedConnectionFactory
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Compares managed factories according to their configuration.

Specified by:
equals in interface javax.resource.spi.ManagedConnectionFactory
Overrides:
equals in class java.lang.Object

getResourceAdapter

public javax.resource.spi.ResourceAdapter getResourceAdapter()
Returns the resource adapter central authority instance.

Specified by:
getResourceAdapter in interface javax.resource.spi.ResourceAdapterAssociation

setResourceAdapter

public void setResourceAdapter(javax.resource.spi.ResourceAdapter ra)
                        throws javax.resource.ResourceException
Sets the resource adapter central authority.

Specified by:
setResourceAdapter in interface javax.resource.spi.ResourceAdapterAssociation
Throws:
javax.resource.ResourceException - If the adapter could not be set.

getInvalidConnections

public java.util.Set getInvalidConnections(java.util.Set connectionSet)
                                    throws javax.resource.ResourceException
From a set of managed connections, returns the set of invalid ones.

Specified by:
getInvalidConnections in interface javax.resource.spi.ValidatingManagedConnectionFactory
Throws:
javax.resource.ResourceException

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Deserializing method.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

setCollocated

public void setCollocated(java.lang.Boolean collocated)

setHostName

public void setHostName(java.lang.String hostName)

setServerPort

public void setServerPort(java.lang.Integer serverPort)

setUserName

public void setUserName(java.lang.String userName)

setPassword

public void setPassword(java.lang.String password)

setIdentityClass

public void setIdentityClass(java.lang.String identityClass)

getCollocated

public java.lang.Boolean getCollocated()

getHostName

public java.lang.String getHostName()

getServerPort

public java.lang.Integer getServerPort()

getUserName

public java.lang.String getUserName()

getPassword

public java.lang.String getPassword()

getIdentityClass

public java.lang.String getIdentityClass()

getOutLocalAddress

public java.lang.String getOutLocalAddress()

getOutLocalPort

public java.lang.Integer getOutLocalPort()

setOutLocalAddress

public void setOutLocalAddress(java.lang.String outLocalAddress)

setOutLocalPort

public void setOutLocalPort(java.lang.Integer outLocalPort)

setOutInterceptors

public void setOutInterceptors(java.lang.String outInterceptors)

setInInterceptors

public void setInInterceptors(java.lang.String inInterceptors)


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.