use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.
the class HibernateSearchProcessor 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();
if (JPADeploymentMarker.isJPADeployment(deploymentUnit)) {
addSearchDependency(moduleSpecification, moduleLoader, deploymentUnit);
}
}
use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.
the class PersistenceProviderLoader method loadProviderModuleByName.
/**
* Loads the specified JPA persistence provider module
*
* @param moduleName is the static module to be loaded
* @throws ModuleLoadException
* @return list of persistence providers in specified module
*
* Note: side effect of saving loaded persistence providers to static api in javax.persistence.spi.PersistenceProvider.
*/
public static List<PersistenceProvider> loadProviderModuleByName(String moduleName) throws ModuleLoadException {
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
Module module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleName));
final ServiceLoader<PersistenceProvider> serviceLoader = module.loadService(PersistenceProvider.class);
List<PersistenceProvider> result = new ArrayList<>();
if (serviceLoader != null) {
for (PersistenceProvider provider1 : serviceLoader) {
// persistence provider jar may contain multiple provider service implementations
// save each provider
PersistenceProviderResolverImpl.getInstance().addPersistenceProvider(provider1);
result.add(provider1);
}
}
return result;
}
use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.
the class FederationDependencyProcessor method addDependency.
private void addDependency(DeploymentPhaseContext phaseContext, ServiceName federationServiceName) {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
ModuleLoader moduleLoader = Module.getBootModuleLoader();
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, MODULE_ORG_PICKETLINK, false, false, true, false));
phaseContext.addDeploymentDependency(federationServiceName, DEPLOYMENT_ATTACHMENT_KEY);
}
use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.
the class UndertowDependencyProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext phaseContext) {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
//add the api classes for every deployment
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, SERVLET_API, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JSP_API, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, WEBSOCKET_API, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JSTL, false, false, false, false));
if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
// Skip non web deployments
return;
}
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, UNDERTOW_CORE, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, UNDERTOW_SERVLET, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, UNDERTOW_JSP, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, UNDERTOW_WEBSOCKET, false, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, UNDERTOW_JS, true, false, true, false));
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, CLUSTERING_API, true, false, false, false));
}
use of org.jboss.modules.ModuleLoader in project wildfly by wildfly.
the class ExpressionFilterDefinition method createHttpHandler.
@Override
public HttpHandler createHttpHandler(Predicate predicate, ModelNode model, HttpHandler next) {
String expression = model.get(EXPRESSION.getName()).asString();
String moduleName = null;
if (model.hasDefined(MODULE.getName())) {
moduleName = model.get(MODULE.getName()).asString();
}
ClassLoader classLoader;
if (moduleName == null) {
classLoader = getClass().getClassLoader();
} else {
try {
ModuleLoader moduleLoader = Module.getBootModuleLoader();
Module filterModule = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleName));
classLoader = filterModule.getClassLoader();
} catch (ModuleLoadException e) {
throw UndertowLogger.ROOT_LOGGER.couldNotLoadHandlerFromModule(expression, moduleName, e);
}
}
List<PredicatedHandler> handlers = PredicatedHandlersParser.parse(expression, classLoader);
UndertowLogger.ROOT_LOGGER.debugf("Creating http handler %s from module %s", expression, moduleName);
if (predicate != null) {
return Handlers.predicate(predicate, Handlers.predicates(handlers, next), next);
} else {
return Handlers.predicates(handlers, next);
}
}
Aggregations