org.objectweb.joram.client.connector

Class ManagedConnectionFactoryImpl

Implemented Interfaces:
javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation, java.io.Serializable, javax.resource.spi.ValidatingManagedConnectionFactory
Known Direct 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

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.
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.
protected PrintWriter
out
Out stream for error logging and tracing.
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".

Constructor Summary

ManagedConnectionFactoryImpl()
Constructs a ManagedConnectionFactoryImpl instance.

Method Summary

Object
createConnectionFactory()
Method called in the non managed case for creating an OutboundConnectionFactory instance.
Object
createConnectionFactory(ConnectionManager cxManager)
Method called by an application server (managed case) for creating an OutboundConnectionFactory instance.
ManagedConnection
createManagedConnection(Subject subject, ConnectionRequestInfo cxRequest)
Creates a new physical connection to the underlying JORAM server, and returns a ManagedConnectionImpl instance for a managed environment.
boolean
equals(Object o)
Compares managed factories according to their configuration.
int
getCnxPendingTimer()
java.lang.Boolean
getCollocated()
int
getConnectingTimer()
java.lang.String
getHostName()
Set
getInvalidConnections(Set connectionSet)
From a set of managed connections, returns the set of invalid ones.
PrintWriter
getLogWriter()
Gets the log writer of this ManagedConnectionFactoryImpl instance.
java.lang.String
getPassword()
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.
ManagedConnection
matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequest)
Finds a matching connection from the candidate set of connections and returns a ManagedConnectionImpl instance.
void
setCollocated(java.lang.Boolean collocated)
void
setHostName(java.lang.String hostName)
void
setLogWriter(PrintWriter out)
Sets the log writer for this ManagedConnectionFactoryImpl instance.
protected void
setParameters(Object factory)
void
setPassword(java.lang.String password)
void
setResourceAdapter(ResourceAdapter ra)
Sets the resource adapter central authority.
void
setServerPort(java.lang.Integer serverPort)
void
setUserName(java.lang.String userName)

Field Details

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.


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.


out

protected PrintWriter out
Out stream for error logging and tracing.


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".

Constructor Details

ManagedConnectionFactoryImpl

public ManagedConnectionFactoryImpl()
Constructs a ManagedConnectionFactoryImpl instance.

Method Details

createConnectionFactory

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


createConnectionFactory

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

Parameters:
cxManager - Application server's connections pooling manager.


createManagedConnection

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

Parameters:
subject - Security data, not taken into account.
cxRequest - User identification data, may be null.


equals

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


getCnxPendingTimer

public int getCnxPendingTimer()


getCollocated

public java.lang.Boolean getCollocated()


getConnectingTimer

public int getConnectingTimer()


getHostName

public java.lang.String getHostName()


getInvalidConnections

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


getLogWriter

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


getPassword

public java.lang.String getPassword()


getResourceAdapter

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


getServerPort

public java.lang.Integer getServerPort()


getTxPendingTimer

public int getTxPendingTimer()


getUserName

public java.lang.String getUserName()


hashCode

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


matchManagedConnections

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

Parameters:
connectionSet - Set of connections to test.
subject - Security data, not taken into account.
cxRequest - User identification data, may be null.


setCollocated

public void setCollocated(java.lang.Boolean collocated)


setHostName

public void setHostName(java.lang.String hostName)


setLogWriter

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


setParameters

protected void setParameters(Object factory)


setPassword

public void setPassword(java.lang.String password)


setResourceAdapter

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


setServerPort

public void setServerPort(java.lang.Integer serverPort)


setUserName

public void setUserName(java.lang.String userName)


Copyright B) 2004 Scalagent - All rights reserved