FileDocCategorySizeDatePackage
ConnectorRuntime.javaAPI DocGlassfish v2 API49708Thu Jul 26 03:27:26 BST 2007com.sun.enterprise.connectors

ConnectorRuntime

public final class ConnectorRuntime extends Object implements ConnectorConstants
This class is the entry point to connector backend module. It exposes different API's called by external entities like 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 and Aditya Gore

Fields Summary
static final Logger
_logger
private volatile int
environment
private final ConnectorAdminObjectAdminServiceImpl
adminObjectAdmService
private final ConnectorConfigurationParserServiceImpl
configParserAdmService
private final ConnectorConnectionPoolAdminServiceImpl
ccPoolAdmService
private final ConnectorResourceAdminServiceImpl
connectorResourceAdmService
private final ConnectorSecurityAdminServiceImpl
connectorSecurityAdmService
private final ResourceAdapterAdminServiceImpl
resourceAdapterAdmService
private final ConnectorServiceImpl
connectorService
private boolean
isSystemResourcesLoaded
private static final ConnectorRuntime
_runtime
Constructors Summary
private ConnectorRuntime()
Private constructor. It is private as it follows singleton pattern.

        com.sun.enterprise.util.Utility.setEnvironment();
        adminObjectAdmService = (ConnectorAdminObjectAdminServiceImpl)
           ConnectorAdminServicesFactory.getService(ConnectorAdminService.AOR);
        ccPoolAdmService = ( ConnectorConnectionPoolAdminServiceImpl)
           ConnectorAdminServicesFactory.getService(ConnectorAdminService.CCP);
        connectorResourceAdmService = ( ConnectorResourceAdminServiceImpl)
           ConnectorAdminServicesFactory.getService(ConnectorAdminService.CR);
        connectorSecurityAdmService = ( ConnectorSecurityAdminServiceImpl)
           ConnectorAdminServicesFactory.getService(ConnectorAdminService.SEC);
        resourceAdapterAdmService = ( ResourceAdapterAdminServiceImpl)
           ConnectorAdminServicesFactory.getService(ConnectorAdminService.RA);
        configParserAdmService = new ConnectorConfigurationParserServiceImpl();
        connectorService = new ConnectorServiceImpl();
    
Methods Summary
public voidaddAdminObject(java.lang.String appName, java.lang.String connectorName, java.lang.String jndiName, java.lang.String adminObjectType, java.util.Properties props)

        adminObjectAdmService.addAdminObject(
                  appName,connectorName,jndiName,adminObjectType,props);
    
public voidaddResourceAdapterConfig(java.lang.String rarName, ResourceAdapterConfig raConfig)
Add the resource adapter configuration to the connector registry

param
rarName rarmodule
param
raConfig Resource Adapter configuration object
throws
ConnectorRuntimeExcetion if the addition fails.

        resourceAdapterAdmService.addResourceAdapterConfig(rarName,raConfig);
    
public booleancheckAccessibility(java.lang.String rarName, java.lang.ClassLoader loader)

        return connectorService.checkAccessibility(rarName, loader);
    
public booleancheckAndLoadResource(java.lang.String resName)

        return connectorService.checkAndLoadResource(resName);
    
public voidcreateActiveResourceAdapter(ConnectorDescriptor connectorDescriptor, java.lang.String moduleName, java.lang.String moduleDir)
Creates Active resource Adapter which abstracts the rar module. During the creation of ActiveResourceAdapter, default pools and resources also are created.

param
connectorDescriptor object which abstracts the connector deployment descriptor i.e rar.xml and sun-ra.xml.
param
moduleName Name of the module
param
moduleDir Directory where rar module is exploded.
param
writeSunDescriptor If true write the sun-ra.xml props to domain.xml and if false it doesnot write to domain.xml
throws
ConnectorRuntimeException if creation fails.

        resourceAdapterAdmService.createActiveResourceAdapter(
               connectorDescriptor,moduleName,moduleDir);

    
public voidcreateActiveResourceAdapter(java.lang.String moduleDir, java.lang.String moduleName)
Creates Active resource Adapter which abstracts the rar module. During the creation of ActiveResourceAdapter, default pools and resources also are created.

