geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r618530 - 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 Tue, 05 Feb 2008 04:04:57 GMT
Author: kevan
Date: Mon Feb  4 20:04:56 2008
New Revision: 618530

URL: http://svn.apache.org/viewvc?rev=618530&view=rev
Log:
GERONIMO-3746 Merge from branches/2.1. Patch from Joe Leong. Thanks Joe! Fixes plugin progress
bar on plugin installation. Also, fixes occasional prompts for user name and password while
moving from one page to the next

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/ResultsHandler.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
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/results.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=618530&r1=618529&r2=618530&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
Mon Feb  4 20:04:56 2008
@@ -22,12 +22,14 @@
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.geronimo.console.car.ManagementHelper;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.system.plugin.DownloadResults;
 import org.apache.geronimo.system.plugin.PluginInstaller;
+import org.apache.geronimo.system.plugin.PluginInstallerGBean;
 import org.directwebremoting.ScriptSession;
 import org.directwebremoting.WebContext;
 import org.directwebremoting.WebContextFactory;
@@ -47,12 +49,14 @@
     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);
+        //DownloadResults results = getPluginInstaller().checkOnInstall(downloadKey);
         ScriptProxy scriptProxy = new ScriptProxy();
         scriptProxy.addScriptSession(scriptSession);
         
+        PluginInstallerGBean pluginInstallerInternal = (PluginInstallerGBean) getPluginInstaller();
+        DownloadResults results = pluginInstallerInternal.checkOnInstall(downloadKey, false);
+        
         //In the event results.isFinished is passed in true during polling
         scriptProxy.addFunctionCall("setMainMessage", results.getCurrentMessage());
         scriptProxy.addFunctionCall("setProgressCurrentFile", results.getCurrentFile());
@@ -65,22 +69,19 @@
             
             // get an update on the download progress, sleep time reduce to poll faster for
smaller files
             Thread.sleep(100);
-            results = getPluginInstaller().checkOnInstall(downloadKey);
+            //results = getPluginInstaller().checkOnInstall(downloadKey);
+            results = pluginInstallerInternal.checkOnInstall(downloadKey, false);
         }
         
         if(results.isFailed()) {
+            scriptProxy.addFunctionCall("setErrorMessage", results.getFailure().toString());
             throw new Exception("Unable to install configuration", results.getFailure());
         }
         
