Search in sources :

Example 1 with MountHandle

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

the class VDBDependencyDeployer method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
        return;
    }
    final VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
    ArrayList<ModuleDependency> localDependencies = new ArrayList<ModuleDependency>();
    ArrayList<ModuleDependency> userDependencies = new ArrayList<ModuleDependency>();
    // $NON-NLS-1$
    String moduleNames = deployment.getPropertyValue("lib");
    if (moduleNames != null) {
        StringTokenizer modules = new StringTokenizer(moduleNames);
        while (modules.hasMoreTokens()) {
            String moduleName = modules.nextToken().trim();
            ModuleIdentifier lib = ModuleIdentifier.create(moduleName);
            ModuleLoader moduleLoader = Module.getCallerModuleLoader();
            try {
                moduleLoader.loadModule(lib);
                localDependencies.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create(moduleName), false, false, false, false));
            } catch (ModuleLoadException e) {
                // this is to handle JAR based deployments which take on name like "deployment.<jar-name>"
                moduleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
                try {
                    moduleLoader.loadModule(lib);
                    userDependencies.add(new ModuleDependency(moduleLoader, ModuleIdentifier.create(moduleName), false, false, false, true));
                } catch (ModuleLoadException e1) {
                    throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50088, moduleName, deployment.getName(), deployment.getVersion(), e1));
                }
            }
        }
    }
    if (!TeiidAttachments.isVDBXMLDeployment(deploymentUnit)) {
        try {
            final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
            final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
            if (deploymentRoot == null) {
                return;
            }
            final VirtualFile libDir = deploymentRoot.getChild(LIB);
            if (libDir.exists()) {
                final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
                for (final VirtualFile archive : archives) {
                    try {
                        final Closeable closable = VFS.mountZip(archive, archive, TempFileProviderService.provider());
                        final ResourceRoot jarArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
                        ModuleRootMarker.mark(jarArchiveRoot);
                        deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, jarArchiveRoot);
                    } catch (IOException e) {
                        throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50018, archive), e);
                    }
                }
            }
        } catch (IOException e) {
            throw new DeploymentUnitProcessingException(e);
        }
    }
    // add translators as dependent modules to this VDB.
    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));
        if (!localDependencies.isEmpty()) {
            moduleSpecification.addLocalDependencies(localDependencies);
        }
        if (!userDependencies.isEmpty()) {
            moduleSpecification.addUserDependencies(userDependencies);
        }
    } catch (ModuleLoadException e) {
        throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50018.name(), e);
    }
}
Also used : ModuleLoadException(org.jboss.modules.ModuleLoadException) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) VirtualFile(org.jboss.vfs.VirtualFile) ModuleLoader(org.jboss.modules.ModuleLoader) ModuleDependency(org.jboss.as.server.deployment.module.ModuleDependency) MountHandle(org.jboss.as.server.deployment.module.MountHandle) Closeable(java.io.Closeable) ArrayList(java.util.ArrayList) IOException(java.io.IOException) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) StringTokenizer(java.util.StringTokenizer) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) ModuleSpecification(org.jboss.as.server.deployment.module.ModuleSpecification) ModuleIdentifier(org.jboss.modules.ModuleIdentifier) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 2 with MountHandle

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

the class ApplicationClientStructureProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    String deploymentUnitName = deploymentUnit.getName().toLowerCase(Locale.ENGLISH);
    if (deploymentUnitName.endsWith(".ear")) {
        final Map<VirtualFile, ResourceRoot> existing = new HashMap<VirtualFile, ResourceRoot>();
        for (final ResourceRoot additional : deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS)) {
            existing.put(additional.getRoot(), additional);
        }
        final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
        final VirtualFile appClientRoot = root.getRoot().getChild(deployment);
        if (appClientRoot.exists()) {
            if (existing.containsKey(appClientRoot)) {
                final ResourceRoot existingRoot = existing.get(appClientRoot);
                SubDeploymentMarker.mark(existingRoot);
                ModuleRootMarker.mark(existingRoot);
            } else {
                final Closeable closable = appClientRoot.isFile() ? mount(appClientRoot, false) : null;
                final MountHandle mountHandle = new MountHandle(closable);
                final ResourceRoot childResource = new ResourceRoot(appClientRoot, mountHandle);
                ModuleRootMarker.mark(childResource);
                SubDeploymentMarker.mark(childResource);
                deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource);
            }
        } else {
            throw AppClientLogger.ROOT_LOGGER.cannotFindAppClient(deployment);
        }
    } else if (deploymentUnit.getParent() != null && deploymentUnitName.endsWith(".jar")) {
        final ResourceRoot parentRoot = deploymentUnit.getParent().getAttachment(Attachments.DEPLOYMENT_ROOT);
        final VirtualFile appClientRoot = parentRoot.getRoot().getChild(deployment);
        final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
        if (appClientRoot.equals(root.getRoot())) {
            DeploymentTypeMarker.setType(DeploymentType.APPLICATION_CLIENT, deploymentUnit);
        }
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) HashMap(java.util.HashMap) MountHandle(org.jboss.as.server.deployment.module.MountHandle) Closeable(java.io.Closeable) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 3 with MountHandle

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

