Class ManagedConnectionFactoryImpl

    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Define serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • logger

        private static final Logger logger
      • DEBUG

        private static final boolean DEBUG
      • out

        protected transient PrintWriter out
        Out stream for error logging and tracing.
    • Constructor Detail

      • ManagedConnectionFactoryImpl

        public ManagedConnectionFactoryImpl()
        Constructs a ManagedConnectionFactoryImpl instance.
    • Method Detail

      • createConnectionFactory

        public Object createConnectionFactory​(jakarta.resource.spi.ConnectionManager cxManager)
                                       throws jakarta.resource.ResourceException
        Method called by an application server (managed case) for creating an OutboundConnectionFactory instance.
        Specified by:
        createConnectionFactory in interface jakarta.resource.spi.ManagedConnectionFactory
        Parameters:
        cxManager - Application server's connections pooling manager.
        Throws:
        jakarta.resource.ResourceException - Never thrown.
      • createConnectionFactory

        public Object createConnectionFactory()
                                       throws jakarta.resource.ResourceException
        Method called in the non managed case for creating an OutboundConnectionFactory instance.
        Specified by:
        createConnectionFactory in interface jakarta.resource.spi.ManagedConnectionFactory
        Throws:
        jakarta.resource.ResourceException - Never thrown.
      • createFactory

        protected jakarta.jms.XAConnectionFactory createFactory​(jakarta.resource.spi.ConnectionRequestInfo cxRequest)
                                                         throws jakarta.resource.ResourceException
        Throws:
        jakarta.resource.ResourceException
      • createXAConnection

        protected jakarta.jms.XAConnection createXAConnection​(jakarta.jms.XAConnectionFactory factory,
                                                              String userName,
                                                              String password)
                                                       throws jakarta.resource.ResourceException
        Throws:
        jakarta.resource.ResourceException
      • createManagedConnection

        public final jakarta.resource.spi.ManagedConnection createManagedConnection​(Subject subject,
                                                                                    jakarta.resource.spi.ConnectionRequestInfo cxRequest)
                                                                             throws jakarta.resource.ResourceException
        Creates a new physical connection to the underlying JORAM server, and returns a ManagedConnectionImpl instance for a managed environment.
        Specified by:
        createManagedConnection in interface jakarta.resource.spi.ManagedConnectionFactory
        Parameters:
        subject - Security data, not taken into account.
        cxRequest - User identification data, may be null.
        Throws:
        jakarta.resource.spi.CommException - If the JORAM server is not reachable.
        jakarta.resource.spi.SecurityException - If the connecting is not allowed.
        jakarta.jms.IllegalStateException - If the central Joram adapter state is invalid.
        jakarta.resource.ResourceException - If the provided user info is invalid, or if connecting fails for any other reason.
      • matchManagedConnections

        public final jakarta.resource.spi.ManagedConnection matchManagedConnections​(Set connectionSet,
                                                                                    Subject subject,
                                                                                    jakarta.resource.spi.ConnectionRequestInfo cxRequest)
                                                                             throws jakarta.resource.ResourceException
        Finds a matching connection from the candidate set of connections and returns a ManagedConnectionImpl instance.
        Specified by:
        matchManagedConnections in interface jakarta.resource.spi.ManagedConnectionFactory
        Parameters:
        connectionSet - Set of connections to test.
        subject - Security data, not taken into account.
        cxRequest - User identification data, may be null.
        Throws:
        jakarta.resource.ResourceException - If the provided connection request info is invalid.
      • setLogWriter

        public void setLogWriter​(PrintWriter out)
                          throws jakarta.resource.ResourceException
        Sets the log writer for this ManagedConnectionFactoryImpl instance.
        Specified by:
        setLogWriter in interface jakarta.resource.spi.ManagedConnectionFactory
        Throws:
        jakarta.resource.ResourceException
      • getLogWriter

        public PrintWriter getLogWriter()
                                 throws jakarta.resource.ResourceException
        Gets the log writer of this ManagedConnectionFactoryImpl instance.
        Specified by:
        getLogWriter in interface jakarta.resource.spi.ManagedConnectionFactory
        Throws:
        jakarta.resource.ResourceException
      • hashCode

        public int hashCode()
        Returns a code depending on the managed factory configuration.
        Specified by:
        hashCode in interface jakarta.resource.spi.ManagedConnectionFactory
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object o)
        Compares managed factories according to their configuration.
        Specified by:
        equals in interface jakarta.resource.spi.ManagedConnectionFactory
        Overrides:
        equals in class Object
      • getResourceAdapter

        public jakarta.resource.spi.ResourceAdapter getResourceAdapter()
        Returns the resource adapter central authority instance.
        Specified by:
        getResourceAdapter in interface jakarta.resource.spi.ResourceAdapterAssociation
      • setResourceAdapter

        public void setResourceAdapter​(jakarta.resource.spi.ResourceAdapter ra)
                                throws jakarta.resource.ResourceException
        Sets the resource adapter central authority.
        Specified by:
        setResourceAdapter in interface jakarta.resource.spi.ResourceAdapterAssociation
        Throws:
        jakarta.resource.ResourceException - If the adapter could not be set.
      • getInvalidConnections

        public Set<ManagedConnectionImpl> getInvalidConnections​(Set connectionSet)
                                                         throws jakarta.resource.ResourceException
        From a set of managed connections, returns the set of invalid ones.
        Specified by:
        getInvalidConnections in interface jakarta.resource.spi.ValidatingManagedConnectionFactory
        Throws:
        jakarta.resource.ResourceException