Search in sources :

Example 11 with ModuleLoader

use of org.jboss.modules.ModuleLoader 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 12 with ModuleLoader

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

the class ClusteringDependencyProcessor 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();
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, API, true, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, MARSHALLING_API, true, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, SINGLETON_API, true, false, false, 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 13 with ModuleLoader

use of org.jboss.modules.ModuleLoader 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);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    addDependency(moduleSpecification, moduleLoader, JAXRS_API, false);
    addDependency(moduleSpecification, moduleLoader, JAXB_API, false);
    addDependency(moduleSpecification, moduleLoader, JSON_API, false);
    //we need to add these from all deployments, as they could be using the JAX-RS client
    addDependency(moduleSpecification, moduleLoader, RESTEASY_ATOM, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_VALIDATOR_11, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JAXRS, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JAXB, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JACKSON2, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JSON_P_PROVIDER, true);
    //addDependency(moduleSpecification, moduleLoader, RESTEASY_JETTISON);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_JSAPI, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_MULTIPART, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_YAML, true);
    addDependency(moduleSpecification, moduleLoader, JACKSON_CORE_ASL, true);
    addDependency(moduleSpecification, moduleLoader, RESTEASY_CRYPTO, true);
    addDependency(moduleSpecification, moduleLoader, JACKSON_DATATYPE_JDK8, true);
    addDependency(moduleSpecification, moduleLoader, JACKSON_DATATYPE_JSR310, true);
    if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        addDependency(moduleSpecification, moduleLoader, RESTEASY_CDI, true);
    }
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 14 with ModuleLoader

use of org.jboss.modules.ModuleLoader 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 EJBs
    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 15 with ModuleLoader

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

the class PersistenceProviderAdaptorLoader method loadPersistenceAdapterModule.

/**
     * Loads the persistence provider adapter
     *
     * @param adapterModule may specify the adapter module name (can be null to use noop provider)
     * @return the persistence provider adaptor for the provider class
     * @throws ModuleLoadException
     */
public static PersistenceProviderAdaptor loadPersistenceAdapterModule(final String adapterModule, final Platform platform, JtaManagerImpl manager) throws ModuleLoadException {
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    if (adapterModule == null) {
        return noopAdaptor;
    }
    PersistenceProviderAdaptor persistenceProviderAdaptor = null;
    Module module = moduleLoader.loadModule(ModuleIdentifier.fromString(adapterModule));
    final ServiceLoader<PersistenceProviderAdaptor> serviceLoader = module.loadService(PersistenceProviderAdaptor.class);
    if (serviceLoader != null) {
        for (PersistenceProviderAdaptor adaptor : serviceLoader) {
            if (persistenceProviderAdaptor != null) {
                throw JpaLogger.ROOT_LOGGER.multipleAdapters(adapterModule);
            }
            persistenceProviderAdaptor = adaptor;
            ROOT_LOGGER.debugf("loaded persistence provider adapter %s", adapterModule);
        }
        if (persistenceProviderAdaptor != null) {
            persistenceProviderAdaptor.injectJtaManager(manager);
            persistenceProviderAdaptor.injectPlatform(platform);
        }
    }
    return persistenceProviderAdaptor;
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) Module(org.jboss.modules.Module) PersistenceProviderAdaptor(org.jipijapa.plugin.spi.PersistenceProviderAdaptor)

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