Search in sources :

Example 31 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly by wildfly.

the class SecurityDependencyProcessor method deploy.

/** {@inheritDoc} */
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, PICKETBOX_ID, false, false, false, false));
    //add the remoting login module
    final ModuleDependency remoting = new ModuleDependency(moduleLoader, REMOTING_LOGIN_MODULE, false, false, false, false);
    remoting.addImportFilter(PathFilters.is(RemotingLoginModule.class.getName().replace(".", "/")), true);
    moduleSpecification.addSystemDependency(remoting);
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JACC_API, false, false, true, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, AUTH_MESSAGE_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) RemotingLoginModule(org.jboss.as.security.remoting.RemotingLoginModule)

Example 32 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project wildfly-camel by wildfly-extras.

the class CamelDependenciesProcessor method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
    CamelDeploymentSettings depSettings = depUnit.getAttachment(CamelDeploymentSettings.ATTACHMENT_KEY);
    // Camel dependencies disabled
    if (!depSettings.isEnabled()) {
        return;
    }
    ModuleLoader moduleLoader = depUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
    ModuleSpecification moduleSpec = depUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    moduleSpec.addUserDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(GRAVIA_MODULE), false, false, false, false));
    moduleSpec.addUserDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(WILDFLY_CAMEL_MODULE), false, false, false, false));
    // Add camel aggregator dependency
    ModuleDependency moddep = new ModuleDependency(moduleLoader, ModuleIdentifier.create(APACHE_CAMEL_MODULE), false, false, true, false);
    moddep.addImportFilter(PathFilters.getMetaInfFilter(), true);
    moduleSpec.addUserDependency(moddep);
    List<ModuleIdentifier> deploymentDefinedModules = depSettings.getModuleDependencies();
    if (!deploymentDefinedModules.isEmpty()) {
        for (ModuleIdentifier modid : deploymentDefinedModules) {
            moduleSpec.addUserDependency(new ModuleDependency(moduleLoader, modid, false, false, true, false));
        }
    } else {
        moddep = new ModuleDependency(moduleLoader, ModuleIdentifier.create(APACHE_CAMEL_COMPONENT_MODULE), false, false, true, false);
        moddep.addImportFilter(PathFilters.getMetaInfFilter(), true);
        moddep.addImportFilter(PathFilters.isOrIsChildOf("META-INF/cxf"), true);
        moduleSpec.addUserDependency(moddep);
        moddep = new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.apache.camel.component.cdi"), true, false, false, false);
        moddep.addImportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), true);
        moddep.addImportFilter(PathFilters.getMetaInfFilter(), true);
        moduleSpec.addUserDependency(moddep);
    }
}
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 33 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project teiid by teiid.

the class FileRootMountProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT) != null || !deploymentUnit.getName().toLowerCase().endsWith(this.fileSuffix)) {
        return;
    }
    final DeploymentMountProvider deploymentMountProvider = deploymentUnit.getAttachment(Attachments.SERVER_DEPLOYMENT_REPOSITORY);
    if (deploymentMountProvider == null) {
        throw new DeploymentUnitProcessingException("No deployment repository available.");
    }
    final VirtualFile deploymentContents = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_CONTENTS);
    // internal deployments do not have any contents, so there is nothing to mount
    if (deploymentContents == null)
        return;
    String deploymentName = deploymentUnit.getName();
    final VirtualFile deploymentRoot = VFS.getChild("content/" + deploymentName);
    Closeable handle = null;
    final MountHandle mountHandle;
    boolean failed = false;
    try {
        handle = deploymentMountProvider.mountDeploymentContent(deploymentContents, deploymentRoot, MountType.REAL);
        mountHandle = new MountHandle(handle);
    } catch (IOException e) {
        failed = true;
        throw new DeploymentUnitProcessingException("Failed to mount " + this.fileSuffix + " file", e);
    } finally {
        if (failed) {
            VFSUtils.safeClose(handle);
        }
    }
    final ResourceRoot resourceRoot = new ResourceRoot(deploymentRoot, mountHandle);
    ModuleRootMarker.mark(resourceRoot);
    deploymentUnit.putAttachment(Attachments.DEPLOYMENT_ROOT, resourceRoot);
    deploymentUnit.putAttachment(Attachments.MODULE_SPECIFICATION, new ModuleSpecification());
}
Also used : DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) VirtualFile(org.jboss.vfs.VirtualFile) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) DeploymentMountProvider(org.jboss.as.server.deployment.DeploymentMountProvider) MountHandle(org.jboss.as.server.deployment.module.MountHandle) Closeable(java.io.Closeable) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) IOException(java.io.IOException) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 34 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project teiid by teiid.

the class DynamicVDBRootMountDeployer method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT) != null) {
        return;
    }
    final String deploymentName = deploymentUnit.getName();
    final VirtualFile deploymentContents = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_CONTENTS);
    // internal deployments do not have any contents, so there is nothing to mount
    if (deploymentContents == null)
        return;
    if (deploymentName.endsWith(DYNAMIC_VDB_STRUCTURE) || deploymentName.endsWith(DDL_VDB_STRUCTURE)) {
        // use the contents directly
        // nothing was mounted
        final ResourceRoot resourceRoot = new ResourceRoot(deploymentContents, null);
        ModuleRootMarker.mark(resourceRoot);
        deploymentUnit.putAttachment(Attachments.DEPLOYMENT_ROOT, resourceRoot);
        deploymentUnit.putAttachment(Attachments.MODULE_SPECIFICATION, new ModuleSpecification());
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification)

Example 35 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification in project teiid by teiid.

the class TranslatorDependencyDeployer method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    try {
        final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
        // $NON-NLS-1$
        final ModuleLoader moduleLoader = Module.getCallerModule().getModule(ModuleIdentifier.create("org.jboss.teiid")).getModuleLoader();
        // $NON-NLS-1$
        moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.api"), false, false, false, false));
        // $NON-NLS-1$
        moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.common-core"), false, false, false, false));
        // $NON-NLS-1$
        moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.api"), false, false, false, false));
        // $NON-NLS-1$
        moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.resource.api"), false, false, false, false));
    } catch (ModuleLoadException e) {
        throw new DeploymentUnitProcessingException(e);
    }
}
Also used : ModuleLoadException(org.jboss.modules.ModuleLoadException) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) 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

ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)58 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)45 ModuleLoader (org.jboss.modules.ModuleLoader)45 ModuleDependency (org.jboss.as.server.deployment.module.ModuleDependency)44 ModuleIdentifier (org.jboss.modules.ModuleIdentifier)10 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)7 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)7 IOException (java.io.IOException)6 VirtualFile (org.jboss.vfs.VirtualFile)6 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)5 WeldCapability (org.jboss.as.weld.WeldCapability)5 HashSet (java.util.HashSet)4 MountHandle (org.jboss.as.server.deployment.module.MountHandle)4 WarMetaData (org.jboss.as.web.common.WarMetaData)4 ModuleLoadException (org.jboss.modules.ModuleLoadException)4 Closeable (java.io.Closeable)3 ArrayList (java.util.ArrayList)3 File (java.io.File)2 FilePermission (java.io.FilePermission)2 HashMap (java.util.HashMap)2