org.datanucleus.jdo.connector
Class ManagedConnectionFactoryImpl

java.lang.Object
  extended by org.datanucleus.jdo.connector.ManagedConnectionFactoryImpl
All Implemented Interfaces:
java.io.Serializable, javax.resource.spi.ManagedConnectionFactory

public class ManagedConnectionFactoryImpl
extends java.lang.Object
implements javax.resource.spi.ManagedConnectionFactory

Implementation of the JCA adapter for use of JPOX in J2EE environments. Provides an implementation of the methods for ManagedConnectionFactory as well as setters/getters for properties required in the J2EE environment.

Version:
$Revision: 1.1 $
See Also:
Serialized Form

Constructor Summary
ManagedConnectionFactoryImpl()
          Default constructor
 
Method Summary
 java.lang.Object createConnectionFactory()
          Creator for the connection factory
 java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cm)
          Creator for the connection factory.
 javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Creator for a managed connection.
 boolean equals(java.lang.Object other)
          Equality operator.
protected  void freezeConfiguration()
          Freezes the current configuration.
 java.io.PrintWriter getLogWriter()
          Accessor for the Log writer
 org.datanucleus.jdo.JDOPersistenceManagerFactory getPersistenceManagerFactory()
           
 int hashCode()
           
 javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set mcs, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Method to match managed connections.
 void setLogWriter(java.io.PrintWriter writer)
          Mutator for the Log Writer
 void setPersistenceUnitName(java.lang.String name)
          Mutator for the name of the persistence unit.
 void setPersistenceXmlFilename(java.lang.String name)
          Mutator for the filename of the persistence.xml file.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedConnectionFactoryImpl

public ManagedConnectionFactoryImpl()
Default constructor

Method Detail

freezeConfiguration

protected void freezeConfiguration()
Freezes the current configuration. Executed only once

Throws:
org.datanucleus.exceptions.NucleusException - if the configuration was invalid or inconsistent in some way

setPersistenceUnitName

public void setPersistenceUnitName(java.lang.String name)
Mutator for the name of the persistence unit.

Parameters:
name - Name of the persistence unit

setPersistenceXmlFilename

public void setPersistenceXmlFilename(java.lang.String name)
Mutator for the filename of the persistence.xml file. This is for the case where an application has placed the persistence.xml somewhere else maybe outside the CLASSPATH.

Parameters:
name - Filename of the persistence unit

getPersistenceManagerFactory

public org.datanucleus.jdo.JDOPersistenceManagerFactory getPersistenceManagerFactory()

equals

public boolean equals(java.lang.Object other)
Equality operator.

Specified by:
equals in interface javax.resource.spi.ManagedConnectionFactory
Overrides:
equals in class java.lang.Object
Parameters:
other - The object to compare with
Returns:
Whether the objects are equal

hashCode

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

createConnectionFactory

public java.lang.Object createConnectionFactory()
                                         throws javax.resource.ResourceException
Creator for the connection factory

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Returns:
The connection factory
Throws:
javax.resource.ResourceException - Thrown if an error occurs

createConnectionFactory

public java.lang.Object createConnectionFactory(javax.resource.spi.ConnectionManager cm)
                                         throws javax.resource.ResourceException
Creator for the connection factory.

Specified by:
createConnectionFactory in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
cm - ConnectionManager
Returns:
The connection factory.
Throws:
javax.resource.ResourceException - Thrown if an error occurs

createManagedConnection

public javax.resource.spi.ManagedConnection createManagedConnection(javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cri)
                                                             throws javax.resource.ResourceException
Creator for a managed connection.

Specified by:
createManagedConnection in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
subject - The subject (what ?)
cri - Connection request info.
Returns:
The managed connection.
Throws:
javax.resource.ResourceException - Thrown if an error occurs

matchManagedConnections

public javax.resource.spi.ManagedConnection matchManagedConnections(java.util.Set mcs,
                                                                    javax.security.auth.Subject subject,
                                                                    javax.resource.spi.ConnectionRequestInfo cri)
                                                             throws javax.resource.ResourceException
Method to match managed connections. The application server invokes it when the user asks for a PersistenceManager In application servers such as WebLogic 9.x, 10.x, you can use the setting match-connections-supported=true to return the same ManagedConnection instance if the user asks multiple times for a PersistenceManager (PMF.getPersistenceManager()) inside a single transaction. For JBoss 4.x the setting is track-connection-by-tx.

Specified by:
matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
mcs -
subject -
cri -
Returns:
Throws:
javax.resource.ResourceException - Thrown if an error occurs

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Accessor for the Log writer

Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Returns:
The Log Writer
Throws:
javax.resource.ResourceException - Thrown if an error occurs.

setLogWriter

public void setLogWriter(java.io.PrintWriter writer)
                  throws javax.resource.ResourceException
Mutator for the Log Writer

Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnectionFactory
Parameters:
writer - The log writer
Throws:
javax.resource.ResourceException - Thrown if an error occurs


Copyright © 2009. All Rights Reserved.