Package org.jboss.jca.deployers.common
Class AbstractResourceAdapterDeployer
java.lang.Object
org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer
An abstract resource adapter deployer which contains common functionality
for all resource adapter archive based deployers.
- Author:
- Jesper Pedersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DeployersLoggerthe loggerprotected final booleanboolean to set if validation is needed at class level or it should be considered already valid (IOW object put in repository at previous steps have been already validated at class level -
Constructor Summary
ConstructorsConstructorDescriptionAbstractResourceAdapterDeployer(boolean validateClasses) Create a new AbstractResourceAdapterDeployer. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyCapacity(ConnectionDefinition connectionDefinition, Pool pool, boolean isCRI) Apply capacityprotected voidassociateResourceAdapter(jakarta.resource.spi.ResourceAdapter resourceAdapter, Object object) Associate resource adapter with ojects if they implement ResourceAdapterAssociationprotected abstract String[]bindAdminObject(URL url, String deploymentName, Object ao) Bind admin object into JNDIprotected abstract String[]bindAdminObject(URL url, String deploymentName, Object ao, String jndiName) Bind admin object into JNDIprotected abstract String[]bindConnectionFactory(URL url, String deploymentName, Object cf) Bind connection factory into JNDIprotected abstract String[]bindConnectionFactory(URL url, String deploymentName, Object cf, String jndiName) Bind connection factory into JNDIprotected StringbuildJndiName(String jndiName, Boolean javaContext) Build the jndi nameprotected abstract booleancheckActivation(Connector cmd, Activation activation) Check if the resource adapter should be activated based on the ironjacamar.xml inputprotected abstract booleancheck if the configuration for this deployer has been set to a valid valueprotected CallbackGet a callback implementationprotected CommonDeploymentcreateObjectsAndInjectValue(URL url, String deploymentName, File root, ClassLoader cl, Connector cmd, Activation activation) create objects and inject value for this deployment.protected PoolConfigurationcreatePoolConfiguration(Pool pp, TimeOut tp, Validation vp) Create an instance of the pool configuration based on the inputprotected SubjectcreateSubject(SubjectFactory subjectFactory, String securityDomain, jakarta.resource.spi.ManagedConnectionFactory mcf) Create a subjectprotected Set<AdminObject>findAdminObjects(String clz, Set<String> aos, List<AdminObject> defs) Find the metadata for an admin objectprotected Set<ConnectionDefinition>findConnectionDefinitions(String clz, Set<String> mcfs, List<ConnectionDefinition> defs, ClassLoader cl) Find the metadata for a managed connection factoryprotected BeanValidationGet the bean validation moduleprotected abstract CachedConnectionManagerGet the cached connection managerGet the configurationprotected abstract DeployersLoggerGet the loggerprotected abstract PrintWriterget a PrintWriter where logger will put its outputprotected abstract Fileget The directory where write error reportsprotected abstract SubjectFactorygetSubjectFactory(SecurityMetadata securityMetadata, String jndiName) Get a subject factoryprotected abstract TransactionIntegrationGet the transaction integration.protected abstract jakarta.transaction.TransactionManagerGet the transaction Manager.protected booleanhasFailuresLevel(Collection<Failure> failures, int severity) Cehck for failures at a certain levelinitActivationSpec(ClassLoader cl, Connector cmd, jakarta.resource.spi.ResourceAdapter resourceAdapter, List<Validate> archiveValidationObjects, List<Object> beanValidationObjects, Set<Failure> failures, URL url, boolean activateDeployment) init the acrtivation specinitAdminObject(Connector cmd, ClassLoader cl, List<Validate> archiveValidationObjects, List<Object> beanValidationObjects, Set<Failure> failures, URL url, String deploymentName, boolean activateDeployment, jakarta.resource.spi.ResourceAdapter resourceAdapter, List<AdminObject> aosAct, List<Object> aos, List<String> aoJndiNames, Connector mgtConnector) init an Admin Objectprotected abstract ObjectinitAndInject(String value, List<? extends ConfigProperty> cpm, ClassLoader cl) Initialize and inject configuration properties into containerprintFailuresLog(String urlFileName, Validator validator, Collection<Failure> failures, File reportDirectory, FailureHelper... fhInput) print Failures into Log files.protected abstract voidregisterResourceAdapterToMDR(URL url, File root, Connector cmd, Activation activation) Register the ResourceAdapter to the MDR.protected abstract StringregisterResourceAdapterToResourceAdapterRepository(jakarta.resource.spi.ResourceAdapter instance) Register the ResourceAdapter to the ResourceAdapterRepository.protected booleanRequire explicit JNDI bindingsprotected booleanscanArchive(Connector cmd) Should the archive be scanned for annotationsprotected voidsetCallbackSecurity(WorkManager workManager, Callback cb) Sets the call back security info in this rar work manager before starting the resource adapter.voidsetConfiguration(Configuration value) Set the configurationprotected abstract voidsetRecoveryForResourceAdapterInResourceAdapterRepository(String key, boolean isXA) Set recovery mode for a resource adapter in the ResourceAdapterRepositoryvoidstart()Startprotected voidstartContext(jakarta.resource.spi.ResourceAdapter resourceAdapter, String bootstrapContextIdentifier, String bootstrapContextName, Callback cb) Start the resource adaptervalidate archive
-
Field Details
-
log
the logger -
validateClasses
protected final boolean validateClassesboolean to set if validation is needed at class level or it should be considered already valid (IOW object put in repository at previous steps have been already validated at class level
-
-
Constructor Details
-
AbstractResourceAdapterDeployer
public AbstractResourceAdapterDeployer(boolean validateClasses) Create a new AbstractResourceAdapterDeployer.- Parameters:
validateClasses- validateClasses validateClasses boolean to express if this instance will apply validation on classes structure
-
-
Method Details
-
setConfiguration
Set the configuration- Parameters:
value- value value The value
-
getConfiguration
Get the configuration- Returns:
- The value
-
validateArchive
public Set<Failure> validateArchive(URL url, List<Validate> archiveValidation, Set<Failure> failures) validate archive- Parameters:
url- url url of the archivearchiveValidation- archiveValidation archiveValidation classes and/or to validate.failures- failures failures original list of failures- Returns:
- The list of failures gotten with all new failures added. Null in case of no failures
or if validation is not run according to
Configuration.getArchiveValidation()Setting. It returns null also if the concrete implementation of this class set validateClasses instance variable to flase and the list of archiveValidation contains one or more instance ofValidateClasstype
-
printFailuresLog
public String printFailuresLog(String urlFileName, Validator validator, Collection<Failure> failures, File reportDirectory, FailureHelper... fhInput) print Failures into Log files.- Parameters:
urlFileName- urlFileName urlFileName filename Of deployed rarvalidator- validator validator validator instance used to run validation rulesfailures- failures failures the list of Failures to be printedreportDirectory- reportDirectory reportDirectory where to put various logsfhInput- fhInput fhInput optional parameter. Normally used only for test or in case of FailureHelper already present in context- Returns:
- the error Text
-
hasFailuresLevel
Cehck for failures at a certain level- Parameters:
failures- failures failures The failuresseverity- severity severity The level- Returns:
- True if a failure is found with the specified severity; otherwise false
-
startContext
protected void startContext(jakarta.resource.spi.ResourceAdapter resourceAdapter, String bootstrapContextIdentifier, String bootstrapContextName, Callback cb) throws DeployException Start the resource adapter- Parameters:
resourceAdapter- The resource adapterbootstrapContextIdentifier- The bootstrap context identifierbootstrapContextName- The bootstrap context name; may benullcb- The callback- Throws:
DeployException- DeployException Thrown if the resource adapter cant be started
-
setCallbackSecurity
Sets the call back security info in this rar work manager before starting the resource adapter.- Parameters:
workManager- the work manager that will be used by the resource adaptercb- the security callback
-
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
-
findConnectionDefinitions
protected Set<ConnectionDefinition> findConnectionDefinitions(String clz, Set<String> mcfs, List<ConnectionDefinition> defs, ClassLoader cl) throws DeployException Find the metadata for a managed connection factory- Parameters:
clz- The fully quilified class name for the managed connection factorymcfs- The managed connection facotriesdefs- The connection definitionscl- The class loader- Returns:
- The metadata;
nullif none could be found - Throws:
DeployException- Thrown in case of configuration error
-
findAdminObjects
protected Set<AdminObject> findAdminObjects(String clz, Set<String> aos, List<AdminObject> defs) throws DeployException Find the metadata for an admin object- Parameters:
clz- The fully quilified class name for the admin objectaos- The admin object classesdefs- The admin object definitions- Returns:
- The metadata;
nullif none could be found - Throws:
DeployException- Thrown in case of configuration error
-
createPoolConfiguration
Create an instance of the pool configuration based on the input- Parameters:
pp- The pool parameterstp- The timeout parametersvp- The validation parameters- Returns:
- The configuration
-
start
public void start()Start -
initActivationSpec
protected Set<Failure> initActivationSpec(ClassLoader cl, Connector cmd, jakarta.resource.spi.ResourceAdapter resourceAdapter, List<Validate> archiveValidationObjects, List<Object> beanValidationObjects, Set<Failure> failures, URL url, boolean activateDeployment) throws DeployException init the acrtivation spec- Parameters:
cl- clcmd- cmdresourceAdapter- resourceAdapterarchiveValidationObjects- archiveValidationObjectsbeanValidationObjects- beanValidationObjectsfailures- falures to be updated during implemented operationsurl- urlactivateDeployment- activateDeployment- Returns:
- failures updated after implemented operations
- Throws:
DeployException- DeployException in case of error
-
initAdminObject
protected Set<Failure> initAdminObject(Connector cmd, ClassLoader cl, List<Validate> archiveValidationObjects, List<Object> beanValidationObjects, Set<Failure> failures, URL url, String deploymentName, boolean activateDeployment, jakarta.resource.spi.ResourceAdapter resourceAdapter, List<AdminObject> aosAct, List<Object> aos, List<String> aoJndiNames, Connector mgtConnector) throws DeployException init an Admin Object- Parameters:
cmd- cmdcl- clarchiveValidationObjects- archiveValidationObjectsbeanValidationObjects- beanValidationObjectsfailures- falures to be updated during implemented operationsurl- urldeploymentName- The deployment nameactivateDeployment- activateDeploymentresourceAdapter- The resource adapter instanceaosAct- Admin object definitions from activationaos- The resulting array of admin objectsaoJndiNames- The resulting array of JNDI namesmgtConnector- The management view of the connector- Returns:
- failures updated after implemented operations
- Throws:
DeployException- DeployException in case of errors
-
createObjectsAndInjectValue
protected CommonDeployment createObjectsAndInjectValue(URL url, String deploymentName, File root, ClassLoader cl, Connector cmd, Activation activation) throws DeployException, jakarta.resource.ResourceException, ValidatorException, AlreadyExistsException, ClassNotFoundException, Throwable create objects and inject value for this deployment. it is a general method returning aCommonDeploymentto be used to exchange objects needed to real injection in the container- Parameters:
url- urldeploymentName- deploymentNameroot- rootcl- clcmd- connector mdactivation- activation md- Returns:
- return the exchange POJO with value useful for injection in the container (fungal or AS)
- Throws:
DeployException- DeployExceptionjakarta.resource.ResourceException- ResourceExceptionValidatorException- ValidatorExceptionAlreadyExistsException- AlreadyExistsExceptionClassNotFoundException- ClassNotFoundExceptionThrowable- Throwable
-
buildJndiName
Build the jndi name- Parameters:
jndiName- The jndi namejavaContext- The java context- Returns:
- The value
-
requireExplicitJndiBindings
protected boolean requireExplicitJndiBindings()Require explicit JNDI bindings- Returns:
- True if explicit JNDI bindings are required; otherwise false
-
getSubjectFactory
protected abstract SubjectFactory getSubjectFactory(SecurityMetadata securityMetadata, String jndiName) throws DeployException Get a subject factory- Parameters:
securityMetadata- The security metadata: contains the security domain and any other necessary information for returning the subject factoryjndiName- optionally used for authentication context matching- Returns:
- The subject factory; must return
nullif security domain isn't defined - Throws:
DeployException- Thrown if the security domain can't be resolved
-
createSubject
protected Subject createSubject(SubjectFactory subjectFactory, String securityDomain, jakarta.resource.spi.ManagedConnectionFactory mcf) Create a subject- Parameters:
subjectFactory- The subject factorysecurityDomain- The security domainmcf- The managed connection factory- Returns:
- The subject;
nullin case of an error
-
getBeanValidation
Get the bean validation module- Returns:
- The module
-
getCachedConnectionManager
Get the cached connection manager- Returns:
- The handle
-
createCallback
Get a callback implementation- Parameters:
ws- The WorkManager security settings- Returns:
- The value
-
applyCapacity
Apply capacity- Parameters:
connectionDefinition- The connection definitionpool- The poolisCRI- Is the pool going to be CRI based
-
scanArchive
Should the archive be scanned for annotations- Parameters:
cmd- The metadata- Returns:
- True if scan is needed; otherwise false
-
getReportDirectory
get The directory where write error reports- Returns:
- the directory as
File
-
registerResourceAdapterToMDR
protected abstract void registerResourceAdapterToMDR(URL url, File root, Connector cmd, Activation activation) throws AlreadyExistsException Register the ResourceAdapter to the MDR. Implementer should provide the implementation to get MDR and do the registration- Parameters:
url- urlroot- rootcmd- cmdactivation- activation- Throws:
AlreadyExistsException- AlreadyExistsException
-
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
-
setRecoveryForResourceAdapterInResourceAdapterRepository
protected abstract void setRecoveryForResourceAdapterInResourceAdapterRepository(String key, boolean isXA) Set recovery mode for a resource adapter in the ResourceAdapterRepository- Parameters:
key- The key for the resource adapterisXA- Is the resource adapter XA capable
-
getTransactionManager
protected abstract jakarta.transaction.TransactionManager getTransactionManager()Get the transaction Manager. Implementers have to provide right implementation to find and get it- Returns:
- The value
-
getTransactionIntegration
Get the transaction integration. Implementers have to provide right implementation to find and get it- Returns:
- The value
-
getLogPrintWriter
get a PrintWriter where logger will put its output- Returns:
- the printWriter for Logger
-
bindConnectionFactory
protected abstract String[] bindConnectionFactory(URL url, String deploymentName, Object cf) throws Throwable Bind connection factory into JNDI- Parameters:
url- The deployment URLdeploymentName- The deployment namecf- The connection factory- Returns:
- The JNDI names bound
- Throws:
Throwable- Thrown if an error occurs
-
bindConnectionFactory
protected abstract String[] bindConnectionFactory(URL url, String deploymentName, Object cf, String jndiName) throws Throwable Bind connection factory into JNDI- Parameters:
url- The deployment URLdeploymentName- The deployment namecf- The connection factoryjndiName- The JNDI name- Returns:
- The JNDI names bound
- Throws:
Throwable- Thrown if an error occurs
-
bindAdminObject
protected abstract String[] bindAdminObject(URL url, String deploymentName, Object ao) throws Throwable Bind admin object into JNDI- Parameters:
url- The deployment URLdeploymentName- The deployment nameao- The admin object- Returns:
- The JNDI names bound
- Throws:
Throwable- Thrown if an error occurs
-
bindAdminObject
protected abstract String[] bindAdminObject(URL url, String deploymentName, Object ao, String jndiName) throws Throwable Bind admin object into JNDI- Parameters:
url- The deployment URLdeploymentName- The deployment nameao- The admin objectjndiName- The JNDI name- Returns:
- The JNDI names bound
- Throws:
Throwable- Thrown if an error occurs
-
checkConfigurationIsValid
protected abstract boolean checkConfigurationIsValid()check if the configuration for this deployer has been set to a valid value- Returns:
- false if configuration is not valid
-
checkActivation
Check if the resource adapter should be activated based on the ironjacamar.xml input- Parameters:
cmd- cmd cmd The connector metadataactivation- The activation metadata- Returns:
- True if the deployment should be activated; otherwise false
-
initAndInject
protected abstract Object initAndInject(String value, List<? extends ConfigProperty> cpm, ClassLoader cl) throws DeployException Initialize and inject configuration properties into container- Parameters:
value- valuecpm- confi propertiescl- The class loader- Returns:
- The object
- Throws:
DeployException- DeployException Thrown if the object cant be initialized
-
getLogger
Get the logger- Returns:
- The value
-