param
moduleDir Directory where rar module is exploded.
param
moduleName Name of the module
param
writeSunDescriptor If true write the sun-ra.xml props to domain.xml and if false it doesnot write to domain.xml
throws
ConnectorRuntimeException if creation fails.

        resourceAdapterAdmService.createActiveResourceAdapter(
           moduleDir,moduleName); 
    
public voidcreateConnectorConnectionPool(ConnectorConnectionPool ccp, java.lang.String connectionDefinitionName, java.lang.String rarName, com.sun.enterprise.config.serverbeans.ElementProperty[] props, com.sun.enterprise.config.serverbeans.SecurityMap[] securityMaps)
Creates connector connection pool in the connector container.

param
ccp ConnectorConnectionPool instance to be bound to JNDI. This object contains the pool properties.
param
connectionDefinitionName Connection definition name against which connection pool is being created
param
rarName Name of the resource adapter
param
props Properties of MCF which are present in domain.xml These properties override the ones present in ra.xml
param
securityMaps Array fo security maps.
throws
ConnectorRuntimeException When creation of pool fails.

        ccPoolAdmService.createConnectorConnectionPool(
                 ccp,connectionDefinitionName,rarName,props,securityMaps);
    
public voidcreateConnectorConnectionPool(ConnectorConnectionPool ccp, ConnectionDefDescriptor cdd, java.lang.String rarName)
Creates connector connection pool in the connector container.

param
ccp ConnectorConnectionPool instance to be bound to JNDI. This object contains the pool properties.
param
cdd ConnectorDescriptor obejct which abstracts the ra.xml
param
rarName Name of the resource adapter
throws
ConnectorRuntimeException When creation of pool fails.

        ccPoolAdmService.createConnectorConnectionPool(ccp,cdd,rarName);

    
public voidcreateConnectorConnectionPool(ConnectorConnectionPool connectorPoolObj)
Creates connector connection pool in the connector container.

param
ccp ConnectorConnectionPool instance to be bound to JNDI. This object contains the pool properties.
throws
ConnectorRuntimeException When creation of pool fails.

        ccPoolAdmService.createConnectorConnectionPool(
                             connectorPoolObj);
    
public voidcreateConnectorConnectionPool(ConnectorConnectionPool connectorPoolObj, java.lang.String security, java.util.Set configProperties)
Creates connector connection pool in the connector container. cannot be used for 1.5 rar cases

param
ccp ConnectorConnectionPool instance to be bound to JNDI. This object contains the pool properties.
param
security unused
param
configProperties MCF config properties
throws
ConnectorRuntimeException When creation of pool fails.

        ccPoolAdmService.createConnectorConnectionPool(
                             connectorPoolObj,security,configProperties);
    
public voidcreateConnectorResource(java.lang.String jndiName, java.lang.String poolName, java.lang.String resourceType)
Creates the connector resource on a given connection pool

param
jndiName JNDI name of the resource to be created
poolName
PoolName to which the connector resource belongs.
resourceType
Resource type Unused.
throws
ConnectorRuntimeException If the resouce creation fails.


        connectorResourceAdmService.createConnectorResource(
                                 jndiName,poolName,resourceType);
    
public voiddeleteAdminObject(java.lang.String jndiName)

        adminObjectAdmService.deleteAdminObject(jndiName);

    
public voiddeleteConnectorConnectionPool(java.lang.String poolName)
Deletes connector Connection pool

param
poolName Name of the pool to delete
throws
ConnectorRuntimeException if pool deletion operation fails

        ccPoolAdmService.deleteConnectorConnectionPool(poolName);
    
public voiddeleteConnectorConnectionPool(java.lang.String poolName, boolean cascade)
Deletes connector Connection pool.

param
poolName Name of the pool to delete
param
cascade If true all the resources associed with that are also deleted from connector container If false and if some resources pertaining to pool are present deletion operation fails . If no resources are present pool is deleted.
throws
ConnectorRuntimeException if pool deletion operation fails


        ccPoolAdmService.deleteConnectorConnectionPool(poolName,cascade);
    
