geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r397267 - in /geronimo/branches/1.1/applications/console-standard/src: java/org/apache/geronimo/console/jmsmanager/server/ webapp/WEB-INF/view/jmsmanager/server/ webapp/WEB-INF/view/jmsmanager/server/connector/
Date Wed, 26 Apr 2006 18:31:41 GMT
Author: ammulder
Date: Wed Apr 26 11:31:38 2006
New Revision: 397267

URL: http://svn.apache.org/viewcvs?rev=397267&view=rev
Log:
Updates to the JMS server portlet so it works again (GERONIMO-1802).

Modified:
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/editGeneric.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/normal.jsp

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java?rev=397267&r1=397266&r2=397267&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java
Wed Apr 26 11:31:38 2006
@@ -24,8 +24,9 @@
 
 import javax.portlet.PortletException;
 import javax.portlet.RenderRequest;
-import java.util.LinkedHashMap;
-import java.util.Map;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Common methods for JMS portlets
@@ -36,18 +37,43 @@
     /**
      * Gets a Map relating broker name to JMSBroker instance
      */
-    protected static Map getBrokerMap(RenderRequest renderRequest, JMSManager manager) throws
PortletException {
+    protected static List getBrokerList(RenderRequest renderRequest, JMSManager manager)
throws PortletException {
 
         JMSBroker[] brokers = (JMSBroker[]) manager.getContainers();
-        Map map = new LinkedHashMap();
+        List beans = new ArrayList();
         try {
             for (int i = 0; i < brokers.length; i++) {
-                AbstractName name = PortletManager.getNameFor(renderRequest, brokers[i]);
-                map.put(name.getName().get("name"), brokers[i]);
+                AbstractName abstractName = PortletManager.getNameFor(renderRequest, brokers[i]);
+                String displayName = abstractName.getName().get("name").toString();
+                beans.add(new BrokerWrapper(displayName, abstractName.toString(), brokers[i]));
             }
         } catch (Exception e) {
             throw new PortletException(e);
         }
-        return map;
+        return beans;
+    }
+    
+    public static class BrokerWrapper {
+        private String brokerName;
+        private String brokerURI;
+        private JMSBroker broker;
+
+        public BrokerWrapper(String brokerName, String brokerURI, JMSBroker broker) {
+            this.brokerName = brokerName;
+            this.brokerURI = brokerURI;
+            this.broker = broker;
+        }
+
+        public String getBrokerName() {
+            return brokerName;
+        }
+
+        public JMSBroker getBroker() {
+            return broker;
+        }
+
+        public String getBrokerURI() {
+            return brokerURI;
+        }
     }
 }

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java?rev=397267&r1=397266&r2=397267&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java
Wed Apr 26 11:31:38 2006
@@ -17,7 +17,7 @@
 package org.apache.geronimo.console.jmsmanager.server;
 
 import java.io.IOException;
-import java.util.Map;
+import java.util.List;
 import java.net.URI;
 import javax.portlet.PortletRequestDispatcher;
 import javax.portlet.ActionRequest;
