Search in sources :

Example 36 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.

the class BatchDependencyProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, batchModule, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, jberetModule, false, false, true, false));
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 37 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.

the class ApplicationClientDependencyProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader loader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
    moduleSpecification.addSystemDependency(new ModuleDependency(loader, CORBA_ID, false, true, true, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(loader, XNIO, false, true, true, false));
    final Set<ModuleIdentifier> moduleIdentifiers = new HashSet<ModuleIdentifier>();
    final DeploymentUnit top = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
    moduleIdentifiers.add(top.getAttachment(Attachments.MODULE_IDENTIFIER));
    for (final DeploymentUnit module : top.getAttachmentList(Attachments.SUB_DEPLOYMENTS)) {
        moduleIdentifiers.add(module.getAttachment(Attachments.MODULE_IDENTIFIER));
    }
    final ListIterator<ModuleDependency> iterator = moduleSpecification.getMutableUserDependencies().listIterator();
    while (iterator.hasNext()) {
        final ModuleDependency dep = iterator.next();
        final ModuleIdentifier identifier = dep.getIdentifier();
        if (identifier.getName().startsWith(ServiceModuleLoader.MODULE_PREFIX) && !identifier.getName().startsWith(ExtensionIndexService.MODULE_PREFIX) && !moduleIdentifiers.contains(identifier)) {
            iterator.remove();
        }
    }
}
Also used : ServiceModuleLoader(org.jboss.as.server.moduleservice.ServiceModuleLoader) ModuleLoader(org.jboss.modules.ModuleLoader) ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) ModuleIdentifier(org.jboss.modules.ModuleIdentifier) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) HashSet(java.util.HashSet)

Example 38 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.

the class GlobalDirectoryDependencyProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ServiceName depUnitServiceName = deploymentUnit.getServiceName();
    final DeploymentUnit parent = deploymentUnit.getParent();
    final DeploymentUnit topLevelDeployment = parent == null ? deploymentUnit : parent;
    final ExternalModule externalModuleService = topLevelDeployment.getAttachment(Attachments.EXTERNAL_MODULE_SERVICE);
    final ModuleLoader moduleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final CapabilityServiceSupport capabilitySupport = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    final ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
    final ServiceTarget target = phaseContext.getServiceTarget();
    final ServiceTarget externalServiceTarget = deploymentUnit.getAttachment(Attachments.EXTERNAL_SERVICE_TARGET);
    final ServiceName allDirReadyServiceName = depUnitServiceName.append("directory-services-ready");
    final ServiceBuilder<?> allDirReadyServiceBuilder = target.addService(allDirReadyServiceName);
    final List<Supplier<GlobalDirectoryResourceDefinition.GlobalDirectory>> allDirReadySuppliers = new ArrayList<>();
    final ServiceName csName = capabilitySupport.getCapabilityServiceName(EE_GLOBAL_DIRECTORY_CAPABILITY_NAME);
    List<ServiceName> serviceNames = serviceRegistry.getServiceNames();
    for (ServiceName serviceName : serviceNames) {
        if (csName.isParentOf(serviceName)) {
            Supplier<GlobalDirectoryResourceDefinition.GlobalDirectory> pathRequirement = allDirReadyServiceBuilder.requires(serviceName);
            allDirReadySuppliers.add(pathRequirement);
        }
    }
    if (!allDirReadySuppliers.isEmpty()) {
        GlobalDirectoryDeploymentService globalDirDepService = new GlobalDirectoryDeploymentService(allDirReadySuppliers, externalModuleService, moduleSpecification, moduleLoader, serviceRegistry, externalServiceTarget);
        allDirReadyServiceBuilder.requires(phaseContext.getPhaseServiceName());
        allDirReadyServiceBuilder.setInstance(globalDirDepService).install();
        phaseContext.requires(allDirReadyServiceName, new DelegatingSupplier());
    }
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ServiceTarget(org.jboss.msc.service.ServiceTarget) ArrayList(java.util.ArrayList) GlobalDirectoryDeploymentService(org.jboss.as.ee.subsystem.GlobalDirectoryDeploymentService) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport) DelegatingSupplier(org.jboss.as.server.deployment.DelegatingSupplier) ServiceName(org.jboss.msc.service.ServiceName) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) GlobalDirectoryResourceDefinition(org.jboss.as.ee.subsystem.GlobalDirectoryResourceDefinition) DelegatingSupplier(org.jboss.as.server.deployment.DelegatingSupplier) Supplier(java.util.function.Supplier) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) ExternalModule(org.jboss.as.server.moduleservice.ExternalModule) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 39 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.

the class MessagingDependencyProcessor method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    addDependency(moduleSpecification, moduleLoader, JMS_API);
    final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
    if (support.hasCapability(WELD_CAPABILITY_NAME)) {
        final WeldCapability api = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class).get();
        if (api.isPartOfWeldDeployment(deploymentUnit)) {
            addDependency(moduleSpecification, moduleLoader, AS_MESSAGING);
            // The messaging-activemq subsystem provides support for injected JMSContext.
            // one of the beans has a @TransactionScoped scope which requires the CDI context
            // provided by Narayana in the org.jboss.jts module.
            // @see CDIDeploymentProcessor
            addDependency(moduleSpecification, moduleLoader, JTS);
        }
    }
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) WeldCapability(org.jboss.as.weld.WeldCapability) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 40 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.

the class DependencyProcessor method addModuleDependencies.

private static void addModuleDependencies(DeploymentUnit deploymentUnit) {
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, "org.eclipse.microprofile.health.api", false, false, false, false));
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification)

Aggregations

ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)58 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)45 ModuleLoader (org.jboss.modules.ModuleLoader)45 ModuleDependency (org.jboss.as.server.deployment.module.ModuleDependency)44 ModuleIdentifier (org.jboss.modules.ModuleIdentifier)10 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)7 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)7 IOException (java.io.IOException)6 VirtualFile (org.jboss.vfs.VirtualFile)6 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)5 WeldCapability (org.jboss.as.weld.WeldCapability)5 HashSet (java.util.HashSet)4 MountHandle (org.jboss.as.server.deployment.module.MountHandle)4 WarMetaData (org.jboss.as.web.common.WarMetaData)4 ModuleLoadException (org.jboss.modules.ModuleLoadException)4 Closeable (java.io.Closeable)3 ArrayList (java.util.ArrayList)3 File (java.io.File)2 FilePermission (java.io.FilePermission)2 HashMap (java.util.HashMap)2