-        //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");
+        
     }
     
     private synchronized PluginInstaller getPluginInstaller() throws Exception {

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=618530&r1=618529&r2=618530&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
Mon Feb  4 20:04:56 2008
@@ -21,21 +21,21 @@
 import java.util.ArrayList;
 import java.util.List;
 
+
+
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletException;
-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.car.ManagementHelper;
+import org.apache.geronimo.system.plugin.PluginInstallerGBean;
 import org.apache.geronimo.console.MultiPageModel;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.plugin.DownloadResults;
-import org.directwebremoting.WebContextFactory;
+import org.apache.geronimo.system.plugin.PluginInstaller;
 
 /**
  * Handler for the initial download screen.
@@ -68,26 +68,14 @@
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        PluginInstallerGBean pluginInstaller = (PluginInstallerGBean) ManagementHelper.getManagementHelper(request).getPluginInstaller();
         String[] configId = request.getParameterValues("configId");
         String repo = request.getParameter("repository");
         String user = request.getParameter("repo-user");
         String pass = request.getParameter("repo-pass");
+        int downloadKey = Integer.parseInt(request.getParameter("download-key"));
+        DownloadResults results = pluginInstaller.checkOnInstall(downloadKey, true);
 
-        //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>();
         if (results != null) {
             if(results.isFailed()) {

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ResultsHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ResultsHandler.java?rev=618530&r1=618529&r2=618530&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ResultsHandler.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ResultsHandler.java
Mon Feb  4 20:04:56 2008
@@ -51,7 +51,7 @@
         String repo = request.getParameter("repository");
         String user = request.getParameter("repo-user");
         String pass = request.getParameter("repo-pass");
-        String configId = request.getParameter("configId");
+        String[] configId = request.getParameterValues("configId");
         request.setAttribute("configId", configId);
         List deps = (List) request.getPortletSession(true).getAttribute("car.install.results");
         request.setAttribute("dependencies", deps);
@@ -61,7 +61,7 @@
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
-        String configId = request.getParameter("configId");
+        String[] configId = request.getParameterValues("configId");
         String repo = request.getParameter("repository");
         String user = request.getParameter("repo-user");
         String pass = request.getParameter("repo-pass");
@@ -70,11 +70,14 @@
         if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
         try {
             //todo: hide this in PortletManager/ManagementHelper
-            ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(KernelRegistry.getSingleKernel());
-            Artifact artifact = Artifact.create(configId);
-            mgr.loadConfiguration(artifact);
-            mgr.startConfiguration(artifact);
-            return LIST_MODE;
+            for(int i=0; i<configId.length; i++) {
+                ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(KernelRegistry.getSingleKernel());
+                Artifact artifact = Artifact.create(configId[i]); 
+                mgr.loadConfiguration(artifact);
+                mgr.startConfiguration(artifact);
+            }
+            return INDEX_MODE;
+            //return LIST_MODE;
         } catch (Exception e) {
             log.error("Unable to start configuration "+configId, e);
             response.setRenderParameter("configId", configId);

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=618530&r1=618529&r2=618530&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
Mon Feb  4 20:04:56 2008
@@ -95,6 +95,7 @@
 car.pluginParams.uniqueIDExp                  = The globally unique ID for this plugin. 
This is determined from the installation in the server you're exporting.  This defines the
version number for the plugin, so make sure it's correct.
 car.results.filesProcessed                    = Files Processed
 car.results.title                             = The plugin {0} has been installed.
+car.results.titles                            = The following plugin(s) have been installed:
 car.viewForDownload.author                    = Author
 car.viewForDownload.dependencies              = Dependencies
 car.viewForDownload.description               = Description
@@ -148,6 +149,7 @@
 consolebase.common.usage           = usage
 consolebase.common.user            = User
 consolebase.common.userName        = Username
+consolebase.common.done            = Done
 
 realmwizard._sql.JDBCDriverClassExp              = The fully-qualified JDBC driver class
name.  This driver must be located in the JAR specified in the next field.
 realmwizard._sql.JDBCPasswordExp                 = The password used to connect to the database

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=618530&r1=618529&r2=618530&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
Mon Feb  4 20:04:56 2008
@@ -39,14 +39,23 @@
         </div>
     </div>
 </div>
-
+<br>
 <div id="<portlet:namespace/>ErrorArea"></div>
+<div id="<portlet:namespace/>ErrorMessage"></div>
+<div id="<portlet:namespace/>BackBtn"></div>
 
 <script type="text/javascript">
 dwr.engine.setErrorHandler(<portlet:namespace/>onError);
 
+function setErrorMessage(errorMsg) {
+    if (errorMsg != null) {
+        document.getElementById('<portlet:namespace/>ErrorMessage').innerHTML = errorMsg;
+        document.getElementById('<portlet:namespace/>BackBtn').innerHTML = "<br><form><input
type='submit' value='Go Back' onclick='history.go(-3); return false;' /></form>";
+    }
+}
+
 function <portlet:namespace/>onError() {
-    dwr.util.setValue("<portlet:namespace/>ErrorArea", 'I had a problem!');
+    dwr.util.setValue("<portlet:namespace/>ErrorArea", 'A problem has occured: ');
 }
 
 function setMainMessage(mainMessage) {
@@ -84,10 +93,6 @@
 }
 
 function setFinished() {
-    <%
-        DownloadResults results = (DownloadResults) request.getAttribute("console.plugins.DownloadResults");
-        System.out.println("Results are" + results);
-    %>
     document.forms['<portlet:namespace/>ContinueForm'].submit();
 }
 

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=618530&r1=618529&r2=618530&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
Mon Feb  4 20:04:56 2008
@@ -26,6 +26,8 @@
     <input type="hidden" name="repository" value="${repository}" />
     <input type="hidden" name="repo-user" value="${repouser}" />
     <input type="hidden" name="repo-pass" value="${repopass}" />
+    <input type="hidden" name="download-key" value="${downloadKey}" /> 
+    
     <%  String[] configIds = request.getParameterValues("configIds");
         for(int i=0;i<configIds.length;i++){
     %>
@@ -35,7 +37,7 @@
     %>
 </form>
 
-<jsp:include flush="true" page="../ajax/progressbar.jsp?downloadKey=${downloadKey}"/>
+<jsp:include flush="false" page="../ajax/progressbar.jsp?downloadKey=${downloadKey}"/>
 
 <script type="text/javascript">
     dwr.engine.setActiveReverseAjax(true);

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/results.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/results.jsp?rev=618530&r1=618529&r2=618530&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/results.jsp
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/results.jsp
Mon Feb  4 20:04:56 2008
@@ -22,10 +22,15 @@
 <fmt:setBundle basename="pluginportlets"/>
 <portlet:defineObjects/>
 <p>
-<fmt:message key="car.results.title" >
-<fmt:param  value="${configId}"/>
-</fmt:message>
+<fmt:message key="car.results.titles" />
 </p>
+<% 
+    String[] configIds = request.getParameterValues("configId");
+    for(int j=0;j<configIds.length;j++){
+%>
+        <%= configIds[j] %><br>
+<%  }%>
+    
 
 <c:if test="${! empty dependencies}">
   <p><b><fmt:message key="car.results.filesProcessed" />:</b></p>
@@ -37,11 +42,17 @@
 </c:if>
 
 <form name="<portlet:namespace/>PluginForm" action="<portlet:actionURL/>">
-    <input type="hidden" name="mode" value="results-after" />
-    <input type="hidden" name="configId" value="${configId}" />
+    <input type="hidden" name="mode" value="index-before" />
     <input type="hidden" name="repository" value="${repository}" />
     <input type="hidden" name="repo-user" value="${repouser}" />
     <input type="hidden" name="repo-pass" value="${repopass}" />
-    <input type="submit" value='<fmt:message key="consolebase.common.start"/> ${configId}'
/>
+    <%  
+        for(int i=0;i<configIds.length;i++){
+    %>
+    <input type="hidden" name="configId" value="<%=configIds[i]%>" />
+    <%
+        }
+    %>
+    <input type="submit" value='<fmt:message key="consolebase.common.done"/>' />
 </form>
 



Mime
View raw message