geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r617243 - in /geronimo/server/trunk/plugins/console/plugin-portlets/src/main: java/org/apache/geronimo/console/ajax/ java/org/apache/geronimo/console/car/ resources/ webapp/WEB-INF/view/ajax/ webapp/WEB-INF/view/car/
Date Thu, 31 Jan 2008 21:16:19 GMT
Author: djencks
Date: Thu Jan 31 13:16:05 2008
New Revision: 617243

URL: http://svn.apache.org/viewvc?rev=617243&view=rev
Log:
GERONIMO-3746 apply intermediate patch from JCLeong fixing some of the plugin installer issues

Modified:
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/ajax/ProgressMonitor.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/ajax/progressbar.jsp
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/downloadStatus.jsp

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/ajax/ProgressMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/ajax/ProgressMonitor.java?rev=617243&r1=617242&r2=617243&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/ajax/ProgressMonitor.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/ajax/ProgressMonitor.java
Thu Jan 31 13:16:05 2008
@@ -19,6 +19,9 @@
 
 import java.util.Set;
 
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.Kernel;
@@ -44,19 +47,24 @@
     public void getProgressInfo(Integer downloadKey) throws Exception {
         // DWR objects
         WebContext wctx = WebContextFactory.get();
+        HttpSession session = wctx.getSession();
         ScriptSession scriptSession = wctx.getScriptSession();
-        
         DownloadResults results = getPluginInstaller().checkOnInstall(downloadKey);
         ScriptProxy scriptProxy = new ScriptProxy();
         scriptProxy.addScriptSession(scriptSession);
         
+        //In the event results.isFinished is passed in true during polling
+        scriptProxy.addFunctionCall("setMainMessage", results.getCurrentMessage());
+        scriptProxy.addFunctionCall("setProgressCurrentFile", results.getCurrentFile());
+        
         while (!results.isFinished()) {
             // update the progress bar
+            scriptProxy.addFunctionCall("setProgressCurrentFile", results.getCurrentFile());
             scriptProxy.addFunctionCall("setProgressPercent", results.getCurrentFilePercent());
             scriptProxy.addFunctionCall("setMainMessage", results.getCurrentMessage());
             
-            // get an update on the download progress
-            Thread.sleep(1000);
+            // get an update on the download progress, sleep time reduce to poll faster for
smaller files
+            Thread.sleep(100);
             results = getPluginInstaller().checkOnInstall(downloadKey);
         }
         
@@ -64,9 +72,14 @@
             throw new Exception("Unable to install configuration", results.getFailure());
         }
         
-        // store the download results in the http sesssion
-        wctx.getSession(true).setAttribute("console.plugins.DownloadResults", results);
-
+        //store the download results in the http sesssion
+        HttpServletRequest request = wctx.getHttpServletRequest();
+        request.setAttribute("console.plugins.DownloadResults", results);
+        
+        //wctx.getSession(true).setAttribute("console.plugins.DownloadResults", results);

+        
+        //Fills bar at the end in the event the poller didn't catch the 100
+        scriptProxy.addFunctionCall("setProgressFull");
         scriptProxy.addFunctionCall("setFinished");
     }
     

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java?rev=617243&r1=617242&r2=617243&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/DownloadStatusHandler.java
Thu Jan 31 13:16:05 2008
@@ -27,10 +27,15 @@
 import javax.portlet.PortletSession;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletRequest;
 
+import org.apache.geronimo.system.plugin.PluginInstaller;
+import org.apache.geronimo.console.ajax.ProgressMonitor;
 import org.apache.geronimo.console.MultiPageModel;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.plugin.DownloadResults;
+import org.directwebremoting.WebContextFactory;
 
 /**
  * Handler for the initial download screen.
@@ -38,48 +43,65 @@
  * @version $Rev$ $Date$
  */
 public class DownloadStatusHandler extends BaseImportExportHandler {
-
     public DownloadStatusHandler() {
         super(DOWNLOAD_STATUS_MODE, "/WEB-INF/view/car/downloadStatus.jsp");
     }
 
     public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         return getMode();
+        
     }
 
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
-        String configId = request.getParameter("configId");
+        String[] configId = request.getParameterValues("configIds");
         String repo = request.getParameter("repository");
         String user = request.getParameter("repo-user");
         String pass = request.getParameter("repo-pass");
         String downloadKey = request.getParameter("downloadKey");
-        request.setAttribute("configId", configId);
+        
         request.setAttribute("repository", repo);
         request.setAttribute("repouser", user);
         request.setAttribute("repopass", pass);
         request.setAttribute("downloadKey", downloadKey);
+        request.setAttribute("configIds", configId);
+        
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        String[] configId = request.getParameterValues("configId");
         String repo = request.getParameter("repository");
         String user = request.getParameter("repo-user");
         String pass = request.getParameter("repo-pass");
-        String configId = request.getParameter("configId");
 