public voiddeleteConnectorResource(java.lang.String jndiName)
Deletes the connector resource.

param
jndiName JNDI name of the resource to delete.
throws
ConnectorRuntimeException if connector resource deletion fails.

        connectorResourceAdmService.deleteConnectorResource(jndiName);

    
public voiddeleteResourceAdapterConfig(java.lang.String rarName)
Delete the resource adapter configuration to the connector registry

param
rarName rarmodule

        resourceAdapterAdmService.deleteResourceAdapterConfig(rarName);
    
public voiddestroyActiveResourceAdapter(java.lang.String moduleName)
Destroys/deletes the Active resource adapter object from the connector container. Active resource adapter abstracts the rar deployed. It checks whether any resources (pools and connector resources) are still present. If they are present the deletion fails and all the objects and datastructures pertaining to to the resource adapter are left untouched.

param
moduleName Name of the rarModule to destroy/delete
throws
ConnectorRuntimeException if the deletion fails

        resourceAdapterAdmService.destroyActiveResourceAdapter(moduleName);
    
public voiddestroyActiveResourceAdapter(java.lang.String moduleName, boolean cascade)
Destroys/deletes the Active resource adapter object from the connector container. Active resource adapter abstracts the rar deployed. It checks whether any resources (pools and connector resources) are still present. If they are present and cascade option is false the deletion fails and all the objects and datastructures pertaining to the resource adapter are left untouched. If cascade option is true, even if resources are still present, they are also destroyed with the active resource adapter

param
moduleName Name of the rarModule to destroy/delete
param
cascade If true all the resources belonging to the rar are destroyed recursively. If false, and if resources pertaining to resource adapter /rar are present deletetion is failed. Then cascade should be set to true or all the resources have to deleted explicitly before destroying the rar/Active resource adapter.
throws
ConnectorRuntimeException if the deletion fails

        resourceAdapterAdmService.destroyActiveResourceAdapter(
                                  moduleName,cascade);
    
public java.lang.StringgetActivationSpecClass(java.lang.String rarName, java.lang.String messageListenerType)
Return the ActivationSpecClass name for given rar and messageListenerType

param
moduleDir The directory where rar is exploded.
param
messageListenerType MessageListener type
throws
ConnectorRuntimeException If moduleDir is null. If corresponding rar is not deployed.

        return configParserAdmService.getActivationSpecClass(
                          rarName,messageListenerType);
    
public java.util.PropertiesgetAdminObjectConfigProps(java.lang.String rarName, java.lang.String adminObjectIntf)
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.

param
rarName rar module name
return
admin object javabean properties with default values.
throws
ConnectorRuntimeException if property retrieval fails.

        return 
	    rarName.indexOf( ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER ) == -1
	        ? configParserAdmService.getAdminObjectConfigProps(
		    rarName,adminObjectIntf)
		: new Properties();    
    
public java.lang.String[]getAdminObjectInterfaceNames(java.lang.String rarName)
Obtains all the Admin object interface names of a rar

param
rarName rar moduleName
return
Array of admin object interface names.

        return configParserAdmService.getAdminObjectInterfaceNames(rarName);
    
public AuthenticationServicegetAuthenticationService(java.lang.String rarName, java.lang.String poolName)
Obtain the authentication service associated with rar module. Currently only the BasicPassword authentication is supported.

rarName
Rar module Name
poolName
Name of the pool. Used for creation of BasicPasswordAuthenticationService


        return connectorSecurityAdmService.getAuthenticationService(
                            rarName,poolName);
    
public java.sql.ConnectiongetConnection(java.lang.String jndiName, java.lang.String user, java.lang.String password)
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.

param
jndiName the jndi name of the resource being used to get Connection from This resource can either be a pmf resource or a jdbc resource
param
user the user used to authenticate this request
param
password the password used to authenticate this request
return
a java.sql.Connection
throws
java.sql.SQLException in case of errors

             

	return ccPoolAdmService.getConnection( jndiName, user, password ); 
    
