Package org.jboss.jca.deployers.common
Class AbstractDsDeployer
java.lang.Object
org.jboss.jca.deployers.common.AbstractDsDeployer
An abstract deployer implementation for datasources
- Author:
- Stefano Maestri, Jesper Pedersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DeployersLoggerlogprotected TransactionIntegrationThe transaction integrationprotected XAResourceRecoveryRegistryxaResourceRecoveryRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassociateResourceAdapter(jakarta.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 jakarta.resource.spi.ManagedConnectionFactorycreateMcf(DataSource ds, String uniqueId, ClassLoader cl) Create Mcf for dsprotected abstract jakarta.resource.spi.ManagedConnectionFactorycreateMcf(XaDataSource ds, String uniqueId, ClassLoader cl) Create Mcf for xadsprotected CommonDeploymentcreateObjectsAndInjectValue(URL url, String deploymentName, String uniqueJdbcLocalId, String uniqueJdbcXAId, DataSources dataSources, ClassLoader parentClassLoader) create objects and inject value for this depployment.protected abstract jakarta.resource.spi.ResourceAdaptercreateRa(String uniqueId, ClassLoader cl) Create Raprotected SubjectcreateSubject(SubjectFactory subjectFactory, String securityDomain, jakarta.resource.spi.ManagedConnectionFactory mcf, String jndiName) Create a subjectGet the ccmprotected abstract ClassLoadergetDeploymentClassLoader(String uniqueId) Provide the classloader of the deployment identified by the unique idprotected StringGet the driverprotected abstract DeployersLoggerGet the loggerGet the managementRepository.protected abstract SubjectFactorygetSubjectFactory(Credential credential, String jndiName) Get a subject factoryGet the transaction integrationGet the xAResourceRecoveryRegistry.protected abstract ObjectinitAndInject(String className, List<? extends ConfigProperty> configs, ClassLoader cl) Initialize and inject configuration propertiesprotected voidinitAndInjectClassLoaderPlugin(jakarta.resource.spi.ManagedConnectionFactory mcf, CommonDataSource dsMetadata) Initialize and inject class loader pluginprotected booleanneedsBootstrapContext(DataSources datasources) Needs a BootstrapContext instanceprotected intnumberOfDataSources(DataSources datasources) Get the number of datasource deploymentsprotected abstract StringregisterResourceAdapterToResourceAdapterRepository(jakarta.resource.spi.ResourceAdapter instance) Register the ResourceAdapter to the ResourceAdapterRepository.voidSet the ccmvoidsetManagementRepository(ManagementRepository managementRepository) Set the managementRepository.voidSet the transaction integrationvoidsetXAResourceRecoveryRegistry(XAResourceRecoveryRegistry xAResourceRecoveryRegistry) Set the xAResourceRecoveryRegistry.protected voidstartContext(jakarta.resource.spi.ResourceAdapter resourceAdapter, String bootstrapContextIdentifier) Start the resource adapterprotected booleanverifyTypes(DataSources datasources) Verify the types of the datasources
-
Field Details
-
log
log -
transactionIntegration
The transaction integration -
xaResourceRecoveryRegistry
xaResourceRecoveryRegistry
-
-
Constructor Details
-
AbstractDsDeployer
public AbstractDsDeployer()Create a new AbstractDsDeployer.
-
-
Method Details
-
setTransactionIntegration
Set the transaction integration- Parameters:
value- The value
-
getTransactionIntegration
Get the transaction integration- Returns:
- The value
-
getManagementRepository
Get the managementRepository.- Returns:
- the managementRepository.
-
setManagementRepository
Set the managementRepository.- Parameters:
managementRepository- The managementRepository to set.
-
setCachedConnectionManager
Set the ccm- Parameters:
value- The value
-
getCachedConnectionManager
Get the ccm- Returns:
- The handle
-
getXAResourceRecoveryRegistry
Get the xAResourceRecoveryRegistry.- Returns:
- the xAResourceRecoveryRegistry.
-
setXAResourceRecoveryRegistry
Set the xAResourceRecoveryRegistry.- Parameters:
xAResourceRecoveryRegistry- The xAResourceRecoveryRegistry to set.
-
createObjectsAndInjectValue
protected CommonDeployment createObjectsAndInjectValue(URL url, String deploymentName, String uniqueJdbcLocalId, String uniqueJdbcXAId, 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
Build the jndi name- Parameters:
jndiName- The jndi namejavaContext- The java context- Returns:
- The value
-
getDriver
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
Get the number of datasource deployments- Parameters:
datasources- The datasources- Returns:
- The number
-
verifyTypes
Verify the types of the datasources- Parameters:
datasources- The datasources- Returns:
- True if all datasources fall into the same caterogy, otherwise false
-
needsBootstrapContext
Needs a BootstrapContext instance- Parameters:
datasources- The datasources- Returns:
- True if needs a context
-
startContext
protected void startContext(jakarta.resource.spi.ResourceAdapter resourceAdapter, String bootstrapContextIdentifier) throws DeployException Start 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(jakarta.resource.spi.ResourceAdapter resourceAdapter, Object object) throws DeployException Associate 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 jakarta.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(jakarta.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 jakarta.resource.spi.ManagedConnectionFactory createMcf(XaDataSource ds, String uniqueId, ClassLoader cl) throws NotFoundException, Exception, DeployException Create 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 jakarta.resource.spi.ManagedConnectionFactory createMcf(DataSource ds, String uniqueId, ClassLoader cl) throws NotFoundException, Exception, DeployException Create 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
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 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(jakarta.resource.spi.ManagedConnectionFactory mcf, CommonDataSource dsMetadata) throws DeployException Initialize 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(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
Get the logger- Returns:
- The value
-
createSubject
protected Subject createSubject(SubjectFactory subjectFactory, String securityDomain, jakarta.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
-