ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r632736 - in /ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver: AbstractResourceResolver.java RepositoryResolver.java
Date Sun, 02 Mar 2008 11:05:16 GMT
Author: xavier
Date: Sun Mar  2 03:05:13 2008
New Revision: 632736

URL: http://svn.apache.org/viewvc?rev=632736&view=rev
Log:
fix style: change methods signature to reduce number of parameters, avoiding to pass around
information which can be accessed easily from instance variables.

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java?rev=632736&r1=632735&r2=632736&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
Sun Mar  2 03:05:13 2008
@@ -40,7 +40,6 @@
 import org.apache.ivy.core.resolve.ResolveData;
 import org.apache.ivy.core.settings.IvyPattern;
 import org.apache.ivy.plugins.conflict.ConflictManager;
-import org.apache.ivy.plugins.latest.LatestStrategy;
 import org.apache.ivy.plugins.resolver.util.MDResolvedResource;
 import org.apache.ivy.plugins.resolver.util.ResolvedResource;
 import org.apache.ivy.plugins.resolver.util.ResourceMDParser;
@@ -107,8 +106,7 @@
         if (resolvedResources.size() > 1) {
             ResolvedResource[] rress = (ResolvedResource[]) resolvedResources
                     .toArray(new ResolvedResource[resolvedResources.size()]);
-            return findResource(rress, getName(), getLatestStrategy(), getSettings()
-                    .getVersionMatcher(), rmdparser, moduleRevision, date);
+            return findResource(rress, rmdparser, moduleRevision, date);
         } else if (resolvedResources.size() == 1) {
             return (ResolvedResource) resolvedResources.get(0);
         } else {
@@ -119,11 +117,13 @@
     protected abstract ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid,
             String pattern, Artifact artifact, ResourceMDParser rmdparser, Date date);
 
-    public ResolvedResource findResource(ResolvedResource[] rress, String name,
-            LatestStrategy strategy, VersionMatcher versionMatcher, ResourceMDParser rmdparser,
+    public ResolvedResource findResource(ResolvedResource[] rress, ResourceMDParser rmdparser,
             ModuleRevisionId mrid, Date date) {
+        String name = getName();
+        VersionMatcher versionMatcher = getSettings().getVersionMatcher();
+        
         ResolvedResource found = null;
-        List sorted = strategy.sort(rress);
+        List sorted = getLatestStrategy().sort(rress);
         List rejected = new ArrayList();
         List foundBlacklisted = new ArrayList();
         IvyContext context = IvyContext.getContext();

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java?rev=632736&r1=632735&r2=632736&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java Sun
Mar  2 03:05:13 2008
@@ -35,7 +35,6 @@
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.DownloadReport;
 import org.apache.ivy.core.resolve.DownloadOptions;
-import org.apache.ivy.plugins.latest.LatestStrategy;
 import org.apache.ivy.plugins.repository.AbstractRepository;
 import org.apache.ivy.plugins.repository.Repository;
 import org.apache.ivy.plugins.repository.Resource;
@@ -76,17 +75,10 @@
 
     protected ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid, String pattern,
             Artifact artifact, ResourceMDParser rmdparser, Date date) {
-        return findResourceUsingPattern(getName(), getRepository(), getLatestStrategy(),
-            getSettings().getVersionMatcher(), rmdparser, mrid, pattern, artifact, date,
-            isAlwaysCheckExactRevision());
-    }
-
-    public ResolvedResource findResourceUsingPattern(String name, Repository repository,
-            LatestStrategy strategy, VersionMatcher versionMatcher, ResourceMDParser rmdparser,
-            ModuleRevisionId mrid, String pattern, Artifact artifact, Date date,
-            boolean alwaysCheckExactRevision) {
+        String name = getName();
+        VersionMatcher versionMatcher = getSettings().getVersionMatcher();
         try {
-            if (!versionMatcher.isDynamic(mrid) || alwaysCheckExactRevision) {
+            if (!versionMatcher.isDynamic(mrid) || isAlwaysCheckExactRevision()) {
                 String resourceName = IvyPatternHelper.substitute(pattern, mrid, artifact);
                 Message.debug("\t trying " + resourceName);
                 logAttempt(resourceName);
@@ -97,16 +89,15 @@
                         ? "working@" + name : mrid.getRevision();
                     return new ResolvedResource(res, revision);
                 } else if (versionMatcher.isDynamic(mrid)) {
-                    return findDynamicResourceUsingPattern(name, repository, strategy,
-                        versionMatcher, rmdparser, mrid, pattern, artifact, date);
+                    return findDynamicResourceUsingPattern(
+                        rmdparser, mrid, pattern, artifact, date);
                 } else {
                     Message.debug("\t" + name + ": resource not reachable for " + mrid +
": res="
                             + res);
                     return null;
                 }
             } else {
-                return findDynamicResourceUsingPattern(name, repository, strategy, versionMatcher,
-                    rmdparser, mrid, pattern, artifact, date);
+                return findDynamicResourceUsingPattern(rmdparser, mrid, pattern, artifact,
date);
             }
         } catch (IOException ex) {
             throw new RuntimeException(name + ": unable to get resource for " + mrid + ":
res="
@@ -114,10 +105,10 @@
         }
     }
 
-    private ResolvedResource findDynamicResourceUsingPattern(String name,
-            Repository repository, LatestStrategy strategy, VersionMatcher versionMatcher,
+    private ResolvedResource findDynamicResourceUsingPattern(
             ResourceMDParser rmdparser, ModuleRevisionId mrid, String pattern, Artifact artifact,
             Date date) {
+        String name = getName();
         logAttempt(IvyPatternHelper.substitute(pattern, ModuleRevisionId.newInstance(mrid,
             IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY)), artifact));
         ResolvedResource[] rress = listResources(repository, mrid, pattern, artifact);
@@ -126,8 +117,7 @@
                     + pattern);
             return null;
         } else {
-            ResolvedResource found = findResource(rress, name, strategy, versionMatcher,
rmdparser,
-                mrid, date);
+            ResolvedResource found = findResource(rress, rmdparser, mrid, date);
             if (found == null) {
                 Message.debug("\t" + name + ": no resource found for " + mrid + ": pattern="
                         + pattern);



Mime
View raw message