Search in sources :

Example 46 with ModuleDependency

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

the class WeldDependencyProcessor method deploy.

/**
 * Add dependencies for modules required for weld deployments, if managed weld configurations are attached to the deployment
 */
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, JAVAX_ENTERPRISE_API);
    addDependency(moduleSpecification, moduleLoader, JAVAX_INJECT_API);
    if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        // Skip if there are no beans.xml files in the deployment
        return;
    }
    addDependency(moduleSpecification, moduleLoader, JAVAX_PERSISTENCE_API_ID);
    addDependency(moduleSpecification, moduleLoader, WELD_CORE_ID);
    addDependency(moduleSpecification, moduleLoader, WELD_PROBE_ID, true);
    addDependency(moduleSpecification, moduleLoader, WELD_API_ID);
    addDependency(moduleSpecification, moduleLoader, WELD_SPI_ID);
    ModuleDependency weldSubsystemDependency = new ModuleDependency(moduleLoader, JBOSS_AS_WELD_ID, false, false, false, false);
    weldSubsystemDependency.addImportFilter(PathFilters.getMetaInfFilter(), true);
    weldSubsystemDependency.addImportFilter(PathFilters.is("org/jboss/as/weld/injection"), true);
    weldSubsystemDependency.addImportFilter(PathFilters.acceptAll(), false);
    weldSubsystemDependency.addExportFilter(PathFilters.getMetaInfFilter(), true);
    moduleSpecification.addSystemDependency(weldSubsystemDependency);
    // Due to serialization of Jakarta Enterprise Beans
    ModuleDependency weldEjbDependency = new ModuleDependency(moduleLoader, JBOSS_AS_WELD_EJB_ID, true, false, false, false);
    weldEjbDependency.addImportFilter(PathFilters.is("org/jboss/as/weld/ejb"), true);
    weldEjbDependency.addImportFilter(PathFilters.acceptAll(), false);
    moduleSpecification.addSystemDependency(weldEjbDependency);
}
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 47 with ModuleDependency

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

the class CompensationsDependenciesDeploymentProcessor method addCompensationsModuleDependency.

private void addCompensationsModuleDependency(final DeploymentUnit unit) {
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION);
    moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, COMPENSATIONS_MODULE, 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)

Example 48 with ModuleDependency

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

the class WSClassVerificationProcessorTestCase method testCxfModuleDependencyPresent.

@Test
public void testCxfModuleDependencyPresent() {
    spec.addUserDependency(new ModuleDependency(null, "org.apache.cxf", false, false, false, false));
    Assert.assertTrue(WSClassVerificationProcessor.hasCxfModuleDependency(unit));
}
Also used : ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) Test(org.junit.Test)

Example 49 with ModuleDependency

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

the class WSClassVerificationProcessorTestCase method testSiblingExportedCxfModuleDependencyPresent.

@Test
public void testSiblingExportedCxfModuleDependencyPresent() {
    setSubDeploymentsIsolated(false);
    siblingSpec.addUserDependency(new ModuleDependency(null, "org.apache.cxf", false, true, false, false));
    Assert.assertTrue(WSClassVerificationProcessor.hasCxfModuleDependency(unit));
}
Also used : ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) Test(org.junit.Test)

Example 50 with ModuleDependency

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

the class WSClassVerificationProcessorTestCase method testSiblingCxfModuleDependencyPresentIsolatedDeploymentsTrue.

@Test
public void testSiblingCxfModuleDependencyPresentIsolatedDeploymentsTrue() {
    setSubDeploymentsIsolated(true);
    siblingSpec.addUserDependency(new ModuleDependency(null, "org.apache.cxf", false, true, false, false));
    Assert.assertFalse(WSClassVerificationProcessor.hasCxfModuleDependency(unit));
}
Also used : ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) Test(org.junit.Test)

Aggregations

ModuleDependency (org.jboss.as.server.deployment.module.ModuleDependency)66 ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)45 ModuleLoader (org.jboss.modules.ModuleLoader)40 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)34 ModuleIdentifier (org.jboss.modules.ModuleIdentifier)16 Test (org.junit.Test)6 ModuleLoadException (org.jboss.modules.ModuleLoadException)5 HashSet (java.util.HashSet)4 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)4 ArrayList (java.util.ArrayList)3 CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)3 WarMetaData (org.jboss.as.web.common.WarMetaData)3 WeldCapability (org.jboss.as.weld.WeldCapability)3 Module (org.jboss.modules.Module)3 HashMap (java.util.HashMap)2 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)2 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)2 ServiceModuleLoader (org.jboss.as.server.moduleservice.ServiceModuleLoader)2 VirtualFile (org.jboss.vfs.VirtualFile)2 Closeable (java.io.Closeable)1