You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jl...@apache.org on 2014/01/14 09:27:43 UTC
svn commit: r1557968 [7/26] - in /ant/ivy/core/trunk:
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver/
src/...
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java Tue Jan 14 08:27:37 2014
@@ -41,11 +41,11 @@ public class ArtifactDownloadReport {
* </p>
*/
public static final String MISSING_ARTIFACT = "missing artifact";
-
+
private Artifact artifact;
private ArtifactOrigin origin;
-
+
private File localFile;
private DownloadStatus downloadStatus;
@@ -109,7 +109,7 @@ public class ArtifactDownloadReport {
public void setDownloadDetails(String message) {
downloadDetails = message;
}
-
+
public String getDownloadDetails() {
return downloadDetails;
}
@@ -117,21 +117,20 @@ public class ArtifactDownloadReport {
public void setDownloadTimeMillis(long l) {
downloadTimeMillis = l;
}
-
+
public long getDownloadTimeMillis() {
return downloadTimeMillis;
}
-
+
public String toString() {
if (downloadStatus == DownloadStatus.SUCCESSFUL) {
return "[SUCCESSFUL ] " + artifact + " (" + downloadTimeMillis + "ms)";
} else if (downloadStatus == DownloadStatus.FAILED) {
if (downloadDetails == MISSING_ARTIFACT) {
- return "[NOT FOUND ] " + artifact
- + " (" + downloadTimeMillis + "ms)";
+ return "[NOT FOUND ] " + artifact + " (" + downloadTimeMillis + "ms)";
} else {
- return "[FAILED ] " + artifact + ": " + downloadDetails
- + " (" + downloadTimeMillis + "ms)";
+ return "[FAILED ] " + artifact + ": " + downloadDetails + " ("
+ + downloadTimeMillis + "ms)";
}
} else if (downloadStatus == DownloadStatus.NO) {
return "[NOT REQUIRED] " + artifact;
@@ -141,8 +140,8 @@ public class ArtifactDownloadReport {
}
/**
- * Returns the File where the artifact is available on the local filesystem,
- * or <code>null</code> if and only if the artifact caching failed.
+ * Returns the File where the artifact is available on the local filesystem, or
+ * <code>null</code> if and only if the artifact caching failed.
*
* @return the file where the artifact is now available on the local filesystem.
*/
@@ -153,7 +152,7 @@ public class ArtifactDownloadReport {
public void setLocalFile(File localFile) {
this.localFile = localFile;
}
-
+
public boolean isDownloaded() {
return DownloadStatus.SUCCESSFUL == downloadStatus;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java Tue Jan 14 08:27:37 2014
@@ -77,15 +77,13 @@ public class ConfigurationResolveReport
this.options = options;
}
-
/**
- * Check if the set of dependencies has changed since the previous execution
- * of a resolution.<br/>
- * This function use the report file found in the cache. So the function must be called
- * before the new report is serialized there.</br>
- * This function also use the internal dependencies that must already be filled.
- * This function might be 'heavy' because it may have to parse the previous
- * report.
+ * Check if the set of dependencies has changed since the previous execution of a resolution.<br/>
+ * This function use the report file found in the cache. So the function must be called before
+ * the new report is serialized there.</br> This function also use the internal dependencies
+ * that must already be filled. This function might be 'heavy' because it may have to parse the
+ * previous report.
+ *
* @return
*/
public void checkIfChanged() {
@@ -96,8 +94,10 @@ public class ConfigurationResolveReport
try {
XmlReportParser parser = new XmlReportParser();
parser.parse(previousReportFile);
- List<ModuleRevisionId> previousDeps = Arrays.asList(parser.getDependencyRevisionIds());
- HashSet<ModuleRevisionId> previousDepSet = new HashSet<ModuleRevisionId>(previousDeps);
+ List<ModuleRevisionId> previousDeps = Arrays.asList(parser
+ .getDependencyRevisionIds());
+ HashSet<ModuleRevisionId> previousDepSet = new HashSet<ModuleRevisionId>(
+ previousDeps);
hasChanged = Boolean.valueOf(!previousDepSet.equals(getModuleRevisionIds()));
} catch (Exception e) {
Message.warn("Error while parsing configuration resolve report "
@@ -108,11 +108,11 @@ public class ConfigurationResolveReport
hasChanged = Boolean.TRUE;
}
}
-
+
/**
* @pre checkIfChanged has been called.
*/
- public boolean hasChanged() {
+ public boolean hasChanged() {
return hasChanged.booleanValue();
}
@@ -135,7 +135,7 @@ public class ConfigurationResolveReport
public void addDependency(IvyNode node) {
dependencies.put(node.getId(), node);
dependencies.put(node.getResolvedId(), node);
- dependencyReports.put(node, Collections.<ArtifactDownloadReport>emptyList());
+ dependencyReports.put(node, Collections.<ArtifactDownloadReport> emptyList());
}
public void updateDependency(ModuleRevisionId mrid, IvyNode node) {
@@ -205,7 +205,7 @@ public class ConfigurationResolveReport
public IvyNode[] getDownloadedNodes() {
List<IvyNode> downloaded = new ArrayList<IvyNode>();
- for (IvyNode node : getDependencies()) {
+ for (IvyNode node : getDependencies()) {
if (node.isDownloaded() && node.getRealNode() == node) {
downloaded.add(node);
}
@@ -272,7 +272,7 @@ public class ConfigurationResolveReport
public int getArtifactsNumber() {
int total = 0;
- for (Collection<ArtifactDownloadReport> reports : dependencyReports.values()) {
+ for (Collection<ArtifactDownloadReport> reports : dependencyReports.values()) {
total += reports == null ? 0 : reports.size();
}
return total;
@@ -292,16 +292,16 @@ public class ConfigurationResolveReport
* specific download status, and also remove the download report for the evicted modules.
*
* @param downloadStatus
- * the status of download to retreive. Set it to <code>null</code> for no
- * restriction on the download status
+ * the status of download to retreive. Set it to <code>null</code> for no restriction
+ * on the download status
* @param withEvicted
* set it to <code>true</code> if the report for the evicted modules have to be
* retrieved.
* @return the list of reports, never <code>null</code>
* @see ArtifactDownloadReport
*/
- public ArtifactDownloadReport[] getArtifactsReports(
- DownloadStatus downloadStatus, boolean withEvicted) {
+ public ArtifactDownloadReport[] getArtifactsReports(DownloadStatus downloadStatus,
+ boolean withEvicted) {
Collection<ArtifactDownloadReport> all = new LinkedHashSet<ArtifactDownloadReport>();
Collection<ModuleRevisionId> evictedMrids = null;
if (!withEvicted) {
@@ -312,9 +312,9 @@ public class ConfigurationResolveReport
if (downloadStatus != null && report.getDownloadStatus() != downloadStatus) {
continue;
}
- if (withEvicted
+ if (withEvicted
|| !evictedMrids.contains(report.getArtifact().getModuleRevisionId())) {
- all.add(report);
+ all.add(report);
}
}
}
@@ -336,8 +336,7 @@ public class ConfigurationResolveReport
* @return the list of reports, never <code>null</code>
*/
public ArtifactDownloadReport[] getFailedArtifactsReports() {
- ArtifactDownloadReport[] allFailedReports
- = getArtifactsReports(DownloadStatus.FAILED, true);
+ ArtifactDownloadReport[] allFailedReports = getArtifactsReports(DownloadStatus.FAILED, true);
return filterOutMergedArtifacts(allFailedReports);
}
@@ -351,10 +350,11 @@ public class ConfigurationResolveReport
public static ArtifactDownloadReport[] filterOutMergedArtifacts(
ArtifactDownloadReport[] allFailedReports) {
- Collection<ArtifactDownloadReport> adrs = new ArrayList<ArtifactDownloadReport>(Arrays.asList(allFailedReports));
+ Collection<ArtifactDownloadReport> adrs = new ArrayList<ArtifactDownloadReport>(
+ Arrays.asList(allFailedReports));
for (Iterator<ArtifactDownloadReport> iterator = adrs.iterator(); iterator.hasNext();) {
ArtifactDownloadReport adr = (ArtifactDownloadReport) iterator.next();
-
+
if (adr.getArtifact().getExtraAttribute("ivy:merged") != null) {
iterator.remove();
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java Tue Jan 14 08:27:37 2014
@@ -35,7 +35,7 @@ public final class DownloadStatus {
public static final DownloadStatus SUCCESSFUL = new DownloadStatus("successful");
public static final DownloadStatus FAILED = new DownloadStatus("failed");
-
+
/**
* Returns the {@link DownloadStatus} corresponding to the given String representation.
*
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/MetadataArtifactDownloadReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/MetadataArtifactDownloadReport.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/MetadataArtifactDownloadReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/MetadataArtifactDownloadReport.java Tue Jan 14 08:27:37 2014
@@ -23,7 +23,7 @@ import org.apache.ivy.core.module.descri
public class MetadataArtifactDownloadReport extends ArtifactDownloadReport {
private boolean isSearched;
-
+
private File originalLocalFile;
public MetadataArtifactDownloadReport(Artifact artifact) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java Tue Jan 14 08:27:37 2014
@@ -343,8 +343,7 @@ public class ResolveReport {
return (String[]) extendingConfs.toArray(new String[extendingConfs.size()]);
}
- private boolean gatherExtendingConfs(Set<String> extendingConfs, String conf,
- String extended) {
+ private boolean gatherExtendingConfs(Set<String> extendingConfs, String conf, String extended) {
if (extendingConfs.contains(conf)) {
return true;
}
@@ -369,8 +368,7 @@ public class ResolveReport {
return false;
}
- public ModuleDescriptor toFixedModuleDescriptor(IvySettings settings,
- List<ModuleId> midToKeep) {
+ public ModuleDescriptor toFixedModuleDescriptor(IvySettings settings, List<ModuleId> midToKeep) {
DefaultModuleDescriptor fixedmd = new DefaultModuleDescriptor(md.getModuleRevisionId(),
md.getStatus(), new Date());
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java Tue Jan 14 08:27:37 2014
@@ -70,55 +70,62 @@ import org.apache.ivy.util.Message;
*/
public class RepositoryManagementEngine {
private static final double THOUSAND = 1000.0;
+
private static final int KILO = 1024;
-
- ///////////////////////////////////////////
+
+ // /////////////////////////////////////////
// state loaded on #load()
- ///////////////////////////////////////////
+ // /////////////////////////////////////////
/**
* True if the repository has already been loaded, false otherwise.
*/
private boolean loaded;
+
/**
* ModuleDescriptors stored by ModuleRevisionId
*/
- private Map/*<ModuleRevisionId,ModuleDescriptor>*/ revisions = new HashMap();
+ private Map/* <ModuleRevisionId,ModuleDescriptor> */revisions = new HashMap();
+
/**
* ModuleRevisionId for which loading was not possible, with corresponding error message.
*/
- private Map/*<ModuleRevisionId,String>*/ errors = new HashMap();
+ private Map/* <ModuleRevisionId,String> */errors = new HashMap();
+
/**
* List of ModuleRevisionId per ModuleId.
*/
- private Map/*<ModuleId,Collection<ModuleRevisionId>>*/ modules = new HashMap();
-
- ///////////////////////////////////////////
+ private Map/* <ModuleId,Collection<ModuleRevisionId>> */modules = new HashMap();
+
+ // /////////////////////////////////////////
// state loaded on #analyze()
- ///////////////////////////////////////////
+ // /////////////////////////////////////////
/**
* True when the repository has been analyzed, false otherwise
*/
private boolean analyzed;
+
/**
* Cache from requested module revision id to actual module revision id.
*/
- private Map/*<ModuleRevisionId,ModuleRevisionId>*/ cache = new HashMap();
+ private Map/* <ModuleRevisionId,ModuleRevisionId> */cache = new HashMap();
+
/**
* list of dependers per ModuleRevisionId.
*/
- private Map/*<ModuleRevisionId,List<ModuleRevisionId>>*/ dependers = new HashMap();
-
- ///////////////////////////////////////////
+ private Map/* <ModuleRevisionId,List<ModuleRevisionId>> */dependers = new HashMap();
+
+ // /////////////////////////////////////////
// dependencies
- ///////////////////////////////////////////
+ // /////////////////////////////////////////
private SearchEngine searchEngine;
+
private ResolveEngine resolveEngine;
+
private RepositoryManagementEngineSettings settings;
-
- public RepositoryManagementEngine(RepositoryManagementEngineSettings settings,
+ public RepositoryManagementEngine(RepositoryManagementEngineSettings settings,
SearchEngine searchEngine, ResolveEngine resolveEngine) {
this.settings = settings;
this.searchEngine = searchEngine;
@@ -150,21 +157,23 @@ public class RepositoryManagementEngine
}
}
long endTime = System.currentTimeMillis();
- Message.info("\nrepository loaded: " + modules.size() + " modules; "
- + revisions.size() + " revisions; "
- + (settings.dumpMemoryUsage()
- ? (MemoryUtil.getUsedMemory() - startingMemoryUse) / KILO + "kB; "
- : "")
- + (endTime - startTime) / THOUSAND + "s");
+ Message.info("\nrepository loaded: "
+ + modules.size()
+ + " modules; "
+ + revisions.size()
+ + " revisions; "
+ + (settings.dumpMemoryUsage() ? (MemoryUtil.getUsedMemory() - startingMemoryUse)
+ / KILO + "kB; " : "") + (endTime - startTime) / THOUSAND + "s");
loaded = true;
}
/**
* Analyze data in the repository.
* <p>
- * This method may take a long time to proceed. It should never be called from event
- * dispatch thread in a GUI.
+ * This method may take a long time to proceed. It should never be called from event dispatch
+ * thread in a GUI.
* </p>
+ *
* @throws IllegalStateException
* if the repository has not been loaded yet
* @see #load()
@@ -178,8 +187,8 @@ public class RepositoryManagementEngine
for (int i = 0; i < dds.length; i++) {
ModuleRevisionId dep = getDependency(dds[i]);
if (dep == null) {
- Message.warn(
- "inconsistent repository: declared dependency not found: " + dds[i]);
+ Message.warn("inconsistent repository: declared dependency not found: "
+ + dds[i]);
} else {
getDependers(dep).add(md.getModuleRevisionId());
}
@@ -231,15 +240,11 @@ public class RepositoryManagementEngine
return orphans;
}
-
private ModuleRevisionId[] searchModules() {
- ModuleRevisionId[] mrids = searchEngine.listModules(
- ModuleRevisionId.newInstance(
- PatternMatcher.ANY_EXPRESSION,
- PatternMatcher.ANY_EXPRESSION,
- PatternMatcher.ANY_EXPRESSION,
- PatternMatcher.ANY_EXPRESSION),
- RegexpPatternMatcher.INSTANCE);
+ ModuleRevisionId[] mrids = searchEngine.listModules(ModuleRevisionId.newInstance(
+ PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION,
+ PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION),
+ RegexpPatternMatcher.INSTANCE);
return mrids;
}
@@ -249,11 +254,10 @@ public class RepositoryManagementEngine
if (vmatcher.isDynamic(askedMrid)) {
ModuleRevisionId mrid = (ModuleRevisionId) cache.get(askedMrid);
if (mrid == null) {
- Collection revs = getAllRevisions(askedMrid);
+ Collection revs = getAllRevisions(askedMrid);
for (Iterator iterator = revs.iterator(); iterator.hasNext();) {
ModuleDescriptor md = (ModuleDescriptor) iterator.next();
- if (vmatcher.needModuleDescriptor(
- askedMrid, md.getResolvedModuleRevisionId())) {
+ if (vmatcher.needModuleDescriptor(askedMrid, md.getResolvedModuleRevisionId())) {
if (vmatcher.accept(askedMrid, md)) {
mrid = md.getResolvedModuleRevisionId();
break;
@@ -287,9 +291,8 @@ public class RepositoryManagementEngine
}
private void loadModuleRevision(ModuleRevisionId mrid) throws Exception {
- ResolvedModuleRevision module = settings.getResolver(mrid)
- .getDependency(new DefaultDependencyDescriptor(mrid, false),
- newResolveData());
+ ResolvedModuleRevision module = settings.getResolver(mrid).getDependency(
+ new DefaultDependencyDescriptor(mrid, false), newResolveData());
if (module == null) {
Message.warn("module not found while listed: " + mrid);
} else {
@@ -308,8 +311,8 @@ public class RepositoryManagementEngine
ModuleDescriptor md2 = (ModuleDescriptor) o2;
// we use reverse order compared to latest revision, to have latest revision
// first
- return settings.getDefaultLatestStrategy()
- .sort(new ArtifactInfo[] {md1, md2}).get(0).equals(md1) ? 1 : -1;
+ return settings.getDefaultLatestStrategy().sort(new ArtifactInfo[] {md1, md2})
+ .get(0).equals(md1) ? 1 : -1;
}
});
modules.put(id.getModuleId(), revisions);
@@ -324,14 +327,13 @@ public class RepositoryManagementEngine
private void ensureAnalyzed() {
if (!analyzed) {
throw new IllegalStateException(
- "repository must have been analyzed to perform this method");
+ "repository must have been analyzed to perform this method");
}
}
private void ensureLoaded() {
if (!loaded) {
- throw new IllegalStateException(
- "repository must have be loaded to perform this method");
+ throw new IllegalStateException("repository must have be loaded to perform this method");
}
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java Tue Jan 14 08:27:37 2014
@@ -19,7 +19,6 @@ package org.apache.ivy.core.resolve;
import org.apache.ivy.core.LogOptions;
-
public class DownloadOptions extends LogOptions {
public DownloadOptions() {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java Tue Jan 14 08:27:37 2014
@@ -93,7 +93,7 @@ public class IvyNode implements Comparab
private boolean downloaded = false;
private boolean searched = false;
-
+
private Collection confsToFetch = new HashSet();
private Collection fetchedConfigurations = new HashSet();
@@ -103,9 +103,9 @@ public class IvyNode implements Comparab
// //////// USAGE DATA
private IvyNodeUsage usage = new IvyNodeUsage(this);
-
+
// usage information merged from evicted nodes this node is "replacing"
- private Map/*<ModuleRevisionId, IvyNodeUsage>*/ mergedUsages = new LinkedHashMap();
+ private Map/* <ModuleRevisionId, IvyNodeUsage> */mergedUsages = new LinkedHashMap();
public IvyNode(ResolveData data, IvyNode parent, DependencyDescriptor dd) {
id = dd.getDependencyRevisionId();
@@ -127,7 +127,7 @@ public class IvyNode implements Comparab
eviction = new IvyNodeEviction(this);
callers = new IvyNodeCallers(this);
}
-
+
/**
* After the call node may be discarded. To avoid using discarded node, make sure to get the
* real node after the call IvyNode node = ... node.loadData(); node = node.getRealNode(); ...
@@ -161,23 +161,23 @@ public class IvyNode implements Comparab
Message.debug("\tusing " + resolver + " to resolve " + getId());
DependencyDescriptor dependencyDescriptor = getDependencyDescriptor(parent);
long start = System.currentTimeMillis();
- ModuleRevisionId requestedRevisionId
- = dependencyDescriptor.getDependencyRevisionId();
+ ModuleRevisionId requestedRevisionId = dependencyDescriptor
+ .getDependencyRevisionId();
data.getEventManager().fireIvyEvent(
- new StartResolveDependencyEvent(
- resolver, dependencyDescriptor, requestedRevisionId));
+ new StartResolveDependencyEvent(resolver, dependencyDescriptor,
+ requestedRevisionId));
module = resolver.getDependency(dependencyDescriptor, data);
data.getEventManager().fireIvyEvent(
- new EndResolveDependencyEvent(
- resolver, dependencyDescriptor, requestedRevisionId,
- module, System.currentTimeMillis() - start));
-
+ new EndResolveDependencyEvent(resolver, dependencyDescriptor,
+ requestedRevisionId, module, System.currentTimeMillis() - start));
+
if (module != null) {
- module.getResolver().getRepositoryCacheManager().saveResolvers(
- module.getDescriptor(),
- module.getResolver().getName(),
- module.getArtifactResolver().getName());
- if (settings.logModuleWhenFound()
+ module.getResolver()
+ .getRepositoryCacheManager()
+ .saveResolvers(module.getDescriptor(),
+ module.getResolver().getName(),
+ module.getArtifactResolver().getName());
+ if (settings.logModuleWhenFound()
&& LogOptions.LOG_DEFAULT.equals(getData().getOptions().getLog())) {
Message.info("\tfound " + module.getId() + " in "
+ module.getResolver().getName());
@@ -187,13 +187,12 @@ public class IvyNode implements Comparab
}
// IVY-56: check if revision has actually been resolved
- if (settings.getVersionMatcher().isDynamic(getId())
+ if (settings.getVersionMatcher().isDynamic(getId())
&& settings.getVersionMatcher().isDynamic(module.getId())) {
- Message.error("impossible to resolve dynamic revision for "
- + getId() + ": check your configuration and "
- + "make sure revision is part of your pattern");
- problem = new RuntimeException(
- "impossible to resolve dynamic revision");
+ Message.error("impossible to resolve dynamic revision for " + getId()
+ + ": check your configuration and "
+ + "make sure revision is part of your pattern");
+ problem = new RuntimeException("impossible to resolve dynamic revision");
return false;
}
if (!getId().equals(module.getId())) {
@@ -217,7 +216,8 @@ public class IvyNode implements Comparab
log += " (forced)";
}
if (settings.logResolvedRevision()
- && LogOptions.LOG_DEFAULT.equals(getData().getOptions().getLog())) {
+ && LogOptions.LOG_DEFAULT.equals(getData().getOptions()
+ .getLog())) {
Message.info(log);
} else {
Message.verbose(log);
@@ -226,7 +226,7 @@ public class IvyNode implements Comparab
downloaded = module.getReport().isDownloaded();
searched = module.getReport().isSearched();
loaded = true;
-
+
md = module.getDescriptor();
confsToFetch.remove("*");
updateConfsToFetch(Arrays
@@ -248,8 +248,7 @@ public class IvyNode implements Comparab
loaded = true;
}
}
- handleConfiguration(
- loaded, rootModuleConf, parent, parentConf, conf, shouldBePublic, usage);
+ handleConfiguration(loaded, rootModuleConf, parent, parentConf, conf, shouldBePublic, usage);
if (hasProblem()) {
Message.debug("problem : " + problem.getMessage());
return false;
@@ -277,7 +276,7 @@ public class IvyNode implements Comparab
resolved.loadData(rootModuleConf, parent, parentConf, conf, shouldBePublic, usage);
resolved.usage.updateDataFrom(getAllUsages(), rootModuleConf);
usage = resolved.usage;
-
+
data.replaceNode(getId(), resolved, rootModuleConf); // this actually discards the node
if (settings.logResolvedRevision()
@@ -320,13 +319,15 @@ public class IvyNode implements Comparab
* the actual node conf requested, possibly extending the <code>conf</code> one.
* @return
*/
- public Collection/*<IvyNode>*/ getDependencies(String rootModuleConf, String conf, String requestedConf) {
+ public Collection/* <IvyNode> */getDependencies(String rootModuleConf, String conf,
+ String requestedConf) {
if (md == null) {
throw new IllegalStateException(
"impossible to get dependencies when data has not been loaded");
}
DependencyDescriptor[] dds = md.getDependencies();
- Map/*<ModuleRevisionId, IvyNode> */ dependencies = new LinkedHashMap(); // it's important to respect order
+ Map/* <ModuleRevisionId, IvyNode> */dependencies = new LinkedHashMap(); // it's important to
+ // respect order
for (int i = 0; i < dds.length; i++) {
DependencyDescriptor dd = data.mediate(dds[i]);
String[] dependencyConfigurations = dd.getDependencyConfigurations(conf, requestedConf);
@@ -366,7 +367,8 @@ public class IvyNode implements Comparab
depNode.addRootModuleConfigurations(depNode.usage, rootModuleConf, confsArray);
depNode.usage.setRequiredConfs(this, conf, confs);
- depNode.addCaller(rootModuleConf, this, conf, requestedConf, dependencyConfigurations, dd);
+ depNode.addCaller(rootModuleConf, this, conf, requestedConf, dependencyConfigurations,
+ dd);
dependencies.put(requestedDependencyRevisionId, depNode);
}
return dependencies.values();
@@ -438,29 +440,27 @@ public class IvyNode implements Comparab
if (c == null) {
confsToFetch.remove(conf);
if (isConfRequiredByMergedUsageOnly(rootModuleConf, conf)) {
- Message.verbose(
- "configuration required by evicted revision is not available in "
- + "selected revision. skipping " + conf + " in " + this);
+ Message.verbose("configuration required by evicted revision is not available in "
+ + "selected revision. skipping " + conf + " in " + this);
} else if (!conf.equals(confs[i])) {
- problem = new RuntimeException("configuration not found in " + this
- + ": '" + conf + "'. Missing configuration: '" + confs[i]
+ problem = new RuntimeException("configuration not found in " + this + ": '"
+ + conf + "'. Missing configuration: '" + confs[i]
+ "'. It was required from " + parent + " " + parentConf);
} else {
- problem = new RuntimeException("configuration not found in " + this
- + ": '" + confs[i] + "'. It was required from " + parent + " "
- + parentConf);
+ problem = new RuntimeException("configuration not found in " + this + ": '"
+ + confs[i] + "'. It was required from " + parent + " " + parentConf);
}
return false;
} else if (shouldBePublic && !isRoot()
&& c.getVisibility() != Configuration.Visibility.PUBLIC) {
confsToFetch.remove(conf);
if (isConfRequiredByMergedUsageOnly(rootModuleConf, conf)) {
- Message.verbose(
- "configuration required by evicted revision is not visible in "
- + "selected revision. skipping " + conf + " in " + this);
+ Message.verbose("configuration required by evicted revision is not visible in "
+ + "selected revision. skipping " + conf + " in " + this);
} else {
- problem = new RuntimeException("configuration not public in " + this + ": '"
- + c + "'. It was required from " + parent + " " + parentConf);
+ problem = new RuntimeException("configuration not public in " + this
+ + ": '" + c + "'. It was required from " + parent + " "
+ + parentConf);
}
return false;
}
@@ -581,13 +581,13 @@ public class IvyNode implements Comparab
}
return (String[]) depConfs.toArray(new String[depConfs.size()]);
}
-
+
protected boolean isConfRequiredByMergedUsageOnly(String rootModuleConf, String conf) {
Set confs = usage.getConfigurations(rootModuleConf);
return confs == null || !confs.contains(conf);
}
- //This is never called. Could we remove it?
+ // This is never called. Could we remove it?
public void discardConf(String rootModuleConf, String conf) {
Set depConfs = usage.addAndGetConfigurations(rootModuleConf);
if (md != null) {
@@ -608,8 +608,8 @@ public class IvyNode implements Comparab
}
}
- private void addRootModuleConfigurations(
- IvyNodeUsage usage, String rootModuleConf, String[] dependencyConfs) {
+ private void addRootModuleConfigurations(IvyNodeUsage usage, String rootModuleConf,
+ String[] dependencyConfs) {
Set depConfs = usage.addAndGetConfigurations(rootModuleConf);
if (md != null) {
// add all given dependency configurations to the set + extended ones
@@ -619,7 +619,7 @@ public class IvyNode implements Comparab
if (conf != null) {
String[] exts = conf.getExtends();
// recursive add of extended
- addRootModuleConfigurations(usage, rootModuleConf, exts);
+ addRootModuleConfigurations(usage, rootModuleConf, exts);
}
}
} else {
@@ -664,7 +664,9 @@ public class IvyNode implements Comparab
}
String defaultConf = getDefaultConf(conf);
conf = getMainConf(conf);
- if ((md.getConfiguration(conf) == null) || Configuration.Visibility.PRIVATE.equals(md.getConfiguration(conf).getVisibility())) {
+ if ((md.getConfiguration(conf) == null)
+ || Configuration.Visibility.PRIVATE.equals(md.getConfiguration(conf)
+ .getVisibility())) {
if ("".equals(defaultConf)) {
return new String[0];
}
@@ -697,14 +699,12 @@ public class IvyNode implements Comparab
private Collection findPath(ModuleId from, IvyNode node, List path) {
IvyNode parent = (IvyNode) node.getDirectCallerFor(from);
if (parent == null) {
- throw new IllegalArgumentException(
- "no path from " + from + " to " + getId() + " found");
+ 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));
+ 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);
@@ -748,8 +748,8 @@ public class IvyNode implements Comparab
updateConfsToFetch(node.fetchedConfigurations);
updateConfsToFetch(node.confsToFetch);
}
-
- private Collection/*<IvyNodeUsage>*/ getAllUsages() {
+
+ private Collection/* <IvyNodeUsage> */getAllUsages() {
Collection usages = new ArrayList();
usages.add(usage);
usages.addAll(mergedUsages.values());
@@ -763,7 +763,7 @@ public class IvyNode implements Comparab
*/
public Artifact[] getAllArtifacts() {
Set ret = new HashSet();
-
+
for (Iterator it = getRootModuleConfigurationsSet().iterator(); it.hasNext();) {
String rootModuleConf = (String) it.next();
ret.addAll(Arrays.asList(getArtifacts(rootModuleConf)));
@@ -808,10 +808,9 @@ public class IvyNode implements Comparab
if (md == null) {
throw new IllegalStateException(
"impossible to get artifacts when data has not been loaded. IvyNode = "
- + this.toString());
+ + this.toString());
}
-
Set artifacts = new HashSet(); // the set we fill before returning
// we check if we have dependencyArtifacts includes description for this rootModuleConf
@@ -886,8 +885,8 @@ public class IvyNode implements Comparab
private void addArtifactsFromOwnUsage(Set artifacts, Set dependencyArtifacts) {
for (Iterator it = dependencyArtifacts.iterator(); it.hasNext();) {
DependencyArtifactDescriptor dad = (DependencyArtifactDescriptor) it.next();
- artifacts.add(new MDArtifact(md, dad.getName(), dad.getType(), dad.getExt(),
- dad.getUrl(), dad.getQualifiedExtraAttributes()));
+ artifacts.add(new MDArtifact(md, dad.getName(), dad.getType(), dad.getExt(), dad
+ .getUrl(), dad.getQualifiedExtraAttributes()));
}
}
@@ -899,14 +898,13 @@ public class IvyNode implements Comparab
for (Iterator it = mergedDependencyArtifacts.iterator(); it.hasNext();) {
DependencyArtifactDescriptor dad = (DependencyArtifactDescriptor) it.next();
Map extraAttributes = new HashMap(dad.getQualifiedExtraAttributes());
- MDArtifact artifact = new MDArtifact(md, dad.getName(), dad.getType(), dad.getExt(),
- dad.getUrl(), extraAttributes);
-
+ MDArtifact artifact = new MDArtifact(md, dad.getName(), dad.getType(),
+ dad.getExt(), dad.getUrl(), extraAttributes);
+
if (!artifacts.contains(artifact)) {
// this is later used to know that this is a merged artifact
- extraAttributes.put("ivy:merged",
- dad.getDependencyDescriptor().getParentRevisionId()
- + " -> " + usage.getNode().getId());
+ extraAttributes.put("ivy:merged", dad.getDependencyDescriptor()
+ .getParentRevisionId() + " -> " + usage.getNode().getId());
artifacts.add(artifact);
}
}
@@ -969,7 +967,7 @@ public class IvyNode implements Comparab
if (md == null) {
throw new IllegalStateException(
"impossible to get conflict manager when data has not been loaded. IvyNode = "
- + this.toString());
+ + this.toString());
}
ConflictManager cm = md.getConflictManager(mid);
return cm == null ? settings.getConflictManager(mid) : cm;
@@ -1073,16 +1071,16 @@ public class IvyNode implements Comparab
public void addCaller(String rootModuleConf, IvyNode callerNode, String callerConf,
String requestedConf, String[] dependencyConfs, DependencyDescriptor dd) {
- callers.addCaller(rootModuleConf, callerNode, callerConf, requestedConf, dependencyConfs, dd);
+ callers.addCaller(rootModuleConf, callerNode, callerConf, requestedConf, dependencyConfs,
+ dd);
boolean isCircular = callers.getAllCallersModuleIds().contains(getId().getModuleId());
if (isCircular) {
- IvyContext.getContext().getCircularDependencyStrategy().handleCircularDependency(
- toMrids(findPath(getId().getModuleId()), this));
+ IvyContext.getContext().getCircularDependencyStrategy()
+ .handleCircularDependency(toMrids(findPath(getId().getModuleId()), this));
}
}
- public boolean doesCallersExclude(
- String rootModuleConf, Artifact artifact, Stack callersStack) {
+ public boolean doesCallersExclude(String rootModuleConf, Artifact artifact, Stack callersStack) {
return callers.doesCallersExclude(rootModuleConf, artifact, callersStack);
}
@@ -1131,7 +1129,7 @@ public class IvyNode implements Comparab
return eviction.getAllEvictingNodes();
}
- public Collection/*<String>*/ getAllEvictingNodesDetails() {
+ public Collection/* <String> */getAllEvictingNodesDetails() {
return eviction.getAllEvictingNodesDetails();
}
@@ -1212,8 +1210,7 @@ public class IvyNode implements Comparab
return eviction.getPendingConflicts(rootModuleConf, mid);
}
- public void setPendingConflicts(
- ModuleId moduleId, String rootModuleConf, Collection conflicts) {
+ public void setPendingConflicts(ModuleId moduleId, String rootModuleConf, Collection conflicts) {
eviction.setPendingConflicts(moduleId, rootModuleConf, conflicts);
}
@@ -1230,7 +1227,8 @@ public class IvyNode implements Comparab
* {@link LatestCompatibleConflictManager}
* </p>
*
- * @param rootModuleConf the root module configuration in which the node should be blacklisted
+ * @param rootModuleConf
+ * the root module configuration in which the node should be blacklisted
*/
public void blacklist(IvyNodeBlacklist bdata) {
if (data.getSettings().logResolvedRevision()) {
@@ -1238,18 +1236,17 @@ public class IvyNode implements Comparab
} else {
Message.verbose("BLACKLISTING " + bdata);
}
-
+
Stack callerStack = new Stack();
callerStack.push(this);
clearEvictionDataInAllCallers(bdata.getRootModuleConf(), callerStack);
-
+
usage.blacklist(bdata);
data.blacklist(this);
}
-
- private void clearEvictionDataInAllCallers(
- String rootModuleConf, Stack/*<IvyNode>*/ callerStack) {
+ private void clearEvictionDataInAllCallers(String rootModuleConf,
+ Stack/* <IvyNode> */callerStack) {
IvyNode node = (IvyNode) callerStack.peek();
Caller[] callers = node.getCallers(rootModuleConf);
for (int i = 0; i < callers.length; i++) {
@@ -1264,7 +1261,7 @@ public class IvyNode implements Comparab
}
}
}
-
+
/**
* Indicates if this node has been blacklisted in the given root module conf.
* <p>
@@ -1280,7 +1277,7 @@ public class IvyNode implements Comparab
public boolean isBlacklisted(String rootModuleConf) {
return usage.isBlacklisted(rootModuleConf);
}
-
+
/**
* Indicates if this node has been blacklisted in all root module configurations.
*
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeBlacklist.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeBlacklist.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeBlacklist.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeBlacklist.java Tue Jan 14 08:27:37 2014
@@ -17,7 +17,6 @@
*/
package org.apache.ivy.core.resolve;
-
/**
* Information about a blacklisted module, providing context information in which it has been
* blacklisted
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java Tue Jan 14 08:27:37 2014
@@ -73,8 +73,8 @@ public class IvyNodeCallers {
if (prevDepConfs != null) {
Set newDepConfs = new HashSet(Arrays.asList(prevDepConfs));
newDepConfs.addAll(Arrays.asList(dependencyConfs));
- confs.put(callerConf, (String[]) newDepConfs
- .toArray(new String[newDepConfs.size()]));
+ confs.put(callerConf,
+ (String[]) newDepConfs.toArray(new String[newDepConfs.size()]));
} else {
confs.put(callerConf, dependencyConfs);
}
@@ -97,11 +97,11 @@ public class IvyNodeCallers {
}
public int hashCode() {
- //CheckStyle:MagicNumber| OFF
+ // CheckStyle:MagicNumber| OFF
int hash = 31;
hash = hash * 13 + confs.hashCode();
hash = hash * 13 + mrid.hashCode();
- //CheckStyle:MagicNumber| ON
+ // CheckStyle:MagicNumber| ON
return hash;
}
@@ -126,9 +126,9 @@ public class IvyNodeCallers {
}
public void setRealCaller(boolean b) {
- this.real = b;
+ this.real = b;
}
-
+
public boolean isRealCaller() {
return real;
}
@@ -186,7 +186,7 @@ public class IvyNodeCallers {
}
allCallers.put(mrid.getModuleId(), callerNode);
}
-
+
void removeCaller(String rootModuleConf, ModuleRevisionId callerMrid) {
allCallers.remove(callerMrid.getModuleId());
Map callers = (Map) callersByRootConf.get(rootModuleConf);
@@ -278,14 +278,15 @@ public class IvyNodeCallers {
return false;
}
ModuleDescriptor md = callers[i].getModuleDescriptor();
- Boolean doesExclude = node.doesExclude(md, rootModuleConf, callers[i].getCallerConfigurations(),
- callers[i].getDependencyDescriptor(), artifact, callersStack);
+ Boolean doesExclude = node.doesExclude(md, rootModuleConf,
+ callers[i].getCallerConfigurations(), callers[i].getDependencyDescriptor(),
+ artifact, callersStack);
if (doesExclude != null) {
if (!doesExclude.booleanValue()) {
return false;
}
allUnconclusive = false;
- }
+ }
}
return allUnconclusive ? false : true;
} finally {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java Tue Jan 14 08:27:37 2014
@@ -98,9 +98,8 @@ public class IvyNodeEviction {
public String toString() {
if (selected != null) {
- return selected + " in " + parent
- + (detail == null ? "" : " " + detail)
- + " (" + conflictManager + ") [" + rootModuleConf + "]";
+ return selected + " in " + parent + (detail == null ? "" : " " + detail) + " ("
+ + conflictManager + ") [" + rootModuleConf + "]";
} else {
return "transitively [" + rootModuleConf + "]";
}
@@ -125,7 +124,7 @@ public class IvyNodeEviction {
public boolean isTransitivelyEvicted() {
return parent == null;
}
-
+
public String getDetail() {
return detail;
}
@@ -164,11 +163,11 @@ public class IvyNodeEviction {
}
public int hashCode() {
- //CheckStyle:MagicNumber| OFF
+ // CheckStyle:MagicNumber| OFF
int hash = 33;
hash += getModuleId().hashCode() * 17;
hash += getConf().hashCode() * 17;
- //CheckStyle:MagicNumber| ON
+ // CheckStyle:MagicNumber| ON
return hash;
}
}
@@ -231,11 +230,11 @@ public class IvyNodeEviction {
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
+
+ // 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(),
+ resolvedRevs.add(ModuleRevisionId.newInstance(resolvedId.getOrganisation(),
resolvedId.getName(), resolvedId.getBranch(), resolvedId.getRevision()));
}
}
@@ -294,7 +293,7 @@ public class IvyNodeEviction {
ModuleId moduleId = node.getId().getModuleId();
Collection resolvedRevisions = root.getResolvedRevisions(moduleId, rootModuleConf);
return !resolvedRevisions.contains(node.getResolvedId())
- || evictedData.isTransitivelyEvicted();
+ || evictedData.isTransitivelyEvicted();
}
public boolean isCompletelyEvicted() {
@@ -364,8 +363,8 @@ public class IvyNodeEviction {
}
return allEvictingNodes;
}
-
- public Collection/*<String>*/ getAllEvictingNodesDetails() {
+
+ public Collection/* <String> */getAllEvictingNodesDetails() {
Collection ret = null;
for (Iterator iter = evicted.values().iterator(); iter.hasNext();) {
EvictionData ed = (EvictionData) iter.next();
@@ -375,11 +374,10 @@ public class IvyNodeEviction {
ret = new HashSet();
}
if (selected.size() == 1) {
- ret.add(selected.iterator().next()
- + (ed.getDetail() == null ? "" : " " + ed.getDetail()));
+ ret.add(selected.iterator().next()
+ + (ed.getDetail() == null ? "" : " " + ed.getDetail()));
} else if (selected.size() > 1) {
- ret.add(selected
- + (ed.getDetail() == null ? "" : " " + ed.getDetail()));
+ ret.add(selected + (ed.getDetail() == null ? "" : " " + ed.getDetail()));
}
}
}
@@ -433,8 +431,7 @@ public class IvyNodeEviction {
return ret;
}
- public void setPendingConflicts(ModuleId moduleId, String rootModuleConf,
- Collection conflicts) {
+ public void setPendingConflicts(ModuleId moduleId, String rootModuleConf, Collection conflicts) {
ModuleIdConf moduleIdConf = new ModuleIdConf(moduleId, rootModuleConf);
pendingConflicts.put(moduleIdConf, new HashSet(conflicts));
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java Tue Jan 14 08:27:37 2014
@@ -73,39 +73,41 @@ public class IvyNodeUsage {
}
public int hashCode() {
- //CheckStyle:MagicNumber| OFF
+ // CheckStyle:MagicNumber| OFF
int hash = 33;
hash += getNode().hashCode() * 17;
hash += getConf().hashCode() * 17;
- //CheckStyle:MagicNumber| OFF
+ // CheckStyle:MagicNumber| OFF
return hash;
}
-
+
public String toString() {
return "NodeConf(" + conf + ")";
}
}
-
+
private static final class Depender {
private DependencyDescriptor dd;
+
private String dependerConf;
-
+
public Depender(DependencyDescriptor dd, String dependerConf) {
this.dd = dd;
this.dependerConf = dependerConf;
}
-
+
public String toString() {
return dd + " [" + dependerConf + "]";
}
-
+
public boolean equals(Object obj) {
- if (! (obj instanceof Depender)) {
+ if (!(obj instanceof Depender)) {
return false;
}
Depender other = (Depender) obj;
return other.dd == dd && other.dependerConf.equals(dependerConf);
}
+
public int hashCode() {
int hash = 33;
hash += dd.hashCode() * 13;
@@ -113,7 +115,7 @@ public class IvyNodeUsage {
return hash;
}
}
-
+
private IvyNode node;
// Map (String rootConfName -> Set(String confName))
@@ -123,12 +125,12 @@ public class IvyNodeUsage {
// Map (NodeConf in -> Set(String conf))
private Map requiredConfs = new HashMap();
-
- private Map /*<String, Set<Depender>>*/ dependers = new HashMap();
-
+
+ private Map /* <String, Set<Depender>> */dependers = new HashMap();
+
// Map (String rootModuleConf -> IvyNodeBlacklist)
private Map blacklisted = new HashMap();
-
+
public IvyNodeUsage(IvyNode node) {
this.node = node;
}
@@ -140,7 +142,7 @@ public class IvyNodeUsage {
protected void setRequiredConfs(IvyNode parent, String parentConf, Collection confs) {
requiredConfs.put(new NodeConf(parent, parentConf), new HashSet(confs));
}
-
+
/**
* Returns the configurations of the dependency required in a given root module configuration.
*
@@ -150,7 +152,7 @@ public class IvyNodeUsage {
protected Set getConfigurations(String rootModuleConf) {
return (Set) rootModuleConfs.get(rootModuleConf);
}
-
+
protected Set addAndGetConfigurations(String rootModuleConf) {
Set depConfs = (Set) rootModuleConfs.get(rootModuleConf);
if (depConfs == null) {
@@ -159,19 +161,18 @@ public class IvyNodeUsage {
}
return depConfs;
}
-
- protected Set /*<String>*/ getRootModuleConfigurations() {
+
+ protected Set /* <String> */getRootModuleConfigurations() {
return rootModuleConfs.keySet();
}
-
- public void updateDataFrom(Collection/*<IvyNodeUsage>*/ usages, String rootModuleConf) {
+ public void updateDataFrom(Collection/* <IvyNodeUsage> */usages, String rootModuleConf) {
for (Iterator iterator = usages.iterator(); iterator.hasNext();) {
IvyNodeUsage usage = (IvyNodeUsage) iterator.next();
updateDataFrom(usage, rootModuleConf);
}
}
-
+
private void updateDataFrom(IvyNodeUsage usage, String rootModuleConf) {
// update requiredConfs
updateMapOfSet(usage.requiredConfs, requiredConfs);
@@ -202,16 +203,16 @@ public class IvyNodeUsage {
}
}
-// protected void addDependencyArtifacts(String rootModuleConf,
-// DependencyArtifactDescriptor[] dependencyArtifacts) {
-// addObjectsForConf(rootModuleConf, Arrays.asList(dependencyArtifacts),
-// this.dependencyArtifacts);
-// }
-//
-// protected void addDependencyIncludes(String rootModuleConf, IncludeRule[] rules) {
-// addObjectsForConf(rootModuleConf, Arrays.asList(rules), dependencyIncludes);
-// }
-//
+ // protected void addDependencyArtifacts(String rootModuleConf,
+ // DependencyArtifactDescriptor[] dependencyArtifacts) {
+ // addObjectsForConf(rootModuleConf, Arrays.asList(dependencyArtifacts),
+ // this.dependencyArtifacts);
+ // }
+ //
+ // protected void addDependencyIncludes(String rootModuleConf, IncludeRule[] rules) {
+ // addObjectsForConf(rootModuleConf, Arrays.asList(rules), dependencyIncludes);
+ // }
+ //
private void addObjectsForConf(String rootModuleConf, Object objectToAdd, Map map) {
Set set = (Set) map.get(rootModuleConf);
if (set == null) {
@@ -233,8 +234,8 @@ public class IvyNodeUsage {
Set dependencyArtifacts = new HashSet();
for (Iterator iterator = dependersInConf.iterator(); iterator.hasNext();) {
Depender depender = (Depender) iterator.next();
- DependencyArtifactDescriptor[] dads =
- depender.dd.getDependencyArtifacts(depender.dependerConf);
+ DependencyArtifactDescriptor[] dads = depender.dd
+ .getDependencyArtifacts(depender.dependerConf);
dependencyArtifacts.addAll(Arrays.asList(dads));
}
return dependencyArtifacts;
@@ -248,10 +249,9 @@ public class IvyNodeUsage {
Set dependencyIncludes = new HashSet();
for (Iterator iterator = dependersInConf.iterator(); iterator.hasNext();) {
Depender depender = (Depender) iterator.next();
- IncludeRule[] rules =
- depender.dd.getIncludeRules(depender.dependerConf);
+ IncludeRule[] rules = depender.dd.getIncludeRules(depender.dependerConf);
if (rules == null || rules.length == 0) {
- // no include rule in at least one depender -> we must include everything,
+ // no include rule in at least one depender -> we must include everything,
// and so return no include rule at all
return null;
}
@@ -267,7 +267,7 @@ public class IvyNodeUsage {
protected void blacklist(IvyNodeBlacklist bdata) {
blacklisted.put(bdata.getRootModuleConf(), bdata);
}
-
+
/**
* Indicates if this node has been blacklisted in the given root module conf.
* <p>
@@ -310,7 +310,7 @@ public class IvyNodeUsage {
* the given root module conf, <code>false</code> otherwise.
*/
public boolean hasTransitiveDepender(String rootModuleConf) {
- Set/*<Depender>*/ dependersSet = (Set) dependers.get(rootModuleConf);
+ Set/* <Depender> */dependersSet = (Set) dependers.get(rootModuleConf);
if (dependersSet == null) {
return false;
}
@@ -322,5 +322,5 @@ public class IvyNodeUsage {
}
return false;
}
-
+
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java Tue Jan 14 08:27:37 2014
@@ -38,7 +38,7 @@ public class ResolveData {
private ResolveEngine engine;
private Map visitData; // shared map of all visit data: Map (ModuleRevisionId -> VisitData)
-
+
private ConfigurationResolveReport report;
private ResolveOptions options;
@@ -48,8 +48,8 @@ public class ResolveData {
private ResolvedModuleRevision currentResolvedModuleRevision;
public ResolveData(ResolveData data, boolean validate) {
- this(data.engine, new ResolveOptions(data.options).setValidate(validate),
- data.report, data.visitData);
+ this(data.engine, new ResolveOptions(data.options).setValidate(validate), data.report,
+ data.visitData);
setCurrentVisitNode(data.currentVisitNode);
setCurrentResolvedModuleRevision(data.currentResolvedModuleRevision);
}
@@ -101,7 +101,7 @@ public class ResolveData {
for (Iterator it = visitData.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Entry) it.next();
ModuleRevisionId current = (ModuleRevisionId) entry.getKey();
-
+
if (isSubMap(mrid.getAttributes(), current.getAttributes())) {
result = (VisitData) entry.getValue();
break;
@@ -111,54 +111,54 @@ public class ResolveData {
return result;
}
-
+
/**
* Checks whether one map is a sub-map of the other.
*/
private static boolean isSubMap(Map map1, Map map2) {
int map1Size = map1.size();
int map2Size = map2.size();
-
+
if (map1Size == map2Size) {
return map1.equals(map2);
}
-
+
Map smallest = map1Size < map2Size ? map1 : map2;
Map largest = map1Size < map2Size ? map2 : map1;
-
- for (Iterator it = smallest.entrySet().iterator(); it.hasNext(); ) {
+
+ for (Iterator it = smallest.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Entry) it.next();
-
+
if (!largest.containsKey(entry.getKey())) {
return false;
}
-
+
Object map1Value = smallest.get(entry.getKey());
Object map2Value = largest.get(entry.getKey());
if (!isEqual(map1Value, map2Value)) {
return false;
}
}
-
+
return true;
}
-
+
private static boolean isEqual(Object obj1, Object obj2) {
if (obj1 == obj2) {
return true;
}
-
+
if (obj1 == null) {
return obj2 == null;
}
-
+
if (obj2 == null) {
return obj1 == null;
}
-
+
return obj1.equals(obj2);
}
-
+
/**
* Returns the VisitNode currently visited, or <code>null</code> if there is no node currently
* visited in this context.
@@ -168,10 +168,10 @@ public class ResolveData {
public VisitNode getCurrentVisitNode() {
return currentVisitNode;
}
-
+
/**
- * Sets the currently visited node.
- * WARNING: This should only be called by Ivy core ResolveEngine!
+ * Sets the currently visited node. WARNING: This should only be called by Ivy core
+ * ResolveEngine!
*
* @param currentVisitNode
*/
@@ -221,7 +221,7 @@ public class ResolveData {
this.visitData.put(mrid, keptVisitData);
// update visit data with discarde visit nodes
keptVisitData.addVisitNodes(rootModuleConf, visitData.getVisitNodes(rootModuleConf));
-
+
report.updateDependency(mrid, node);
}
@@ -262,7 +262,7 @@ public class ResolveData {
Entry entry = (Entry) iter.next();
VisitData vdata = (VisitData) entry.getValue();
if (vdata.getNode() == node && !node.getResolvedId().equals(entry.getKey())) {
- // this visit data was associated with the blacklisted node,
+ // this visit data was associated with the blacklisted node,
// we discard this association
iter.remove();
}
@@ -271,31 +271,30 @@ public class ResolveData {
public boolean isBlacklisted(String rootModuleConf, ModuleRevisionId mrid) {
IvyNode node = getNode(mrid);
-
-// if (node == null) {
-// // search again, now ignore the extra attributes
-// // TODO: maybe we should search the node that has at least the
-// // same attributes as mrid
-// for (Iterator it = visitData.entrySet().iterator(); it.hasNext();) {
-// Map.Entry entry = (Entry) it.next();
-// ModuleRevisionId current = (ModuleRevisionId) entry.getKey();
-// if (current.getModuleId().equals(mrid.getModuleId())
-// && current.getRevision().equals(mrid.getRevision())) {
-// VisitData data = (VisitData) entry.getValue();
-// node = data.getNode();
-// break;
-// }
-// }
-// }
-//
+
+ // if (node == null) {
+ // // search again, now ignore the extra attributes
+ // // TODO: maybe we should search the node that has at least the
+ // // same attributes as mrid
+ // for (Iterator it = visitData.entrySet().iterator(); it.hasNext();) {
+ // Map.Entry entry = (Entry) it.next();
+ // ModuleRevisionId current = (ModuleRevisionId) entry.getKey();
+ // if (current.getModuleId().equals(mrid.getModuleId())
+ // && current.getRevision().equals(mrid.getRevision())) {
+ // VisitData data = (VisitData) entry.getValue();
+ // node = data.getNode();
+ // break;
+ // }
+ // }
+ // }
+ //
return node != null && node.isBlacklisted(rootModuleConf);
}
-
public DependencyDescriptor mediate(DependencyDescriptor dd) {
DependencyDescriptor originalDD = dd;
dd = getEngine().mediate(dd, getOptions());
-
+
VisitNode current = getCurrentVisitNode();
if (current != null) {
// mediating dd through dependers stack
@@ -313,10 +312,9 @@ public class ResolveData {
}
}
}
-
+
if (originalDD != dd) {
- Message.verbose("dependency descriptor has been mediated: "
- + originalDD + " => " + dd);
+ Message.verbose("dependency descriptor has been mediated: " + originalDD + " => " + dd);
}
return dd;
@@ -338,7 +336,7 @@ public class ResolveData {
public void setCurrentResolvedModuleRevision(ResolvedModuleRevision mr) {
this.currentResolvedModuleRevision = mr;
}
-
+
/**
* Returns the last {@link ResolvedModuleRevision} which has been currently resolved.
* <p>