@@ -50,17 +50,17 @@
                               ActionResponse actionResponse) throws PortletException, IOException
{
         try {
             String mode = actionRequest.getParameter("mode");
-            String name = actionRequest.getParameter("objectName");
+            String brokerURI = actionRequest.getParameter("brokerURI");
             if(mode.equals("start")) {
                 try {
                     //todo: this only goes into the "starting" state, doesn't make it to
"running" -- what's up with that?
-                    PortletManager.getManagedBean(actionRequest, new AbstractName(URI.create(name))).startRecursive();
+                    PortletManager.getManagedBean(actionRequest, new AbstractName(URI.create(brokerURI))).startRecursive();
                 } catch (Exception e) {
                     throw new PortletException(e);
                 }
             } else if(mode.equals("stop")) {
                 try {
-                    PortletManager.getManagedBean(actionRequest,  new AbstractName(URI.create(name))).stop();
+                    PortletManager.getManagedBean(actionRequest,  new AbstractName(URI.create(brokerURI))).stop();
                 } catch (Exception e) {
                     throw new PortletException(e);
                 }
@@ -87,8 +87,8 @@
                 return;
             }
             JMSManager manager = PortletManager.getCurrentServer(renderRequest).getJMSManagers()[0];
 //todo: handle multiple
-            Map map = getBrokerMap(renderRequest, manager);
-            renderRequest.setAttribute("brokers", map.entrySet());
+            List beans = getBrokerList(renderRequest, manager);
+            renderRequest.setAttribute("brokers", beans);
             if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
                 normalView.include(renderRequest, renderResponse);
             } else {

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java?rev=397267&r1=397266&r2=397267&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java
Wed Apr 26 11:31:38 2006
@@ -30,8 +30,6 @@
 import javax.portlet.WindowState;
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletContext;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
 import org.apache.geronimo.console.util.PortletManager;
 import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 import org.apache.geronimo.management.geronimo.JMSConnector;
@@ -61,14 +59,15 @@
                               ActionResponse actionResponse) throws PortletException, IOException
{
         try {
             String mode = actionRequest.getParameter("mode");
+            String connectorURI = actionRequest.getParameter("connectorURI");
+            String brokerURI = actionRequest.getParameter("brokerURI");
             JMSManager manager = PortletManager.getCurrentServer(actionRequest).getJMSManagers()[0];
 //todo: handle multiple
-            AbstractName brokerName = new AbstractName(URI.create(actionRequest.getParameter("brokerName")));
             if(mode.equals("new")) {
                 // User selected to add a new connector, need to show criteria portlet
                 actionResponse.setRenderParameter("mode", "new");
                 String protocol = actionRequest.getParameter("protocol");
                 actionResponse.setRenderParameter("protocol", protocol);
-                actionResponse.setRenderParameter("brokerName", brokerName.toString());
+                actionResponse.setRenderParameter("brokerURI", brokerURI);
             } else if(mode.equals("add")) { // User just submitted the form to add a new
connector
                 // Get submitted values
                 //todo: lots of validation
@@ -76,8 +75,9 @@
                 String host = actionRequest.getParameter("host");
                 int port = Integer.parseInt(actionRequest.getParameter("port"));
                 String name = actionRequest.getParameter("name");
+                AbstractName brokerAbstractName = new AbstractName(URI.create(brokerURI));
                 // Create and configure the connector
-                JMSConnector connector = PortletManager.createJMSConnector(actionRequest,
manager, brokerName, name, protocol, host, port);
+                JMSConnector connector = PortletManager.createJMSConnector(actionRequest,
manager, brokerAbstractName, name, protocol, host, port);
                 // Start the connector
                 try {
                     ((GeronimoManagedBean)connector).startRecursive();
@@ -90,37 +90,36 @@
                 //todo: lots of validation
                 String host = actionRequest.getParameter("host");
                 int port = Integer.parseInt(actionRequest.getParameter("port"));
-                String abstractNameString = actionRequest.getParameter("objectName");
                 // Identify and update the connector
-                JMSConnector connector = (JMSConnector)PortletManager.getManagedBean(actionRequest,
new AbstractName(URI.create(abstractNameString)));
+                AbstractName connectorAbstractName = new AbstractName(URI.create(connectorURI));
+                JMSConnector connector = (JMSConnector)PortletManager.getManagedBean(actionRequest,
connectorAbstractName);
                 if(connector != null) {
                     connector.setHost(host);
                     connector.setPort(port);
                 }
                 actionResponse.setRenderParameter("mode", "list");
             } else if(mode.equals("start")) {
-                String abstractNameString = actionRequest.getParameter("objectName");
+                AbstractName connectorAbstractName = new AbstractName(URI.create(connectorURI));
                 try {
-                    PortletManager.getManagedBean(actionRequest, new AbstractName(URI.create(abstractNameString))).startRecursive();
+                    PortletManager.getManagedBean(actionRequest, connectorAbstractName).startRecursive();
                 } catch (Exception e) {
                     throw new PortletException(e);
                 }
                 actionResponse.setRenderParameter("mode", "list");
             } else if(mode.equals("stop")) {
-                String abstractNameString = actionRequest.getParameter("objectName");
+                AbstractName connectorAbstractName = new AbstractName(URI.create(connectorURI));
                 try {
-                    PortletManager.getManagedBean(actionRequest, new AbstractName(URI.create(abstractNameString))).stop();
+                    PortletManager.getManagedBean(actionRequest, connectorAbstractName).stop();
                 } catch (Exception e) {
                     throw new PortletException(e);
                 }
                 actionResponse.setRenderParameter("mode", "list");
             } else if(mode.equals("edit")) {
-                String objectName = actionRequest.getParameter("objectName");
-                actionResponse.setRenderParameter("objectName", objectName);
+                actionResponse.setRenderParameter("connectorURI", connectorURI);
                 actionResponse.setRenderParameter("mode", "edit");
             } else if(mode.equals("delete")) {
-                String abstractNameString = actionRequest.getParameter("objectName");
-                manager.removeConnector(new AbstractName(URI.create(abstractNameString)));
+                AbstractName connectorAbstractName = new AbstractName(URI.create(connectorURI));
+                manager.removeConnector(connectorAbstractName);
                 actionResponse.setRenderParameter("mode", "list");
             }
         } catch (Throwable e) {
@@ -145,19 +144,19 @@
             JMSManager manager = PortletManager.getCurrentServer(renderRequest).getJMSManagers()[0];
 //todo: handle multiple
 
             if(mode.equals("new")) {
-                String brokerName = renderRequest.getParameter("brokerName");
+                String brokerURI = renderRequest.getParameter("brokerURI");
                 String protocol = renderRequest.getParameter("protocol");
                 renderRequest.setAttribute("protocol", protocol);
-                renderRequest.setAttribute("brokerName", brokerName);
+                renderRequest.setAttribute("brokerURI", brokerURI);
                 renderRequest.setAttribute("mode", "add");
                 editView.include(renderRequest, renderResponse);
             } else if(mode.equals("edit")) {
-                String objectName = renderRequest.getParameter("objectName");
-                JMSConnector connector = (JMSConnector)PortletManager.getManagedBean(renderRequest,
new AbstractName(URI.create(objectName)));
+                String connectorURI = renderRequest.getParameter("connectorURI");
+                JMSConnector connector = (JMSConnector)PortletManager.getManagedBean(renderRequest,
new AbstractName(URI.create(connectorURI)));
                 if(connector == null) {
                     doList(renderRequest, manager, renderResponse);
                 } else {
-                    renderRequest.setAttribute("objectName", objectName);
+                    renderRequest.setAttribute("connectorURI", connectorURI);
                     renderRequest.setAttribute("port", new Integer(connector.getPort()));
                     renderRequest.setAttribute("host", connector.getHost());
                     renderRequest.setAttribute("mode", "save");
@@ -176,22 +175,20 @@
         JMSBroker[] brokers = (JMSBroker[]) manager.getContainers();
         for (int i = 0; i < brokers.length; i++) {
             JMSBroker broker = brokers[i];
-            AbstractName brokerName = PortletManager.getNameFor(renderRequest, broker);
-            try {
-                JMSConnector[] connectors = (JMSConnector[]) manager.getConnectorsForContainer(broker);
-                for (int j = 0; j < connectors.length; j++) {
-                    JMSConnector connector = connectors[j];
-                    ObjectName conName = ObjectName.getInstance(((GeronimoManagedBean)connector).getObjectName());
-                    String connectorName = conName.getKeyProperty("name");
-                    ConnectorWrapper info = new ConnectorWrapper((String) brokerName.getName().get("name"),
-                                                                 brokerName.toString(), connectorName,
connector);
-                    beans.add(info);
-                }
-            } catch (MalformedObjectNameException e) {
-                log.error("Unable to decode ObjectName", e);
+            AbstractName brokerAbstractName = PortletManager.getNameFor(renderRequest, broker);
+            JMSConnector[] connectors = (JMSConnector[]) manager.getConnectorsForContainer(broker);
+            for (int j = 0; j < connectors.length; j++) {
+                JMSConnector connector = connectors[j];
+                AbstractName connectorAbstractName = PortletManager.getNameFor(renderRequest,connector);
+                String brokerName = brokerAbstractName.getName().get("name").toString();
+                String connectorName = connectorAbstractName.getName().get("name").toString();
+                ConnectorWrapper info = new ConnectorWrapper(brokerName, brokerAbstractName.toString(),
+                		                                     connectorName, connectorAbstractName.toString(),
+                		                                     connector);
+                beans.add(info);
             }
         }
-        renderRequest.setAttribute("brokers", getBrokerMap(renderRequest, manager).entrySet());
+        renderRequest.setAttribute("brokers", getBrokerList(renderRequest, manager));
         renderRequest.setAttribute("connectors", beans);
         renderRequest.setAttribute("protocols", manager.getSupportedProtocols());
 
@@ -230,31 +227,36 @@
 
     public static class ConnectorWrapper {
         private String brokerName;
-        private String brokerAbstractName;
-        private String displayName;
+        private String brokerURI;
+        private String connectorName;
+        private String connectorURI;
         private JMSConnector connector;
 
-        public ConnectorWrapper(String brokerName, String brokerAbstractName, String displayName,
JMSConnector connector) {
+        public ConnectorWrapper(String brokerName, String brokerURI, String connectorName,
String connectorURI, JMSConnector connector) {
             this.brokerName = brokerName;
-            this.displayName = displayName;
+            this.brokerURI = brokerURI;
+            this.connectorName = connectorName;
+            this.connectorURI = connectorURI;
             this.connector = connector;
-            this.brokerAbstractName = brokerAbstractName;
         }
 
         public String getBrokerName() {
             return brokerName;
         }
 
-        public String getDisplayName() {
-            return displayName;
+        public String getConnectorName() {
+            return connectorName;
         }
 
         public JMSConnector getConnector() {
             return connector;
         }
 
-        public String getBrokerAbstractName() {
-            return brokerAbstractName;
+        public String getBrokerURI() {
+            return brokerURI;
+        }
+        public String getConnectorURI() {
+            return connectorURI;
         }
     }
 }

Modified: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/editGeneric.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/editGeneric.jsp?rev=397267&r1=397266&r2=397267&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/editGeneric.jsp
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/editGeneric.jsp
Wed Apr 26 11:31:38 2006
@@ -7,10 +7,10 @@
 <input type="hidden" name="protocol" value="${protocol}">
 <c:choose>
 <c:when test="${mode eq 'save'}">
-  <input type="hidden" name="objectName" value="${objectName}">
+  <input type="hidden" name="connectorURI" value="${connectorURI}">
 </c:when>
 <c:otherwise>
-  <input type="hidden" name="brokerName" value="${brokerName}">
+  <input type="hidden" name="brokerURI" value="${brokerURI}">
 </c:otherwise>
 </c:choose>
 <table width="100%%"  border="0">

Modified: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp?rev=397267&r1=397266&r2=397267&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp
Wed Apr 26 11:31:38 2006
@@ -20,7 +20,7 @@
           </tr>
 <c:forEach var="info" items="${connectors}">
           <tr>
-            <td>${info.displayName}</td>
+            <td>${info.connectorName}</td>
             <td>${info.brokerName}</td>
             <td>${info.connector.protocol}</td>
             <td>${info.connector.port}</td>
@@ -30,23 +30,27 @@
                <c:when test="${info.connector.stateInstance.name eq 'running'}">
                <a href="<portlet:actionURL portletMode="view">
                  <portlet:param name="mode" value="stop" />
-                 <portlet:param name="objectName" value="${info.connector.objectName}"
/>
+                 <portlet:param name="brokerURI" value="${info.brokerURI}" />
+                 <portlet:param name="connectorURI" value="${info.connectorURI}" />
                </portlet:actionURL>">stop</a>
                </c:when>
                <c:otherwise>
                <a href="<portlet:actionURL portletMode="view">
                  <portlet:param name="mode" value="start" />
-                 <portlet:param name="objectName" value="${info.connector.objectName}"
/>
+                 <portlet:param name="brokerURI" value="${info.brokerURI}" />
+                 <portlet:param name="connectorURI" value="${info.connectorURI}" />
                </portlet:actionURL>">start</a>
                </c:otherwise>
              </c:choose>
                <a href="<portlet:actionURL portletMode="view">
                  <portlet:param name="mode" value="edit" />
-                 <portlet:param name="objectName" value="${info.connector.objectName}"
/>
+                 <portlet:param name="brokerURI" value="${info.brokerURI}" />
+                 <portlet:param name="connectorURI" value="${info.connectorURI}" />
                </portlet:actionURL>">edit</a>
                <a href="<portlet:actionURL portletMode="view">
                  <portlet:param name="mode" value="delete" />
-                 <portlet:param name="objectName" value="${info.connector.objectName}"
/>
+                 <portlet:param name="brokerURI" value="${info.brokerURI}" />
+                 <portlet:param name="connectorURI" value="${info.connectorURI}" />
                </portlet:actionURL>">delete</a>
              </td>
           </tr>
@@ -55,13 +59,13 @@
 </c:if>
 
 <!-- Links to add new connectors -->
-<c:forEach var="entry" items="${brokers}">
-<p>Add connector to ${entry.key}:</p>
+<c:forEach var="info" items="${brokers}">
+<p>Add connector to ${info.brokerName}:</p>
 <ul>
 <c:forEach var="protocol" items="${protocols}">
 <li><a href="<portlet:actionURL portletMode="view">
            <portlet:param name="mode" value="new" />
-           <portlet:param name="brokerName" value="${entry.value.objectName}" />
+           <portlet:param name="brokerURI" value="${info.brokerURI}" />
            <portlet:param name="protocol" value="${protocol}" />
          </portlet:actionURL>">Add new <b>${protocol}</b> listener</a></li>
 </c:forEach>

Modified: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/normal.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/normal.jsp?rev=397267&r1=397266&r2=397267&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/normal.jsp
(original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/jmsmanager/server/normal.jsp
Wed Apr 26 11:31:38 2006
@@ -18,31 +18,31 @@
           </tr>
 <c:forEach var="entry" items="${brokers}">
           <tr>
-            <td>${entry.key}</td>
-            <td>${entry.value.stateInstance}</td>
+            <td>${entry.brokerName}</td>
+            <td>${entry.broker.stateInstance}</td>
 <!--
             <td>
              <c:choose>
-               <c:when test="${entry.value.stateInstance.name eq 'running'}">
+               <c:when test="${entry.broker.stateInstance.name eq 'running'}">
                <a href="<portlet:actionURL portletMode="view">
                  <portlet:param name="mode" value="stop" />
-                 <portlet:param name="objectName" value="${entry.value.objectName}" />
+                 <portlet:param name="objectName" value="${entry.brokerURI}" />
                </portlet:actionURL>">stop</a>
                </c:when>
                <c:otherwise>
                <a href="<portlet:actionURL portletMode="view">
                  <portlet:param name="mode" value="start" />
-                 <portlet:param name="objectName" value="${entry.value.objectName}" />
+                 <portlet:param name="objectName" value="${entry.brokerURI}" />
                </portlet:actionURL>">start</a>
                </c:otherwise>
              </c:choose>
                <a href="<portlet:actionURL portletMode="view">
                  <portlet:param name="mode" value="edit" />
-                 <portlet:param name="objectName" value="${entry.value.objectName}" />
+                 <portlet:param name="objectName" value="${entry.brokerURI}" />
                </portlet:actionURL>">edit</a>
                <a href="<portlet:actionURL portletMode="view">
                  <portlet:param name="mode" value="delete" />
-                 <portlet:param name="objectName" value="${entry.value.objectName}" />
+                 <portlet:param name="objectName" value="${entry.brokerURI}" />
                </portlet:actionURL>">delete</a>
              </td>
 -->



Mime
View raw message