public java.sql.ConnectiongetConnection(java.lang.String jndiName)
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.

param
jndiName the jndi name of the resource being used to get Connection from This resource can either be a pmf resource or a jdbc resource
return
a java.sql.Connection
throws
java.sql.SQLException in case of errors

	return ccPoolAdmService.getConnection( jndiName ); 
    
public java.lang.String[]getConnectionDefinitionNames(java.lang.String rarName)
Obtains all the Connection definition names of a rar

param
rarName rar moduleName
return
Array of connection definition names.

        return configParserAdmService.getConnectionDefinitionNames(rarName);
    
public static java.util.SetgetConnectionDefinitionProperties(java.lang.String connectionDefinitionClassName)
Gets the properties of the Java bean connection definition class that have setter methods defined

param
connectionDefinitionClassName The Connection Definition Java bean class for which overrideable properties are required.
return
A Set of properties that have a setter method defined in the Connection Definition class

        return getRuntime().ccPoolAdmService.getConnectionDefinitionProperties(
            connectionDefinitionClassName);
    
public static java.util.MapgetConnectionDefinitionPropertiesAndDefaults(java.lang.String connectionDefinitionClassName)
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.

param
connectionDefinitionClassName The Connection Definition Java bean class for which overrideable properties are required.
return
Map [property, defaultValue]

        return getRuntime().ccPoolAdmService.getConnectionDefinitionPropertiesAndDefaults(
            connectionDefinitionClassName);
    
public java.util.PropertiesgetConnectorConfigJavaBeans(java.lang.String rarName, java.lang.String connectionDefName, java.lang.String type)
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.

param
rarName rar module name
return
admin object javabean properties with default values.
throws
ConnectorRuntimeException if property retrieval fails.


        return configParserAdmService.getConnectorConfigJavaBeans(
                             rarName,connectionDefName,type);
    
public ConnectorDescriptorgetConnectorDescriptor(java.lang.String rarName)
Obtains the connector Descriptor pertaining to rar. If ConnectorDescriptor is present in registry, it is obtained from registry and returned. Else it is explicitly read from directory where rar is exploded.

param
rarName Name of the rar
return
ConnectorDescriptor pertaining to rar.

        return connectorService.getConnectorDescriptor( rarName );
        
    
public java.lang.StringgetDefaultPoolName(java.lang.String jndiName)
Returns the generated default poolName of JMS resources.

jndiName
jndi of the resources for which pool is to be created,
return
generated poolname

        return connectorService.getDefaultPoolName(jndiName);
    
public java.lang.StringgetDefaultPoolName(java.lang.String moduleName, java.lang.String connectionDefName)
Returns the generated default connection poolName for a connection definition.

moduleName
rar module name
connectionDefName
connection definition name
return
generated connection poolname

        return connectorService.getDefaultPoolName(
                         moduleName,connectionDefName);
    
public java.lang.StringgetDefaultResourceName(java.lang.String moduleName, java.lang.String connectionDefName)
Returns the generated default connector resource for a connection definition.

moduleName
rar module name
connectionDefName
connection definition name
return
generated default connector resource name

        return connectorService.getDefaultResourceName(
                            moduleName,connectionDefName);
    
public intgetEnviron()
Returns the execution environment.

return
ConnectorConstants.SERVER if execution environment is appserv runtime else it returns ConnectorConstants.CLIENT

        return environment;
    
public JmsRaMappinggetJmsRaMapping()

        return resourceAdapterAdmService.getJmsRaMapping();
    
public java.util.PropertiesgetMCFConfigProps(java.lang.String rarName, java.lang.String connectionDefName)
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.

param
rarName rar module name
return
managed connection factory javabean properties with default values.
throws
ConnectorRuntimeException if property retrieval fails.

        return 
	    rarName.indexOf( ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER ) == -1
	        ? configParserAdmService.getMCFConfigProps(
		    rarName,connectionDefName)
	        : new Properties(); 
    
