geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r426524 - in /geronimo/sandbox/svkmerge/m2migration/modules/system/src: ./ java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java java/org/apache/geronimo/system/repository/AbstractRepository.java
Date Fri, 28 Jul 2006 13:30:57 GMT
Author: jdillon
Date: Fri Jul 28 06:30:57 2006
New Revision: 426524

URL: http://svn.apache.org/viewvc?rev=426524&view=rev
Log:
 r565@Bliss (orig r426503):  jdillon | 2006-07-28 06:18:43 -0700
  r552@Bliss (orig r425747):  sppatel | 2006-07-26 07:37:44 -0700
  GERONIMO-1959 reset progress to 0%
  
 

Modified:
    geronimo/sandbox/svkmerge/m2migration/modules/system/src/   (props changed)
    geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java

Propchange: geronimo/sandbox/svkmerge/m2migration/modules/system/src/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Jul 28 06:30:57 2006
@@ -1 +1 @@
-13f79535-47bb-0310-9956-ffa450edef68:/geronimo/sandbox/svkmerge/trunk/modules/system/src:424405
+13f79535-47bb-0310-9956-ffa450edef68:/geronimo/sandbox/svkmerge/trunk/modules/system/src:426503

Modified: geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=426524&r1=426523&r2=426524&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Fri Jul 28 06:30:57 2006
@@ -670,6 +670,8 @@
         boolean pluginWasInstalled = false;
         Artifact[] matches = configManager.getArtifactResolver().queryArtifacts(configID);
         if(matches.length == 0) { // not present, needs to be downloaded
+            monitor.getResults().setCurrentMessage("Downloading " + configID);
+            monitor.getResults().setCurrentFilePercent(-1);
             OpenResult result = openStream(configID, repos, username, password, monitor);
             try {
                 File tempFile = downloadFile(result, monitor);
@@ -693,6 +695,7 @@
                 if(pluginData != null) { // it's a plugin, not a plain JAR
                     validatePlugin(pluginData);
                 }
+                monitor.getResults().setCurrentMessage("Copying " + result.getConfigID()
+ " to the repository");
                 writeableRepo.copyToRepository(tempFile, result.getConfigID(), monitor);
//todo: download SNAPSHOTS if previously available?
                 if(!tempFile.delete()) {
                     log.warn("Unable to delete temporary download file "+tempFile.getAbsolutePath());
@@ -913,7 +916,7 @@
     private static OpenResult openStream(Artifact artifact, URL[] repos, String username,
String password, ResultsFileWriteMonitor monitor) throws IOException, FailedLoginException,
MissingDependencyException {
         if(monitor != null) {
             monitor.getResults().setCurrentFilePercent(-1);
-            monitor.getResults().setCurrentMessage("Attempting to download "+artifact);
+            monitor.getResults().setCurrentMessage("Downloading "+artifact+"...");
             monitor.setTotalBytes(-1); // In case the server doesn't say
         }
         if(artifact != null && !artifact.isResolved()) {
@@ -1716,13 +1719,13 @@
             totalBytes = fileSize;
             file = fileDescription;
             results.setCurrentFile(fileDescription);
-            results.setCurrentMessage("Downloading "+fileDescription+"...");
             results.setCurrentFilePercent(totalBytes > 0 ? 0 : -1);
         }
 
         public void writeProgress(int bytes) {
             if(totalBytes > 0) {
-                results.setCurrentFilePercent((bytes*100)/totalBytes);
+                double percent = (double)bytes/(double)totalBytes;
+                results.setCurrentFilePercent((int)(percent*100));
             } else {
                 results.setCurrentMessage((bytes/1024)+" kB of "+file);
             }
@@ -1730,7 +1733,7 @@
 
         public void writeComplete(int bytes) {
             results.setCurrentFilePercent(100);
-            results.setCurrentMessage("Downloaded "+file+" ("+(bytes/1024)+" kB)");
+            results.setCurrentMessage("Finished installing "+file+" ("+(bytes/1024)+" kB)");
             results.addDownloadBytes(bytes);
         }
 

Modified: geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java?rev=426524&r1=426523&r2=426524&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
(original)
+++ geronimo/sandbox/svkmerge/m2migration/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
Fri Jul 28 06:30:57 2006
@@ -25,9 +25,13 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.Enumeration;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -185,9 +189,19 @@
         if (!source.exists() || !source.canRead() || source.isDirectory()) {
             throw new IllegalArgumentException("Cannot read source file at " + source.getAbsolutePath());
         }
+        int size = 0;
+        try {
+            ZipFile zip = new ZipFile(source);
+            for (Enumeration entries=zip.entries(); entries.hasMoreElements();) {
+            	ZipEntry entry = (ZipEntry)entries.nextElement();
+            	size += entry.getSize();
+            }
+        } catch (ZipException ze) {
+        	size = (int)source.length();
+        }
         FileInputStream is = new FileInputStream(source);
         try {
-            copyToRepository(is, (int)source.length(), destination, monitor);
+            copyToRepository(is, size, destination, monitor);
         } finally {
             try {
                 is.close();



Mime
View raw message