geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r383230 - in /geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console: ./ jmsmanager/wizard/
Date Sun, 05 Mar 2006 00:19:09 GMT
Author: ammulder
Date: Sat Mar  4 16:19:08 2006
New Revision: 383230

URL: http://svn.apache.org/viewcvs?rev=383230&view=rev
Log:
I like the way the JMS portlet is structured much more than the way the
  JDBC and Security Realm portlets are.  Extracting the framework for
  that so it can be used by future portlets.
Will use this for GERONIMO-1691

Added:
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java
  (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageModel.java
  (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
  (with props)
Modified:
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ConfigureRAInstanceHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateConnectionFactoryHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateDestinationHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/DeployHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java?rev=383230&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java
(added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java
Sat Mar  4 16:19:08 2006
@@ -0,0 +1,91 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.console;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import java.io.IOException;
+
+/**
+ * ReplaceMe
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public abstract class MultiPageAbstractHandler {
+    protected final static String BEFORE_ACTION="-before";
+    protected final static String AFTER_ACTION="-after";
+    protected PortletRequestDispatcher view;
+    private final String mode;
+    private final String viewName;
+
+    protected MultiPageAbstractHandler(String mode, String viewName) {
+        this.mode = mode;
+        this.viewName = viewName;
+    }
+
+    public String getMode() {
+        return mode;
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        if(viewName != null) {
+            view = portletConfig.getPortletContext().getRequestDispatcher(viewName);
+        }
+    }
+
+    public void destroy() {
+        view = null;
+    }
+
+    public PortletRequestDispatcher getView() {
+        return view;
+    }
+
+    protected static boolean isEmpty(String s) {
+        return s == null || s.trim().equals("");
+    }
+
+    /**
+     * Returns the mode for the next screen to render (usually this one)
+     */
+    public abstract String actionBeforeView(ActionRequest request, ActionResponse response,
MultiPageModel model) throws PortletException, IOException;
+
+    public abstract void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException;
+
+    /**
+     * Returns the mode for the next screen to render (usually the one after this in the
sequence)
+     */
+    public abstract String actionAfterView(ActionRequest request, ActionResponse response,
MultiPageModel model) throws PortletException, IOException;
+
+
+    protected static void waitForProgress(ProgressObject po) {
+        while(po.getDeploymentStatus().isRunning()) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageModel.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageModel.java?rev=383230&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageModel.java
(added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageModel.java
Sat Mar  4 16:19:08 2006
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.console;
+
+import javax.portlet.ActionResponse;
+
+/**
+ * Interface for models for multi-page portlets.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public interface MultiPageModel {
+    public void save(ActionResponse response);
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java?rev=383230&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
(added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
Sat Mar  4 16:19:08 2006
@@ -0,0 +1,130 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.console;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletRequest;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.io.IOException;
+
+/**
+ * A base class for porlets consisting on multiple JSPs with before and after
+ * actions (e.g. for load and validation/save) and the ability for an "after"
+ * action to set the next page to load.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public abstract class MultiPagePortlet extends BasePortlet {
+    private final static Log log = LogFactory.getLog(MultiPagePortlet.class);
+    protected static final String MODE_KEY = "mode";
+    protected Map helpers = new HashMap();
+
+    public void destroy() {
+        for (Iterator it = helpers.values().iterator(); it.hasNext();) {
+            MultiPageAbstractHandler handler = (MultiPageAbstractHandler) it.next();
+            handler.destroy();
+        }
+        helpers.clear();
+        super.destroy();
+    }
+
+    public void processAction(ActionRequest actionRequest,
+                              ActionResponse actionResponse) throws PortletException, IOException
{
+        String mode = actionRequest.getParameter(MODE_KEY);
+        MultiPageModel model = getModel(actionRequest);
+        while(true) {
+            if(mode == null) {
+                break;
+            }
+            int pos = mode.lastIndexOf('-');
+            if(pos == -1) { // Assume it's a render request
+                break;
+            } else {
+                String type = mode.substring(pos+1);
+                mode = mode.substring(0, pos);
+                MultiPageAbstractHandler handler = (MultiPageAbstractHandler) helpers.get(mode);
+                if(handler == null) {
+                    log.error("No handler for action mode '"+mode+"'");
+                    break;
+                }
+                log.debug("Using action handler '"+handler.getClass().getName()+"'");
+                if(type.equals("before")) {
+                    mode = handler.actionBeforeView(actionRequest, actionResponse, model);
+                } else if(type.equals("after")) {
+                    mode = handler.actionAfterView(actionRequest, actionResponse, model);
+                } else {
+                    log.error("Unrecognized portlet action '"+mode+"'");
+                    mode = null;
+                }
+            }
+        }
+        if(mode != null) {
+            actionResponse.setRenderParameter(MODE_KEY, mode);
+        }
+        model.save(actionResponse);
+    }
+
+    protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException, PortletException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+        String mode = renderRequest.getParameter(MODE_KEY);
+        MultiPageModel model = getModel(renderRequest);
+        if(mode == null || mode.equals("")) {
+            mode = getDefaultMode();
+        }
+        MultiPageAbstractHandler handler = (MultiPageAbstractHandler) helpers.get(mode);
+        try {
+            if(handler == null) {
+                log.error("No handler for render mode '"+mode+"'");
+            } else {
+                log.debug("Using render handler '"+handler.getClass().getName()+"'");
+                handler.renderView(renderRequest, renderResponse, model);
+            }
+        } catch (Throwable e) {
+            log.error("Unable to render portlet", e);
+        }
+        renderRequest.setAttribute("data", model);
+        if(handler != null) {
+            handler.getView().include(renderRequest, renderResponse);
+        }
+    }
+
+    protected void addHelper(MultiPageAbstractHandler handler, PortletConfig config) throws
PortletException {
+        handler.init(config);
+        helpers.put(handler.getMode(), handler);
+    }
+
+    protected String getDefaultMode() {
+        if(helpers.containsKey("list")) return "list";
+        if(helpers.containsKey("index")) return "index";
+        return null;
+    }
+
+    protected abstract MultiPageModel getModel(PortletRequest request);
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
Sat Mar  4 16:19:08 2006
@@ -36,6 +36,8 @@
 import java.util.Iterator;
 import java.net.URL;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.MultiPageAbstractHandler;
+import org.apache.geronimo.console.MultiPageModel;
 import org.apache.geronimo.deployment.tools.loader.ConnectorDeployable;
 import org.apache.geronimo.connector.deployment.jsr88.Connector15DCBRoot;
 import org.apache.geronimo.connector.deployment.jsr88.ConnectorDCB;
@@ -55,64 +57,8 @@
  *
  * @version $Rev: 368994 $ $Date: 2006-01-14 02:07:18 -0500 (Sat, 14 Jan 2006) $
  */
-public abstract class AbstractHandler {
+public abstract class AbstractHandler extends MultiPageAbstractHandler {
     private final static Log log = LogFactory.getLog(AbstractHandler.class);
-    protected final static String BEFORE_ACTION="-before";
-    protected final static String AFTER_ACTION="-after";
-    protected PortletRequestDispatcher view;
-    private final String mode;
-    private final String viewName;
-
-    protected AbstractHandler(String mode, String viewName) {
-        this.mode = mode;
-        this.viewName = viewName;
-    }
-
-    public String getMode() {
-        return mode;
-    }
-
-    public void init(PortletConfig portletConfig) throws PortletException {
-        if(viewName != null) {
-            view = portletConfig.getPortletContext().getRequestDispatcher(viewName);
-        }
-    }
-
-    public void destroy() {
-        view = null;
-    }
-
-    public PortletRequestDispatcher getView() {
-        return view;
-    }
-
-    protected static boolean isEmpty(String s) {
-        return s == null || s.trim().equals("");
-    }
-
-    /**
-     * Returns the mode for the next screen to render (usually this one)
-     */
-    public abstract String actionBeforeView(ActionRequest request, ActionResponse response,
JMSResourceData data) throws PortletException, IOException;
-
-    public abstract void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException;
-
-    /**
-     * Returns the mode for the next screen to render (usually the one after this in the
sequence)
-     */
-    public abstract String actionAfterView(ActionRequest request, ActionResponse response,
JMSResourceData data) throws PortletException, IOException;
-
-
-    private static void waitForProgress(ProgressObject po) {
-        while(po.getDeploymentStatus().isRunning()) {
-            try {
-                Thread.sleep(100);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
     // ********** This part specific to JMS portlets **********
 
     protected final static String LIST_MODE="list";
@@ -143,7 +89,11 @@
     protected final static String IDLE_TIME_PARAMETER="poolIdleTimeout";
     protected final static String BLOCK_TIME_PARAMETER="poolBlockingTimeout";
 
-    public static class JMSResourceData {
+    public AbstractHandler(String mode, String viewName) {
+        super(mode, viewName);
+    }
+
+    public static class JMSResourceData implements MultiPageModel {
         private String rarURI;
         private String dependency;
         private String instanceName;

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ConfigureRAInstanceHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ConfigureRAInstanceHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ConfigureRAInstanceHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ConfigureRAInstanceHandler.java
Sat Mar  4 16:19:08 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console.jmsmanager.wizard;
 
+import org.apache.geronimo.console.MultiPageModel;
+
 import java.io.IOException;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -33,16 +35,18 @@
         super(CONFIGURE_RA_MODE, "/WEB-INF/view/jmswizard/raInstance.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
         request.setAttribute("provider", provider);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         if(isEmpty(data.getInstanceName())) {
             return getMode()+BEFORE_ACTION;
         }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateConnectionFactoryHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateConnectionFactoryHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateConnectionFactoryHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateConnectionFactoryHandler.java
Sat Mar  4 16:19:08 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console.jmsmanager.wizard;
 
+import org.apache.geronimo.console.MultiPageModel;
+
 import java.io.IOException;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -33,17 +35,20 @@
         super(ADD_FACTORY_MODE, "/WEB-INF/view/jmswizard/factory.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         data.getCurrentFactory().setFactoryType(data.getFactoryType());
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
         request.setAttribute("provider", provider);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         if(isEmpty(data.getCurrentFactory().getInstanceName())) {
             return getMode();
         }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateDestinationHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateDestinationHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateDestinationHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/CreateDestinationHandler.java
Sat Mar  4 16:19:08 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console.jmsmanager.wizard;
 
+import org.apache.geronimo.console.MultiPageModel;
+
 import java.io.IOException;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -33,17 +35,20 @@
         super(ADD_DESTINATION_MODE, "/WEB-INF/view/jmswizard/destination.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         data.getCurrentDestination().setDestinationType(data.getDestinationType());
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
         request.setAttribute("provider", provider);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         if(isEmpty(data.getCurrentDestination().getName())) {
             return getMode();
         }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/DeployHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/DeployHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/DeployHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/DeployHandler.java
Sat Mar  4 16:19:08 2006
@@ -23,6 +23,7 @@
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.MultiPageModel;
 
 /**
  * Can deploy a JMS resource into the server.  There currently no UI associated with this.
@@ -34,15 +35,16 @@
         super(DEPLOY_MODE, null);
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         save(request, response, data, false);
         return LIST_MODE;
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         return LIST_MODE;
     }
 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
Sat Mar  4 16:19:08 2006
@@ -27,20 +27,20 @@
 import javax.portlet.RenderRequest;
 import javax.portlet.ActionRequest;
 import javax.portlet.WindowState;
+import javax.portlet.PortletRequest;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.MultiPagePortlet;
+import org.apache.geronimo.console.MultiPageModel;
 
 /**
  * A portlet that lets you configure and deploy JDBC connection pools.
  *
  * @version $Rev: 368994 $ $Date: 2006-01-14 02:07:18 -0500 (Sat, 14 Jan 2006) $
  */
-public class JMSResourcePortlet extends BasePortlet {
-    private final static Log log = LogFactory.getLog(JMSResourcePortlet.class);
-    private static final String MODE_KEY = "mode";
-    private Map helpers = new HashMap();
-
+public class JMSResourcePortlet extends MultiPagePortlet {
     public void init(PortletConfig config) throws PortletException {
         super.init(config);
         addHelper(new ListScreenHandler(), config);
@@ -55,79 +55,7 @@
         addHelper(new ReviewHandler(), config);
     }
 
-    public void destroy() {
-        for (Iterator it = helpers.values().iterator(); it.hasNext();) {
-            AbstractHandler handler = (AbstractHandler) it.next();
-            handler.destroy();
-        }
-        helpers.clear();
-        super.destroy();
-    }
-
-    public void processAction(ActionRequest actionRequest,
-                              ActionResponse actionResponse) throws PortletException, IOException
{
-        String mode = actionRequest.getParameter(MODE_KEY);
-        AbstractHandler.JMSResourceData data = new AbstractHandler.JMSResourceData(actionRequest);
-        while(true) {
-            if(mode == null) {
-                break;
-            }
-            int pos = mode.lastIndexOf('-');
-            if(pos == -1) { // Assume it's a render request
-                break;
-            } else {
-                String type = mode.substring(pos+1);
-                mode = mode.substring(0, pos);
-                AbstractHandler handler = (AbstractHandler) helpers.get(mode);
-                if(handler == null) {
-                    log.error("No handler for action mode '"+mode+"'");
-                    break;
-                }
-                log.debug("Using action handler '"+handler.getClass().getName()+"'");
-                if(type.equals("before")) {
-                    mode = handler.actionBeforeView(actionRequest, actionResponse, data);
-                } else if(type.equals("after")) {
-                    mode = handler.actionAfterView(actionRequest, actionResponse, data);
-                } else {
-                    log.error("Unrecognized portlet action '"+mode+"'");
-                    mode = null;
-                }
-            }
-        }
-        if(mode != null) {
-            actionResponse.setRenderParameter(MODE_KEY, mode);
-        }
-        data.save(actionResponse);
-    }
-
-    protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException, PortletException {
-        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
-            return;
-        }
-        String mode = renderRequest.getParameter(MODE_KEY);
-        AbstractHandler.JMSResourceData data = new AbstractHandler.JMSResourceData(renderRequest);
-        if(mode == null || mode.equals("")) {
-            mode = "list";
-        }
-        AbstractHandler handler = (AbstractHandler) helpers.get(mode);
-        try {
-            if(handler == null) {
-                log.error("No handler for render mode '"+mode+"'");
-            } else {
-                log.debug("Using render handler '"+handler.getClass().getName()+"'");
-                handler.renderView(renderRequest, renderResponse, data);
-            }
-        } catch (Throwable e) {
-            log.error("Unable to render portlet", e);
-        }
-        renderRequest.setAttribute("data", data);
-        if(handler != null) {
-            handler.getView().include(renderRequest, renderResponse);
-        }
-    }
-
-    private void addHelper(AbstractHandler handler, PortletConfig config) throws PortletException
{
-        handler.init(config);
-        helpers.put(handler.getMode(), handler);
+    protected MultiPageModel getModel(PortletRequest request) {
+        return new AbstractHandler.JMSResourceData(request);
     }
 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
Sat Mar  4 16:19:08 2006
@@ -25,6 +25,7 @@
 import org.apache.geronimo.management.geronimo.JCAResource;
 import org.apache.geronimo.management.ResourceAdapter;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.MultiPageModel;
 
 import javax.portlet.*;
 import javax.management.ObjectName;
@@ -44,15 +45,16 @@
         super(LIST_MODE, "/WEB-INF/view/jmswizard/list.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
         populateExistingList(request);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         String provider = request.getParameter(PROVIDER_PARAMETER);
         if(isEmpty(provider)) {
             return SELECT_PROVIDER_MODE+BEFORE_ACTION;

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ReviewHandler.java
Sat Mar  4 16:19:08 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console.jmsmanager.wizard;
 
+import org.apache.geronimo.console.MultiPageModel;
+
 import java.io.IOException;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -33,16 +35,18 @@
         super(REVIEW_MODE, "/WEB-INF/view/jmswizard/status.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
         request.setAttribute("provider", provider);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         String next = request.getParameter("nextAction");
         if(next.equals(SELECT_DESTINATION_TYPE_MODE)) {
             data.setCurrentDestinationID(data.getAdminObjects().size());

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectConnectionFactoryTypeHandler.java
Sat Mar  4 16:19:08 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console.jmsmanager.wizard;
 
+import org.apache.geronimo.console.MultiPageModel;
+
 import java.io.IOException;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -33,7 +35,8 @@
         super(SELECT_FACTORY_TYPE_MODE, "/WEB-INF/view/jmswizard/factoryType.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         data.createIfNecessary();
         JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
         if(data.getCurrentFactory().getTransaction() == null || data.getCurrentFactory().getTransaction().equals(""))
{
@@ -47,12 +50,13 @@
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
         request.setAttribute("provider", provider);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         return ADD_FACTORY_MODE+BEFORE_ACTION;
     }
 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectDestinationTypeHandler.java
Sat Mar  4 16:19:08 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console.jmsmanager.wizard;
 
+import org.apache.geronimo.console.MultiPageModel;
+
 import java.io.IOException;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -33,7 +35,8 @@
         super(SELECT_DESTINATION_TYPE_MODE, "/WEB-INF/view/jmswizard/destinationType.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         data.createIfNecessary();
         JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
         // If there's only one factory type, skip this step
@@ -44,12 +47,13 @@
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         JMSProviderData provider = JMSProviderData.getProviderData(data.getRarURI(), request);
         request.setAttribute("provider", provider);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         return ADD_DESTINATION_MODE+BEFORE_ACTION;
     }
 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/SelectProviderHandler.java
Sat Mar  4 16:19:08 2006
@@ -29,6 +29,7 @@
 import javax.portlet.RenderResponse;
 import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.MultiPageModel;
 
 /**
  * Handler for the screen where you select a JMS provider (because
@@ -43,15 +44,16 @@
         super(SELECT_PROVIDER_MODE, "/WEB-INF/view/jmswizard/provider.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
         loadRARList(request);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         String rar = request.getParameter(RAR_FILE_PARAMETER);
         if(isEmpty(rar)) {
             return SELECT_PROVIDER_MODE+BEFORE_ACTION;

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java?rev=383230&r1=383229&r2=383230&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/ShowPlanHandler.java
Sat Mar  4 16:19:08 2006
@@ -23,6 +23,7 @@
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.console.MultiPageModel;
 
 /**
  * Handles the page that shows a deployment plan
@@ -34,13 +35,15 @@
         super(SHOW_PLAN_MODE, "/WEB-INF/view/jmswizard/plan.jsp");
     }
 
-    public String actionBeforeView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         String plan = save(request, response, data, true);
         request.getPortletSession(true).setAttribute("deploymentPlan", plan);
         return getMode();
     }
 
-    public void renderView(RenderRequest request, RenderResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         request.setAttribute("deploymentPlan", request.getPortletSession().getAttribute("deploymentPlan"));
         String path = PortletManager.getRepositoryEntry(request, data.getRarURI()).getPath();
         String base = PortletManager.getServerInfo(request).getCurrentBaseDirectory();
@@ -56,7 +59,8 @@
         request.setAttribute("rarURL", path);
     }
 
-    public String actionAfterView(ActionRequest request, ActionResponse response, JMSResourceData
data) throws PortletException, IOException {
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel
model) throws PortletException, IOException {
+        JMSResourceData data = (JMSResourceData) model;
         request.getPortletSession(true).removeAttribute("deploymentPlan");
         String next = request.getParameter("nextAction");
         if(next.equals(SELECT_DESTINATION_TYPE_MODE)) {



Mime
View raw message