Package com.sun.enterprise.connectors
Class ActiveResourceAdapterImpl
- java.lang.Object
-
- com.sun.enterprise.connectors.ActiveResourceAdapterImpl
-
- All Implemented Interfaces:
ActiveResourceAdapter
- Direct Known Subclasses:
ActiveOutboundResourceAdapter
@Service @PerLookup public class ActiveResourceAdapterImpl extends Object implements ActiveResourceAdapter
This class represents the abstraction of a 1.0 compliant rar. It holds the ra.xml (connector decriptor) values, class loader used to to load the Resource adapter class and managed connection factory and module name (rar) to which it belongs. It is also the base class for ActiveOutboundResourceAdapter(a 1.5 compliant outbound rar).- Author:
- Srikanth P, Binod PG
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectionDefDescriptor[]connectionDefs_protected ConnectorRuntimeconnectorRuntime_protected ConnectorDescriptordesc_protected ClassLoaderjcl_protected StringmoduleName_
-
Constructor Summary
Constructors Constructor Description ActiveResourceAdapterImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcreateAllConnectorResources()Creates both the default connector connection pools and resourcesprotected voidcreateDefaultConnectorConnectionPools(boolean useSunRA)Creates default connector connection poolprotected voidcreateDefaultConnectorResources()Creates default connector resourcejakarta.resource.spi.ManagedConnectionFactory[]createManagedConnectionFactories(ConnectorConnectionPool ccp, ClassLoader jcl)Creates managed Connection factories corresponding to one pool.jakarta.resource.spi.ManagedConnectionFactorycreateManagedConnectionFactory(ConnectorConnectionPool ccp, ClassLoader jcl)Creates managed Connection factory instance.protected voiddeleteDefaultConnectorConnectionPools()Deletes the default connector connection pools.protected voiddeleteDefaultConnectorResources()Deletes the default connector resources.voiddestroy()uninitializes the resource adapter.protected voiddestroyAllConnectorResources()Deletes both the default connector connection pools and resourcesClassLoadergetClassLoader()Returns the class loader that is used to load the RAR.ConnectorDescriptorgetDescriptor()Returns the Connector descriptor which represents/holds ra.xmlStringgetModuleName()Returns the module Name of the RARjakarta.resource.spi.ResourceAdaptergetResourceAdapter()Retrieves the resource adapter java bean.booleanhandles(ConnectorDescriptor cd, String moduleName)Indicates whether a particular implementation of ActiveRA can handle the RAR in question.voidinit(jakarta.resource.spi.ResourceAdapter ra, ConnectorDescriptor desc, String moduleName, ClassLoader jcl)Constructor.protected jakarta.resource.spi.ManagedConnectionFactoryinstantiateMCF(String mcfClass, ClassLoader loader)protected booleanisServer()Check if the execution environment is appserver runtime or application client container.protected booleanisSystemRar(String moduleName)voidsetup()It initializes the resource adapter.
-
-
-
Field Detail
-
desc_
protected ConnectorDescriptor desc_
-
moduleName_
protected String moduleName_
-
jcl_
protected ClassLoader jcl_
-
connectionDefs_
protected ConnectionDefDescriptor[] connectionDefs_
-
connectorRuntime_
protected ConnectorRuntime connectorRuntime_
-
-
Method Detail
-
init
public void init(jakarta.resource.spi.ResourceAdapter ra, ConnectorDescriptor desc, String moduleName, ClassLoader jcl) throws ConnectorRuntimeExceptionConstructor.- Specified by:
initin interfaceActiveResourceAdapter- Parameters:
desc- Connector Descriptor. Holds the all ra.xml valuesmoduleName- Name of the module i.e rar Name. Incase of embedded resource adapters its name will be appName#rarNamejcl- Classloader used to load the ResourceAdapter and managed connection factory class. values to domain.xml.ra- resource-adapter bean- Throws:
ConnectorRuntimeException- when unable to initialize the runtime RA
-
getModuleName
public String getModuleName()
Returns the module Name of the RAR- Specified by:
getModuleNamein interfaceActiveResourceAdapter- Returns:
- A
Stringrepresenting the name of the connector module
-
setup
public void setup() throws ConnectorRuntimeExceptionIt initializes the resource adapter. It also creates the default pools and resources of all the connection definitions.- Specified by:
setupin interfaceActiveResourceAdapter- Throws:
ConnectorRuntimeException- This exception is thrown if the ra.xml is invalid or the default pools and resources couldn't be created
-
isServer
protected boolean isServer()
Check if the execution environment is appserver runtime or application client container.- Returns:
- boolean if the environment is appserver runtime
-
createAllConnectorResources
protected void createAllConnectorResources() throws ConnectorRuntimeExceptionCreates both the default connector connection pools and resources- Throws:
ConnectorRuntimeException- when unable to create resources
-
destroyAllConnectorResources
protected void destroyAllConnectorResources()
Deletes both the default connector connection pools and resources
-
isSystemRar
protected boolean isSystemRar(String moduleName)
-
deleteDefaultConnectorConnectionPools
protected void deleteDefaultConnectorConnectionPools()
Deletes the default connector connection pools.
-
deleteDefaultConnectorResources
protected void deleteDefaultConnectorResources()
Deletes the default connector resources.
-
destroy
public void destroy()
uninitializes the resource adapter. It also destroys the default pools and resources- Specified by:
destroyin interfaceActiveResourceAdapter
-
getDescriptor
public ConnectorDescriptor getDescriptor()
Returns the Connector descriptor which represents/holds ra.xml- Specified by:
getDescriptorin interfaceActiveResourceAdapter- Returns:
- ConnectorDescriptor Representation of ra.xml.
-
handles
public boolean handles(ConnectorDescriptor cd, String moduleName)
Indicates whether a particular implementation of ActiveRA can handle the RAR in question.- Specified by:
handlesin interfaceActiveResourceAdapter- Parameters:
cd- ConnectorDescriptormoduleName- resource adapter name- Returns:
- boolean indiating whether a ActiveRA can handle the RAR
-
createManagedConnectionFactories
public jakarta.resource.spi.ManagedConnectionFactory[] createManagedConnectionFactories(ConnectorConnectionPool ccp, ClassLoader jcl)
Creates managed Connection factories corresponding to one pool. This should be implemented in the ActiveJmsResourceAdapter, for jms resources, has been implemented to perform xa resource recovery in mq clusters, not supported for any other code path.- Specified by:
createManagedConnectionFactoriesin interfaceActiveResourceAdapter- Parameters:
ccp- Connector connection pool which contains the pool properties and ra.xml values pertaining to managed connection factory class. These values are used in MCF creation.jcl- Classloader used to managed connection factory class.- Returns:
- ManagedConnectionFactory created managed connection factories
-
createManagedConnectionFactory
public jakarta.resource.spi.ManagedConnectionFactory createManagedConnectionFactory(ConnectorConnectionPool ccp, ClassLoader jcl)
Creates managed Connection factory instance.- Specified by:
createManagedConnectionFactoryin interfaceActiveResourceAdapter- Parameters:
ccp- Connector connection pool which contains the pool properties and ra.xml values pertaining to managed connection factory class. These values are used in MCF creation.jcl- Classloader used to managed connection factory class.- Returns:
- ManagedConnectionFactory created managed connection factory instance
-
instantiateMCF
protected jakarta.resource.spi.ManagedConnectionFactory instantiateMCF(String mcfClass, ClassLoader loader) throws Exception
- Throws:
Exception
-
createDefaultConnectorResources
protected void createDefaultConnectorResources() throws ConnectorRuntimeExceptionCreates default connector resource- Throws:
ConnectorRuntimeException- when unable to create connector resources
-
createDefaultConnectorConnectionPools
protected void createDefaultConnectorConnectionPools(boolean useSunRA) throws ConnectorRuntimeExceptionCreates default connector connection pool- Parameters:
useSunRA- whether to use default pool settings or settings in sun-ra.xml- Throws:
ConnectorRuntimeException- when unable to create connector connection pools
-
getClassLoader
public ClassLoader getClassLoader()
Returns the class loader that is used to load the RAR.- Specified by:
getClassLoaderin interfaceActiveResourceAdapter- Returns:
ClassLoaderobject.
-
getResourceAdapter
public jakarta.resource.spi.ResourceAdapter getResourceAdapter()
Retrieves the resource adapter java bean.- Specified by:
getResourceAdapterin interfaceActiveResourceAdapter- Returns:
ResourceAdapter
-
-