public MQJMXConnectorInfo[]getMQJMXConnectorInfo(java.lang.String target)
Returns a list of MQJMXConnectorInfo associated with the target

       /*
        For getting a JMXConnector for each jms-host defined in jms-service:
        If EMBEDDED/LOCAL and notclustered: get default JMS host from jms-service.
        If MQRA has already been started, get from registry, introspect and get
        the valid properties to construct MQJMXConnector
        If clustered: get all hosts from JMS host information and for each of them
        construct a MQRA instance, and get properties to construct MQJMXConnector
        */
        return MQJMXConnectorHelper.getMQJMXConnectorInfo(target);
    
public java.util.PropertiesgetMessageListenerConfigPropTypes(java.lang.String rarName, java.lang.String messageListenerType)
Returns the Properties object consisting of propertyname as the key and datatype as the value.

param
rarName name of the rar module.
param
messageListenerType message listener type.It is uniqie across all sub-elements in element in a given rar.
return
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.xml

        return configParserAdmService.getMessageListenerConfigPropTypes(
                        rarName,messageListenerType);
    
public java.util.PropertiesgetMessageListenerConfigProps(java.lang.String rarName, java.lang.String messageListenerType)
Parses the ra.xml for the ActivationSpec javabean properties. 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.

param
rarName name of the rar module.
param
messageListenerType message listener type.It is uniqie across all sub-elements in element in a given rar.
return
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

        return 
	    rarName.indexOf( ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER ) == -1
            ? configParserAdmService.getMessageListenerConfigProps(
                        rarName,messageListenerType)
	    : new Properties();		
    
public java.lang.String[]getMessageListenerTypes(java.lang.String rarName)

        return configParserAdmService.getMessageListenerTypes( rarName);
    
public java.util.MapgetResourceAdapterBeanProperties(java.lang.String pathToDeployableUnit)
Returns the configurable ResourceAdapterBean Properties for a connector module bundled as a RAR.

param
pathToDeployableUnit a physical,accessible location of the connector module. [either a RAR for RAR-based deployments or a directory for Directory based deployments]
return
A Map that is of An empty map is returned in the case of a 1.0 RAR

        return configParserAdmService.getRABeanProperties(pathToDeployableUnit);
    
public java.util.PropertiesgetResourceAdapterConfigProps(java.lang.String rarName)
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.

param
rarName rar module name
return
Resource adapter javabean properties with default values.
throws
ConnectorRuntimeException if property retrieval fails.

        return 
	    rarName.indexOf( ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER ) == -1
            ? configParserAdmService.getResourceAdapterConfigProps(rarName)
	    : new Properties();
    
public ConnectorNamingEventNotifiergetResourceRebindEventNotifier()
Gets Connector Resource Rebind Event notifier.

return
ConnectorNamingEventNotifier

        return connectorResourceAdmService.getResourceRebindEventNotifier();
    
public static com.sun.enterprise.connectors.ConnectorRuntimegetRuntime()
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

return
ConnectorRuntime instance

    

                                         

        
        return _runtime;
    
public java.lang.StringgetSecurityPermissionSpec(java.lang.String moduleName)
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

param
moduleName rar module Name
ConnectorRuntimeException
If rar.xml parsing fails.

        return configParserAdmService.getSecurityPermissionSpec(moduleName);
    
public java.lang.String[]getSystemConnectorsAllowingPoolCreation()
Returns the system RAR names that allow pool creation

        return new String[] {
                ConnectorConstants.DEFAULT_JMS_ADAPTER,
                ConnectorConstants.JAXR_RA_NAME};
    
public voidinitialize(int environment)
Initializes the execution environment. If the execution environment is appserv runtime it is set to ConnectorConstants.SERVER else it is set ConnectorConstants.CLIENT

param
environment set to ConnectorConstants.SERVER if execution environment is appserv runtime else set to ConnectorConstants.CLIENT

        this.environment = environment;
        connectorService.initialize(getEnviron());
    
public voidinitializeConnectorMonitoring()
Initialize the monitoring listeners for connection pools, work management and message end point factory related stats

        connectorService.initializeConnectorMonitoring();
    
public booleanisConnectorConnectionPoolDeployed(java.lang.String poolName)
Checks if a conncetor connection pool has been deployed to this server instance