the class RaOperationUtil method installRaServicesAndDeployFromModule.

public static void installRaServicesAndDeployFromModule(OperationContext context, String name, ModifiableResourceAdapter resourceAdapter, String fullModuleName, final List<ServiceController<?>> newControllers) throws OperationFailedException {
    ServiceName raServiceName = installRaServices(context, name, resourceAdapter, newControllers);
    final boolean resolveProperties = true;
    final ServiceTarget serviceTarget = context.getServiceTarget();
    final String moduleName;
    final CapabilityServiceSupport support = context.getCapabilityServiceSupport();
    // load module
    String slot = "main";
    if (fullModuleName.contains(":")) {
        slot = fullModuleName.substring(fullModuleName.indexOf(":") + 1);
        moduleName = fullModuleName.substring(0, fullModuleName.indexOf(":"));
    } else {
        moduleName = fullModuleName;
    }
    Module module;
    try {
        ModuleIdentifier moduleId = ModuleIdentifier.create(moduleName, slot);
        module = Module.getCallerModuleLoader().loadModule(moduleId);
    } catch (ModuleNotFoundException e) {
        throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.raModuleNotFound(moduleName, e.getMessage()), e);
    } catch (ModuleLoadException e) {
        throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToLoadModuleRA(moduleName), e);
    }
    URL path = module.getExportedResource("META-INF/ra.xml");
    Closeable closable = null;
    try {
        VirtualFile child;
        if (path.getPath().contains("!")) {
            throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.compressedRarNotSupportedInModuleRA(moduleName));
        } else {
            child = VFS.getChild(path.getPath().split("META-INF")[0]);
            closable = VFS.mountReal(new File(path.getPath().split("META-INF")[0]), child);
        }
        // final Closeable closable = VFS.mountZip((InputStream) new JarInputStream(new FileInputStream(path.getPath().split("!")[0].split(":")[1])), path.getPath().split("!")[0].split(":")[1], child, TempFileProviderService.provider());
        final MountHandle mountHandle = new MountHandle(closable);
        final ResourceRoot resourceRoot = new ResourceRoot(child, mountHandle);
        final VirtualFile deploymentRoot = resourceRoot.getRoot();
        if (deploymentRoot == null || !deploymentRoot.exists())
            return;
        ConnectorXmlDescriptor connectorXmlDescriptor = RaDeploymentParsingProcessor.process(resolveProperties, deploymentRoot, null, name);
        IronJacamarXmlDescriptor ironJacamarXmlDescriptor = IronJacamarDeploymentParsingProcessor.process(deploymentRoot, resolveProperties);
        RaNativeProcessor.process(deploymentRoot);
        Map<ResourceRoot, Index> annotationIndexes = new HashMap<ResourceRoot, Index>();
        ResourceRootIndexer.indexResourceRoot(resourceRoot);
        Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
        if (index != null) {
            annotationIndexes.put(resourceRoot, index);
        }
        if (ironJacamarXmlDescriptor != null) {
            ConnectorLogger.SUBSYSTEM_RA_LOGGER.forceIJToNull();
            ironJacamarXmlDescriptor = null;
        }
        final ServiceName deployerServiceName = ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(connectorXmlDescriptor.getDeploymentName());
        final ServiceController<?> deployerService = context.getServiceRegistry(true).getService(deployerServiceName);
        if (deployerService == null) {
            ServiceBuilder builder = ParsedRaDeploymentProcessor.process(connectorXmlDescriptor, ironJacamarXmlDescriptor, module.getClassLoader(), serviceTarget, annotationIndexes, RAR_MODULE.append(name), null, null, support);
            builder.requires(raServiceName);
            newControllers.add(builder.setInitialMode(ServiceController.Mode.ACTIVE).install());
        }
        String rarName = resourceAdapter.getArchive();
        if (fullModuleName.equals(rarName)) {
            ServiceName serviceName = ConnectorServices.INACTIVE_RESOURCE_ADAPTER_SERVICE.append(name);
            InactiveResourceAdapterDeploymentService service = new InactiveResourceAdapterDeploymentService(connectorXmlDescriptor, module, name, name, RAR_MODULE.append(name), null, serviceTarget, null);
            newControllers.add(serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.ACTIVE).install());
        }
    } catch (Exception e) {
        throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToLoadModuleRA(moduleName), e);
    } finally {
        if (closable != null) {
            try {
                closable.close();
            } catch (IOException e) {
            }
        }
    }
}
Also used : ModuleLoadException(org.jboss.modules.ModuleLoadException) VirtualFile(org.jboss.vfs.VirtualFile) HashMap(java.util.HashMap) Closeable(java.io.Closeable) ConnectorXmlDescriptor(org.jboss.as.connector.metadata.xmldescriptors.ConnectorXmlDescriptor) Index(org.jboss.jandex.Index) URL(java.net.URL) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport) ServiceBuilder(org.jboss.msc.service.ServiceBuilder) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) ModuleIdentifier(org.jboss.modules.ModuleIdentifier) InactiveResourceAdapterDeploymentService(org.jboss.as.connector.services.resourceadapters.deployment.InactiveResourceAdapterDeploymentService) ModuleNotFoundException(org.jboss.modules.ModuleNotFoundException) MountHandle(org.jboss.as.server.deployment.module.MountHandle) ServiceTarget(org.jboss.msc.service.ServiceTarget) OperationFailedException(org.jboss.as.controller.OperationFailedException) IOException(java.io.IOException) ModuleNotFoundException(org.jboss.modules.ModuleNotFoundException) IOException(java.io.IOException) OperationFailedException(org.jboss.as.controller.OperationFailedException) ModuleLoadException(org.jboss.modules.ModuleLoadException) ValidateException(org.jboss.jca.common.api.validator.ValidateException) ServiceName(org.jboss.msc.service.ServiceName) IronJacamarXmlDescriptor(org.jboss.as.connector.metadata.xmldescriptors.IronJacamarXmlDescriptor) Module(org.jboss.modules.Module) File(java.io.File) VirtualFile(org.jboss.vfs.VirtualFile)

