org.drools.jsr94.jca.spi
Class RuleManagedConnectionFactory

java.lang.Object
  |
  +--org.drools.jsr94.jca.spi.RuleManagedConnectionFactory
All Implemented Interfaces:
javax.resource.spi.ManagedConnectionFactory, java.io.Serializable

public class RuleManagedConnectionFactory
extends java.lang.Object
implements javax.resource.spi.ManagedConnectionFactory, java.io.Serializable

ManagedConnectionFactory instance is a factory of both ManagedConnection and EIS-specific connection factory instances. This interface supports connection pooling by providing methods for matching and creation of ManagedConnection instance.

Author:
thomas diesler
See Also:
Serialized Form

Constructor Summary
RuleManagedConnectionFactory()
           
 
Method Summary
 java.lang.Object createConnectionFactory()
          Creates a Connection Factory instance.
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
          Creates a Connection Factory instance.
 javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo info)
          Creates a new physical connection to the underlying EIS resource manager.
 java.io.PrintWriter getLogWriter()
          Get the log writer for this ManagedConnectionFactory instance.
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo info)
          Returns a matched connection from the candidate set of connections.
 void setLogWriter(java.io.PrintWriter logWriter)
          Set the log writer for this ManagedConnectionFactory instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.resource.spi.ManagedConnectionFactory
equals, hashCode
 

Constructor Detail

RuleManagedConnectionFactory

public RuleManagedConnectionFactory()
Method Detail

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
                                         throws javax.resource.ResourceException
Creates a Connection Factory instance. The Connection Factory instance gets initialized with the passed ConnectionManager. In the managed scenario, ConnectionManager is provided by the application server.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Creates a Connection Factory instance. The Connection Factory instance gets initialized with a default ConnectionManager provided by the resource adapter.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo info)
Creates a new physical connection to the underlying EIS resource manager.

ManagedConnectionFactory uses the security information (passed as Subject) and additional ConnectionRequestInfo (which is specific to ResourceAdapter and opaque to application server) to create this new connection.

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

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set connectionSet,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo info)
                                                             throws javax.resource.ResourceException
Returns a matched connection from the candidate set of connections.

ManagedConnectionFactory uses the security info (as in Subject) and information provided through ConnectionRequestInfo and additional Resource Adapter specific criteria to do matching. Note that criteria used for matching is specific to a resource adapter and is not prescribed by the Connector specification.

This method returns a ManagedConnection instance that is the best match for handling the connection allocation request.

Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
javax.resource.ResourceException

setLogWriter

public void setLogWriter(java.io.PrintWriter logWriter)
                  throws javax.resource.ResourceException
Set the log writer for this ManagedConnectionFactory instance.

The log writer is a character output stream to which all logging and tracing messages for this ManagedConnectionfactory instance will be printed.

ApplicationServer manages the association of output stream with the ManagedConnectionFactory. When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled. Once a log writer is associated with a ManagedConnectionFactory, logging and tracing for ManagedConnectionFactory instance is enabled.

The ManagedConnection instances created by ManagedConnectionFactory "inherits" the log writer, which can be overridden by ApplicationServer using ManagedConnection.setLogWriter to set ManagedConnection specific logging and tracing.

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

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Get the log writer for this ManagedConnectionFactory instance.

The log writer is a character output stream to which all logging and tracing messages for this ManagedConnectionFactory instance will be printed.

ApplicationServer manages the association of output stream with the ManagedConnectionFactory. When a ManagedConnectionFactory object is created the log writer is initially null, in other words, logging is disabled.

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