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


Java ModuleDependency.addImportFilter方法代码示例

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


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

示例1: deploy

import org.jboss.as.server.deployment.module.ModuleDependency; //导入方法依赖的package包/类
/**
 * Add dependencies for modules required for metric deployments
 *
 */
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
    final ModuleLoader moduleLoader = Module.getBootModuleLoader();

//    ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
    //   final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild("META-INF/beans.xml");
    //   final boolean rootBeansXmlPresent = rootBeansXml.exists() && rootBeansXml.isFile();
    //   System.out.println("rootBeansXmlPresent " + rootBeansXmlPresent);
/*    Map<ResourceRoot, ExplicitBeanArchiveMetadata> beanArchiveMetadata = new HashMap<>();
     PropertyReplacingBeansXmlParser parser = new PropertyReplacingBeansXmlParser(deploymentUnit);

     ResourceRoot classesRoot = null;
     List<ResourceRoot> structure = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
     for (ResourceRoot resourceRoot : structure) {
     if (ModuleRootMarker.isModuleRoot(resourceRoot) && !SubDeploymentMarker.isSubDeployment(resourceRoot)) {
     if (resourceRoot.getRootName().equals("classes")) {
     // hack for dealing with war modules
     classesRoot = resourceRoot;
     deploymentUnit.putAttachment(WeldAttachments.CLASSES_RESOURCE_ROOT, resourceRoot);
     } else {
     VirtualFile beansXml = resourceRoot.getRoot().getChild("META-INF/beans.xml");
     if (beansXml.exists() && beansXml.isFile()) {
     System.out.println("rootBeansXmlPresent found");
     beanArchiveMetadata.put(resourceRoot, new ExplicitBeanArchiveMetadata(beansXml, resourceRoot, parseBeansXml(beansXml, parser, deploymentUnit), false));
     }
     }
     }
     }
     */
    //   BeansXml beansXml = deployment.getBeanDeploymentArchive().getBeansXml();
    if (!WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
        return; // Skip if there are no beans.xml files in the deployment
    }

    ModuleDependency dep = new ModuleDependency(moduleLoader, ORG_JAM_METRICS, false, false, true, false);
    dep.addImportFilter(PathFilters.getMetaInfFilter(), true);
    dep.addExportFilter(PathFilters.getMetaInfFilter(), true);
    moduleSpecification.addSystemDependency(dep);

    ModuleDependency dep2 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_API, false, false, true, false);
    dep2.addImportFilter(PathFilters.getMetaInfFilter(), true);
    dep2.addExportFilter(PathFilters.getMetaInfFilter(), true);
    moduleSpecification.addSystemDependency(dep2);

    ModuleDependency dep3 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_PROPERTIES, false, false, true, false);
    dep3.addImportFilter(PathFilters.getMetaInfFilter(), true);
    dep3.addExportFilter(PathFilters.getMetaInfFilter(), true);
    moduleSpecification.addSystemDependency(dep3);

    ModuleDependency dep4 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_LIBRARY, false, false, true, false);
    dep4.addImportFilter(PathFilters.getMetaInfFilter(), true);
    dep4.addExportFilter(PathFilters.getMetaInfFilter(), true);
    moduleSpecification.addSystemDependency(dep4);

    ModuleDependency dep5 = new ModuleDependency(moduleLoader, ORG_JAM_METRICS_LIBRARY2, false, false, true, false);
    dep5.addImportFilter(PathFilters.getMetaInfFilter(), true);
    dep5.addExportFilter(PathFilters.getMetaInfFilter(), true);
    moduleSpecification.addSystemDependency(dep5);
}
 
开发者ID:panossot,项目名称:jam-metrics,代码行数:66,代码来源:JamMetricsDependencyProcessor.java

示例2: parseModuleDependency

import org.jboss.as.server.deployment.module.ModuleDependency; //导入方法依赖的package包/类
private static void parseModuleDependency(final XMLStreamReader reader, final ModuleStructureSpec specBuilder,
                                          ModuleLoader moduleLoader) throws XMLStreamException {
    String name = null;
    String slot = null;
    boolean export = false;
    boolean optional = false;
    Disposition services = Disposition.NONE;
    final Set<Attribute> required = EnumSet.of(Attribute.NAME);
    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 SLOT:
                slot = reader.getAttributeValue(i);
                break;
            case EXPORT:
                export = Boolean.parseBoolean(reader.getAttributeValue(i));
                break;
            case SERVICES:
                services = Disposition.of(reader.getAttributeValue(i));
                break;
            case OPTIONAL:
                optional = Boolean.parseBoolean(reader.getAttributeValue(i));
                break;
            default:
                throw unexpectedContent(reader);
        }
    }
    if (!required.isEmpty()) {
        throw missingAttributes(reader.getLocation(), required);
    }
    ModuleDependency dependency = new ModuleDependency(moduleLoader, ModuleIdentifier.create(name, slot), optional, export,
            services == Disposition.IMPORT, true);
    specBuilder.addModuleDependency(dependency);
    while (reader.hasNext()) {
        switch (reader.nextTag()) {
            case XMLStreamConstants.END_ELEMENT: {
                if (services == Disposition.EXPORT) {
                    // If services are to be re-exported, add META-INF/services -> true near the end of the list
                    dependency.addExportFilter(PathFilters.getMetaInfServicesFilter(), true);
                }
                if (export) {
                    // If re-exported, add META-INF/** -> false at the end of the list (require explicit override)
                    dependency.addExportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), false);
                    dependency.addExportFilter(PathFilters.getMetaInfFilter(), false);
                }
                if (dependency.getImportFilters().isEmpty()) {
                    dependency.addImportFilter(services == Disposition.NONE ? PathFilters.getDefaultImportFilter()
                            : PathFilters.getDefaultImportFilterWithServices(), true);
                } else {
                    if (services != Disposition.NONE) {
                        dependency.addImportFilter(PathFilters.getMetaInfServicesFilter(), true);
                    }
                    dependency.addImportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), false);
                    dependency.addImportFilter(PathFilters.getMetaInfFilter(), false);
                }
                return;
            }
            case XMLStreamConstants.START_ELEMENT: {
                switch (Element.of(reader.getName())) {
                    case EXPORTS:
                        parseFilterList(reader, dependency.getExportFilters());
                        break;
                    case IMPORTS:
                        parseFilterList(reader, dependency.getImportFilters());
                        break;
                    default:
                        throw unexpectedContent(reader);
                }
                break;
            }
            default: {
                throw unexpectedContent(reader);
            }
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:82,代码来源:JBossDeploymentStructureParser10.java


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