Example 4 with MountHandle

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

the class EarStructureProcessor method deploy.

public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
        return;
    }
    final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT);
    final VirtualFile virtualFile = deploymentRoot.getRoot();
    // Make sure we don't index or add this as a module root
    deploymentRoot.putAttachment(Attachments.INDEX_RESOURCE_ROOT, false);
    ModuleRootMarker.mark(deploymentRoot, false);
    String libDirName = DEFAULT_LIB_DIR;
    // its possible that the ear metadata could come for jboss-app.xml
    final boolean appXmlPresent = deploymentRoot.getRoot().getChild("META-INF/application.xml").exists();
    final EarMetaData earMetaData = deploymentUnit.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
    if (earMetaData != null) {
        final String xmlLibDirName = earMetaData.getLibraryDirectory();
        if (xmlLibDirName != null) {
            if (xmlLibDirName.length() == 1 && xmlLibDirName.charAt(0) == '/') {
                throw EeLogger.ROOT_LOGGER.rootAsLibraryDirectory();
            }
            libDirName = xmlLibDirName;
        }
    }
    // Process all the children
    Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
    try {
        final VirtualFile libDir;
        // process the lib directory
        if (!libDirName.isEmpty()) {
            libDir = virtualFile.getChild(libDirName);
            if (libDir.exists()) {
                List<VirtualFile> libArchives = libDir.getChildren(CHILD_ARCHIVE_FILTER);
                for (final VirtualFile child : libArchives) {
                    String relativeName = child.getPathNameRelativeTo(deploymentRoot.getRoot());
                    MountedDeploymentOverlay overlay = overlays.get(relativeName);
                    final MountHandle mountHandle;
                    if (overlay != null) {
                        overlay.remountAsZip(false);
                        mountHandle = new MountHandle(null);
                    } else {
                        final Closeable closable = child.isFile() ? mount(child, false) : null;
                        mountHandle = new MountHandle(closable);
                    }
                    final ResourceRoot childResource = new ResourceRoot(child, mountHandle);
                    if (child.getName().toLowerCase(Locale.ENGLISH).endsWith(JAR_EXTENSION)) {
                        ModuleRootMarker.mark(childResource);
                        deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource);
                    }
                }
            }
        } else {
            libDir = null;
        }
        // scan the ear looking for wars and jars
        final List<VirtualFile> childArchives = new ArrayList<VirtualFile>(virtualFile.getChildren(new SuffixMatchFilter(CHILD_ARCHIVE_EXTENSIONS, new VisitorAttributes() {

            @Override
            public boolean isLeavesOnly() {
                return false;
            }

            @Override
            public boolean isRecurse(VirtualFile file) {
                // don't recurse into /lib
                if (file.equals(libDir)) {
                    return false;
                }
                for (String suffix : CHILD_ARCHIVE_EXTENSIONS) {
                    if (file.getName().endsWith(suffix)) {
                        // don't recurse into sub deployments
                        return false;
                    }
                }
                return true;
            }
        })));
        // if there is no application.xml then look in the ear root for modules
        if (!appXmlPresent) {
            for (final VirtualFile child : childArchives) {
                final boolean isWarFile = child.getName().toLowerCase(Locale.ENGLISH).endsWith(WAR_EXTENSION);
                final boolean isRarFile = child.getName().toLowerCase(Locale.ENGLISH).endsWith(RAR_EXTENSION);
                this.createResourceRoot(deploymentUnit, child, isWarFile || isRarFile, isWarFile);
            }
        } else {
            final Set<VirtualFile> subDeploymentFiles = new HashSet<VirtualFile>();
            // otherwise read from application.xml
            for (final ModuleMetaData module : earMetaData.getModules()) {
                if (module.getFileName().endsWith(".xml")) {
                    throw EeLogger.ROOT_LOGGER.unsupportedModuleType(module.getFileName());
                }
                final VirtualFile moduleFile = virtualFile.getChild(module.getFileName());
                if (!moduleFile.exists()) {
                    throw EeLogger.ROOT_LOGGER.cannotProcessEarModule(virtualFile, module.getFileName());
                }
                if (libDir != null) {
                    VirtualFile moduleParentFile = moduleFile.getParent();
                    if (moduleParentFile != null && libDir.equals(moduleParentFile)) {
                        throw EeLogger.ROOT_LOGGER.earModuleChildOfLibraryDirectory(libDirName, module.getFileName());
                    }
                }
                // maintain this in a collection of subdeployment virtual files, to be used later
                subDeploymentFiles.add(moduleFile);
                final boolean webArchive = module.getType() == ModuleType.Web;
                final ResourceRoot childResource = this.createResourceRoot(deploymentUnit, moduleFile, true, webArchive);
                childResource.putAttachment(org.jboss.as.ee.structure.Attachments.MODULE_META_DATA, module);
                if (!webArchive) {
                    ModuleRootMarker.mark(childResource);
                }
                final String alternativeDD = module.getAlternativeDD();
                if (alternativeDD != null && alternativeDD.trim().length() > 0) {
                    final VirtualFile alternateDeploymentDescriptor = deploymentRoot.getRoot().getChild(alternativeDD);
                    if (!alternateDeploymentDescriptor.exists()) {
                        throw EeLogger.ROOT_LOGGER.alternateDeploymentDescriptor(alternateDeploymentDescriptor, moduleFile);
                    }
                    switch(module.getType()) {
                        case Client:
                            childResource.putAttachment(org.jboss.as.ee.structure.Attachments.ALTERNATE_CLIENT_DEPLOYMENT_DESCRIPTOR, alternateDeploymentDescriptor);
                            break;
                        case Connector:
                            childResource.putAttachment(org.jboss.as.ee.structure.Attachments.ALTERNATE_CONNECTOR_DEPLOYMENT_DESCRIPTOR, alternateDeploymentDescriptor);
                            break;
                        case Ejb:
                            childResource.putAttachment(org.jboss.as.ee.structure.Attachments.ALTERNATE_EJB_DEPLOYMENT_DESCRIPTOR, alternateDeploymentDescriptor);
                            break;
                        case Web:
                            childResource.putAttachment(org.jboss.as.ee.structure.Attachments.ALTERNATE_WEB_DEPLOYMENT_DESCRIPTOR, alternateDeploymentDescriptor);
                            break;
                        case Service:
                            throw EeLogger.ROOT_LOGGER.unsupportedModuleType(module.getFileName());
                    }
                }
            }
            // now check the rest of the archive for any other jar/sar files
            for (final VirtualFile child : childArchives) {
                if (subDeploymentFiles.contains(child)) {
                    continue;
                }
                final String fileName = child.getName().toLowerCase(Locale.ENGLISH);
                if (fileName.endsWith(SAR_EXTENSION) || fileName.endsWith(JAR_EXTENSION)) {
                    this.createResourceRoot(deploymentUnit, child, false, false);
                }
            }
        }
    } catch (IOException e) {
        throw EeLogger.ROOT_LOGGER.failedToProcessChild(e, virtualFile);
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) MountedDeploymentOverlay(org.jboss.as.server.deployment.MountedDeploymentOverlay) MountHandle(org.jboss.as.server.deployment.module.MountHandle) Closeable(java.io.Closeable) ArrayList(java.util.ArrayList) IOException(java.io.IOException) VisitorAttributes(org.jboss.vfs.VisitorAttributes) EarMetaData(org.jboss.metadata.ear.spec.EarMetaData) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) SuffixMatchFilter(org.jboss.vfs.util.SuffixMatchFilter) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) HashSet(java.util.HashSet) ModuleMetaData(org.jboss.metadata.ear.spec.ModuleMetaData)

