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


Java ModuleId类代码示例

本文整理汇总了Java中org.apache.ivy.core.module.id.ModuleId的典型用法代码示例。如果您正苦于以下问题:Java ModuleId类的具体用法?Java ModuleId怎么用?Java ModuleId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModuleId类属于org.apache.ivy.core.module.id包,在下文中一共展示了ModuleId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExcludedModules

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
public List<ModuleId> getExcludedModules() {
    Element exclusionsElement = getFirstChildElement(depElement, EXCLUSIONS);
    List<ModuleId> exclusions = new LinkedList<ModuleId>();
    if (exclusionsElement != null) {
        NodeList childs = exclusionsElement.getChildNodes();
        for (int i = 0; i < childs.getLength(); i++) {
            Node node = childs.item(i);
            if (node instanceof Element && EXCLUSION.equals(node.getNodeName())) {
                String groupId = getFirstChildText((Element) node, GROUP_ID);
                String artifactId = getFirstChildText((Element) node, ARTIFACT_ID);
                if ((groupId != null) && (artifactId != null)) {
                    exclusions.add(IvyUtil.createModuleId(groupId, artifactId));
                }
            }
        }
    }
    return exclusions;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:19,代码来源:PomReader.java

示例2: ExcludeRuleBackedSpec

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
private ExcludeRuleBackedSpec(Iterable<ExcludeRule> excludeRules) {
    for (ExcludeRule rule : excludeRules) {
        if (!(rule.getMatcher() instanceof ExactPatternMatcher)) {
            excludeSpecs.add(new ExcludeRuleSpec(rule));
            continue;
        }
        ModuleId moduleId = rule.getId().getModuleId();
        boolean wildcardGroup = PatternMatcher.ANY_EXPRESSION.equals(moduleId.getOrganisation());
        boolean wildcardModule = PatternMatcher.ANY_EXPRESSION.equals(moduleId.getName());
        if (wildcardGroup && wildcardModule) {
            excludeSpecs.add(new ExcludeRuleSpec(rule));
        } else if (wildcardGroup) {
            excludeSpecs.add(new ModuleNameSpec(moduleId.getName()));
        } else if (wildcardModule) {
            excludeSpecs.add(new GroupNameSpec(moduleId.getOrganisation()));
        } else {
            excludeSpecs.add(new ModuleIdSpec(moduleId));
        }
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:21,代码来源:ModuleVersionSpec.java

示例3: findConflictsBeneathNode

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
/**
 * Derives configuration conflicts that exist between node and all of its descendant dependencies.
 */
private static void findConflictsBeneathNode(IvyNodeElement node) {
  // Derive conflicts
  Map<ModuleId,Collection<IvyNodeElement>> moduleRevisionMap = new HashMap<>();
  IvyNodeElement[] deepDependencies = node.getDeepDependencies();
  for (int i = 0; i < deepDependencies.length; i++) {
    if (deepDependencies[i].isEvicted())
      continue;

    ModuleId moduleId = deepDependencies[i].getModuleRevisionId().getModuleId();
    if (moduleRevisionMap.containsKey(moduleId)) {
      Collection<IvyNodeElement> conflicts = moduleRevisionMap.get(moduleId);
      conflicts.add(deepDependencies[i]);
      for (Iterator iter = conflicts.iterator(); iter.hasNext();) {
        IvyNodeElement conflict = (IvyNodeElement) iter.next();
        conflict.setConflicts(conflicts);
      }
    } else {
      List<IvyNodeElement> immutableMatchingSet = Arrays.asList(deepDependencies[i]);
      moduleRevisionMap.put(moduleId, new HashSet<>(immutableMatchingSet));
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:IvyNodeElementAdapter.java

示例4: testCacheTTLMatcherAttribute

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
/**
 * Test case for IVY-1495.
 * <code>&lt;ttl&gt;</code> containing the <code>matcher</code> attribute,
 * in an ivy settings file, must work as expected.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1495">IVY-1495</a>
 */
@Test
public void testCacheTTLMatcherAttribute() throws Exception {
    final IvySettings settings = new IvySettings();
    settings.setBaseDir(new File("test/base/dir"));
    final XmlSettingsParser parser = new XmlSettingsParser(settings);
    parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-cache-ttl-matcher.xml"));
    // verify ttl
    final DefaultRepositoryCacheManager cacheManager = (DefaultRepositoryCacheManager) settings.getRepositoryCacheManager("foo");
    assertNotNull("Missing cache manager 'foo'", cacheManager);
    assertEquals("Unexpected default ttl on cache manager", 30000, cacheManager.getDefaultTTL());
    final ModuleRevisionId module1 = new ModuleRevisionId(new ModuleId("foo", "bar"), "*");
    final long module1SpecificTTL = cacheManager.getTTL(module1);
    assertEquals("Unexpected ttl for module " + module1 + " on cache manager", 60000, module1SpecificTTL);
    final ModuleRevisionId module2 = new ModuleRevisionId(new ModuleId("food", "*"), "1.2.4");
    final long module2SpecificTTL = cacheManager.getTTL(module2);
    assertEquals("Unexpected ttl for module " + module2 + " on cache manager", 60000, module2SpecificTTL);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:XmlSettingsParserTest.java

示例5: genreport

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
private void genreport(ResolutionCacheManager cache, String organisation, String module) {
    // first process the report with xslt
    XSLTProcess xslt = new XSLTProcess();
    xslt.setTaskName(getTaskName());
    xslt.setProject(getProject());
    xslt.init();

    String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
    xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
    xslt.setOut(new File(getTodir(), outputname + "." + xslext));

    xslt.setStyle(xslFile);

    XSLTProcess.Param xslExt = xslt.createParam();
    xslExt.setName("extension");
    xslExt.setExpression(xslext);

    // add the provided XSLT parameters
    for (XSLTProcess.Param param : params) {
        XSLTProcess.Param realParam = xslt.createParam();
        realParam.setName(param.getName());
        realParam.setExpression(param.getExpression());
    }

    xslt.execute();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:IvyRepositoryReport.java

示例6: getResolveReport

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
/**
 * Try to load a resolve report. If not found, not available, out of date or contains resolve errors, it returns
 * <code>null</code>.
 */
private XmlReportParser getResolveReport(Ivy ivy, ModuleId mid, String conf, File ivyfile) {
    File report = ivy.getResolutionCacheManager().getConfigurationResolveReportInCache(
            ResolveOptions.getDefaultResolveId(mid), conf);
    if (!report.exists()) {
        return null;
    }
    if (ivyfile != null && ivyfile.lastModified() > report.lastModified()) {
        return null;
    }
    // found a report, try to parse it.
    try {
        log("Reading resolve report " + report, Project.MSG_DEBUG);
        XmlReportParser reportparser = new XmlReportParser();
        reportparser.parse(report);
        if (reportparser.hasError()) {
            return null;
        }
        log("Loading last resolve report for " + mid + "[" + conf + "]", Project.MSG_VERBOSE);
        return reportparser;
    } catch (ParseException e) {
        return null;
    }
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:28,代码来源:ImportAntscripts.java

示例7: doExecute

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
public void doExecute() throws BuildException {
    if (organisation == null) {
        throw new BuildException("no organisation provided for ivy findrevision task");
    }
    if (module == null) {
        throw new BuildException("no module name provided for ivy findrevision task");
    }
    if (revision == null) {
        throw new BuildException("no revision provided for ivy findrevision task");
    }

    Ivy ivy = getIvyInstance();
    IvySettings settings = ivy.getSettings();
    if (branch == null) {
        branch = settings.getDefaultBranch(new ModuleId(organisation, module));
    }
    ResolvedModuleRevision rmr = ivy.findModule(ModuleRevisionId.newInstance(organisation,
        module, branch, revision));
    if (rmr != null) {
        getProject().setProperty(property, rmr.getId().getRevision());
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:23,代码来源:IvyFindRevision.java

示例8: testFixedMdKeep

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
@Test
public void testFixedMdKeep() throws Exception {
    ResolveReport report = ivy.resolve(new File(
            "test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
        getResolveOptions(new String[] {"*"}));
    assertNotNull(report);
    assertFalse(report.hasError());
    ModuleDescriptor fixedMd = report.toFixedModuleDescriptor(ivy.getSettings(),
            Collections.singletonList(ModuleId.newInstance("org1", "mod1.2")));

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.4", "1.0.2");
    assertEquals(mrid, fixedMd.getModuleRevisionId());

    assertEquals(Arrays.asList("default", "compile"),
        Arrays.asList(fixedMd.getConfigurationsNames()));

    assertEquals(1, fixedMd.getDependencies().length);

    checkFixedMdDependency(fixedMd.getDependencies()[0], "org1", "mod1.2", "[1.0,2.0[",
        "default", new String[] {"*"});
    checkFixedMdDependency(fixedMd.getDependencies()[0], "org1", "mod1.2", "[1.0,2.0[",
        "compile", new String[] {"default"});
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:ResolveReportTest.java

示例9: getResolvedRevisions

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
public Collection<ModuleRevisionId> getResolvedRevisions(ModuleId mid, String rootModuleConf) {
    Collection<IvyNode> resolved = selectedDeps.get(new ModuleIdConf(mid, rootModuleConf));
    if (resolved == null) {
        return new HashSet<>();
    } else {
        Collection<ModuleRevisionId> resolvedRevs = new HashSet<>();
        for (IvyNode node : resolved) {
            ModuleRevisionId resolvedId = node.getResolvedId();
            resolvedRevs.add(node.getId());
            resolvedRevs.add(resolvedId);

            // in case there are extra attributes on the resolved module we also add the
            // the module without these extra attributes (cfr. IVY-1236)
            if (!resolvedId.getExtraAttributes().isEmpty()) {
                resolvedRevs.add(ModuleRevisionId.newInstance(resolvedId.getOrganisation(),
                    resolvedId.getName(), resolvedId.getBranch(), resolvedId.getRevision()));
            }
        }
        return resolvedRevs;
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:IvyNodeEviction.java

示例10: isEvicted

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
public boolean isEvicted(String rootModuleConf) {
    cleanEvicted();
    if (node.isRoot()) {
        return false;
    }
    EvictionData evictedData = getEvictedData(rootModuleConf);
    if (evictedData == null) {
        return false;
    }
    IvyNode root = node.getRoot();
    ModuleId moduleId = node.getId().getModuleId();
    Collection<ModuleRevisionId> resolvedRevisions = root.getResolvedRevisions(moduleId,
        rootModuleConf);
    return !resolvedRevisions.contains(node.getResolvedId())
            || evictedData.isTransitivelyEvicted();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:IvyNodeEviction.java

示例11: findPath

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
private Collection<IvyNode> findPath(ModuleId from, IvyNode node, List<IvyNode> path) {
    IvyNode parent = node.getDirectCallerFor(from);
    if (parent == null) {
        throw new IllegalArgumentException("no path from " + from + " to " + getId() + " found");
    }
    if (path.contains(parent)) {
        path.add(0, parent);
        Message.verbose(
            "circular dependency found while looking for the path for another one: was looking for "
                    + from + " as a caller of " + path.get(path.size() - 1));
        return path;
    }
    path.add(0, parent);
    if (parent.getId().getModuleId().equals(from)) {
        return path;
    }
    return findPath(from, parent, path);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:19,代码来源:IvyNode.java

示例12: listModules

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
/**
 * List module ids of the module accessible through the current resolvers matching the given mid
 * criteria according to the given matcher.
 * <p>
 * ModuleId are returned in the system namespace.
 * </p>
 *
 * @param moduleCrit ModuleId
 * @param matcher PatternMatcher
 * @return ModuleId[]
 */
public ModuleId[] listModules(ModuleId moduleCrit, PatternMatcher matcher) {
    List<ModuleId> ret = new ArrayList<>();

    Map<String, Object> criteria = new HashMap<>();
    addMatcher(matcher, moduleCrit.getOrganisation(), criteria,
        IvyPatternHelper.ORGANISATION_KEY);
    addMatcher(matcher, moduleCrit.getName(), criteria, IvyPatternHelper.MODULE_KEY);

    String[] tokensToList = new String[] {IvyPatternHelper.ORGANISATION_KEY,
            IvyPatternHelper.MODULE_KEY};

    for (DependencyResolver resolver : settings.getResolvers()) {
        Map<String, String>[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
        for (Map<String, String> moduleId : moduleIdAsMap) {
            String org = moduleId.get(IvyPatternHelper.ORGANISATION_KEY);
            String name = moduleId.get(IvyPatternHelper.MODULE_KEY);
            ModuleId modId = ModuleId.newInstance(org, name);
            ret.add(NameSpaceHelper.transform(modId, resolver.getNamespace()
                    .getToSystemTransformer()));
        }
    }

    return ret.toArray(new ModuleId[ret.size()]);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:36,代码来源:SearchEngine.java

示例13: reportNonMatchingVersion

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
public void reportNonMatchingVersion(DependencyDescriptor descriptor, ModuleDescriptor md) {
    ModuleRevisionId dependencyRevisionId = descriptor.getDependencyRevisionId();
    ModuleRevisionId parentRevisionId = descriptor.getParentRevisionId();
    if (parentRevisionId == null) {
        // There are some rare case where DependencyDescriptor have no parent.
        // This is should not be used in the SortEngine, but if it is, we
        // show a decent trace.
        reportMessage("Non matching revision detected when sorting.  Dependency "
                + dependencyRevisionId + " doesn't match " + md.getModuleRevisionId());
    } else {
        ModuleId parentModuleId = parentRevisionId.getModuleId();
        reportMessage("Non matching revision detected when sorting.  " + parentModuleId
                + " depends on " + dependencyRevisionId + ", doesn't match "
                + md.getModuleRevisionId());
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:MessageBasedNonMatchingVersionReporter.java

示例14: getModuleIds

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
/**
 * gives all the modules ids concerned by this report, from the most dependent to the least one
 *
 * @return a list of ModuleId
 */
public List<ModuleId> getModuleIds() {
    if (modulesIds == null) {
        List<IvyNode> sortedDependencies = resolveEngine.getSortEngine().sortNodes(
            getDependencies(), SortOptions.SILENT);
        Collections.reverse(sortedDependencies);
        for (IvyNode dependency : sortedDependencies) {
            ModuleId mid = dependency.getResolvedId().getModuleId();
            Collection<IvyNode> deps = modulesIdsMap.get(mid);
            if (deps == null) {
                deps = new LinkedHashSet<>();
                modulesIdsMap.put(mid, deps);
            }
            deps.add(dependency);
        }
        modulesIds = new ArrayList<>(modulesIdsMap.keySet());
    }
    return Collections.unmodifiableList(modulesIds);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:ConfigurationResolveReport.java

示例15: getConflictManager

import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
public synchronized ConflictManager getConflictManager(ModuleId moduleId) {
    ModuleSettings ms = moduleSettings.getRule(moduleId, new Filter<ModuleSettings>() {
        public boolean accept(ModuleSettings o) {
            return o.getConflictManager() != null;
        }
    });
    if (ms == null) {
        return getDefaultConflictManager();
    } else {
        ConflictManager cm = getConflictManager(ms.getConflictManager());
        if (cm == null) {
            throw new IllegalStateException("ivy badly configured: unknown conflict manager "
                    + ms.getConflictManager());
        }
        return cm;
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:IvySettings.java


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