-        PortletSession session = request.getPortletSession(true);
-        DownloadResults results = (DownloadResults) session.getAttribute(DOWNLOAD_RESULTS_SESSION_KEY,PortletSession.APPLICATION_SCOPE);
-        if(results.isFailed()) {
-            throw new PortletException("Unable to install configuration", results.getFailure());
-        }
+        //DownloadResults results = (DownloadResults) request.getAttribute("results");
+        //Integer downloadKey = Integer.parseInt(downloadKeys);
+
+        //ProgressMonitor mResults = null;
+        //mResults.getProgressInfo(downloadKey);
+        //DownloadResults results = mResults.dwrSession();
+        
+        DownloadResults results = (DownloadResults) request.getAttribute("console.plugins.DownloadResults");
+        //DownloadResults result2 = (DownloadResults) request.getPortletSession(true).getAttribute("console.plugins.DownloadResults");
+        
+        //DownloadResults results = (DownloadResults) request.getPortletSession(true).getAttribute("console.plugins.DownloadResults",
PortletSession.APPLICATION_SCOPE);
+        //DownloadResults results = (DownloadResults) session.getAttribute("console.plugins.DownloadResults");
+        //DownloadResults results = (DownloadResults) session.getAttribute(DOWNLOAD_RESULTS_SESSION_KEY);
+        //No Work DownloadResults results = (DownloadResults) request.getPortletSession(true).getAttribute("console.plugins.DownloadResults",
PortletSession.APPLICATION_SCOPE);
+        //DownloadResults results = (DownloadResults) session.getAttribute(DOWNLOAD_RESULTS_SESSION_KEY,PortletSession.APPLICATION_SCOPE);
         List<InstallResults> dependencies = new ArrayList<InstallResults>();
-        for (Artifact uri: results.getDependenciesInstalled()) {
-            dependencies.add(new InstallResults(uri.toString(), "installed"));
-        }
-        for (Artifact uri: results.getDependenciesPresent()) {
-            dependencies.add(new InstallResults(uri.toString(), "already present"));
+        if (results != null) {
+            if(results.isFailed()) {
+                //TODO is this an appropriate way to explain failure?
+                throw new PortletException("Unable to install configuration", results.getFailure());
+            }
+            for (Artifact uri: results.getDependenciesInstalled()) {
+                dependencies.add(new InstallResults(uri.toString(), "installed"));
+            }
+            for (Artifact uri: results.getDependenciesPresent()) {
+                dependencies.add(new InstallResults(uri.toString(), "already present"));
+            }
         }
         request.getPortletSession(true).setAttribute("car.install.results", dependencies);
-
         response.setRenderParameter("configId", configId);
         response.setRenderParameter("repository", repo);
         if(!isEmpty(user)) response.setRenderParameter("repo-user", user);

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java?rev=617243&r1=617242&r2=617243&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ViewPluginDownloadHandler.java
Thu Jan 31 13:16:05 2008
@@ -132,6 +132,7 @@
         Object downloadKey = pluginInstaller.startInstall(installList, repo, false, user,
pass);
         DownloadResults results = pluginInstaller.checkOnInstall(downloadKey);
         request.getPortletSession(true).setAttribute(DOWNLOAD_RESULTS_SESSION_KEY, results);
+        
         response.setRenderParameter("configIds", configIds);
         response.setRenderParameter("repository", repo);
         response.setRenderParameter("downloadKey", downloadKey.toString());

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties?rev=617243&r1=617242&r2=617243&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/resources/pluginportlets.properties
Thu Jan 31 13:16:05 2008
@@ -59,7 +59,7 @@
 car.confirmExport.useBtnBelow                 = Use the button below to save the plugin "{0}"
to disk.
 car.download.foundDependencies                = Found the following dependencies for this
plugin.  Any missing dependencies will be installed for you automatically if you proceed.
 car.download.processing                       = Processing {0}...
-car.downloadStatus.processing                 = Processing {0}...
+car.downloadStatus.processing                 = Current file being operated on...
 car.index.assembleServerLong                  = Assemble a server from plugins in this one
 car.index.assembleServer                      = Assemble a server
 car.index.createGeronimoPluginExp             = Choose a configuration in the current Geronimo
server to export as a Geronimo plugin.  The configuration will be saved as a CAR file to your
local filesystem. <i>Note: at present, you must manually add a <tt>META-INF/geronimo-plugin.xml</tt>
file to the CAR  after you export it in order for it to be a valid plugin.</i>

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/ajax/progressbar.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/ajax/progressbar.jsp?rev=617243&r1=617242&r2=617243&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/ajax/progressbar.jsp
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/ajax/progressbar.jsp
Thu Jan 31 13:16:05 2008
@@ -16,12 +16,32 @@
 --%>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ page import="org.apache.geronimo.system.plugin.DownloadResults"%> 
+<%@page import="com.sun.mail.iap.Response"%>
 <fmt:setBundle basename="pluginportlets"/>
+<fmt:message key="car.downloadStatus.processing"/>
 <portlet:defineObjects/>
 <script type='text/javascript' src='/plugin/dwr/interface/ProgressMonitor.js'></script>
 <script type='text/javascript' src='/plugin/dwr/engine.js'></script>
 <script type='text/javascript' src='/plugin/dwr/util.js'></script>
 
+<div id="<portlet:namespace/>progressMeter" style="display: none; padding-top: 5px;">
+    <div>
+        <div id="<portlet:namespace/>progressMeterCurrentFile"></div>
+        <br/>
+        <br/>
+        <br/>
+        <br/>
+        <div id="<portlet:namespace/>progressMeterMainMessage"></div>
+        <div id="<portlet:namespace/>progressMeterSubMessage"></div>
+        <div id="<portlet:namespace/>progressMeterShell" style="display: none; width:
350px; height: 20px; border: 1px inset; background: #eee;">
+            <div id="<portlet:namespace/>progressMeterBar" style="width: 0; height:
20px; border-right: 1px solid #444; background: #9ACB34;"></div>
+        </div>
+    </div>
+</div>
+
+<div id="<portlet:namespace/>ErrorArea"></div>
+
 <script type="text/javascript">
 dwr.engine.setErrorHandler(<portlet:namespace/>onError);
 
@@ -35,6 +55,12 @@
     }
 }
 