param
poolName
return

        return ccPoolAdmService.isConnectorConnectionPoolDeployed(poolName);
    
public static booleanisJmsRa()

        return ResourceAdapterAdminServiceImpl.isJmsRa();
    
public booleanisRarDeployed(java.lang.String moduleName)
Checks if the rar module is already reployed.

param
moduleName Rarmodule name
return
true if it is already deployed. false if it is not deployed.

        
        return resourceAdapterAdmService.isRarDeployed(moduleName);
    
public static booleanisServer()
Checks whether the executing environment is application server

return
true if execution environment is server false if it is client

        return getRuntime().connectorService.isServer(); 
    
public booleanisValidJndiSuffix(java.lang.String name)
Code that checks whether a jndi suffix is valid or not.

        return connectorResourceAdmService.isValidJndiSuffix(name);
    
public voidkillAllPools(java.lang.String moduleName)
Kills all the pools pertaining to the rar module.

moduleName
Rar module Name

        ccPoolAdmService.killAllPools(moduleName);
    
public voidkillPool(java.lang.String poolName)
Kills a specific pool

param
poolName poolName to kill

        ccPoolAdmService.killPool(poolName);
    
public synchronized voidloadAllSystemRAResources()
Loads all system RA resources not used till now This method is used when user accesses jndi tree.

        if(!isSystemResourcesLoaded){
            ResourcesUtil.createInstance().loadSystemRAResources();
            isSystemResourcesLoaded = true;
        }
    
public voidloadDeferredResourceAdapter(java.lang.String rarName)

        connectorService.loadDeferredResourceAdapter(rarName);
    
public java.lang.Objectlookup(java.lang.String name)
Lookup the JNDI name with appropriate suffix.

param
name : JNDI name to be looked up. This can be suffixed with a proper suffix like __pm or __nontx

        return connectorResourceAdmService.lookup(name);
    
private java.lang.ObjectlookupDataSourceInDAS(java.lang.String jndiName)
Get a wrapper datasource specified by the jdbcjndi name This API is intended to be used in the DAS. 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.

param
jndiName jndi name of the resource
return
DataSource representing the resource.

        return connectorResourceAdmService.lookupDataSourceInDAS(jndiName);
    
public java.lang.ObjectlookupNonTxResource(java.lang.String jndiName, boolean force)
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.

param
jndiName jndi name of the resource
param
force provide the resource (in DAS) even if it is not enabled in DAS
return
DataSource representing the resource.
throws
NamingException when not able to get the datasource.

        Object result ;
        try{
            result = connectorResourceAdmService.lookup(jndiName+NON_TX_JNDI_SUFFIX);
        }catch(NamingException ne){
            if(force && ResourcesUtil.isDAS()){
                _logger.log(Level.FINE, "jdbc.unable_to_lookup_resource",new Object[] {jndiName});
                result = lookupDataSourceInDAS(jndiName);
            }else{
                throw ne;
            }
        }
        return result;
    
public java.lang.ObjectlookupPMResource(java.lang.String jndiName, boolean force)
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"

param
jndiName jndi name of the resource
param
force provide the resource (in DAS) even if it is not enabled in DAS
return
DataSource representing the resource.
throws
NamingException when not able to get the datasource.

        Object result ;
        try{
            result = connectorResourceAdmService.lookup(jndiName+PM_JNDI_SUFFIX);
        }catch(NamingException ne){
            if(force && ResourcesUtil.isDAS()){
                _logger.log(Level.FINE, "jdbc.unable_to_lookup_resource",new Object[] {jndiName});
                result = lookupDataSourceInDAS(jndiName);
            }else{
                throw ne;
            }
        }
        return result;
    
public ConnectionManagerobtainConnectionManager(java.lang.String poolName, boolean forceNoLazyAssoc)

        ConnectionManager mgr = ConnectionManagerFactory.
                getAvailableConnectionManager(poolName, forceNoLazyAssoc);
        return mgr;
    
public ConnectionManagerobtainConnectionManager(java.lang.String poolName)

        return this.obtainConnectionManager( poolName, false );
    
