use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.
the class SearchEngine method listOrganisationEntries.
public OrganisationEntry[] listOrganisationEntries() {
Set<OrganisationEntry> entries = new HashSet<>();
for (DependencyResolver resolver : settings.getResolvers()) {
Map<String, String>[] orgs = resolver.listTokenValues(new String[] { IvyPatternHelper.ORGANISATION_KEY }, new HashMap<String, Object>());
for (Map<String, String> oe : orgs) {
String org = oe.get(IvyPatternHelper.ORGANISATION_KEY);
entries.add(new OrganisationEntry(resolver, org));
}
}
return entries.toArray(new OrganisationEntry[entries.size()]);
}
use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.
the class SearchEngine method listModules.
public String[] listModules(String org) {
Set<String> entries = new HashSet<>();
Map<String, Object> tokenValues = new HashMap<>();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
for (DependencyResolver resolver : settings.getResolvers()) {
Map<String, String>[] modules = resolver.listTokenValues(new String[] { IvyPatternHelper.MODULE_KEY }, tokenValues);
for (Map<String, String> module : modules) {
entries.add(module.get(IvyPatternHelper.MODULE_KEY));
}
}
return entries.toArray(new String[entries.size()]);
}
use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.
the class SearchEngine method listRevisionEntries.
public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
Set<RevisionEntry> entries = new HashSet<>();
Map<String, Object> tokenValues = new HashMap<>();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, module.getOrganisation());
tokenValues.put(IvyPatternHelper.MODULE_KEY, module.getModule());
for (DependencyResolver resolver : settings.getResolvers()) {
Map<String, String>[] revisions = resolver.listTokenValues(new String[] { IvyPatternHelper.REVISION_KEY }, tokenValues);
for (Map<String, String> revision : revisions) {
entries.add(new RevisionEntry(module, revision.get(IvyPatternHelper.REVISION_KEY)));
}
}
return entries.toArray(new RevisionEntry[entries.size()]);
}
use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.
the class SearchEngine method listModules.
/**
* 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()]);
}
use of org.apache.ivy.plugins.resolver.DependencyResolver in project ant-ivy by apache.
the class IvySettings method addResolver.
public synchronized void addResolver(DependencyResolver resolver) {
if (resolver == null) {
throw new NullPointerException("null resolver");
}
init(resolver);
resolversMap.put(resolver.getName(), resolver);
if (resolver instanceof ChainResolver) {
List<DependencyResolver> subresolvers = ((ChainResolver) resolver).getResolvers();
for (DependencyResolver dr : subresolvers) {
addResolver(dr);
}
} else if (resolver instanceof DualResolver) {
DependencyResolver ivyResolver = ((DualResolver) resolver).getIvyResolver();
if (ivyResolver != null) {
addResolver(ivyResolver);
}
DependencyResolver artifactResolver = ((DualResolver) resolver).getArtifactResolver();
if (artifactResolver != null) {
addResolver(artifactResolver);
}
}
}
Aggregations