+function setProgressCurrentFile(mainFile) {
+    if (mainFile != null) {
+        document.getElementById('<portlet:namespace/>progressMeterCurrentFile').innerHTML
= mainFile;
+    }
+}
+
 function setSubMessage(subMessage) {
     if (subMessage != null) {
 	    document.getElementById('<portlet:namespace/>progressMeterSubMessage').innerHTML
= subMessage;
@@ -51,8 +77,18 @@
     }
 }
 
+//For Aesthetics
+function setProgressFull() {
+    document.getElementById('<portlet:namespace/>progressMeterShell').style.display
= 'block';
+    document.getElementById('<portlet:namespace/>progressMeterBar').style.width = parseInt(350)
+ 'px';
+}
+
 function setFinished() {
-    document.forms['ContinueForm'].submit();
+    <%
+        DownloadResults results = (DownloadResults) request.getAttribute("console.plugins.DownloadResults");
+        System.out.println("Results are" + results);
+    %>
+    document.forms['<portlet:namespace/>ContinueForm'].submit();
 }
 
 function <portlet:namespace/>startProgress()
@@ -63,18 +99,6 @@
     metadata.errorHandler=<portlet:namespace/>onError;
     ProgressMonitor.getProgressInfo(${downloadKey},metadata);
 }
-
 </script>
 
-<div id="<portlet:namespace/>progressMeter" style="display: none; padding-top: 5px;">
-    <br/>
-    <div>
-        <div id="<portlet:namespace/>progressMeterMainMessage"></div>
-        <div id="<portlet:namespace/>progressMeterSubMessage"></div>
-        <div id="<portlet:namespace/>progressMeterShell" style="display: none; width:
350px; height: 20px; border: 1px inset; background: #eee;">
-            <div id="<portlet:namespace/>progressMeterBar" style="width: 0; height:
20px; border-right: 1px solid #444; background: #9ACB34;"></div>
-        </div>
-    </div>
-</div>
 
-<div id="<portlet:namespace/>ErrorArea"></div>

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/downloadStatus.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/downloadStatus.jsp?rev=617243&r1=617242&r2=617243&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/downloadStatus.jsp
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/downloadStatus.jsp
Thu Jan 31 13:16:05 2008
@@ -21,19 +21,18 @@
 <fmt:setBundle basename="pluginportlets"/>
 <portlet:defineObjects/>
 
-<p>
-<fmt:message key="car.downloadStatus.processing" >
-<fmt:param  value="${configIds}"/>
-</fmt:message>
-</p>
-
-
-<form name="<portlet:namespace/>ContinueForm" action="<portlet:actionURL/>">
+<form name="<portlet:namespace/>ContinueForm" action="<portlet:actionURL/>"
method="POST">
     <input type="hidden" name="mode" value="downloadStatus-after" />
-    <%--<input type="hidden" name="configId" value="${configId}" />--%>
     <input type="hidden" name="repository" value="${repository}" />
     <input type="hidden" name="repo-user" value="${repouser}" />
     <input type="hidden" name="repo-pass" value="${repopass}" />
+    <%  String[] configIds = request.getParameterValues("configIds");
+        for(int i=0;i<configIds.length;i++){
+    %>
+    <input type="hidden" name="configId" value="<%=configIds[i]%>" />
+    <%
+        }
+    %>
 </form>
 
 <jsp:include flush="true" page="../ajax/progressbar.jsp?downloadKey=${downloadKey}"/>
@@ -42,6 +41,7 @@
     dwr.engine.setActiveReverseAjax(true);
     <portlet:namespace/>startProgress();
 </script>
+
 <%--
 <p><a href="<portlet:actionURL portletMode="view"><portlet:param name="mode"
value="index-before" /></portlet:actionURL>">
 <fmt:message key="consolebase.common.cancel"/></a></p>



Mime
View raw message