当前位置: 首页>>代码示例>>Java>>正文


Java ResourceRoot.getRoot方法代码示例

本文整理汇总了Java中org.jboss.as.server.deployment.module.ResourceRoot.getRoot方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceRoot.getRoot方法的具体用法?Java ResourceRoot.getRoot怎么用?Java ResourceRoot.getRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.as.server.deployment.module.ResourceRoot的用法示例。


在下文中一共展示了ResourceRoot.getRoot方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deploy

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (TeiidAttachments.isTranslator(deploymentUnit)) {
    	return;
    }

    List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
    for (ResourceRoot resourceRoot : resourceRoots) {
        final VirtualFile deploymentRoot = resourceRoot.getRoot();

        if (deploymentRoot.getChild("META-INF/services/org.teiid.translator.ExecutionFactory").exists())  { //$NON-NLS-1$
            TeiidAttachments.setAsTranslatorDeployment(deploymentUnit);
            //deploymentUnit.putAttachment(Attachments.IGNORE_OSGI, Boolean.TRUE);
            break;
        }
    }
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:19,代码来源:TranslatorStructureDeployer.java

示例2: processAnnotationIndex

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private void processAnnotationIndex(DeploymentUnit deploymentUnit) {
    DotName dotName = DotName.createSimple(BootstrapDatabase.class.getName());
    CompositeIndex index = deploymentUnit.getAttachment(COMPOSITE_ANNOTATION_INDEX);
    if (index == null) {
        return;
    }

    List<AnnotationInstance> indexAnnotations = index.getAnnotations(dotName);
    if (indexAnnotations.isEmpty()) {
        return;
    }

    ResourceRoot deploymentRoot = deploymentUnit.getAttachment(DEPLOYMENT_ROOT);
    VirtualFile root = deploymentRoot.getRoot();

    DbBootstrapLogger.ROOT_LOGGER.tracef("match on %s", root.getPathName());
    try {
        final Module module = deploymentUnit.getAttachment(MODULE);
        processAnnotatedClasses(indexAnnotations, module.getClassLoader());
    } catch (Exception e) {
        DbBootstrapLogger.ROOT_LOGGER.error("Unable to process the internal jar files", e);
    }
}
 
开发者ID:wildfly-extras,项目名称:db-bootstrap,代码行数:24,代码来源:DbBootstrapScanDetectorProcessor.java

示例3: findConfigFile

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
/**
 * Finds the configuration file to be used and returns the first one found.
 * <p/>
 * Preference is for {@literal logging.properties} or {@literal jboss-logging.properties}.
 *
 * @param resourceRoot the resource to check.
 *
 * @return the configuration file if found, otherwise {@code null}.
 *
 * @throws DeploymentUnitProcessingException if an error occurs.
 */
