incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickcha...@apache.org
Subject svn commit: rev 20187 - incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache
Date Fri, 21 May 2004 07:01:24 GMT
Author: nickchalko
Date: Fri May 21 00:01:23 2004
New Revision: 20187

Modified:
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/CachedResourceSet.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/CachedResourceSetExportTask.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/ResourceElement.java
Log:
Save the remoteResource not just that path.

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/CachedResourceSet.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/CachedResourceSet.java
(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/CachedResourceSet.java
Fri May 21 00:01:23 2004
@@ -149,9 +149,9 @@
 	 */
 	private void cacheFile(ResourceElement r) {
 		try {
-			Resource resource = findBestRepoteResource(r);
+			Resource resource = findBestRemoteResource(r);
 			if (resource != null) {
-				r.setDownloadedFrom(resource.getLocation().toExternalForm());
+				
 				downLoadRemoteResult(resource);
 			}
 			return;
@@ -163,8 +163,8 @@
 	 * @param r
 	 * @return
 	 */
-	Resource findBestRepoteResource(ResourceElement r) {
-		return r.findBestRepoteResource();
+	Resource findBestRemoteResource(ResourceElement r) {
+		return r.findBestRemoteResource();
 	}
 	/**
 	 * @param r

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/CachedResourceSetExportTask.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/CachedResourceSetExportTask.java
(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/CachedResourceSetExportTask.java
Fri May 21 00:01:23 2004
@@ -99,7 +99,7 @@
 								? resource.getName()
 								: resource.getGroup()));
 				out.println("              "
-						+ nameValue("version", resource.getVersion()));
+						+ nameValue("version", resource.getDownloadedVersion().toString()));
 				out.println("              "
 						+ nameValue("href", resource.getDownloadedFrom()));
 				out.println("     />");

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/ResourceElement.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/ResourceElement.java
(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/cache/ResourceElement.java
Fri May 21 00:01:23 2004
@@ -17,7 +17,6 @@
  */
 package org.apache.depot.update.ant.cache;
 import java.io.File;
-
 import org.apache.depot.update.UpdateException;
 import org.apache.depot.update.impl.RepositorySetWrapper;
 import org.apache.depot.update.impl.ResourceUpdaterContext;
@@ -54,7 +53,7 @@
 	private String version;
 	private String repository;
 	private String ext;
-	private String downloadedFrom;
+	private Resource bestRemoteResource;
 	private final Project project;
 	/**
 	 * @return Returns the name.
@@ -204,26 +203,34 @@
 	 * @return
 	 */
 	public String getDownloadedFrom() {
-		if (downloadedFrom == null) {
-			Resource resource = findBestRepoteResource();
-			if (resource != null) {
-			downloadedFrom=resource.getLocation().toExternalForm();
+		if (bestRemoteResource == null) {
+			bestRemoteResource = findBestRemoteResource();
+			if (bestRemoteResource != null) {
+				return bestRemoteResource.getLocation().toExternalForm();
 			}
 		}
-		return downloadedFrom;
+		return null;
 	}
+	
 	/**
-	 * @param downloadedFrom
-	 *            The downloadedFrom to set.
+	 * @return
 	 */
-	void setDownloadedFrom(String downloadedFrom) {
-		this.downloadedFrom = downloadedFrom;
+	public Version getDownloadedVersion() {
+		if (bestRemoteResource == null) {
+			bestRemoteResource = findBestRemoteResource();
+			if (bestRemoteResource != null) {
+				return bestRemoteResource.getVersion();
+			}
+		}
+		return null;
 	}
+	
+
 	/**
 	 * @param this
 	 * @return
 	 */
-	Resource findBestRepoteResource() {
+	Resource findBestRemoteResource() {
 		ResourceResult res = query(getIRepository());
 		Resource resource = null;
 		if (res.size() == 0) {
@@ -236,9 +243,9 @@
 							+ " returning first", Project.MSG_VERBOSE);
 			resource = ResourceResult.getFirstResource(res);
 		}
+		bestRemoteResource=resource;
 		return resource;
 	}
-	
 	ResourceResult query(IRepository repo) { //TODO
 		// experiment
 		getProject().log("Looking for " + this, Project.MSG_DEBUG);

Mime
View raw message