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 ConnectorRuntime
connectorRuntime_
protected ConnectorDescriptor
desc_
protected ClassLoader
jcl_
protected String
moduleName_
-
Constructor Summary
Constructors Constructor Description ActiveResourceAdapterImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createAllConnectorResources()
Creates both the default connector connection pools and resourcesprotected void
createDefaultConnectorConnectionPools(boolean useSunRA)
Creates default connector connection poolprotected void
createDefaultConnectorResources()
Creates default connector resourcejakarta.resource.spi.ManagedConnectionFactory[]
createManagedConnectionFactories(ConnectorConnectionPool ccp, ClassLoader jcl)
Creates managed Connection factories corresponding to one pool.jakarta.resource.spi.ManagedConnectionFactory
createManagedConnectionFactory(ConnectorConnectionPool ccp, ClassLoader jcl)
Creates managed Connection factory instance.protected void
deleteDefaultConnectorConnectionPools()
Deletes the default connector connection pools.protected void
deleteDefaultConnectorResources()
Deletes the default connector resources.void
destroy()
uninitializes the resource adapter.protected void
destroyAllConnectorResources()
Deletes both the default connector connection pools and resourcesClassLoader
getClassLoader()
Returns the class loader that is used to load the RAR.ConnectorDescriptor
getDescriptor()
Returns the Connector descriptor which represents/holds ra.xmlString
getModuleName()
Returns the module Name of the RARjakarta.resource.spi.ResourceAdapter
getResourceAdapter()
Retrieves the resource adapter java bean.boolean
handles(ConnectorDescriptor cd, String moduleName)
Indicates whether a particular implementation of ActiveRA can handle the RAR in question.void
init(jakarta.resource.spi.ResourceAdapter ra, ConnectorDescriptor desc, String moduleName, ClassLoader jcl)
Constructor.protected jakarta.resource.spi.ManagedConnectionFactory
instantiateMCF(String mcfClass, ClassLoader loader)
protected boolean
isServer()
Check if the execution environment is appserver runtime or application client container.protected boolean
isSystemRar(String moduleName)
void
setup()
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 ConnectorRuntimeException
Constructor.- Specified by:
init
in 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:
getModuleName
in interfaceActiveResourceAdapter
- Returns:
- A
String
representing the name of the connector module
-
setup
public void setup() throws ConnectorRuntimeException
It initializes the resource adapter. It also creates the default pools and resources of all the connection definitions.- Specified by:
setup
in 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 ConnectorRuntimeException
Creates 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:
destroy
in interfaceActiveResourceAdapter
-
getDescriptor
public ConnectorDescriptor getDescriptor()
Returns the Connector descriptor which represents/holds ra.xml- Specified by:
getDescriptor
in 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:
handles
in 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:
createManagedConnectionFactories
in 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:
createManagedConnectionFactory
in 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 ConnectorRuntimeException
Creates default connector resource- Throws:
ConnectorRuntimeException
- when unable to create connector resources
-
createDefaultConnectorConnectionPools
protected void createDefaultConnectorConnectionPools(boolean useSunRA) throws ConnectorRuntimeException
Creates default connector connection pool- Parameters:
useSunRA
- whether to use default pool settings or settings in sun-ra.xml- Throws:
ConnectorRuntimeException
- when unable to create connector connection pools
-
getClassLoader
public ClassLoader getClassLoader()
Returns the class loader that is used to load the RAR.- Specified by:
getClassLoader
in interfaceActiveResourceAdapter
- Returns:
ClassLoader
object.
-
getResourceAdapter
public jakarta.resource.spi.ResourceAdapter getResourceAdapter()
Retrieves the resource adapter java bean.- Specified by:
getResourceAdapter
in interfaceActiveResourceAdapter
- Returns:
ResourceAdapter
-
-