Search in sources :

Example 6 with ModuleSpecification

use of org.jboss.as.server.deployment.module.ModuleSpecification 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 7 with ModuleSpecification

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

the class RaStructureProcessor method deploy.

public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ResourceRoot resourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
    if (resourceRoot == null) {
        return;
    }
    final VirtualFile deploymentRoot = resourceRoot.getRoot();
    if (deploymentRoot == null || !deploymentRoot.exists()) {
        return;
    }
    final String deploymentRootName = deploymentRoot.getName().toLowerCase(Locale.ENGLISH);
    if (!deploymentRootName.endsWith(RAR_EXTENSION)) {
        return;
    }
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    moduleSpecification.setPublicModule(true);
    // this violates the spec, but everyone expects it to work
    ModuleRootMarker.mark(resourceRoot, true);
    Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
    try {
        final List<VirtualFile> childArchives = deploymentRoot.getChildren(CHILD_ARCHIVE_FILTER);
        for (final VirtualFile child : childArchives) {
            String relativeName = child.getPathNameRelativeTo(deploymentRoot);
            MountedDeploymentOverlay overlay = overlays.get(relativeName);
            Closeable closable = NO_OP_CLOSEABLE;
            if (overlay != null) {
                overlay.remountAsZip(false);
            } else if (child.isFile()) {
                closable = VFS.mountZip(child, child, TempFileProviderService.provider());
            }
            final MountHandle mountHandle = new MountHandle(closable);
            final ResourceRoot childResource = new ResourceRoot(child, mountHandle);
            ModuleRootMarker.mark(childResource);
            deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource);
            resourceRoot.addToAttachmentList(Attachments.INDEX_IGNORE_PATHS, child.getPathNameRelativeTo(deploymentRoot));
        }
    } catch (IOException e) {
        throw ConnectorLogger.ROOT_LOGGER.failedToProcessRaChild(e, deploymentRoot);
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) MountedDeploymentOverlay(org.jboss.as.server.deployment.MountedDeploymentOverlay) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) MountHandle(org.jboss.as.server.deployment.module.MountHandle) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) Closeable(java.io.Closeable) IOException(java.io.IOException) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 8 with ModuleSpecification

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

the class RarDependencyProcessor method deploy.

/**
 * Add dependencies for modules required for ra deployments
 *
 * @param phaseContext the deployment unit context
 * @throws DeploymentUnitProcessingException
 */
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, RESOURCE_API_ID, false, false, false, false));
    if (phaseContext.getDeploymentUnit().getAttachment(ConnectorXmlDescriptor.ATTACHMENT_KEY) == null) {
        // Skip non ra deployments
        return;
    }
    // if a module depends on a rar it also needs a dep on all the rar's "local dependencies"
    moduleSpecification.setLocalDependenciesTransitive(true);
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, JMS_ID, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VALIDATION_ID, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, IRON_JACAMAR_ID, false, false, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, IRON_JACAMAR_IMPL_ID, false, true, false, false));
    moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, HIBERNATE_VALIDATOR_ID, false, false, true, false));
    if (!appclient)
        phaseContext.addDeploymentDependency(ConnectorServices.RESOURCEADAPTERS_SUBSYSTEM_SERVICE, ResourceAdaptersSubsystemService.ATTACHMENT_KEY);
}
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 9 with ModuleSpecification

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

the class DriverManagerAdapterProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final DriverAdapterResourceLoader resourceLoader = new DriverAdapterResourceLoader();
    moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(resourceLoader));
}
Also used : ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 10 with ModuleSpecification

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

the class OidcDependencyProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (!OidcDeploymentMarker.isOidcDeployment(deploymentUnit)) {
        return;
    }
    ModuleLoader moduleLoader = Module.getBootModuleLoader();
    ModuleSpecification moduleSpec = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ELYTRON_HTTP_OIDC, 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)

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