org.objectweb.speedo.jca
Class SpeedoManagedConnectionFactory

java.lang.Object
  extended by org.objectweb.speedo.jca.SpeedoManagedConnectionFactory
All Implemented Interfaces:
java.io.Serializable, javax.resource.spi.ManagedConnectionFactory, SpeedoAttributeController
Direct Known Subclasses:
JDOManagedConnectionFactory

public abstract class SpeedoManagedConnectionFactory
extends java.lang.Object
implements javax.resource.spi.ManagedConnectionFactory, SpeedoAttributeController

Author:
P. Dechamboux
See Also:
Serialized Form

Field Summary
protected  SpeedoConnectionFactory connectionFactory
          It is assumed that only one ConnectionFactory is actually created by a ManagedConnectionFactory.
 POManagerFactoryItf pmf
          The factory for managing JDO transaction contexts.
 boolean started
           
protected  javax.transaction.TransactionManager tm
           
 
Constructor Summary
SpeedoManagedConnectionFactory()
           
 
Method Summary
 java.lang.Object createConnection()
          Delegates the creation of a Connection to the ConnectionFactory.
 java.lang.Object createConnectionFactory()
          Creates a JDOConnectionFactory; yields the existing one if any.
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cm)
          Creates a JDOConnectionFactory; yields the existing one if any.
protected abstract  SpeedoConnectionFactory createConnectionFactory(org.objectweb.util.monolog.api.Logger l, SpeedoManagedConnectionFactory fmcf, javax.resource.spi.ConnectionManager cm, byte transactionMode)
          This abstract method is used to create a ConnectionFactory.
 javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo info)
          Creates a new SpeedoManagedConnection.
protected  void finalize()
           
 java.io.PrintWriter getLogWriter()
          Retrieves the printwriter used for the logging.
 java.lang.String getPropertyFile()
          Gives access to the name of the property file for initializing the underlying JDO implementation.
 java.lang.String getTransactionManagerJNDIName()
          Gives access to the JNDI name of the transaction manager (javax.transaction.TransactionManager).
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set set, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo info)
          No matching rules supported.
 void setLogWriter(java.io.PrintWriter writer)
          If he given PrintWrtier is a Loggable implementation then the inner logger and the inner loggerFactory are used.
 void setPropertyFile(java.lang.String pf)
          Assigns to this JDO connector the name of the property file for initializing the underlying JDO implementation.
 void setTransactionManager(javax.transaction.TransactionManager tm)
           
 void setTransactionManagerJNDIName(java.lang.String jndiname)
          Assigns the JNDI name of the transaction manager (javax.transaction.TransactionManager).
 void start()
          Starts this SpeedoManagedConnectionFactory.
 void stop()
          Stops this SpeedoManagedConnectionFactory.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.resource.spi.ManagedConnectionFactory
equals, hashCode
 

Field Detail

connectionFactory

protected SpeedoConnectionFactory connectionFactory
It is assumed that only one ConnectionFactory is actually created by a ManagedConnectionFactory.


pmf

public POManagerFactoryItf pmf
The factory for managing JDO transaction contexts.


started

public boolean started

tm

protected javax.transaction.TransactionManager tm
Constructor Detail

SpeedoManagedConnectionFactory

public SpeedoManagedConnectionFactory()
Method Detail

createConnectionFactory

protected abstract SpeedoConnectionFactory createConnectionFactory(org.objectweb.util.monolog.api.Logger l,
                                                                   SpeedoManagedConnectionFactory fmcf,
                                                                   javax.resource.spi.ConnectionManager cm,
                                                                   byte transactionMode)
                                                            throws javax.resource.ResourceException
This abstract method is used to create a ConnectionFactory. It should be implemented by the ManagedConnectionFactory associated with the actual implementation of the JCA driver (either for JDO or for EJB).

Throws:
javax.resource.ResourceException

start

public void start()
           throws javax.resource.ResourceException
Starts this SpeedoManagedConnectionFactory.

Throws:
javax.resource.ResourceException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

stop

public void stop()
          throws javax.resource.ResourceException
Stops this SpeedoManagedConnectionFactory.

Throws:
javax.resource.ResourceException

createConnection

public java.lang.Object createConnection()
                                  throws javax.resource.ResourceException
Delegates the creation of a Connection to the ConnectionFactory.

Throws:
javax.resource.ResourceException

getPropertyFile

public java.lang.String getPropertyFile()
Gives access to the name of the property file for initializing the underlying JDO implementation.

Specified by:
getPropertyFile in interface SpeedoAttributeController
Returns:
The name of the property file.

setPropertyFile

public void setPropertyFile(java.lang.String pf)
Assigns to this JDO connector the name of the property file for initializing the underlying JDO implementation.

Specified by:
setPropertyFile in interface SpeedoAttributeController
Parameters:
pf - The name of the property file.

getTransactionManagerJNDIName

public java.lang.String getTransactionManagerJNDIName()
Description copied from interface: SpeedoAttributeController
Gives access to the JNDI name of the transaction manager (javax.transaction.TransactionManager).

Specified by:
getTransactionManagerJNDIName in interface SpeedoAttributeController
Returns:
the JNDI name of the transaction manager

setTransactionManagerJNDIName

public void setTransactionManagerJNDIName(java.lang.String jndiname)
                                   throws javax.resource.ResourceException
Description copied from interface: SpeedoAttributeController
Assigns the JNDI name of the transaction manager (javax.transaction.TransactionManager).

Specified by:
setTransactionManagerJNDIName in interface SpeedoAttributeController
Parameters:
jndiname - is the JNDI name of the transaction manager
Throws:
javax.resource.ResourceException

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager tm)

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cm)
                                         throws javax.resource.ResourceException
Creates a JDOConnectionFactory; yields the existing one if any.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
cm - The ConnectionManager to be used by the created ConnectionFactory (may be null).
Throws:
javax.resource.ResourceException

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Creates a JDOConnectionFactory; yields the existing one if any.

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

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo info)
                                                             throws javax.resource.ResourceException
Creates a new SpeedoManagedConnection.

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

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set set,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo info)
                                                             throws javax.resource.ResourceException
No matching rules supported. Always yields the first element of the set if any.

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

setLogWriter

public void setLogWriter(java.io.PrintWriter writer)
                  throws javax.resource.ResourceException
If he given PrintWrtier is a Loggable implementation then the inner logger and the inner loggerFactory are used. Otherwise the a basic Logger implementation is used over the specified PrintWriter.

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

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Retrieves the printwriter used for the logging.

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