Package org.jboss.jca.deployers.common
Class AbstractDsDeployer
- java.lang.Object
-
- org.jboss.jca.deployers.common.AbstractDsDeployer
-
public abstract class AbstractDsDeployer extends Object
An abstract deployer implementation for datasources- Author:
- Stefano Maestri, Jesper Pedersen
-
-
Field Summary
Fields Modifier and Type Field Description protected DeployersLoggerloglogprotected TransactionIntegrationtransactionIntegrationThe transaction integrationprotected XAResourceRecoveryRegistryxaResourceRecoveryRegistryxaResourceRecoveryRegistry
-
Constructor Summary
Constructors Constructor Description AbstractDsDeployer()Create a new AbstractDsDeployer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidassociateResourceAdapter(javax.resource.spi.ResourceAdapter resourceAdapter, Object object)Associate resource adapter with ojects if they implement ResourceAdapterAssociationprotected abstract String[]bindConnectionFactory(String deployment, String jndi, Object cf)Bind connection factory into JNDIprotected StringbuildJndiName(String jndiName, Boolean javaContext)Build the jndi nameprotected abstract javax.resource.spi.ManagedConnectionFactorycreateMcf(org.jboss.jca.common.api.metadata.ds.DataSource ds, String uniqueId, ClassLoader cl)Create Mcf for dsprotected abstract javax.resource.spi.ManagedConnectionFactorycreateMcf(org.jboss.jca.common.api.metadata.ds.XaDataSource ds, String uniqueId, ClassLoader cl)Create Mcf for xadsprotected CommonDeploymentcreateObjectsAndInjectValue(URL url, String deploymentName, String uniqueJdbcLocalId, String uniqueJdbcXAId, org.jboss.jca.common.api.metadata.ds.DataSources dataSources, ClassLoader parentClassLoader)create objects and inject value for this depployment.protected abstract javax.resource.spi.ResourceAdaptercreateRa(String uniqueId, ClassLoader cl)Create Raprotected SubjectcreateSubject(SubjectFactory subjectFactory, String securityDomain, javax.resource.spi.ManagedConnectionFactory mcf, String jndiName)Create a subjectCachedConnectionManagergetCachedConnectionManager()Get the ccmprotected abstract ClassLoadergetDeploymentClassLoader(String uniqueId)Provide the classloader of the deployment identified by the unique idprotected StringgetDriver(String driverName, String moduleId)Get the driverprotected abstract DeployersLoggergetLogger()Get the loggerManagementRepositorygetManagementRepository()Get the managementRepository.protected abstract SubjectFactorygetSubjectFactory(org.jboss.jca.common.api.metadata.common.Credential credential, String jndiName)Get a subject factoryTransactionIntegrationgetTransactionIntegration()Get the transaction integrationXAResourceRecoveryRegistrygetXAResourceRecoveryRegistry()Get the xAResourceRecoveryRegistry.protected abstract ObjectinitAndInject(String className, List<? extends org.jboss.jca.common.api.metadata.spec.ConfigProperty> configs, ClassLoader cl)Initialize and inject configuration propertiesprotected voidinitAndInjectClassLoaderPlugin(javax.resource.spi.ManagedConnectionFactory mcf, org.jboss.jca.common.api.metadata.ds.CommonDataSource dsMetadata)Initialize and inject class loader pluginprotected booleanneedsBootstrapContext(org.jboss.jca.common.api.metadata.ds.DataSources datasources)Needs a BootstrapContext instanceprotected intnumberOfDataSources(org.jboss.jca.common.api.metadata.ds.DataSources datasources)Get the number of datasource deploymentsprotected abstract StringregisterResourceAdapterToResourceAdapterRepository(javax.resource.spi.ResourceAdapter instance)Register the ResourceAdapter to the ResourceAdapterRepository.voidsetCachedConnectionManager(CachedConnectionManager value)Set the ccmvoidsetManagementRepository(ManagementRepository managementRepository)Set the managementRepository.voidsetTransactionIntegration(TransactionIntegration value)Set the transaction integrationvoidsetXAResourceRecoveryRegistry(XAResourceRecoveryRegistry xAResourceRecoveryRegistry)Set the xAResourceRecoveryRegistry.protected voidstartContext(javax.resource.spi.ResourceAdapter resourceAdapter, String bootstrapContextIdentifier)Start the resource adapterprotected booleanverifyTypes(org.jboss.jca.common.api.metadata.ds.DataSources datasources)Verify the types of the datasources
-
-
-
Field Detail
-
log
protected DeployersLogger log
log
-
transactionIntegration
protected TransactionIntegration transactionIntegration
The transaction integration
-
xaResourceRecoveryRegistry
protected XAResourceRecoveryRegistry xaResourceRecoveryRegistry
xaResourceRecoveryRegistry
-
-
Method Detail
-
setTransactionIntegration
public void setTransactionIntegration(TransactionIntegration value)
Set the transaction integration- Parameters:
value- The value
-
getTransactionIntegration
public TransactionIntegration getTransactionIntegration()
Get the transaction integration- Returns:
- The value
-
getManagementRepository
public ManagementRepository getManagementRepository()
Get the managementRepository.- Returns:
- the managementRepository.
-
setManagementRepository
public void setManagementRepository(ManagementRepository managementRepository)
Set the managementRepository.- Parameters:
managementRepository- The managementRepository to set.
-
setCachedConnectionManager
public void setCachedConnectionManager(CachedConnectionManager value)
Set the ccm- Parameters:
value- The value
-
getCachedConnectionManager
public CachedConnectionManager getCachedConnectionManager()
Get the ccm- Returns:
- The handle
-
getXAResourceRecoveryRegistry
public XAResourceRecoveryRegistry getXAResourceRecoveryRegistry()
Get the xAResourceRecoveryRegistry.- Returns:
- the xAResourceRecoveryRegistry.
-
setXAResourceRecoveryRegistry
public void setXAResourceRecoveryRegistry(XAResourceRecoveryRegistry xAResourceRecoveryRegistry)
Set the xAResourceRecoveryRegistry.- Parameters:
xAResourceRecoveryRegistry- The xAResourceRecoveryRegistry to set.
-
createObjectsAndInjectValue
protected CommonDeployment createObjectsAndInjectValue(URL url, String deploymentName, String uniqueJdbcLocalId, String uniqueJdbcXAId, org.jboss.jca.common.api.metadata.ds.DataSources dataSources, ClassLoader parentClassLoader) throws DeployException
create objects and inject value for this depployment. it is a general method returning aCommonDeploymentto be used to exchange objects needed to real injection in the container- Parameters:
url- urldeploymentName- deploymentNameuniqueJdbcLocalId- uniqueJdbcLocalIduniqueJdbcXAId- uniqueJdbcXAIdparentClassLoader- cldataSources- datasources metadata defined in xml- Returns:
- return the exchange POJO with value useful for injection in the container (fungal or AS)
- Throws:
DeployException- DeployException
-
buildJndiName
protected String buildJndiName(String jndiName, Boolean javaContext)
Build the jndi name- Parameters:
jndiName- The jndi namejavaContext- The java context- Returns:
- The value
-
getDriver
protected String getDriver(String driverName, String moduleId)
Get the driver- Parameters:
driverName- The name of the drivermoduleId- The id of the module- Returns:
- The driver class name; or
nullif not found
-
numberOfDataSources
protected int numberOfDataSources(org.jboss.jca.common.api.metadata.ds.DataSources datasources)
Get the number of datasource deployments- Parameters:
datasources- The datasources- Returns:
- The number
-
verifyTypes
protected boolean verifyTypes(org.jboss.jca.common.api.metadata.ds.DataSources datasources)
Verify the types of the datasources- Parameters:
datasources- The datasources- Returns:
- True if all datasources fall into the same caterogy, otherwise false
-
needsBootstrapContext
protected boolean needsBootstrapContext(org.jboss.jca.common.api.metadata.ds.DataSources datasources)
Needs a BootstrapContext instance- Parameters:
datasources- The datasources- Returns:
- True if needs a context
-
startContext
protected void startContext(javax.resource.spi.ResourceAdapter resourceAdapter, String bootstrapContextIdentifier) throws DeployExceptionStart the resource adapter- Parameters:
resourceAdapter- The resource adapterbootstrapContextIdentifier- The bootstrap context identifier- Throws:
DeployException- DeployException Thrown if the resource adapter cant be started
-
associateResourceAdapter
protected void associateResourceAdapter(javax.resource.spi.ResourceAdapter resourceAdapter, Object object) throws DeployExceptionAssociate resource adapter with ojects if they implement ResourceAdapterAssociation- Parameters:
resourceAdapter- resourceAdapter resourceAdapter The resource adapterobject- object object The of possible association object- Throws:
DeployException- DeployException Thrown if the resource adapter cant be started
-
createRa
protected abstract javax.resource.spi.ResourceAdapter createRa(String uniqueId, ClassLoader cl) throws NotFoundException, Exception, DeployException
Create Ra- Parameters:
uniqueId- the uniqueIdcl- the classloader- Returns:
- the resource adapter
- Throws:
NotFoundException- in case it's not found in clException- in case of other errorDeployException- in case of deploy error
-
registerResourceAdapterToResourceAdapterRepository
protected abstract String registerResourceAdapterToResourceAdapterRepository(javax.resource.spi.ResourceAdapter instance)
Register the ResourceAdapter to the ResourceAdapterRepository. Implementer should provide the implementation to get repository and do the registration- Parameters:
instance- the instance- Returns:
- The key
-
createMcf
protected abstract javax.resource.spi.ManagedConnectionFactory createMcf(org.jboss.jca.common.api.metadata.ds.XaDataSource ds, String uniqueId, ClassLoader cl) throws NotFoundException, Exception, DeployExceptionCreate Mcf for xads- Parameters:
ds- the xsdsuniqueId- the uniqueIdcl- the classloader- Returns:
- the mcf
- Throws:
NotFoundException- in case it's not found in clException- in case of other errroDeployException- in case of deoloy error
-
createMcf
protected abstract javax.resource.spi.ManagedConnectionFactory createMcf(org.jboss.jca.common.api.metadata.ds.DataSource ds, String uniqueId, ClassLoader cl) throws NotFoundException, Exception, DeployExceptionCreate Mcf for ds- Parameters:
ds- the xsdsuniqueId- the uniqueIdcl- the classloader- Returns:
- the mcf
- Throws:
NotFoundException- in case it's not found in clException- in case of other errroDeployException- in case of deoloy error
-
getDeploymentClassLoader
protected abstract ClassLoader getDeploymentClassLoader(String uniqueId)
Provide the classloader of the deployment identified by the unique id- Parameters:
uniqueId- The- Returns:
- The classloader used by this deployment
-
bindConnectionFactory
protected abstract String[] bindConnectionFactory(String deployment, String jndi, Object cf) throws Throwable
Bind connection factory into JNDI- Parameters:
deployment- The deployment namecf- The connection factoryjndi- passed jndi name- Returns:
- The JNDI names bound
- Throws:
Throwable- Thrown if an error occurs
-
initAndInject
protected abstract Object initAndInject(String className, List<? extends org.jboss.jca.common.api.metadata.spec.ConfigProperty> configs, ClassLoader cl) throws DeployException
Initialize and inject configuration properties- Parameters:
className- The fully qualified class nameconfigs- The configuration propertiescl- The class loader- Returns:
- The object
- Throws:
DeployException- Thrown if the object cant be initialized
-
initAndInjectClassLoaderPlugin
protected void initAndInjectClassLoaderPlugin(javax.resource.spi.ManagedConnectionFactory mcf, org.jboss.jca.common.api.metadata.ds.CommonDataSource dsMetadata) throws DeployExceptionInitialize and inject class loader plugin- Parameters:
mcf- The managed connection factorydsMetadata- The dataSource metadata- Throws:
DeployException- Thrown if the object cant be initialized or injected
-
getSubjectFactory
protected abstract SubjectFactory getSubjectFactory(org.jboss.jca.common.api.metadata.common.Credential credential, String jndiName) throws DeployException
Get a subject factory- Parameters:
credential- The security credentialjndiName- optionally used for authentication context matching- Returns:
- The subject factory; must return
nullif credential security isn't enabled or if credential isnull - Throws:
DeployException- Thrown if the security info can't be resolved
-
getLogger
protected abstract DeployersLogger getLogger()
Get the logger- Returns:
- The value
-
createSubject
protected Subject createSubject(SubjectFactory subjectFactory, String securityDomain, javax.resource.spi.ManagedConnectionFactory mcf, String jndiName)
Create a subject- Parameters:
subjectFactory- The subject factorysecurityDomain- The security domainmcf- The managed connection factoryjndiName- The jndi-name of the data-source- Returns:
- The subject;
nullin case of an error
-
-