Package org.datanucleus.jdo.connector
Class ManagedConnectionFactoryImpl
- java.lang.Object
-
- org.datanucleus.jdo.connector.ManagedConnectionFactoryImpl
-
- All Implemented Interfaces:
Serializable,javax.resource.spi.ManagedConnectionFactory
public class ManagedConnectionFactoryImpl extends Object implements javax.resource.spi.ManagedConnectionFactory
Implementation of the JCA adapter for use in J2EE environments. Provides an implementation of the methods for ManagedConnectionFactory as well as setters/getters for properties required in the J2EE environment.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ManagedConnectionFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectcreateConnectionFactory()Creator for the connection factoryObjectcreateConnectionFactory(javax.resource.spi.ConnectionManager cm)Creator for the connection factory.javax.resource.spi.ManagedConnectioncreateManagedConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri)Creator for a managed connection.booleanequals(Object other)Equality operator.protected voidfreezeConfiguration()Freezes the current configuration.PrintWritergetLogWriter()Accessor for the Log writerorg.datanucleus.api.jdo.JDOPersistenceManagerFactorygetPersistenceManagerFactory()inthashCode()javax.resource.spi.ManagedConnectionmatchManagedConnections(Set mcs, Subject subject, javax.resource.spi.ConnectionRequestInfo cri)Method to match managed connections.voidsetLogWriter(PrintWriter writer)Mutator for the Log WritervoidsetPersistenceUnitName(String name)Mutator for the name of the persistence unit.voidsetPersistenceXmlFilename(String name)Mutator for the filename of the persistence.xml file.voidsetPrimaryClassLoader(String name)Setter for the primaryClassLoader
-
-
-
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(String name)
Mutator for the name of the persistence unit.- Parameters:
name- Name of the persistence unit
-
setPersistenceXmlFilename
public void setPersistenceXmlFilename(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
-
setPrimaryClassLoader
public void setPrimaryClassLoader(String name)
Setter for the primaryClassLoader- Parameters:
name- Name of the class to use to set the primary class loader. Otherwise uses this class
-
getPersistenceManagerFactory
public org.datanucleus.api.jdo.JDOPersistenceManagerFactory getPersistenceManagerFactory()
-
equals
public boolean equals(Object other)
Equality operator.
-
hashCode
public int hashCode()
-
createConnectionFactory
public Object createConnectionFactory() throws javax.resource.ResourceException
Creator for the connection factory- Specified by:
createConnectionFactoryin interfacejavax.resource.spi.ManagedConnectionFactory- Returns:
- The connection factory
- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
createConnectionFactory
public Object createConnectionFactory(javax.resource.spi.ConnectionManager cm) throws javax.resource.ResourceException
Creator for the connection factory.- Specified by:
createConnectionFactoryin interfacejavax.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(Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException
Creator for a managed connection.- Specified by:
createManagedConnectionin interfacejavax.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(Set mcs, 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:
matchManagedConnectionsin interfacejavax.resource.spi.ManagedConnectionFactory- Parameters:
mcs- managed connectionssubject- The subjectcri- request info- Returns:
- The managed connection that matches
- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
getLogWriter
public PrintWriter getLogWriter() throws javax.resource.ResourceException
Accessor for the Log writer- Specified by:
getLogWriterin interfacejavax.resource.spi.ManagedConnectionFactory- Returns:
- The Log Writer
- Throws:
javax.resource.ResourceException- Thrown if an error occurs.
-
setLogWriter
public void setLogWriter(PrintWriter writer) throws javax.resource.ResourceException
Mutator for the Log Writer- Specified by:
setLogWriterin interfacejavax.resource.spi.ManagedConnectionFactory- Parameters:
writer- The log writer- Throws:
javax.resource.ResourceException- Thrown if an error occurs
-
-