Example 5 with MountHandle

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

the class EarStructureProcessor method createResourceRoot.

/**
 * Creates a {@link ResourceRoot} for the passed {@link VirtualFile file} and adds it to the list of {@link ResourceRoot}s
 * in the {@link DeploymentUnit deploymentUnit}
 *
 * @param deploymentUnit      The deployment unit
 * @param file                The file for which the resource root will be created
 * @param markAsSubDeployment If this is true, then the {@link ResourceRoot} that is created will be marked as a subdeployment
 *                            through a call to {@link SubDeploymentMarker#mark(org.jboss.as.server.deployment.module.ResourceRoot)}
 * @param explodeDuringMount  If this is true then the {@link VirtualFile file} will be exploded during mount,
 *                            while creating the {@link ResourceRoot}
 * @return Returns the created {@link ResourceRoot}
 * @throws IOException
 */
private ResourceRoot createResourceRoot(final DeploymentUnit deploymentUnit, final VirtualFile file, final boolean markAsSubDeployment, final boolean explodeDuringMount) throws IOException {
    final boolean war = file.getName().toLowerCase(Locale.ENGLISH).endsWith(WAR_EXTENSION);
    final Closeable closable = file.isFile() ? mount(file, explodeDuringMount) : exportExplodedWar(war, file, deploymentUnit);
    final MountHandle mountHandle = new MountHandle(closable);
    final ResourceRoot resourceRoot = new ResourceRoot(file, mountHandle);
    deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, resourceRoot);
    if (markAsSubDeployment) {
        SubDeploymentMarker.mark(resourceRoot);
    }
    if (war) {
        resourceRoot.putAttachment(Attachments.INDEX_RESOURCE_ROOT, false);
        SubExplodedDeploymentMarker.mark(resourceRoot);
    }
    return resourceRoot;
}
Also used : ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) MountHandle(org.jboss.as.server.deployment.module.MountHandle) Closeable(java.io.Closeable)

Aggregations

MountHandle (org.jboss.as.server.deployment.module.MountHandle)12 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)12 Closeable (java.io.Closeable)9 VirtualFile (org.jboss.vfs.VirtualFile)9 IOException (java.io.IOException)8 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)8 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)5 ArrayList (java.util.ArrayList)4 MountedDeploymentOverlay (org.jboss.as.server.deployment.MountedDeploymentOverlay)4 ModuleSpecification (org.jboss.as.server.deployment.module.ModuleSpecification)4 File (java.io.File)2 HashMap (java.util.HashMap)2 WarMetaData (org.jboss.as.web.common.WarMetaData)2 ModuleIdentifier (org.jboss.modules.ModuleIdentifier)2 ModuleLoadException (org.jboss.modules.ModuleLoadException)2 FilePermission (java.io.FilePermission)1 URL (java.net.URL)1 HashSet (java.util.HashSet)1 StringTokenizer (java.util.StringTokenizer)1 ConnectorXmlDescriptor (org.jboss.as.connector.metadata.xmldescriptors.ConnectorXmlDescriptor)1