Class ActiveResourceAdapterImpl

  • All Implemented Interfaces:
    ActiveResourceAdapter
    Direct Known Subclasses:
    ActiveOutboundResourceAdapter

    @Service
    @PerLookup
    public class ActiveResourceAdapterImpl
    extends Object
    implements ActiveResourceAdapter
    This class represents the abstraction of a 1.0 compliant rar. It holds the ra.xml (connector decriptor) values, class loader used to to load the Resource adapter class and managed connection factory and module name (rar) to which it belongs. It is also the base class for ActiveOutboundResourceAdapter(a 1.5 compliant outbound rar).
    Author:
    Srikanth P, Binod PG
    • Constructor Detail

      • ActiveResourceAdapterImpl

        public ActiveResourceAdapterImpl()
    • Method Detail

      • init

        public void init​(jakarta.resource.spi.ResourceAdapter ra,
                         ConnectorDescriptor desc,
                         String moduleName,
                         ClassLoader jcl)
                  throws ConnectorRuntimeException
        Constructor.
        Specified by:
        init in interface ActiveResourceAdapter
        Parameters:
        desc - Connector Descriptor. Holds the all ra.xml values
        moduleName - Name of the module i.e rar Name. Incase of embedded resource adapters its name will be appName#rarName
        jcl - Classloader used to load the ResourceAdapter and managed connection factory class. values to domain.xml.
        ra - resource-adapter bean
        Throws:
        ConnectorRuntimeException - when unable to initialize the runtime RA
      • getModuleName

        public String getModuleName()
        Returns the module Name of the RAR
        Specified by:
        getModuleName in interface ActiveResourceAdapter
        Returns:
        A String representing the name of the connector module
      • setup

        public void setup()
                   throws ConnectorRuntimeException
        It initializes the resource adapter. It also creates the default pools and resources of all the connection definitions.
        Specified by:
        setup in interface ActiveResourceAdapter
        Throws:
        ConnectorRuntimeException - This exception is thrown if the ra.xml is invalid or the default pools and resources couldn't be created
      • isServer

        protected boolean isServer()
        Check if the execution environment is appserver runtime or application client container.
        Returns:
        boolean if the environment is appserver runtime
      • destroyAllConnectorResources

        protected void destroyAllConnectorResources()
        Deletes both the default connector connection pools and resources
      • isSystemRar

        protected boolean isSystemRar​(String moduleName)
      • deleteDefaultConnectorConnectionPools

        protected void deleteDefaultConnectorConnectionPools()
        Deletes the default connector connection pools.
      • deleteDefaultConnectorResources

        protected void deleteDefaultConnectorResources()
        Deletes the default connector resources.
      • destroy

        public void destroy()
        uninitializes the resource adapter. It also destroys the default pools and resources
        Specified by:
        destroy in interface ActiveResourceAdapter
      • handles

        public boolean handles​(ConnectorDescriptor cd,
                               String moduleName)
        Indicates whether a particular implementation of ActiveRA can handle the RAR in question.
        Specified by:
        handles in interface ActiveResourceAdapter
        Parameters:
        cd - ConnectorDescriptor
        moduleName - resource adapter name
        Returns:
        boolean indiating whether a ActiveRA can handle the RAR
      • createManagedConnectionFactories

        public jakarta.resource.spi.ManagedConnectionFactory[] createManagedConnectionFactories​(ConnectorConnectionPool ccp,
                                                                                                ClassLoader jcl)
        Creates managed Connection factories corresponding to one pool. This should be implemented in the ActiveJmsResourceAdapter, for jms resources, has been implemented to perform xa resource recovery in mq clusters, not supported for any other code path.
        Specified by:
        createManagedConnectionFactories in interface ActiveResourceAdapter
        Parameters:
        ccp - Connector connection pool which contains the pool properties and ra.xml values pertaining to managed connection factory class. These values are used in MCF creation.
        jcl - Classloader used to managed connection factory class.
        Returns:
        ManagedConnectionFactory created managed connection factories
      • createManagedConnectionFactory

        public jakarta.resource.spi.ManagedConnectionFactory createManagedConnectionFactory​(ConnectorConnectionPool ccp,
                                                                                            ClassLoader jcl)
        Creates managed Connection factory instance.
        Specified by:
        createManagedConnectionFactory in interface ActiveResourceAdapter
        Parameters:
        ccp - Connector connection pool which contains the pool properties and ra.xml values pertaining to managed connection factory class. These values are used in MCF creation.
        jcl - Classloader used to managed connection factory class.
        Returns:
        ManagedConnectionFactory created managed connection factory instance
      • createDefaultConnectorConnectionPools

        protected void createDefaultConnectorConnectionPools​(boolean useSunRA)
                                                      throws ConnectorRuntimeException
        Creates default connector connection pool
        Parameters:
        useSunRA - whether to use default pool settings or settings in sun-ra.xml
        Throws:
        ConnectorRuntimeException - when unable to create connector connection pools
      • getResourceAdapter

        public jakarta.resource.spi.ResourceAdapter getResourceAdapter()
        Retrieves the resource adapter java bean.
        Specified by:
        getResourceAdapter in interface ActiveResourceAdapter
        Returns:
        ResourceAdapter