本文整理汇总了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;
}
示例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));
}
}
}
示例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));
}
}
}
示例4: testCacheTTLMatcherAttribute
import org.apache.ivy.core.module.id.ModuleId; //导入依赖的package包/类
/**
* Test case for IVY-1495.
* <code><ttl></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);
}
示例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();
}
示例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;
}
}
示例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());
}
}
示例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"});
}
示例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;
}
}
示例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();
}
示例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);
}
示例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()]);
}
示例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());
}
}
示例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);
}
示例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;
}
}