public ManagedConnectionFactory[]obtainManagedConnectionFactories(java.lang.String poolName)
Returns the MCF instances in scenarions where a pool has to return multiple mcfs. Should be used only during JMS RA recovery.

param
poolName Name of the pool.MCFs pertaining to this pool is created/returned.
return
created MCF instances
throws
ConnectorRuntimeException if creation/retrieval of MCFs fails


        return ccPoolAdmService.obtainManagedConnectionFactories(poolName);
    
public ManagedConnectionFactoryobtainManagedConnectionFactory(java.lang.String poolName)
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.

param
poolName Name of the pool.MCF pertaining to this pool is created/returned.
return
created/already present MCF instance
throws
ConnectorRuntimeException if creation/retrieval of MCF fails

        return ccPoolAdmService.obtainManagedConnectionFactory(poolName);
    
public voidreCreateActiveResourceAdapter(java.lang.String moduleName)
The ActiveResourceAdapter object which abstract the rar module is recreated in the connector container/registry. All the pools and resources are killed. But the infrastructure to create the pools and and resources is untouched. Only the actual pool is killed.

param
moduleName rar module Name.
throws
ConnectorRuntimeException if recreation fails.

        resourceAdapterAdmService.reCreateActiveResourceAdapter(moduleName);
    
public booleanreconfigureConnectorConnectionPool(ConnectorConnectionPool ccp)
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

param
ccp - the Updated connector connection pool object that admin hands over
return
true - if a pool restart is required, false otherwise
throws
ConnectorRuntimeException

        return ccPoolAdmService.reconfigureConnectorConnectionPool(ccp);
    
public booleanreconfigureConnectorConnectionPool(ConnectorConnectionPool ccp, java.util.Set excludedProps)
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

param
ccp - the Updated connector connection pool object that admin hands over
param
excludedProps - A set of excluded property names that we want to be excluded in the comparison check while comparing MCF properties
return
true - if a pool restart is required, false otherwise
throws
ConnectorRuntimeException

        return ccPoolAdmService.reconfigureConnectorConnectionPool(
                        ccp,excludedProps);
    
public voidrecreateConnectorConnectionPool(ConnectorConnectionPool ccp)
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

param
ccp - the ConnectorConnectionPool to publish

        ccPoolAdmService.recreateConnectorConnectionPool(ccp);
    
public static voidstopAllActiveResourceAdapters()
Calls the stop method for all J2EE Connector 1.5 spec compliant RARs

        getRuntime().resourceAdapterAdmService.stopAllActiveResourceAdapters();
    
public booleanstopAndRemoveActiveResourceAdapter(java.lang.String moduleName)
Stops the resourceAdapter and removes it from connector container/ registry.

param
moduleName Rarmodule name.
return
true it is successful stop and removal of ActiveResourceAdapter false it stop and removal fails.


         return resourceAdapterAdmService.stopAndRemoveActiveResourceAdapter(
                                             moduleName);
    
public voidswitchOnMatching(java.lang.String rarName, java.lang.String poolName)
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.

param
rarName Name of Resource Adpater.
param
poolName Name of the pool.

        connectorService.switchOnMatching(rarName, poolName);
    
public voidswitchOnMatchingInJndi(java.lang.String poolName)
Causes matching to be switched on the ConnectorConnectionPool bound in JNDI

param
poolName Name of the pool

        ccPoolAdmService.switchOnMatching(poolName);
    
public booleantestConnectionPool(java.lang.String poolName)
This method is used to provide backend functionality for the test-connection-pool asadmin command. Briefly the design is as follows:
1. obtainManagedConnection for the poolname
2. lookup ConnectorDescriptorInfo from InitialContext using poolname
3. from cdi get username and password
4. create ResourcePrincipal using default username and password
5. create a Subject from this (doPriveleged)
6. createManagedConnection using above subject
7. getConnection from the ManagedConnection with above subject

return
true if the connection pool is healthy. false otherwise
throws
ResourceException if pool is not usable

        
        return ccPoolAdmService.testConnectionPool(poolName);