Class ConnectorRegistry


  • public class ConnectorRegistry
    extends Object
    This is an registry class which holds various objects in hashMaps, hash tables, and vectors. These objects are updated and queried during various funtionalities of rar deployment/undeployment, resource creation/destruction Ex. of these objects are ResourcesAdapter instances, security maps for pool managed connection factories. It follows singleton pattern. i.e only one instance at any point of time.
    Author:
    Binod P.G and Srikanth P
    • Constructor Detail

      • ConnectorRegistry

        protected ConnectorRegistry()
        Protected constructor. It is protected as it follows singleton pattern.
    • Method Detail

      • getInstance

        public static ConnectorRegistry getInstance()
        Return the ConnectorRegistry instance
        Returns:
        ConnectorRegistry instance which is a singleton
      • addActiveResourceAdapter

        public void addActiveResourceAdapter​(String rarModuleName,
                                             ActiveResourceAdapter rar)
        Adds the object implementing ActiveResourceAdapter interface to the registry.
        Parameters:
        rarModuleName - RarName which is the key
        rar - ActiveResourceAdapter instance which is the value.
      • getResourceInfoVersion

        public long getResourceInfoVersion​(ResourceInfo resourceInfo)
        get the version counter of a resource info
        Parameters:
        resourceInfo - resource-name
        Returns:
        version counter. -1L if the resource is invalid
      • updateResourceInfoVersion

        public long updateResourceInfoVersion​(ResourceInfo resourceInfo)
        Update version information for a resource.
        Parameters:
        resourceInfo - resource info to be updated.
        Returns:
        new version couter
      • removeResourceFactories

        public boolean removeResourceFactories​(ResourceInfo resourceInfo)
        remove and invalidate factories (proxy to actual factory) using the resource.
        Parameters:
        resourceInfo - resource-name
        Returns:
        boolean indicating whether the factories will get invalidated
      • addResourceInfo

        public void addResourceInfo​(ResourceInfo resourceInfo)
        Add resourceInfo that is deployed for book-keeping purposes.
        Parameters:
        resourceInfo - Resource being deployed.
      • removeResourceInfo

        public boolean removeResourceInfo​(ResourceInfo resourceInfo)
        Remove ResourceInfo from registry. Called when resource is disabled/undeployed.
        Parameters:
        resourceInfo - ResourceInfo
        Returns:
        boolean indicating whether resource exists and removed.
      • isResourceDeployed

        public boolean isResourceDeployed​(ResourceInfo resourceInfo)
        indicates whether the resource is deployed (enabled)
        Parameters:
        resourceInfo - resource-info
        Returns:
        boolean indicating whether the resource is deployed.
      • addTransparentDynamicReconfigPool

        public void addTransparentDynamicReconfigPool​(PoolInfo poolInfo)
        Add PoolInfo that has transparent-dynamic-reconfiguration enabled .
        Parameters:
        poolInfo - Pool being deployed.
      • removeTransparentDynamicReconfigPool

        public boolean removeTransparentDynamicReconfigPool​(PoolInfo poolInfo)
        Remove ResourceInfo from registry. Called when resource is disabled/undeployed.
        Parameters:
        poolInfo - poolInfo
        Returns:
        boolean indicating whether the pool exists and removed.
      • isTransparentDynamicReconfigPool

        public boolean isTransparentDynamicReconfigPool​(PoolInfo poolInfo)
        indicates whether the pool has transparent-dynamic-reconfiguration property enabled
        Parameters:
        poolInfo - poolInfo
        Returns:
        boolean false if pool is not deployed
      • removeActiveResourceAdapter

        public boolean removeActiveResourceAdapter​(String rarModuleName)
        Removes the object implementing ActiveResourceAdapter interface from the registry. This method is called whenever an active connector module is removed from the Connector runtime. [eg. undeploy/recreate etc]
        Parameters:
        rarModuleName - RarName which is the key
        Returns:
        true if successfully removed false if deletion fails.
      • getActiveResourceAdapter

        public ActiveResourceAdapter getActiveResourceAdapter​(String rarModuleName)
        Retrieves the object implementing ActiveResourceAdapter interface from the registry. Key is the rarName.
        Parameters:
        rarModuleName - Rar name. It is the key
        Returns:
        object implementing ActiveResourceAdapter interface
      • getLockObject

        public Object getLockObject​(String rarName)
        lock object that will be used by ResourceAdapterAdminService to avoid multiple calls to create ActiveRA for same resource-adapter
        Parameters:
        rarName - resource-adapter name
        Returns:
        lock object for the resource-adapter
      • removeLockObject

        public void removeLockObject​(String rarName)
        removes the lock-object used for creating the ActiveRA for a particular RAR
        Parameters:
        rarName - resource-adapter
      • addBeanValidator

        public void addBeanValidator​(String rarModuleName,
                                     jakarta.validation.Validator validator)
        Adds the bean validator to the registry.
        Parameters:
        rarModuleName - RarName which is the key
        validator - to be added to registry
      • getBeanValidator

        public jakarta.validation.Validator getBeanValidator​(String rarModuleName)
        Retrieves the bean validator of a resource-adapter from the registry. Key is the rarName.
        Parameters:
        rarModuleName - Rar name. It is the key
        Returns:
        bean validator
      • removeBeanValidator

        public boolean removeBeanValidator​(String rarModuleName)
        Removes the bean validator of a resource-adapter from the registry. This method is called whenever an active connector module is removed from the Connector runtime. [eg. undeploy/recreate etc]
        Parameters:
        rarModuleName - RarName which is the key
        Returns:
        true if successfully removed false if deletion fails.
      • isMCFCreated

        public boolean isMCFCreated​(PoolInfo poolInfo)
        Checks if the MCF pertaining to the pool is instantiated and present in the registry. Each pool has its own MCF instance.
        Parameters:
        poolInfo - Name of the pool
        Returns:
        true if the MCF is found. false if MCF is not found
      • removeManagedConnectionFactory

        public boolean removeManagedConnectionFactory​(PoolInfo poolInfo)
        Remove MCF instance pertaining to the poolName from the registry.
        Parameters:
        poolInfo - Name of the pool
        Returns:
        true if successfully removed. false if removal fails.
      • addManagedConnectionFactory

        public void addManagedConnectionFactory​(PoolInfo poolInfo,
                                                PoolMetaData pmd)
        Add MCF instance pertaining to the poolName to the registry.
        Parameters:
        poolInfo - Name of the pool
        pmd - MCF instance to be added.
      • getManagedConnectionFactory

        public jakarta.resource.spi.ManagedConnectionFactory getManagedConnectionFactory​(PoolInfo poolInfo)
        Retrieve MCF instance pertaining to the poolName from the registry.
        Parameters:
        poolInfo - Name of the pool
        Returns:
        factory MCF instance retrieved.
      • isRegistered

        public boolean isRegistered​(String rarModuleName)
        Checks whether the rar is already deployed i.e registered with connector registry
        Parameters:
        rarModuleName - rar Name.
        Returns:
        true if rar is registered false if rar is not registered.
      • getDescriptor

        public ConnectorDescriptor getDescriptor​(String rarModuleName)
        Gets the connector descriptor pertaining the rar
        Parameters:
        rarModuleName - rarName
        Returns:
        ConnectorDescriptor which represents the ra.xml
      • getRuntimeSecurityMap

        public RuntimeSecurityMap getRuntimeSecurityMap​(PoolInfo poolInfo)
        Gets the runtime equivalent of policies enforced by the Security Maps pertaining to a pool from the Pool's Meta Data.
        Parameters:
        poolInfo - pool information
        Returns:
        runtimeSecurityMap in the form of HashMap of HashMaps (user and groups).
      • getResourceAdapterConfig

        public ResourceAdapterConfig getResourceAdapterConfig​(String rarName)
        Get the resource adapter config properties object registered with registry against the rarName.
        Parameters:
        rarName - Name of the rar
        Returns:
        ResourceAdapter configuration object
      • addResourceAdapterConfig

        public void addResourceAdapterConfig​(String rarName,
                                             ResourceAdapterConfig raConfig)
        Add the resource adapter config properties object to registry against the rarName.
        Parameters:
        rarName - Name of the rar
        raConfig - ResourceAdapter configuration object
      • removeResourceAdapterConfig

        public boolean removeResourceAdapterConfig​(String rarName)
        Remove the resource adapter config properties object from registry
        Parameters:
        rarName - Name of the rar
        Returns:
        true if successfully deleted false if deletion fails
      • getAllActiveResourceAdapters

        public ActiveResourceAdapter[] getAllActiveResourceAdapters()
        Returns all Active Resource Adapters in the connector runtime.
        Returns:
        All active resource adapters in the connector runtime
      • addConnectorApplication

        public void addConnectorApplication​(ConnectorApplication rarModule)
        register a connector application (rarModule) with the registry
        Parameters:
        rarModule - resource-adapter module
      • getConnectorApplication

        public ConnectorApplication getConnectorApplication​(String rarName)
        retrieve a connector application (rarModule) from the registry
        Parameters:
        rarName - resource-adapter name
        Returns:
        ConnectorApplication app
      • removeConnectorApplication

        public void removeConnectorApplication​(String rarName)
        remove a connector application (rarModule) from the registry
        Parameters:
        rarName - resource-adapter module
      • getConnectorsSupportingMessageListener

        public List<String> getConnectorsSupportingMessageListener​(String messageListener)
        get the list of resource-adapters that support this message-listener-type
        Parameters:
        messageListener - message-listener class-name
        Returns:
        List of resource-adapters