private VirtualFile findConfigFile(ResourceRoot resourceRoot) throws DeploymentUnitProcessingException {
    final VirtualFile root = resourceRoot.getRoot();
    // First check META-INF
    VirtualFile file = root.getChild("META-INF");
    VirtualFile result = findConfigFile(file);
    if (result == null) {
        file = root.getChild("WEB-INF/classes");
        result = findConfigFile(file);
    }
    return result;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:LoggingConfigDeploymentProcessor.java

示例4: deploy

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
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;
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:40,代码来源:Seam2Processor.java

示例5: processRoot

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private void processRoot(final ResourceRoot resourceRoot, final Map<String, List<String>> foundServices) throws DeploymentUnitProcessingException {
    final VirtualFile virtualFile = resourceRoot.getRoot();
    final VirtualFile child = virtualFile.getChild("META-INF/services");
    for (VirtualFile serviceType : child.getChildren()) {
        final String name = serviceType.getName();
        try {
            List<String> list = foundServices.get(name);
            if (list == null) {
                foundServices.put(name, list = new ArrayList<String>());
            }
            final InputStream stream = serviceType.openStream();
            try {
                final BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
                String line;
                while ((line = reader.readLine()) != null) {
                    final int commentIdx = line.indexOf('#');
                    final String className;
                    if (commentIdx == -1) {
                        className = line.trim();
                    } else {
                        className = line.substring(0, commentIdx).trim();
                    }
                    if (className.length() == 0) {
                        continue;
                    }
                    list.add(className);
                }
            } finally {
                VFSUtils.safeClose(stream);
            }
        } catch (IOException e) {
            throw ServerLogger.ROOT_LOGGER.failedToReadVirtualFile(child, e);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:36,代码来源:ServiceLoaderProcessor.java

示例6: processBlackList

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private void processBlackList(final List<ResourceRoot> jars) throws IOException {
    for (String blackListed : blackList) {
        PathFilter filter = PathFilters.match(blackListed);
        for (ResourceRoot root : jars) {
            VirtualFile jar = root.getRoot();
            SDDLogger.ROOT_LOGGER.tracef("Processing jar %s, matches: %s", jar.getName(), filter.accept(jar.getName()));

            if (filter.accept(jar.getName())) {
                SDDLogger.ROOT_LOGGER.jarBlacklisted(jar);
            }
        }

    }

}
 
开发者ID:ctomc,项目名称:wildfly-sdd,代码行数:16,代码来源:ClassBlackListDetectorProcessor.java

示例7: processBlackList

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private void processBlackList(final List<ResourceRoot> jars) throws IOException {
    for (String blackListed : blackList) {
        PathFilter filter = PathFilters.match(blackListed);
        for (ResourceRoot root : jars) {
            VirtualFile jar = root.getRoot();
            SDDLogger.ROOT_LOGGER.tracef("Processing jar %s, matches: %s", jar.getName(), filter.accept(jar.getName()));

            if (filter.accept(jar.getName())) {
                SDDLogger.ROOT_LOGGER.jarBlacklisted(jar);
            }
        }
    }
}
 
开发者ID:ctomc,项目名称:wildfly-sdd,代码行数:14,代码来源:JarBlackListDetectorProcessor.java

示例8: parseResourceRoot

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private static void parseResourceRoot(final DeploymentUnit deploymentUnit, final XMLStreamReader reader,
                                      final ModuleStructureSpec specBuilder) throws XMLStreamException {
    String name = null;
    String path = null;
    final Set<Attribute> required = EnumSet.of(Attribute.PATH);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final Attribute attribute = Attribute.of(reader.getAttributeName(i));
        required.remove(attribute);
        switch (attribute) {
            case NAME:
                name = reader.getAttributeValue(i);
                break;
            case PATH:
                path = reader.getAttributeValue(i);
                break;
            default:
                throw unexpectedContent(reader);
        }
    }
    if (!required.isEmpty()) {
        throw missingAttributes(reader.getLocation(), required);
    }
    if (name == null)
        name = path;
    List<FilterSpecification> resourceFilters = new ArrayList<FilterSpecification>();
    final Set<Element> encountered = EnumSet.noneOf(Element.class);
    while (reader.hasNext()) {
        switch (reader.nextTag()) {
            case XMLStreamConstants.END_ELEMENT: {
                if (path.startsWith("/")) {
                    throw ServerLogger.ROOT_LOGGER.externalResourceRootsNotSupported(path);
                } else {
                    try {
                        final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
                        final VirtualFile deploymentRootFile = deploymentRoot.getRoot();
                        VirtualFile child = deploymentRootFile.getChild(path);
                        Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
                        MountedDeploymentOverlay overlay = overlays.get(path);
                        Closeable closable = null;
                        if(overlay != null) {
                            overlay.remountAsZip(false);
                        } else if(child.isFile()) {
                            closable = VFS.mountZip(child, child, TempFileProviderService.provider());
                        }
                        final MountHandle mountHandle = new MountHandle(closable);
                        ResourceRoot resourceRoot = new ResourceRoot(name, child, mountHandle);
                        for (FilterSpecification filter : resourceFilters) {
                            resourceRoot.getExportFilters().add(filter);
                        }
                        specBuilder.addResourceRoot(resourceRoot);
                    } catch (IOException e) {
                        throw new XMLStreamException(e);
                    }
                }
                return;
            }
            case XMLStreamConstants.START_ELEMENT: {
                final Element element = Element.of(reader.getName());
                if (!encountered.add(element))
                    throw unexpectedContent(reader);
                switch (element) {
                    case FILTER:
                        parseFilterList(reader, resourceFilters);
                        break;
                    default:
                        throw unexpectedContent(reader);
                }
                break;
            }
            default: {
                throw unexpectedContent(reader);
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:77,代码来源:JBossDeploymentStructureParser10.java

示例9: parseResourceRoot

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private static void parseResourceRoot(final DeploymentUnit deploymentUnit, final XMLStreamReader reader,
                                      final ModuleStructureSpec specBuilder) throws XMLStreamException {
    String name = null;
    String path = null;
    boolean usePhysicalCodeSource = false;
    final Set<Attribute> required = EnumSet.of(Attribute.PATH);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final Attribute attribute = Attribute.of(reader.getAttributeName(i));
        required.remove(attribute);
        switch (attribute) {
            case NAME:
                name = reader.getAttributeValue(i);
                break;
            case PATH:
                path = reader.getAttributeValue(i);
                break;
            case USE_PHYSICAL_CODE_SOURCE:
                usePhysicalCodeSource = Boolean.parseBoolean(reader.getAttributeValue(i));
                break;
            default:
                throw unexpectedContent(reader);
        }
    }
    if (!required.isEmpty()) {
        throw missingAttributes(reader.getLocation(), required);
    }
    if (name == null)
        name = path;
    final List<FilterSpecification> resourceFilters = new ArrayList<FilterSpecification>();
    final Set<Element> encountered = EnumSet.noneOf(Element.class);
    while (reader.hasNext()) {
        switch (reader.nextTag()) {
            case XMLStreamConstants.END_ELEMENT: {
                try {
                    final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
                    final VirtualFile deploymentRootFile = deploymentRoot.getRoot();
                    final VirtualFile child = deploymentRootFile.getChild(path);
                    Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
                    MountedDeploymentOverlay overlay = overlays.get(path);
                    Closeable closable = null;
                    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 resourceRoot = new ResourceRoot(name, child, mountHandle);
                    for (final FilterSpecification filter : resourceFilters) {
                        resourceRoot.getExportFilters().add(filter);
                    }
                    resourceRoot.setUsePhysicalCodeSource(usePhysicalCodeSource);
                    specBuilder.addResourceRoot(resourceRoot);
                } catch (IOException e) {
                    throw new XMLStreamException(e);
                }
                return;
            }
            case XMLStreamConstants.START_ELEMENT: {
                final Element element = Element.of(reader.getName());
                if (!encountered.add(element))
                    throw unexpectedContent(reader);
                switch (element) {
                    case FILTER:
                        parseFilterList(reader, resourceFilters);
                        break;
                    default:
                        throw unexpectedContent(reader);
                }
                break;
            }
            default: {
                throw unexpectedContent(reader);
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:78,代码来源:JBossDeploymentStructureParser13.java

示例10: VirtualFileEntriesProvider

import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
public VirtualFileEntriesProvider(ResourceRoot resourceRoot) {
    IllegalArgumentAssertion.assertNotNull(resourceRoot, "resourceRoot");
    this.rootFile = resourceRoot.getRoot();
}
 
开发者ID:tdiesler,项目名称:gravia,代码行数:5,代码来源:VirtualFileEntriesProvider.java


注:本文中的org.jboss.as.server.deployment.module.ResourceRoot.getRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。