org.objectweb.joram.client.connector
Class ManagedConnectionFactoryImpl

java.lang.Object
  extended byorg.objectweb.joram.client.connector.ManagedConnectionFactoryImpl
All Implemented Interfaces:
javax.resource.spi.ManagedConnectionFactory, javax.resource.spi.ResourceAdapterAssociation, java.io.Serializable, 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
protected  java.io.PrintWriter out
          Out stream for error logging and tracing.
 
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.
 java.lang.Boolean getCollocated()
           
 java.lang.String getHostName()
           
 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.
 java.lang.String getPassword()
           
 javax.resource.spi.ResourceAdapter getResourceAdapter()
          Returns the resource adapter central authority instance.
 java.lang.Integer getServerPort()
           
 java.lang.String getUserName()
           
 int hashCode()
          Returns a code depending on the managed factory configuration.
 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.
 void setCollocated(java.lang.Boolean collocated)
           
 void setHostName(java.lang.String hostName)
           
 void setLogWriter(java.io.PrintWriter out)
          Sets the log writer for this ManagedConnectionFactoryImpl instance.
 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

out

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

Constructor Detail

ManagedConnectionFactoryImpl

public ManagedConnectionFactoryImpl()
Constructs a ManagedConnectionFactoryImpl instance.

Method Detail

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

equals

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

Specified by:
equals in interface javax.resource.spi.ManagedConnectionFactory

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

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)

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()


Copyright © 2004 Scalagent - All rights reserved