use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class VaultPropertyResolverProcessor method deploy.
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final AbstractVaultReader vaultReader = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.VAULT_READER_ATTACHMENT_KEY);
if (vaultReader != null) {
deploymentUnit.addToAttachmentList(Attachments.DEPLOYMENT_PROPERTY_RESOLVERS, new VaultPropertyResolver(vaultReader));
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class AbstractDeploymentUnitProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
// get hold of the deployment unit
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
return;
}
final CompositeIndex compositeIndex = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
if (compositeIndex == null) {
EjbLogger.DEPLOYMENT_LOGGER.tracef("Skipping EJB annotation processing since no composite annotation index found in unit: %s", deploymentUnit);
} else {
if (MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) {
EjbLogger.DEPLOYMENT_LOGGER.trace("Skipping EJB annotation processing due to deployment being metadata-complete. ");
} else {
processAnnotations(deploymentUnit, compositeIndex);
}
}
processDeploymentDescriptor(deploymentUnit);
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class BatchEnvironmentProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.hasAttachment(Attachments.MODULE)) {
BatchLogger.LOGGER.tracef("Processing deployment '%s' for the batch environment.", deploymentUnit.getName());
// Get the class loader
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
final ClassLoader moduleClassLoader = module.getClassLoader();
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
// Create the batch environment
final WildFlyJobXmlResolver jobXmlResolver = WildFlyJobXmlResolver.forDeployment(deploymentUnit);
final BatchEnvironmentService service = new BatchEnvironmentService(moduleClassLoader, jobXmlResolver, deploymentUnit.getName());
// Set the value for the job-repository, this can't be a capability as the JDBC job repository cannot be constructed
// until deployment time because the default JNDI data-source name is only known during DUP processing
service.getJobRepositoryInjector().setValue(new ImmediateValue<>(JobRepositoryFactory.getInstance().getJobRepository(moduleDescription)));
final ServiceBuilder<SecurityAwareBatchEnvironment> serviceBuilder = serviceTarget.addService(BatchServiceNames.batchEnvironmentServiceName(deploymentUnit), service);
// Register the required services
serviceBuilder.addDependency(support.getCapabilityServiceName(Capabilities.BATCH_CONFIGURATION_CAPABILITY.getName()), BatchConfiguration.class, service.getBatchConfigurationInjector());
serviceBuilder.addDependency(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER, TransactionManager.class, service.getTransactionManagerInjector());
// Register the bean manager if this is a CDI deployment
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
BatchLogger.LOGGER.tracef("Adding BeanManager service dependency for deployment %s", deploymentUnit.getName());
serviceBuilder.addDependency(BatchServiceNames.beanManagerServiceName(deploymentUnit), BeanManager.class, service.getBeanManagerInjector());
}
if (rcPresent) {
serviceBuilder.addDependency(RequestController.SERVICE_NAME, RequestController.class, service.getRequestControllerInjector());
}
// Install the batch environment service
serviceBuilder.install();
// Create the job operator service used interact with a deployments batch job
final JobOperatorService jobOperatorService = new JobOperatorService(Boolean.FALSE, deploymentUnit.getName(), jobXmlResolver);
// Install the JobOperatorService
Services.addServerExecutorDependency(serviceTarget.addService(org.wildfly.extension.batch.jberet.BatchServiceNames.jobOperatorServiceName(deploymentUnit), jobOperatorService).addDependency(support.getCapabilityServiceName(Capabilities.BATCH_CONFIGURATION_CAPABILITY.getName()), BatchConfiguration.class, jobOperatorService.getBatchConfigurationInjector()).addDependency(SuspendController.SERVICE_NAME, SuspendController.class, jobOperatorService.getSuspendControllerInjector()).addDependency(org.wildfly.extension.batch.jberet.BatchServiceNames.batchEnvironmentServiceName(deploymentUnit), SecurityAwareBatchEnvironment.class, jobOperatorService.getBatchEnvironmentInjector()), jobOperatorService.getExecutorServiceInjector(), false).install();
// Add the JobOperatorService to the deployment unit
deploymentUnit.putAttachment(BatchAttachments.JOB_OPERATOR, jobOperatorService);
// Add the JobOperator to the context selector
selector.registerContext(moduleClassLoader, JobOperatorContext.create(jobOperatorService));
}
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class EJBComponentCreateService method getEJBUtilities.
/**
* @return
* @deprecated {@link EJBUtilities} is deprecated post 7.2.0.Final version.
*/
@Deprecated
protected EJBUtilities getEJBUtilities() {
// constructs
final DeploymentUnit deploymentUnit = getDeploymentUnitInjector().getValue();
final ServiceController<EJBUtilities> serviceController = (ServiceController<EJBUtilities>) deploymentUnit.getServiceRegistry().getRequiredService(EJBUtilities.SERVICE_NAME);
return serviceController.getValue();
}
use of org.jboss.as.server.deployment.DeploymentUnit in project wildfly by wildfly.
the class CompensationsDependenciesDeploymentProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final CompositeIndex compositeIndex = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
if (compositeIndex == null) {
return;
}
if (isCompensationAnnotationPresent(compositeIndex)) {
addCompensationsModuleDependency(unit);
}
}
Aggregations