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);
}
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();
}
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));
}
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);
}
}
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));
}
Aggregations