Class 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 Detail

      • ManagedConnectionFactoryImpl

        public ManagedConnectionFactoryImpl()
    • 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.
        Specified by:
        equals in interface javax.resource.spi.ManagedConnectionFactory
        Overrides:
        equals in class 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 Object
      • createConnectionFactory

        public 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 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​(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​(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:
        matchManagedConnections in interface javax.resource.spi.ManagedConnectionFactory
        Parameters:
        mcs - managed connections
        subject - The subject
        cri - 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:
        getLogWriter in interface javax.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:
        setLogWriter in interface javax.resource.spi.ManagedConnectionFactory
        Parameters:
        writer - The log writer
        Throws:
        javax.resource.ResourceException - Thrown if an error occurs