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 Details

  • Constructor Details

    • AbstractDsDeployer

      public AbstractDsDeployer()
      Create a new AbstractDsDeployer.
  • Method Details

    • 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 a CommonDeployment to be used to exchange objects needed to real injection in the container
      Parameters:
      url - url
      deploymentName - deploymentName
      uniqueJdbcLocalId - uniqueJdbcLocalId
      uniqueJdbcXAId - uniqueJdbcXAId
      parentClassLoader - cl
      dataSources - 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 name
      javaContext - The java context
      Returns:
      The value
    • getDriver

      protected String getDriver(String driverName, String moduleId)
      Get the driver
      Parameters:
      driverName - The name of the driver
      moduleId - The id of the module
      Returns:
      The driver class name; or null if 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(jakarta.resource.spi.ResourceAdapter resourceAdapter, String bootstrapContextIdentifier) throws DeployException
      Start the resource adapter
      Parameters:
      resourceAdapter - The resource adapter
      bootstrapContextIdentifier - 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 adapter
      object - 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 uniqueId
      cl - the classloader
      Returns:
      the resource adapter
      Throws:
      NotFoundException - in case it's not found in cl
      Exception - in case of other error
      DeployException - 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(org.jboss.jca.common.api.metadata.ds.XaDataSource ds, String uniqueId, ClassLoader cl) throws NotFoundException, Exception, DeployException
      Create Mcf for xads
      Parameters:
      ds - the xsds
      uniqueId - the uniqueId
      cl - the classloader
      Returns:
      the mcf
      Throws:
      NotFoundException - in case it's not found in cl
      Exception - in case of other errro
      DeployException - in case of deoloy error
    • createMcf

      protected abstract jakarta.resource.spi.ManagedConnectionFactory createMcf(org.jboss.jca.common.api.metadata.ds.DataSource ds, String uniqueId, ClassLoader cl) throws NotFoundException, Exception, DeployException
      Create Mcf for ds
      Parameters:
      ds - the xsds
      uniqueId - the uniqueId
      cl - the classloader
      Returns:
      the mcf
      Throws:
      NotFoundException - in case it's not found in cl
      Exception - in case of other errro
      DeployException - 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 name
      cf - The connection factory
      jndi - 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 name
      configs - The configuration properties
      cl - The class loader
      Returns:
      The object
      Throws:
      DeployException - Thrown if the object cant be initialized
    • initAndInjectClassLoaderPlugin

      protected void initAndInjectClassLoaderPlugin(jakarta.resource.spi.ManagedConnectionFactory mcf, org.jboss.jca.common.api.metadata.ds.CommonDataSource dsMetadata) throws DeployException
      Initialize and inject class loader plugin
      Parameters:
      mcf - The managed connection factory
      dsMetadata - 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 credential
      jndiName - optionally used for authentication context matching
      Returns:
      The subject factory; must return null if credential security isn't enabled or if credential is null
      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, jakarta.resource.spi.ManagedConnectionFactory mcf, String jndiName)
      Create a subject
      Parameters:
      subjectFactory - The subject factory
      securityDomain - The security domain
      mcf - The managed connection factory
      jndiName - The jndi-name of the data-source
      Returns:
      The subject; null in case of an error