geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r425743 - in /geronimo/branches/1.1: applications/console-standard/src/webapp/WEB-INF/view/ajax/ modules/system/src/java/org/apache/geronimo/system/plugin/ modules/system/src/java/org/apache/geronimo/system/repository/
Date Wed, 26 Jul 2006 14:34:27 GMT
Author: sppatel
Date: Wed Jul 26 07:34:27 2006
New Revision: 425743

URL: http://svn.apache.org/viewvc?rev=425743&view=rev
Log:
GERONIMO-1959 reset progress to 0% 

Modified:
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/ajax/progressbar.jsp
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java

Modified: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/ajax/progressbar.jsp
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/ajax/progressbar.jsp?rev=425743&r1=425742&r2=425743&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/ajax/progressbar.jsp
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/ajax/progressbar.jsp
Wed Jul 26 07:34:27 2006
@@ -37,6 +37,9 @@
     if (progressPercent > -1) {
        document.getElementById('<portlet:namespace/>progressMeterShell').style.display
= 'block';
        document.getElementById('<portlet:namespace/>progressMeterBar').style.width
= parseInt(progressPercent * 3.5) + 'px';
+    } else {
+       document.getElementById('<portlet:namespace/>progressMeterShell').style.display
= 'block';
+       document.getElementById('<portlet:namespace/>progressMeterBar').style.width
= '0px';
     }
     if(finished) {
         document.forms['<portlet:namespace/>ContinueForm'].submit();

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=425743&r1=425742&r2=425743&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Wed Jul 26 07:34:27 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/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java?rev=425743&r1=425742&r2=425743&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/AbstractRepository.java
Wed Jul 26 07:34:27 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