Search in sources :

Example 11 with ModuleSpecification

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

the class DefaultEarSubDeploymentsIsolationProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    // we only process .ear
    if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
        return;
    }
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    // set the default ear subdeployment isolation value
    moduleSpecification.setSubDeploymentModulesIsolated(earSubDeploymentsIsolated);
}
Also used : ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 12 with ModuleSpecification

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

the class BeanValidationDeploymentDependenciesProcessor method deploy.

@Override
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();
    // 
    for (final ModuleIdentifier moduleIdentifier : DEPENDENCIES) {
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, true, 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) ModuleIdentifier(org.jboss.modules.ModuleIdentifier) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 13 with ModuleSpecification

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

the class JavaEEDependencyProcessor method deploy.

/**
 * Add the EE APIs as a dependency to all deployments
 *
 * @param phaseContext the deployment unit context
 * @throws DeploymentUnitProcessingException
 */
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();
    // add jboss-invocation classes needed by the proxies
    ModuleDependency invocation = new ModuleDependency(moduleLoader, JBOSS_INVOCATION_ID, false, false, false, false);
    invocation.addImportFilter(PathFilters.is("org/jboss/invocation/proxy/classloading"), true);
    invocation.addImportFilter(PathFilters.acceptAll(), false);
    moduleSpecification.addSystemDependency(invocation);
    ModuleDependency ee = new ModuleDependency(moduleLoader, JBOSS_AS_EE, false, false, false, false);
    ee.addImportFilter(PathFilters.is("org/jboss/as/ee/component/serialization"), true);
    ee.addImportFilter(PathFilters.is("org/jboss/as/ee/concurrent"), true);
    ee.addImportFilter(PathFilters.is("org/jboss/as/ee/concurrent/handle"), true);
    ee.addImportFilter(PathFilters.acceptAll(), false);
    moduleSpecification.addSystemDependency(ee);
    // add dep for naming permission
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(WILDFLY_NAMING), false, false, false, false));
    for (final ModuleIdentifier moduleIdentifier : JAVA_EE_API_MODULES) {
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleIdentifier, true, 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) ModuleIdentifier(org.jboss.modules.ModuleIdentifier) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 14 with ModuleSpecification

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

the class JaxrsDependencyProcessor method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    boolean deploymentBundlesClientBuilder = isClientBuilderInDeployment(deploymentUnit);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    addDependency(moduleSpecification, moduleLoader, JAXRS_API, false, false);
    addDependency(moduleSpecification, moduleLoader, JAXB_API, false, false);
    addDependency(moduleSpecification, moduleLoader, JSON_API, false, false);
    // we need to add these from all deployments, as they could be using the Jakarta RESTful Web Services client
    addDependency(moduleSpecification, moduleLoader, RESTEASY_ATOM, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_VALIDATOR, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_CLIENT, true, deploymentBundlesClientBuilder);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_CLIENT_API, true, deploymentBundlesClientBuilder);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_CORE, true, deploymentBundlesClientBuilder);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_CORE_SPI, true, deploymentBundlesClientBuilder);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_CLIENT_MICROPROFILE, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JAXB, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JACKSON2, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JSON_P_PROVIDER, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JSON_B_PROVIDER, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JSAPI, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_MULTIPART, true, false);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_CRYPTO, true, false);
    addDependency(moduleSpecification, moduleLoader, JACKSON_DATATYPE_JDK8, true, false);
    addDependency(moduleSpecification, moduleLoader, JACKSON_DATATYPE_JSR310, true, false);
    addDependency(moduleSpecification, moduleLoader, MP_REST_CLIENT, true, false);
    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, RESTEASY_CDI, true, false);
        }
    }
}
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 15 with ModuleSpecification

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

the class JSFDependencyProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final DeploymentUnit tl = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    // Set default when no default version has been set on the war file
    String jsfVersion = JsfVersionMarker.getVersion(tl).equals(JsfVersionMarker.NONE) ? JSFModuleIdFactory.getInstance().getDefaultSlot() : JsfVersionMarker.getVersion(tl);
    String defaultJsfVersion = JSFModuleIdFactory.getInstance().getDefaultSlot();
    if (JsfVersionMarker.isJsfDisabled(deploymentUnit)) {
        if (jsfVersion.equals(defaultJsfVersion) && !moduleIdFactory.isValidJSFSlot(jsfVersion)) {
            throw JSFLogger.ROOT_LOGGER.invalidDefaultJSFImpl(defaultJsfVersion);
        }
        addJSFAPI(JsfVersionMarker.JSF_2_0, moduleSpecification, moduleLoader);
        return;
    }
    if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) && !DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
        return;
    }
    if (jsfVersion.equals(JsfVersionMarker.WAR_BUNDLES_JSF_IMPL)) {
        // if Jakarta Server Faces is provided by the application we leave it alone
        return;
    }
    if (!moduleIdFactory.isValidJSFSlot(jsfVersion)) {
        JSFLogger.ROOT_LOGGER.unknownJSFVersion(jsfVersion, defaultJsfVersion);
        jsfVersion = defaultJsfVersion;
    }
    if (jsfVersion.equals(defaultJsfVersion) && !moduleIdFactory.isValidJSFSlot(jsfVersion)) {
        throw JSFLogger.ROOT_LOGGER.invalidDefaultJSFImpl(defaultJsfVersion);
    }
    addJSFAPI(jsfVersion, moduleSpecification, moduleLoader);
    addJSFImpl(jsfVersion, moduleSpecification, moduleLoader);
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JSF_SUBSYSTEM, false, false, true, false));
    addJSFInjection(jsfVersion, moduleSpecification, moduleLoader);
    WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
    if (warMetaData != null) {
        addCDIFlag(warMetaData, deploymentUnit);
    }
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) WarMetaData(org.jboss.as.web.common.WarMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

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