Class ConnectorRuntime

  • All Implemented Interfaces:
    ConnectorConstants, ConnectorRuntime, org.glassfish.hk2.api.PostConstruct, org.glassfish.hk2.api.PreDestroy, ResourceConstants

    @Service
    @Singleton
    public class ConnectorRuntime
    extends Object
    implements ConnectorRuntime, org.glassfish.hk2.api.PostConstruct, org.glassfish.hk2.api.PreDestroy
    This class is the entry point to connector backend module. It exposes different API's called by external entities like JPA, admin to perform various connector backend related operations. It delegates calls to various connetcor admin services and other connector services which actually implement the functionality. This is a delegating class.
    Author:
    Binod P.G, Srikanth P, Aditya Gore, Jagadish Ramu
    • Constructor Detail

      • ConnectorRuntime

        public ConnectorRuntime()
        Private constructor. It is private as it follows singleton pattern.
    • Method Detail

      • getRuntime

        public static ConnectorRuntime getRuntime()
        Returns the ConnectorRuntime instance. It follows singleton pattern and only one instance exists at any point of time. External entities need to call this method to get ConnectorRuntime instance
        Returns:
        ConnectorRuntime instance
      • getDefaultPoolName

        public String getDefaultPoolName​(String moduleName,
                                         String connectionDefName)
        Returns the generated default connection poolName for a connection definition.
        Parameters:
        moduleName - rar module name
        connectionDefName - connection definition name
        Returns:
        generated connection poolname
      • createConnectorConnectionPool

        public void createConnectorConnectionPool​(ConnectorConnectionPool connectorPoolObj)
                                           throws ConnectorRuntimeException
        Creates connector connection pool in the connector container.
        Parameters:
        connectorPoolObj - ConnectorConnectionPool instance to be bound to JNDI. This object contains the pool properties.
        Throws:
        ConnectorRuntimeException - When creation of pool fails.
      • createConnectorResource

        public void createConnectorResource​(ResourceInfo resourceInfo,
                                            PoolInfo poolInfo,
                                            String resourceType)
                                     throws ConnectorRuntimeException
        Creates the connector resource on a given connection pool
        Parameters:
        resourceInfo - JNDI name of the resource to be created
        poolInfo - to which the connector resource belongs.
        resourceType - Unused.
        Throws:
        ConnectorRuntimeException - If the resouce creation fails.
      • getDefaultResourceName

        public String getDefaultResourceName​(String moduleName,
                                             String connectionDefName)
        Returns the generated default connector resource for a connection definition.
        Parameters:
        moduleName - rar module name
        connectionDefName - connection definition name
        Returns:
        generated default connector resource name
      • getResourceAdapterLogWriter

        public PrintWriter getResourceAdapterLogWriter()
        Provides resource adapter log writer to be given to MCF of a resource-adapter
        Returns:
        PrintWriter
      • createActiveResourceAdapter

        public void createActiveResourceAdapter​(String moduleDir,
                                                String moduleName,
                                                ClassLoader loader)
                                         throws ConnectorRuntimeException
        Creates Active resource Adapter which abstracts the rar module. During the creation of ActiveResourceAdapter, default pools and resources also are created.
        Specified by:
        createActiveResourceAdapter in interface ConnectorRuntime
        Parameters:
        moduleDir - Directory where rar module is exploded.
        moduleName - Name of the module
        loader - Classloader used to load the .rar
        Throws:
        ConnectorRuntimeException - if creation fails.
      • createActiveResourceAdapter

        public void createActiveResourceAdapter​(ConnectorDescriptor connectorDescriptor,
                                                String moduleName,
                                                String moduleDir)
                                         throws ConnectorRuntimeException
        Creates Active resource Adapter which abstracts the rar module. During the creation of ActiveResourceAdapter, default pools and resources also are created.
        Parameters:
        connectorDescriptor - object which abstracts the connector deployment descriptor i.e rar.xml and sun-ra.xml.
        moduleName - Name of the module
        moduleDir - Directory where rar module is exploded.
        Throws:
        ConnectorRuntimeException - if creation fails.
      • obtainManagedConnectionFactory

        public jakarta.resource.spi.ManagedConnectionFactory obtainManagedConnectionFactory​(PoolInfo poolInfo)
                                                                                     throws ConnectorRuntimeException
        Returns the MCF instance. If the MCF is already created and present in connectorRegistry that instance is returned. Otherwise it is created explicitly and added to ConnectorRegistry.
        Specified by:
        obtainManagedConnectionFactory in interface ConnectorRuntime
        Parameters:
        poolInfo - Name of the pool.MCF pertaining to this pool is created/returned.
        Returns:
        created/already present MCF instance
        Throws:
        ConnectorRuntimeException - if creation/retrieval of MCF fails
      • obtainManagedConnectionFactory

        public jakarta.resource.spi.ManagedConnectionFactory obtainManagedConnectionFactory​(PoolInfo poolInfo,
                                                                                            Hashtable env)
                                                                                     throws ConnectorRuntimeException
        Returns the MCF instance. If the MCF is already created and present in connectorRegistry that instance is returned. Otherwise it is created explicitly and added to ConnectorRegistry.
        Specified by:
        obtainManagedConnectionFactory in interface ConnectorRuntime
        Parameters:
        poolInfo - Name of the pool.MCF pertaining to this pool is created/returned.
        env - Environment entries to use for lookup
        Returns:
        created/already present MCF instance
        Throws:
        ConnectorRuntimeException - if creation/retrieval of MCF fails
      • obtainManagedConnectionFactories

        public jakarta.resource.spi.ManagedConnectionFactory[] obtainManagedConnectionFactories​(PoolInfo poolInfo)
                                                                                         throws ConnectorRuntimeException
        Returns the MCF instances in scenarions where a pool has to return multiple mcfs. Should be used only during JMS RA recovery.
        Parameters:
        poolInfo - Name of the pool.MCFs pertaining to this pool is created/returned.
        Returns:
        created MCF instances
        Throws:
        ConnectorRuntimeException - if creation/retrieval of MCFs fails
      • obtainConnectionManager

        public jakarta.resource.spi.ConnectionManager obtainConnectionManager​(PoolInfo poolInfo,
                                                                              boolean forceNoLazyAssoc,
                                                                              ResourceInfo resourceInfo)
                                                                       throws ConnectorRuntimeException
        provides connection manager for a pool
        Parameters:
        poolInfo - pool name
        forceNoLazyAssoc - when set to true, lazy association feature will be turned off (even if it is ON via pool attribute)
        Returns:
        ConnectionManager for the pool
        Throws:
        ConnectorRuntimeException - when unable to provide a connection manager
      • lookupPMResource

        public Object lookupPMResource​(ResourceInfo resourceInfo,
                                       boolean force)
                                throws NamingException
        Does lookup of "__pm" datasource. If found, it will be returned.

        If not found and force is true, this api will try to get a wrapper datasource specified by the jdbcjndi name. The motivation for having this API is to provide the CMP backend/ JPA-Java2DB a means of acquiring a connection during the codegen phase. If a user is trying to deploy an JPA-Java2DB app on a remote server, without this API, a resource reference has to be present both in the DAS and the server instance. This makes the deployment more complex for the user since a resource needs to be forcibly created in the DAS Too. This API will mitigate this need. When the resource is not enabled, datasource wrapper provided will not be of type "__pm"

        Specified by:
        lookupPMResource in interface ConnectorRuntime
        Parameters:
        resourceInfo - jndi name of the resource
        force - provide the resource (in DAS) even if it is not enabled in DAS
        Returns:
        DataSource representing the resource.
        Throws:
        NamingException - when not able to get the datasource.
      • lookupPMResource

        public Object lookupPMResource​(String jndiName,
                                       boolean force)
                                throws NamingException
        Does lookup of "__pm" datasource. If found, it will be returned.

        If not found and force is true, this api will try to get a wrapper datasource specified by the jdbcjndi name. The motivation for having this API is to provide the CMP backend/ JPA-Java2DB a means of acquiring a connection during the codegen phase. If a user is trying to deploy an JPA-Java2DB app on a remote server, without this API, a resource reference has to be present both in the DAS and the server instance. This makes the deployment more complex for the user since a resource needs to be forcibly created in the DAS Too. This API will mitigate this need. When the resource is not enabled, datasource wrapper provided will not be of type "__pm"

        Specified by:
        lookupPMResource in interface ConnectorRuntime
        Parameters:
        jndiName - jndi name of the resource
        force - provide the resource (in DAS) even if it is not enabled in DAS
        Returns:
        DataSource representing the resource.
        Throws:
        NamingException - when not able to get the datasource.
      • lookupNonTxResource

        public Object lookupNonTxResource​(String jndiName,
                                          boolean force)
                                   throws NamingException
        Does lookup of non-tx-datasource. If found, it will be returned.

        If not found and force is true, this api will try to get a wrapper datasource specified by the jdbcjndi name. The motivation for having this API is to provide the CMP backend/ JPA-Java2DB a means of acquiring a connection during the codegen phase. If a user is trying to deploy an JPA-Java2DB app on a remote server, without this API, a resource reference has to be present both in the DAS and the server instance. This makes the deployment more complex for the user since a resource needs to be forcibly created in the DAS Too. This API will mitigate this need.

        Specified by:
        lookupNonTxResource in interface ConnectorRuntime
        Parameters:
        jndiName - jndi name of the resource
        force - provide the resource (in DAS) even if it is not enabled in DAS
        Returns:
        DataSource representing the resource.
        Throws:
        NamingException - when not able to get the datasource.
      • lookupNonTxResource

        public Object lookupNonTxResource​(ResourceInfo resourceInfo,
                                          boolean force)
                                   throws NamingException
        Does lookup of non-tx-datasource. If found, it will be returned.

        If not found and force is true, this api will try to get a wrapper datasource specified by the jdbcjndi name. The motivation for having this API is to provide the CMP backend/ JPA-Java2DB a means of acquiring a connection during the codegen phase. If a user is trying to deploy an JPA-Java2DB app on a remote server, without this API, a resource reference has to be present both in the DAS and the server instance. This makes the deployment more complex for the user since a resource needs to be forcibly created in the DAS Too. This API will mitigate this need.

        Specified by:
        lookupNonTxResource in interface ConnectorRuntime
        Parameters:
        resourceInfo - jndi name of the resource
        force - provide the resource (in DAS) even if it is not enabled in DAS
        Returns:
        DataSource representing the resource.
        Throws:
        NamingException - when not able to get the datasource.
      • getConnection

        public Connection getConnection​(ResourceInfo resourceInfo,
                                        String user,
                                        String password)
                                 throws SQLException
        Get a sql connection from the DataSource specified by the jdbcJndiName. This API is intended to be used in the DAS. The motivation for having this API is to provide the CMP backend a means of acquiring a connection during the codegen phase. If a user is trying to deploy an app on a remote server, without this API, a resource reference has to be present both in the DAS and the server instance. This makes the deployment more complex for the user since a resource needs to be forcibly created in the DAS Too. This API will mitigate this need.
        Parameters:
        resourceInfo - the jndi name of the resource being used to get Connection from This resource can either be a pmf resource or a jdbc resource
        user - the user used to authenticate this request
        password - the password used to authenticate this request
        Returns:
        a java.sql.Connection
        Throws:
        SQLException - in case of errors
      • getConnection

        public Connection getConnection​(ResourceInfo resourceInfo)
                                 throws SQLException
        Get a sql connection from the DataSource specified by the jdbcJndiName. This API is intended to be used in the DAS. The motivation for having this API is to provide the CMP backend a means of acquiring a connection during the codegen phase. If a user is trying to deploy an app on a remote server, without this API, a resource reference has to be present both in the DAS and the server instance. This makes the deployment more complex for the user since a resource needs to be forcibly created in the DAS Too. This API will mitigate this need.
        Parameters:
        resourceInfo - the jndi name of the resource being used to get Connection from This resource can either be a pmf resource or a jdbc resource
        Returns:
        a java.sql.Connection
        Throws:
        SQLException - in case of errors
      • getConnectionDefinitionPropertiesAndDefaults

        public Map<String,​Object> getConnectionDefinitionPropertiesAndDefaults​(String connectionDefinitionClassName,
                                                                                     String resType)
        Gets the properties of the Java bean connection definition class that have setter methods defined and the default values as provided by the Connection Definition java bean developer. This method is used to get properties of jdbc-data-source
        To get Connection definition properties for Connector Connection Pool, use ConnectorRuntime.getMCFConfigProperties()
        When the connection definition class is not found, standard JDBC properties (of JDBC 3.0 Specification) will be returned.
        Specified by:
        getConnectionDefinitionPropertiesAndDefaults in interface ConnectorRuntime
        Parameters:
        connectionDefinitionClassName - The Connection Definition Java bean class for which overrideable properties are required.
        resType - resource-type
        Returns:
        Map String represents property name and Object is the defaultValue that is a primitive type or String.
      • getBuiltInCustomResources

        public Map<String,​String> getBuiltInCustomResources()
        Provides the list of built in custom resources by resource-type and factory-class-name pair.
        Specified by:
        getBuiltInCustomResources in interface ConnectorRuntime
        Returns:
        map of resource-type & factory-class-name
      • getSecurityPermissionSpec

        public String getSecurityPermissionSpec​(String moduleName)
                                         throws ConnectorRuntimeException
        Obtains the Permission string that needs to be added to the to the security policy files. These are the security permissions needed by the resource adapter implementation classes. These strings are obtained by parsing the ra.xml and by processing annotations if any
        Specified by:
        getSecurityPermissionSpec in interface ConnectorRuntime
        Parameters:
        moduleName - rar module Name
        Returns:
        security permission spec
        Throws:
        ConnectorRuntimeException - If rar.xml parsing or annotation processing fails.
      • hasAdminObject

        public boolean hasAdminObject​(String rarName,
                                      String intfName,
                                      String className)
                               throws ConnectorRuntimeException
        checks whether the specified intfName, className has presence in admin objects of the RAR
        Specified by:
        hasAdminObject in interface ConnectorRuntime
        Parameters:
        rarName - resource-adapter name
        intfName - admin object interface name
        className - admin object class name
        Returns:
        boolean indicating the presence of admin object
        Throws:
        ConnectorRuntimeException - when unable to determine the presence
      • getResourceAdapterConfigProps

        public Map<String,​String> getResourceAdapterConfigProps​(String rarName)
                                                               throws ConnectorRuntimeException
        Retrieves the Resource adapter javabean properties with default values. The default values will the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned. If the Resource Adapter Java bean is annotated, properties will be the result of merging annotated config property and config-property of Resource Adapter bean in ra.xml
        Specified by:
        getResourceAdapterConfigProps in interface ConnectorRuntime
        Parameters:
        rarName - rar module name
        Returns:
        Resource adapter javabean properties with default values.
        Throws:
        ConnectorRuntimeException - if property retrieval fails.
      • getMCFConfigProps

        public Map<String,​String> getMCFConfigProps​(String rarName,
                                                          String connectionDefName)
                                                   throws ConnectorRuntimeException
        Retrieves the MCF javabean properties with default values. The default values will the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned. If the ManagedConnectionFactory Java bean is annotated, properties will be the result of merging annotated config property and config-property of MCF in ra.xml
        Specified by:
        getMCFConfigProps in interface ConnectorRuntime
        Parameters:
        rarName - rar module name
        connectionDefName - connection-definition-name
        Returns:
        managed connection factory javabean properties with default values.
        Throws:
        ConnectorRuntimeException - if property retrieval fails.
      • getAdminObjectConfigProps

        public Map<String,​String> getAdminObjectConfigProps​(String rarName,
                                                                  String adminObjectIntf)
                                                           throws ConnectorRuntimeException
        Retrieves the admin object javabean properties with default values. The default values will the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned. If the AdministeredObject Java bean is annotated, properties will be the result of merging annotated config property and config-property of AdministeredObject in ra.xml
        Specified by:
        getAdminObjectConfigProps in interface ConnectorRuntime
        Parameters:
        rarName - rar module name
        adminObjectIntf - admin-object-interface name
        Returns:
        admin object javabean properties with default values.
        Throws:
        ConnectorRuntimeException - if property retrieval fails.
      • getAdminObjectConfigProps

        public Map<String,​String> getAdminObjectConfigProps​(String rarName,
                                                                  String adminObjectIntf,
                                                                  String adminObjectClass)
                                                           throws ConnectorRuntimeException
        Retrieves the admin object javabean properties with default values. The default values will the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned. If the AdministeredObject Java bean is annotated, properties will be the result of merging annotated config property and config-property of AdministeredObject in ra.xml
        Specified by:
        getAdminObjectConfigProps in interface ConnectorRuntime
        Parameters:
        rarName - rar module name
        adminObjectIntf - admin-object-interface name
        adminObjectClass - admin-object-class name
        Returns:
        admin object javabean properties with default values.
        Throws:
        ConnectorRuntimeException - if property retrieval fails.
      • getConnectorConfigJavaBeans

        public Map<String,​String> getConnectorConfigJavaBeans​(String rarName,
                                                                    String connectionDefName,
                                                                    String type)
                                                             throws ConnectorRuntimeException
        Retrieves the XXX javabean properties with default values. The javabean to introspect/retrieve is specified by the type. The default values will be the values present in the ra.xml. If the value is not present in ra.xxml, javabean is introspected to obtain the default value present, if any. If intrspection fails or null is the default value, empty string is returned. If ra.xml has only the property and no value, empty string is the value returned.
        Specified by:
        getConnectorConfigJavaBeans in interface ConnectorRuntime
        Parameters:
        rarName - rar module name
        connectionDefName - connection definition name
        type - JavaBean type to introspect
        Returns:
        admin object javabean properties with default values.
        Throws:
        ConnectorRuntimeException - if property retrieval fails.
      • getMessageListenerConfigProps

        public Map<String,​String> getMessageListenerConfigProps​(String rarName,
                                                                      String messageListenerType)
                                                               throws ConnectorRuntimeException
        Parses the ra.xml for the ActivationSpec javabean properties and processes annotations if any. The ActivationSpec to be parsed is identified by the moduleDir where ra.xml is present and the message listener type. message listener type will be unique in a given ra.xml. It throws ConnectorRuntimeException if either or both the parameters are null, if corresponding rar is not deployed, if message listener type mentioned as parameter is not found in ra.xml. If rar is deployed and message listener (type mentioned) is present but no properties are present for the corresponding message listener, null is returned.
        Specified by:
        getMessageListenerConfigProps in interface ConnectorRuntime
        Parameters:
        rarName - name of the rar module.
        messageListenerType - message listener type.It is uniqie across all sub-elements in element in a given rar.
        Returns:
        Javabean properties with the property names and values of properties. The property values will be the values mentioned in ra.xml if present. Otherwise it will be the default values obtained by introspecting the javabean. In both the case if no value is present, empty String is returned as the value.
        Throws:
        ConnectorRuntimeException - if either of the parameters are null. If corresponding rar is not deployed i.e moduleDir is invalid. If messagelistener type is not found in ra.xml or could not be found in annotations if any
      • getMessageListenerConfigPropTypes

        public Map<String,​String> getMessageListenerConfigPropTypes​(String rarName,
                                                                          String messageListenerType)
                                                                   throws ConnectorRuntimeException
        Returns the Properties object consisting of propertyname as the key and datatype as the value.
        Specified by:
        getMessageListenerConfigPropTypes in interface ConnectorRuntime
        Parameters:
        rarName - name of the rar module.
        messageListenerType - message listener type.It is uniqie across all sub-elements in element in a given rar.
        Returns:
        Properties object with the property names(key) and datatype of property(as value).
        Throws:
        ConnectorRuntimeException - if either of the parameters are null. If corresponding rar is not deployed i.e moduleDir is invalid. If messagelistener type is not found in ra.xmlor could not be found in annotations if any
      • switchOnMatching

        public void switchOnMatching​(String rarName,
                                     PoolInfo poolInfo)
        Causes pool to switch on the matching of connections. It can be either directly on the pool or on the ConnectorConnectionPool object that is bound in JNDI.
        Parameters:
        rarName - Name of Resource Adpater.
        poolInfo - Name of the pool.
      • switchOnMatchingInJndi

        public void switchOnMatchingInJndi​(PoolInfo poolInfo)
                                    throws ConnectorRuntimeException
        Causes matching to be switched on the ConnectorConnectionPool bound in JNDI
        Parameters:
        poolInfo - Name of the pool
        Throws:
        ConnectorRuntimeException - when unable to set matching via jndi object
      • postConstruct

        public void postConstruct()
        The component has been injected with any dependency and will be placed into commission by the subsystem.
        Specified by:
        postConstruct in interface org.glassfish.hk2.api.PostConstruct
      • isConnectorConnectionPoolDeployed

        public boolean isConnectorConnectionPoolDeployed​(PoolInfo poolInfo)
        Checks if a conncetor connection pool has been deployed to this server instance
        Parameters:
        poolInfo - connection pool name
        Returns:
        boolean indicating whether the resource is deployed or not
      • reconfigureConnectorConnectionPool

        public boolean reconfigureConnectorConnectionPool​(ConnectorConnectionPool ccp,
                                                          Set excludedProps)
                                                   throws ConnectorRuntimeException
        Reconfigure a connection pool. This method compares the passed connector connection pool with the one in memory. If the pools are unequal and the MCF properties are changed a pool recreate is required. However if the pools are unequal and the MCF properties are not changed a recreate is not required
        Parameters:
        ccp - - the Updated connector connection pool object that admin hands over
        excludedProps - - A set of excluded property names that we want to be excluded in the comparison check while comparing MCF properties
        Returns:
        true - if a pool restart is required, false otherwise
        Throws:
        ConnectorRuntimeException - when unable to reconfigure ccp
      • recreateConnectorConnectionPool

        public void recreateConnectorConnectionPool​(ConnectorConnectionPool ccp)
                                             throws ConnectorRuntimeException
        Recreate a connector connection pool. This method essentially does the following things: 1. Delete the said connector connection pool
        2. Bind the pool to JNDI
        3. Create an MCF for this pool and register with the connector registry
        Parameters:
        ccp - - the ConnectorConnectionPool to publish
        Throws:
        ConnectorRuntimeException - when unable to recreate ccp
      • createConnectorConnectionPool

        public void createConnectorConnectionPool​(ConnectorConnectionPool ccp,
                                                  String connectionDefinitionName,
                                                  String rarName,
                                                  List<Property> props,
                                                  List<SecurityMap> securityMaps)
                                           throws ConnectorRuntimeException
        Creates connector connection pool in the connector container.
        Parameters:
        ccp - ConnectorConnectionPool instance to be bound to JNDI. This object contains the pool properties.
        connectionDefinitionName - Connection definition name against which connection pool is being created
        rarName - Name of the resource adapter
        props - Properties of MCF which are present in domain.xml These properties override the ones present in ra.xml
        securityMaps - Array fo security maps.
        Throws:
        ConnectorRuntimeException - When creation of pool fails.
      • getTimer

        public Timer getTimer()
      • getResourceReferenceDescriptor

        public Set getResourceReferenceDescriptor()
        get resource reference descriptors from current component's jndi environment
        Specified by:
        getResourceReferenceDescriptor in interface ConnectorRuntime
        Returns:
        set of resource-refs
      • preDestroy

        public void preDestroy()
        The component is about to be removed from commission
        Specified by:
        preDestroy in interface org.glassfish.hk2.api.PreDestroy
      • getAuthenticationService

        public AuthenticationService getAuthenticationService​(String rarName,
                                                              PoolInfo poolInfo)
        Obtain the authentication service associated with rar module. Currently only the BasicPassword authentication is supported.
        Parameters:
        rarName - Rar module Name
        poolInfo - Name of the pool. Used for creation of BasicPasswordAuthenticationService
        Returns:
        AuthenticationService connector runtime's authentication service
      • isEmbedded

        public boolean isEmbedded()
        Checks whether the executing environment is embedded
        Specified by:
        isEmbedded in interface ConnectorRuntime
        Returns:
        true if execution environment is embedded
      • isNonACCRuntime

        public boolean isNonACCRuntime()
        Checks whether the executing environment is non-acc (standalone)
        Returns:
        true if execution environment is non-acc (standalone)
      • isServer

        public boolean isServer()
        Checks whether the executing environment is application server
        Specified by:
        isServer in interface ConnectorRuntime
        Returns:
        true if execution environment is server false if it is client
      • isACCRuntime

        public boolean isACCRuntime()
        Checks whether the executing environment is appclient container runtime
        Returns:
        true if execution environment is appclient container false if it is not ACC
      • getTransaction

        public jakarta.transaction.Transaction getTransaction()
                                                       throws jakarta.transaction.SystemException
        provides the current transaction
        Returns:
        Transaction
        Throws:
        jakarta.transaction.SystemException - when unable to get the transaction
      • pingConnectionPool

        public boolean pingConnectionPool​(PoolInfo poolInfo)
                                   throws jakarta.resource.ResourceException
        Description copied from interface: ConnectorRuntime
        Tests whether the configuration for the pool is valid by making a connection.
        Specified by:
        pingConnectionPool in interface ConnectorRuntime
        Returns:
        boolean indicating ping status
        Throws:
        jakarta.resource.ResourceException - when unable to ping
      • getWorkManagerProxy

        public jakarta.resource.spi.work.WorkManager getWorkManagerProxy​(String poolId,
                                                                         String moduleName,
                                                                         ClassLoader rarCL)
                                                                  throws ConnectorRuntimeException
        provides work manager proxy that is Serializable
        Parameters:
        poolId - ThreadPoolId
        moduleName - resource-adapter name
        rarCL - classloader of the resource-adapter
        Returns:
        WorkManager
        Throws:
        ConnectorRuntimeException - when unable to get work manager
      • getXATerminatorProxy

        public jakarta.resource.spi.XATerminator getXATerminatorProxy​(String moduleName)
        provides XATerminator proxy that is Serializable
        Parameters:
        moduleName - resource-adapter name
        Returns:
        XATerminator
      • removeWorkManagerProxy

        public void removeWorkManagerProxy​(String moduleName)
      • createConnectorClassLoader

        public ClassLoader createConnectorClassLoader​(String moduleDirectory,
                                                      ClassLoader parent,
                                                      String rarModuleName)
                                               throws ConnectorRuntimeException
        Given the module directory, creates a connector-class-finder (class-loader) for the module
        Specified by:
        createConnectorClassLoader in interface ConnectorRuntime
        Parameters:
        moduleDirectory - rar module directory for which classloader is needed
        parent - parent classloader
        For standalone rars, pass null, as the parent should be common-class-loader that will be automatically taken care by ConnectorClassLoaderService.
        For embedded rars, parent is necessary
        Returns:
        classloader created for the module
        Throws:
        ConnectorRuntimeException - when unable to create classloader
      • registerConnectorApplication

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

        public void unregisterConnectorApplication​(String rarName)
        unregister the connector application from registry
        Parameters:
        rarName - resource-adapter name
      • undeployResourcesOfModule

        public void undeployResourcesOfModule​(String rarName)
        undeploy resources of the module
        Parameters:
        rarName - resource-adapter name
      • deployResourcesOfModule

        public void deployResourcesOfModule​(String rarName)
        deploy resources of the module
        Parameters:
        rarName - resource-adapter name
      • getDomain

        public Domain getDomain()
      • checkAccessibility

        public boolean checkAccessibility​(String rarName,
                                          ClassLoader loader)
        Check whether ClassLoader is permitted to access this resource adapter. If the RAR is deployed and is not a standalone RAR, then only the ClassLoader that loaded the archive (any of its child) should be able to access it. Otherwise everybody can access the RAR.
        Parameters:
        rarName - Resource adapter module name.
        loader - ClassLoader to verify.
      • registerDataSourceDefinitions

        public void registerDataSourceDefinitions​(Application application)
        Used to register data-source-definitions at an earlier stage of deployment (prepare phase). This is used to register "java:global" and "java:app" scoped DataSourceDefinitions which can be referred by JPA in persistence.xml
        Specified by:
        registerDataSourceDefinitions in interface ConnectorRuntime
        Parameters:
        application - Application being deployed.
      • unRegisterDataSourceDefinitions

        public void unRegisterDataSourceDefinitions​(Application application)
        Used to unRegister data-source-definitions at an later stage of undeploy operation. This is used to unRegister "java:global" and "java:app" scoped DataSourceDefinitions which can be referred by JPA in persistence.xml
        Specified by:
        unRegisterDataSourceDefinitions in interface ConnectorRuntime
        Parameters:
        application - Application being undeployed.
      • registerMailSessions

        public void registerMailSessions​(Application application)
      • unRegisterMailSessions

        public void unRegisterMailSessions​(Application application)
      • getWorkSecurityMap

        public List<WorkSecurityMap> getWorkSecurityMap​(String raName)
        get work security maps for a resource-adapter-name
        Specified by:
        getWorkSecurityMap in interface ConnectorRuntime
        Parameters:
        raName - resource-adapter name
        Returns:
        all work security maps of a resource-adapter
      • getResources

        public Resources getResources()
      • getShutdownTimeout

        public long getShutdownTimeout()
        Description copied from interface: ConnectorRuntime
        Gets the shutdown-timeout attribute configured in connector-service
        Specified by:
        getShutdownTimeout in interface ConnectorRuntime
        Returns:
        long shutdown timeout (in milli-seconds)
      • getJdbcDriverClassNames

        public Set<String> getJdbcDriverClassNames​(String dbVendor,
                                                   String resType)
        Get jdbc driver implementation class names list for the dbVendor and resource type supplied.
        Specified by:
        getJdbcDriverClassNames in interface ConnectorRuntime
        Parameters:
        dbVendor -
        resType -
        Returns:
        all jdbc driver implementation class names
      • getJdbcDriverClassNames

        public Set<String> getJdbcDriverClassNames​(String dbVendor,
                                                   String resType,
                                                   boolean introspect)
        Get jdbc driver implementation class names list for the dbVendor and resource type supplied. If introspect is true, classnames are got from introspection of the jdbc driver jar. Else a pre-defined list is used to retrieve the class names.
        Specified by:
        getJdbcDriverClassNames in interface ConnectorRuntime
        Parameters:
        dbVendor -
        resType -
        introspect -
        Returns:
        all jdbc driver implementation class names
      • getConnectorBeanValidator

        public ConnectorJavaBeanValidator getConnectorBeanValidator()
        returns the bean validator that can be used to validate various connector bean artifacts (ResourceAdapter, ManagedConnetionFactory, AdministeredObject, ActivationSpec)
        Returns:
        ConnectorBeanValidator
      • isJdbcPoolMonitoringEnabled

        public boolean isJdbcPoolMonitoringEnabled()
      • isConnectorPoolMonitoringEnabled

        public boolean isConnectorPoolMonitoringEnabled()
      • associateResourceAdapter

        public void associateResourceAdapter​(String rarName,
                                             jakarta.resource.spi.ResourceAdapterAssociation raa)
                                      throws jakarta.resource.ResourceException
        Description copied from interface: ConnectorRuntime
        associates the given instance of ResourceAdapterAssociation with the ResourceAdapter java-bean of the specified RAR
        Specified by:
        associateResourceAdapter in interface ConnectorRuntime
        Parameters:
        rarName - resource-adapter-name
        raa - Object that is an instance of ResourceAdapterAssociation
        Throws:
        jakarta.resource.ResourceException - when unable to associate the RA Bean with RAA instance.
      • getGlobalResourceManager

        public ResourceManager getGlobalResourceManager()