Search in sources :

Example 1 with ModuleLoader

use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.

the class JPADependencyProcessor method deploy.

/**
     * Add dependencies for modules required for JPA deployments
     */
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();
    // all applications get the javax.persistence module added to their deplyoment by default
    addDependency(moduleSpecification, moduleLoader, deploymentUnit, JAVAX_PERSISTENCE_API_ID);
    if (!JPADeploymentMarker.isJPADeployment(deploymentUnit)) {
        // Skip if there are no persistence use in the deployment
        return;
    }
    addDependency(moduleSpecification, moduleLoader, deploymentUnit, JBOSS_AS_JPA_ID, JBOSS_AS_JPA_SPI_ID, JAVASSIST_ID);
    addPersistenceProviderModuleDependencies(phaseContext, moduleSpecification, moduleLoader);
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 2 with ModuleLoader

use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.

the class SecurityActions method getModuleClassLoader.

static ModuleClassLoader getModuleClassLoader(final String moduleSpec) throws ModuleLoadException {
    ModuleLoader loader = Module.getCallerModuleLoader();
    final Module module = loader.loadModule(ModuleIdentifier.fromString(moduleSpec));
    GetModuleClassLoaderAction action = new GetModuleClassLoaderAction(module);
    return WildFlySecurityManager.isChecking() ? doPrivileged(action) : action.run();
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) GetModuleClassLoaderAction(org.wildfly.security.manager.action.GetModuleClassLoaderAction) Module(org.jboss.modules.Module)

Example 3 with ModuleLoader

use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.

the class Jsr77DependenciesProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION);
    moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, JSR77_API, false, true, 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 4 with ModuleLoader

use of org.jboss.modules.ModuleLoader 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();
    if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit) && !DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
        return;
    }
    String jsfVersion = JsfVersionMarker.getVersion(tl);
    if (jsfVersion.equals(JsfVersionMarker.WAR_BUNDLES_JSF_IMPL)) {
        //if JSF is provided by the application we leave it alone
        return;
    }
    //TODO: we should do that same check that is done in com.sun.faces.config.FacesInitializer
    //and only add the dependency if JSF is actually needed
    String defaultJsfVersion = JSFModuleIdFactory.getInstance().getDefaultSlot();
    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);
    }
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    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)

Example 5 with ModuleLoader

use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.

the class MailDependenciesProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION);
    moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, MAIL_API, false, false, true, false));
    moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ACTIVATION_API, 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)

Aggregations

ModuleLoader (org.jboss.modules.ModuleLoader)32 ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)26 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)24 ModuleDependency (org.jboss.as.server.deployment.module.ModuleDependency)22 Module (org.jboss.modules.Module)4 ModuleIdentifier (org.jboss.modules.ModuleIdentifier)4 ArrayList (java.util.ArrayList)2 PredicatedHandler (io.undertow.server.handlers.builder.PredicatedHandler)1 Method (java.lang.reflect.Method)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 ConcurrencyManagementType (javax.ejb.ConcurrencyManagementType)1 TransactionManagementType (javax.ejb.TransactionManagementType)1 PersistenceProvider (javax.persistence.spi.PersistenceProvider)1 Attachments (org.jboss.as.ee.component.Attachments)1 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)1 ComponentConfigurator (org.jboss.as.ee.component.ComponentConfigurator)1 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1