Java Code Examples for org.jboss.as.server.deployment.module.ModuleSpecification#addSystemDependency()

The following examples show how to use org.jboss.as.server.deployment.module.ModuleSpecification#addSystemDependency() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoggingDependencyDeploymentProcessor.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void deploy(final DeploymentPhaseContext phaseContext) {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    // Add the logging modules
    for (String moduleId : DUP_INJECTED_LOGGING_MODULES) {
        try {
            LoggingLogger.ROOT_LOGGER.tracef("Adding module '%s' to deployment '%s'", moduleId, deploymentUnit.getName());
            moduleLoader.loadModule(moduleId);
            moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, moduleId, false, false, false, false));
        } catch (ModuleLoadException ex) {
            LoggingLogger.ROOT_LOGGER.debugf("Module not found: %s", moduleId);
        }
    }
}
 
Example 2
Source File: KeycloakProviderDependencyProcessor.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    KeycloakAdapterConfigService config = KeycloakAdapterConfigService.INSTANCE;
    String deploymentName = deploymentUnit.getName();

    if (config.isKeycloakServerDeployment(deploymentName)) {
        return;
    }

    KeycloakDeploymentInfo info = getKeycloakProviderDeploymentInfo(deploymentUnit);
    if (info.hasServices()) {
        final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
        final ModuleLoader moduleLoader = Module.getBootModuleLoader();
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE, false, false, false, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_SERVER_SPI, false, false, false, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_SERVER_SPI_PRIVATE, false, false, false, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JAXRS, false, false, false, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, RESTEASY, false, false, false, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, APACHE, false, false, false, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_JPA, false, false, false, false));
    }
}
 
Example 3
Source File: DependencyProcessor.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void deploy(DeploymentPhaseContext context) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = context.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();

    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, elytronIdentifier, false, false, true, false));
}
 
Example 4
Source File: EESecurityDependencyProcessor.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void deploy(DeploymentPhaseContext phaseContext) {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);

    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JACC_API, false, false, true, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, AUTH_MESSAGE_API, false, false, true, false));
}
 
Example 5
Source File: Seam2Processor.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (deploymentUnit.getParent() != null) {
        return;
    }

    final List<DeploymentUnit> deploymentUnits = new ArrayList<DeploymentUnit>();
    deploymentUnits.add(deploymentUnit);
    deploymentUnits.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS));

    for (DeploymentUnit unit : deploymentUnits) {

        final ResourceRoot mainRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
        if (mainRoot == null)
            continue;

        VirtualFile root = mainRoot.getRoot();
        for (String path : SEAM_FILES) {
            if (root.getChild(path).exists()) {
                final ModuleSpecification moduleSpecification = deploymentUnit
                        .getAttachment(Attachments.MODULE_SPECIFICATION);
                final ModuleLoader moduleLoader = Module.getBootModuleLoader();
                moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VFS_MODULE, false, false, false,
                        false)); // for VFS scanner

                try {
                    ResourceLoader resourceLoader = ResourceLoaders.createJarResourceLoader(SEAM_INT_JAR, new JarFile(
                            getSeamIntResourceRoot().getRoot().getPathName()));
                    moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(resourceLoader));
                } catch (Exception e) {
                    throw new DeploymentUnitProcessingException(e);
                }

                unit.addToAttachmentList(Attachments.RESOURCE_ROOTS, getSeamIntResourceRoot());
                return;
            }
        }
    }
}
 
Example 6
Source File: ServiceActivatorDependencyProcessor.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Add the dependencies if the deployment contains a service activator loader entry.
 * @param phaseContext the deployment unit context
 * @throws DeploymentUnitProcessingException
 */
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT);
    final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment(
            Attachments.MODULE_SPECIFICATION);
    if(deploymentRoot == null)
        return;
    final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES);
    if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {
        moduleSpecification.addSystemDependency(MSC_DEP);
    }
}
 
Example 7
Source File: KeycloakDependencyProcessor.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
    // ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_JBOSS_CORE_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
}
 
Example 8
Source File: KeycloakDependencyProcessor.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
    // ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_JBOSS_CORE_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
}
 
Example 9
Source File: KeycloakDependencyProcessorWildFly.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected void addPlatformSpecificModules(DeploymentPhaseContext phaseContext, ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
    if (isElytronEnabled(phaseContext)) {
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_ELYTRON_ADAPTER, true, false, true, false));
    } else {
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_WILDFLY_ADAPTER, false, false, true, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_UNDERTOW_ADAPTER, false, false, false, false));
    }
}
 
Example 10
Source File: KeycloakDependencyProcessor.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
    // ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_JBOSS_CORE_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_API_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
}
 
Example 11
Source File: KeycloakDependencyProcessor.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private void addCommonModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
    // ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_JBOSS_CORE_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_API_ADAPTER, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
}
 
Example 12
Source File: KeycloakDependencyProcessorWildFly.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected void addPlatformSpecificModules(DeploymentPhaseContext phaseContext, ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
    if (isElytronEnabled(phaseContext)) {
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_ELYTRON_ADAPTER, true, false, false, false));
    } else {
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_WILDFLY_ADAPTER, false, false, true, false));
        moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_UNDERTOW_ADAPTER, false, false, false, false));
    }
}
 
Example 13
Source File: KeycloakDependencyProcessorAS7.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
protected void addPlatformSpecificModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
    // ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_AS7_ADAPTER, false, false, true, false));
}
 
Example 14
Source File: KeycloakDependencyProcessorAS7.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
protected void addPlatformSpecificModules(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader) {
    // ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_AS7_ADAPTER, false, false, true, false));
}
 
Example 15
Source File: ModuleDependencyProcessor.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
private void addSystemDependency(ModuleLoader moduleLoader, final ModuleSpecification moduleSpecification, ModuleIdentifier dependency) {
  moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, dependency, false, false, false, false));
}
 
Example 16
Source File: ModuleDependencyProcessor.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
private void addSystemDependency(ModuleLoader moduleLoader, final ModuleSpecification moduleSpecification, ModuleIdentifier dependency) {
  moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, dependency, false, false, false, false));
}