geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1099362 - in /geronimo/server/trunk: plugingroups/console-jetty/ plugingroups/console-tomcat/ plugins/activemq/ plugins/activemq/activemq-portlets/ plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/hel...
Date Wed, 04 May 2011 08:09:09 GMT
Author: genspring
Date: Wed May  4 08:09:08 2011
New Revision: 1099362

URL: http://svn.apache.org/viewvc?rev=1099362&view=rev
Log:
GERONIMO-5859 Reenable JMS related portlets, patch from Shenghao Fang

Modified:
    geronimo/server/trunk/plugingroups/console-jetty/pom.xml
    geronimo/server/trunk/plugingroups/console-tomcat/pom.xml
    geronimo/server/trunk/plugins/activemq/activemq-portlets/pom.xml
    geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/helper/JMSMessageHelper.java
    geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java
    geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java
    geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java
    geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
    geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp
    geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/normal.jsp
    geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/web.xml
    geronimo/server/trunk/plugins/activemq/pom.xml

Modified: geronimo/server/trunk/plugingroups/console-jetty/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugingroups/console-jetty/pom.xml?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugingroups/console-jetty/pom.xml (original)
+++ geronimo/server/trunk/plugingroups/console-jetty/pom.xml Wed May  4 08:09:08 2011
@@ -73,12 +73,12 @@
             <!--<type>car</type>-->
         <!--</dependency>-->
 
-        <!--<dependency>-->
-            <!--<groupId>org.apache.geronimo.plugins</groupId>-->
-            <!--<artifactId>activemq-console-jetty</artifactId>-->
-            <!--<version>${project.version}</version>-->
-            <!--<type>car</type>-->
-        <!--</dependency>-->
+        <dependency>
+            <groupId>org.apache.geronimo.plugins</groupId>
+            <artifactId>activemq-console-jetty</artifactId>
+            <version>${project.version}</version>
+            <type>car</type>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.plugins</groupId>

Modified: geronimo/server/trunk/plugingroups/console-tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugingroups/console-tomcat/pom.xml?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugingroups/console-tomcat/pom.xml (original)
+++ geronimo/server/trunk/plugingroups/console-tomcat/pom.xml Wed May  4 08:09:08 2011
@@ -73,12 +73,12 @@
             <!--<type>car</type>-->
         <!--</dependency>-->
 
-        <!--<dependency>-->
-            <!--<groupId>org.apache.geronimo.plugins</groupId>-->
-            <!--<artifactId>activemq-console-tomcat</artifactId>-->
-            <!--<version>${project.version}</version>-->
-            <!--<type>car</type>-->
-        <!--</dependency>-->
+        <dependency>
+            <groupId>org.apache.geronimo.plugins</groupId>
+            <artifactId>activemq-console-tomcat</artifactId>
+            <version>${project.version}</version>
+            <type>car</type>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.plugins</groupId>

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/pom.xml?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/pom.xml (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/pom.xml Wed May  4 08:09:08 2011
@@ -54,10 +54,9 @@
 
         <!-- for jspc maven plugin -->
         <dependency>
-            <groupId>org.apache.geronimo.plugins</groupId>
-            <artifactId>pluto-support</artifactId>
-            <version>${project.version}</version>
-            <type>car</type>
+            <groupId>org.apache.portals.pluto</groupId>
+            <artifactId>pluto-taglib</artifactId>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
@@ -114,8 +113,22 @@
             <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-activemq-management</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        
     </dependencies>
-
+    
     <build>
         <plugins>
             <plugin>

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/helper/JMSMessageHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/helper/JMSMessageHelper.java?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/helper/JMSMessageHelper.java
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/helper/JMSMessageHelper.java
Wed May  4 08:09:08 2011
@@ -141,7 +141,9 @@ public abstract class JMSMessageHelper {
             JCAAdminObject[] jcaAdminObjects = PortletManager.getAdminObjectsForRA(portletRequest,
resourceAdapterModule, new String[] { destinationInfo.getType().getDestinationInterface()
});
             String targetPhysicalName = destinationInfo.getPhysicalName() == null ? "" :
destinationInfo.getPhysicalName();
             for (JCAAdminObject jcaAdminObject : jcaAdminObjects) {
-                GeronimoManagedBean bean = (GeronimoManagedBean) jcaAdminObject;
+                Kernel kernel = PortletManager.getKernel();
+                AbstractName abstractName = kernel.getAbstractNameFor(jcaAdminObject);
+                GeronimoManagedBean bean = PortletManager.getManagedBean(portletRequest,
abstractName);
                 ObjectName name = ObjectName.getInstance(bean.getObjectName());
                 String queueName = name.getKeyProperty(NameFactory.J2EE_NAME);
                 String currentPhysicalName = null;

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/BaseJMSPortlet.java
Wed May  4 08:09:08 2011
@@ -18,14 +18,16 @@ package org.apache.geronimo.console.jmsm
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import javax.portlet.PortletException;
 import javax.portlet.PortletRequest;
 
-import org.apache.geronimo.management.activemq.ActiveMQBroker;
-import org.apache.geronimo.management.activemq.ActiveMQManager;
+import org.apache.activemq.broker.BrokerService;
 import org.apache.geronimo.console.BasePortlet;
 import org.apache.geronimo.console.util.PortletManager;
 import org.apache.geronimo.gbean.AbstractName;
@@ -36,8 +38,13 @@ import org.apache.geronimo.kernel.Kernel
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.management.activemq.ActiveMQBroker;
+import org.apache.geronimo.management.activemq.ActiveMQManager;
 import org.apache.geronimo.management.geronimo.JMSBroker;
 import org.apache.geronimo.management.geronimo.JMSManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.blueprint.container.BlueprintContainer;
 
 /**
  * Common methods for JMS portlets
@@ -45,7 +52,8 @@ import org.apache.geronimo.management.ge
  * @version $Rev$ $Date$
  */
 public class BaseJMSPortlet extends BasePortlet {
-
+    
+    /*
     protected List<BrokerWrapper> getBrokerList(PortletRequest renderRequest, JMSManager
manager) throws PortletException {
         List<BrokerWrapper> beans = new ArrayList<BrokerWrapper>();
         //For we need list all the brokers including running and stop on the page,
@@ -72,7 +80,39 @@ public class BaseJMSPortlet extends Base
         }
         return beans;
     }
-
+    */
+    
+    protected Map<String, BrokerServiceWrapper> getBrokerServices() {
+        Map<String, BrokerServiceWrapper> brokerServices = new HashMap<String, BrokerServiceWrapper>();
+        try {
+            Kernel kernel = PortletManager.getKernel();
+            BundleContext context = kernel.getBundleFor(kernel.getKernelName()).getBundleContext();
+            String clazz = "org.osgi.service.blueprint.container.BlueprintContainer";
+            String filter = "(&(osgi.blueprint.container.symbolicname=org.apache.geronimo.configs.activemq-broker-blueprint)(osgi.blueprint.container.version=3.0.0.SNAPSHOT))";
+            ServiceReference[] references = context.getServiceReferences(clazz, filter);
+            for (ServiceReference reference: references) {
+                BlueprintContainer container = (BlueprintContainer) context.getService(reference);
+                @SuppressWarnings("unchecked")
+                Set<String> ids = (Set<String>) container.getComponentIds();
+                for (Object id: ids) {
+                    Object object = container.getComponentInstance((String)id);
+                    if (object instanceof BrokerService) {
+                        BrokerService brokerService = (BrokerService) object;
+                        String brokerName = brokerService.getBrokerName();
+                        String brokerURI = brokerService.getMasterConnectorURI();
+                        State state = brokerService.isStarted() ? State.RUNNING : State.STOPPED;
+                        BrokerServiceWrapper wrapper = new BrokerServiceWrapper(brokerName,
brokerURI, brokerService, state);
+                        brokerServices.put(brokerName, wrapper);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return brokerServices;
+    }
+    
+    /*
     protected BrokerWrapper getBrokerWrapper(PortletRequest portletRequest, AbstractName
brokerAbstractName) throws PortletException {
         JMSBroker jmsBroker = PortletManager.getJMSBroker(portletRequest, brokerAbstractName);
         if (jmsBroker == null)
@@ -85,7 +125,9 @@ public class BaseJMSPortlet extends Base
             throw new PortletException(e);
         }
     }
-
+    */
+    
+    /*
     protected JMSManager getActiveMQManager(PortletRequest portletRequest) {
         for (JMSManager jmsManager : PortletManager.getCurrentServer(portletRequest).getJMSManagers())
{
             if (jmsManager instanceof ActiveMQManager)
@@ -93,17 +135,18 @@ public class BaseJMSPortlet extends Base
         }
         return null;
     }
-
-    public static class BrokerWrapper {
+    */
+    
+    public static class BrokerServiceWrapper {
         private String brokerName;
         private String brokerURI;
-        private JMSBroker broker;
+        private BrokerService brokerService;
         private State state;
 
-        public BrokerWrapper(String brokerName, String brokerURI, JMSBroker broker, State
state) {
+        public BrokerServiceWrapper(String brokerName, String brokerURI, BrokerService brokerService,
State state) {
             this.brokerName = brokerName;
             this.brokerURI = brokerURI;
-            this.broker = broker;
+            this.brokerService = brokerService;
             this.state = state;
         }
 
@@ -111,8 +154,8 @@ public class BaseJMSPortlet extends Base
             return brokerName;
         }
 
-        public JMSBroker getBroker() {
-            return broker;
+        public BrokerService getBrokerService() {
+            return brokerService;
         }
 
         public String getBrokerURI() {

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSBrokerPortlet.java
Wed May  4 08:09:08 2011
@@ -40,6 +40,7 @@ import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.WindowState;
 
+import org.apache.activemq.broker.BrokerService;
 import org.apache.geronimo.activemq.BrokerServiceGBeanImpl;
 import org.apache.geronimo.console.util.PortletManager;
 import org.apache.geronimo.gbean.AbstractName;
@@ -107,15 +108,16 @@ public class JMSBrokerPortlet extends Ba
 
     protected void doList(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException,
             PortletException {
-        List<BrokerWrapper> beans = getBrokerList(renderRequest, this.getActiveMQManager(renderRequest));
-        renderRequest.setAttribute("brokers", beans);
+        Map<String, BrokerServiceWrapper> brokerServices = getBrokerServices();
+        renderRequest.setAttribute("brokers", brokerServices.values());
         if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
             normalView.include(renderRequest, renderResponse);
         } else {
             maximizedView.include(renderRequest, renderResponse);
         }
     }
-
+    
+    /*
     protected void doUpdate(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException,
             PortletException {
         String sBrokerURI = renderRequest.getParameter("brokerURI");
@@ -139,7 +141,8 @@ public class JMSBrokerPortlet extends Ba
                 .create(sBrokerURI))));
         editView.include(renderRequest, renderResponse);
     }
-
+    */
+    
     protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException,
             PortletException {
         try {
@@ -151,9 +154,9 @@ public class JMSBrokerPortlet extends Ba
                 mode = "list";
             renderRequest.setAttribute("mode", mode);
             if (mode.equals("create")) {
-                doCreate(renderRequest, renderResponse);
+                //doCreate(renderRequest, renderResponse);
             } else if (mode.equals("update")) {
-                doUpdate(renderRequest, renderResponse);
+                //doUpdate(renderRequest, renderResponse);
             } else {
                 doList(renderRequest, renderResponse);
             }
@@ -205,9 +208,9 @@ public class JMSBrokerPortlet extends Ba
             } else if (mode.equals("stop")) {
                 processStopAction(actionRequest, actionResponse);
             } else if (mode.equals("delete")) {
-                processDeleteAction(actionRequest, actionResponse);
+                //processDeleteAction(actionRequest, actionResponse);
             } else if (mode.equals("create")) {
-                processCreateAction(actionRequest, actionResponse);
+                //processCreateAction(actionRequest, actionResponse);
             } else if (mode.equals("update")) {
                 processUpdateAction(actionRequest, actionResponse);
             } else
@@ -226,6 +229,7 @@ public class JMSBrokerPortlet extends Ba
      * @throws PortletException
      * @throws IOException
      */
+    /*
     protected void processCreateAction(ActionRequest actionRequest, ActionResponse actionResponse)
             throws PortletException, IOException {
         String sConfigurationXML = actionRequest.getParameter("configXML");
@@ -260,7 +264,8 @@ public class JMSBrokerPortlet extends Ba
         }
         actionResponse.setRenderParameter("mode", "list");
     }
-
+    */
+    
     /**
      * 1. Remove the configuration XML file
      * 2. Remove the broker GBean
@@ -269,6 +274,7 @@ public class JMSBrokerPortlet extends Ba
      * @throws PortletException
      * @throws IOException
      */
+    /*
     protected void processDeleteAction(ActionRequest actionRequest, ActionResponse actionResponse)
             throws PortletException, IOException {
         String sBrokerName = actionRequest.getParameter("brokerName");
@@ -317,19 +323,21 @@ public class JMSBrokerPortlet extends Ba
         }
         actionResponse.setRenderParameter("mode", "list");
     }
-
+    */
+    
     protected void processStartAction(ActionRequest actionRequest, ActionResponse actionResponse)
             throws PortletException, IOException {
-        String sBrokerURI = actionRequest.getParameter("brokerURI");
+        //String sBrokerURI = actionRequest.getParameter("brokerURI");
         String sBrokerName = actionRequest.getParameter("brokerName");
         try {
-            AbstractName abstractName = new AbstractName(URI.create(sBrokerURI));
-            Kernel kernel = PortletManager.getKernel();
-            if (kernel.isRunning(abstractName))
+            Map<String, BrokerServiceWrapper> brokerServices = getBrokerServices();
+            BrokerService brokerService = brokerServices.get(sBrokerName).getBrokerService();
+            if (brokerService.isStarted()) {
                 return;
-            kernel.startRecursiveGBean(abstractName);
-            //TODO While the broker gbean does not start correctly, sometimes no exception
is threw ?
-            if (!kernel.isRunning(abstractName)) {
+            }
+            brokerService.start(true);
+            brokerService.waitUntilStarted();
+            if (!brokerService.isStarted()) {
                 throw new PortletException(getLocalizedString(actionRequest,
                         "jmsmanager.broker.failStartBrokerNoReason", sBrokerName));
             }
@@ -346,15 +354,17 @@ public class JMSBrokerPortlet extends Ba
 
     protected void processStopAction(ActionRequest actionRequest, ActionResponse actionResponse)
             throws PortletException, IOException {
-        String sBrokerURI = actionRequest.getParameter("brokerURI");
+        //String sBrokerURI = actionRequest.getParameter("brokerURI");
         String sBrokerName = actionRequest.getParameter("brokerName");
         try {
-            AbstractName abstractName = new AbstractName(URI.create(sBrokerURI));
-            Kernel kernel = PortletManager.getKernel();
-            if (!kernel.isRunning(abstractName))
+            Map<String, BrokerServiceWrapper> brokerServices = getBrokerServices();
+            BrokerService brokerService = brokerServices.get(sBrokerName).getBrokerService();
+            if (!brokerService.isStarted()) {
                 return;
-            kernel.stopGBean(abstractName);
-            if (kernel.isRunning(abstractName)) {
+            }
+            brokerService.stop();
+            brokerService.waitUntilStopped();
+            if (brokerService.isStarted()) {
                 throw new PortletException(getLocalizedString(actionRequest,
                         "jmsmanager.broker.failStopBrokerNoReason", sBrokerName));
             }

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/server/JMSConnectorPortlet.java
Wed May  4 08:09:08 2011
@@ -18,8 +18,10 @@ package org.apache.geronimo.console.jmsm
 
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Map;
 import java.net.URI;
 
 import javax.portlet.PortletRequestDispatcher;
@@ -31,6 +33,9 @@ import javax.portlet.RenderResponse;
 import javax.portlet.WindowState;
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletContext;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
 import org.apache.geronimo.console.util.PortletManager;
 import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 import org.apache.geronimo.management.activemq.ActiveMQConnector;
@@ -145,7 +150,7 @@ public class JMSConnectorPortlet extends
             if(mode == null || mode.equals("")) {
                 mode = "list";
             }
-            JMSManager manager = PortletManager.getCurrentServer(renderRequest).getJMSManagers()[0];
 //todo: handle multiple
+            //JMSManager manager = PortletManager.getCurrentServer(renderRequest).getJMSManagers()[0];
 //todo: handle multiple
 
             if(mode.equals("new")) {
                 String brokerURI = renderRequest.getParameter("brokerURI");
@@ -156,6 +161,7 @@ public class JMSConnectorPortlet extends
                 renderRequest.setAttribute("mode", "add");
                 editView.include(renderRequest, renderResponse);
             } else if(mode.equals("edit")) {
+                /*
                 String brokerURI = renderRequest.getParameter("brokerURI");
                 String connectorURI = renderRequest.getParameter("connectorURI");
                 JMSConnector connector = (JMSConnector)PortletManager.getManagedBean(renderRequest,
new AbstractName(URI.create(connectorURI)));
@@ -171,36 +177,37 @@ public class JMSConnectorPortlet extends
                     renderRequest.setAttribute("mode", "save");
                     editView.include(renderRequest, renderResponse);
                 }
+                */
             } else if(mode.equals("list")) {
-                doList(renderRequest, manager, renderResponse);
+                doList(renderRequest, renderResponse);
             }
         } catch (Throwable e) {
             log.error("Unable to render portlet", e);
         }
     }
 
-    private void doList(RenderRequest renderRequest, JMSManager manager, RenderResponse renderResponse)
throws PortletException, IOException {
-        List beans = new ArrayList();
-        JMSBroker[] brokers = (JMSBroker[]) manager.getContainers();
-        for (int i = 0; i < brokers.length; i++) {
-            JMSBroker broker = brokers[i];
-            AbstractName brokerAbstractName = PortletManager.getNameFor(renderRequest, broker);
-            NetworkConnector[] connectors = manager.getConnectorsForContainer(broker);
-            for (int j = 0; j < connectors.length; j++) {
-                ActiveMQConnector connector = (ActiveMQConnector) connectors[j];
-                String brokerName = brokerAbstractName.getName().get("name").toString();
-                ConnectorWrapper info = new ConnectorWrapper(brokerName, brokerAbstractName.toString(),
-                		                                     connector.getPath(),
-                		                                     connector);
-                beans.add(info);
+    private void doList(RenderRequest renderRequest, RenderResponse renderResponse) throws
PortletException, IOException {
+        List<ConnectorWrapper> connectorWrappers = new ArrayList<ConnectorWrapper>();
+        Map<String, BrokerServiceWrapper> brokerServices = getBrokerServices();
+        Collection<BrokerServiceWrapper> wrappers = brokerServices.values();
+        for (BrokerServiceWrapper wrapper: wrappers) {
+            BrokerService brokerService = wrapper.getBrokerService();
+            List<TransportConnector> connectors = brokerService.getTransportConnectors();
+            for (TransportConnector connector: connectors) {
+                String connectorURI = connector.getUri().toString();
+                String brokerName = wrapper.getBrokerName();
+                String protocol = connector.getUri().getScheme();
+                int port = connector.getUri().getPort();
+                ConnectorWrapper connectorWrapper = new ConnectorWrapper(connectorURI, brokerName,
protocol, port);
+                connectorWrappers.add(connectorWrapper);
             }
         }
-        renderRequest.setAttribute("brokers", getBrokerList(renderRequest, manager));
-        renderRequest.setAttribute("connectors", beans);
-        ArrayList protocols = new ArrayList(Arrays.asList(manager.getSupportedProtocols()));
-        protocols.remove("peer"); // add operation not supported for peer protocol
-        protocols.remove("failover"); // add operation not supported for failover protocol
-        renderRequest.setAttribute("protocols", protocols);
+        //renderRequest.setAttribute("brokers", getBrokerList(renderRequest, manager));
+        renderRequest.setAttribute("connectors", connectorWrappers);
+        //ArrayList protocols = new ArrayList(Arrays.asList(manager.getSupportedProtocols()));
+        //protocols.remove("peer"); // add operation not supported for peer protocol
+        //protocols.remove("failover"); // add operation not supported for failover protocol
+        //renderRequest.setAttribute("protocols", protocols);
 
         if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
             normalView.include(renderRequest, renderResponse);
@@ -236,31 +243,33 @@ public class JMSConnectorPortlet extends
     }
 
     public static class ConnectorWrapper {
-        private String brokerName;
-        private String brokerURI;
+        
         private String connectorURI;
-        private JMSConnector connector;
+        private String brokerName;
+        private String protocol;
+        private int port;
+        //private TransportConnector connector;
 
-        public ConnectorWrapper(String brokerName, String brokerURI, String connectorURI,
JMSConnector connector) {
-            this.brokerName = brokerName;
-            this.brokerURI = brokerURI;
+        public ConnectorWrapper(String connectorURI, String brokerName, String protocol,
int port) {
             this.connectorURI = connectorURI;
-            this.connector = connector;
+            this.brokerName = brokerName;
+            this.protocol = protocol;
+            this.port = port;
         }
-
+        
+        public String getConnectorURI() {
+            return connectorURI;
+        }
+        
         public String getBrokerName() {
             return brokerName;
         }
 
-        public JMSConnector getConnector() {
-            return connector;
-        }
-
-        public String getBrokerURI() {
-            return brokerURI;
+        public String getProtocol() {
+            return protocol;
         }
-        public String getConnectorURI() {
-            return connectorURI;
+        public int getPort() {
+            return port;
         }
     }
 }

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java
Wed May  4 08:09:08 2011
@@ -39,7 +39,9 @@ import org.apache.geronimo.console.jmsma
 import org.apache.geronimo.console.jmsmanager.helper.JMSMessageHelper;
 import org.apache.geronimo.console.jmsmanager.helper.JMSMessageHelperFactory;
 import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 import org.apache.geronimo.management.geronimo.JCAAdminObject;
@@ -110,37 +112,31 @@ public class ListScreenHandler extends A
             for (int i = 0; i < modules.length; i++) {
                 ResourceAdapterModule module = modules[i];                 
                 JMSResourceSummary target = null;
-                for (int j = 0; j < resources.size(); j++) {
-                    JMSResourceSummary data = (JMSResourceSummary) resources.get(j);
-                    if (data.adapterObjectName.equals(module.getObjectName())) {
-                        target = data;
-                        break;
-                    }
-                }                
-                if (target == null) {
-                    ResourceAdapter[] adapters = PortletManager.getResourceAdapters(renderRequest,
module);
-                    String name = null;
-                    if (adapters.length == 1 && adapters[0].getJCAResources().length
== 1) {
-                        JCAResource[] resource = PortletManager.getJCAResources(renderRequest,
adapters[0]);
-                        if (resource.length == 1 && resource[0].getResourceAdapterInstances().length
== 1) {
-                            name = ObjectName.getInstance(resource[0].getResourceAdapterInstanceNames()[0]).getKeyProperty(NameFactory.J2EE_NAME);
-                        }
+                ResourceAdapter[] adapters = PortletManager.getResourceAdapters(renderRequest,
module);
+                String name = null;
+                if (adapters.length == 1 && adapters[0].getJCAResources().length
== 1) {
+                    JCAResource[] resource = PortletManager.getJCAResources(renderRequest,
adapters[0]);
+                    if (resource.length == 1 && resource[0].getResourceAdapterInstances().length
== 1) {
+                        name = ObjectName.getInstance(resource[0].getResourceAdapterInstanceNames()[0]).getKeyProperty(NameFactory.J2EE_NAME);
                     }
-                    if (name == null) {
-                        name = ObjectName.getInstance(module.getObjectName()).getKeyProperty(NameFactory.J2EE_NAME);
-                    }
-                    String configurationName = PortletManager.getConfigurationFor(renderRequest,
PortletManager.getNameFor(renderRequest, module)).toString();
-                    String resourceAdapterModuleName = PortletManager.getNameFor(renderRequest,
module).toString();
-                    target = new JMSResourceSummary(configurationName, module.getObjectName(),
resourceAdapterModuleName, name, ((GeronimoManagedBean) module).getState());
-                    resources.add(target);
                 }
+                if (name == null) {
+                    name = ObjectName.getInstance(module.getObjectName()).getKeyProperty(NameFactory.J2EE_NAME);
+                }
+                String configurationName = PortletManager.getConfigurationFor(renderRequest,
PortletManager.getNameFor(renderRequest, module)).toString();
+                String resourceAdapterModuleName = PortletManager.getNameFor(renderRequest,
module).toString();
+                target = new JMSResourceSummary(configurationName, module.getObjectName(),
resourceAdapterModuleName, name);
+                resources.add(target);
                 JCAManagedConnectionFactory[] factories = PortletManager.getOutboundFactoriesForRA(renderRequest,
module, new String[]{
                         "javax.jms.ConnectionFactory", "javax.jms.QueueConnectionFactory",
"javax.jms.TopicConnectionFactory",});
                 for (int j = 0; j < factories.length; j++) {
                     JCAManagedConnectionFactory factory = factories[j];
-                    ObjectName name = ObjectName.getInstance(factory.getObjectName());
-                    target.getConnectionFactories().add(new ConnectionFactorySummary(factory.getObjectName(),
name.getKeyProperty(NameFactory.J2EE_NAME),
-                            ((GeronimoManagedBean) factory).getState()));
+                    ObjectName objectName = ObjectName.getInstance(factory.getObjectName());
+                    Kernel kernel = PortletManager.getKernel();
+                    AbstractName abstractName = kernel.getAbstractNameFor(factory);
+                    int state = kernel.getGBeanState(abstractName);
+                    target.getConnectionFactories().add(new ConnectionFactorySummary(factory.getObjectName(),
objectName.getKeyProperty(NameFactory.J2EE_NAME),
+                            state));
                     String factoryInterface = factory.getConnectionInterface();
                     if (!target.isQueueConnectionFactoryContained()) {                  
     
                         target.setQueueConnectionFactoryContained(factoryInterface.equals("javax.jms.ConnectionFactory")
|| factoryInterface.equals("javax.jms.QueueConnectionFactory"));
@@ -178,7 +174,7 @@ public class ListScreenHandler extends A
                     }
                     String configurationName = PortletManager.getConfigurationFor(renderRequest,
PortletManager.getNameFor(renderRequest, module)).toString();
                     String resourceAdapterModuleName = PortletManager.getNameFor(renderRequest,
module).toString();
-                    target = new JMSResourceSummary(configurationName, module.getObjectName(),
resourceAdapterModuleName, name, ((GeronimoManagedBean) module).getState());
+                    target = new JMSResourceSummary(configurationName, module.getObjectName(),
resourceAdapterModuleName, name);
                     resources.add(target);
                 }
                 
@@ -186,8 +182,9 @@ public class ListScreenHandler extends A
 
                 JCAAdminObject[] admins = PortletManager.getAdminObjectsForRA(renderRequest,
module, new String[]{"javax.jms.Queue", "javax.jms.Topic"});
                 for (int j = 0; j < admins.length; j++) {
-                    GeronimoManagedBean bean = (GeronimoManagedBean) admins[j];
-                    ObjectName name = ObjectName.getInstance(bean.getObjectName());
+                    Kernel kernel = PortletManager.getKernel();
+                    AbstractName abstractName = kernel.getAbstractNameFor(admins[j]);
+                    ObjectName name = ObjectName.getInstance(abstractName.getObjectName());
                     String queueName = name.getKeyProperty(NameFactory.J2EE_NAME);
                     String physicalName = null;
                     try {
@@ -210,7 +207,7 @@ public class ListScreenHandler extends A
                             destinationStat = new DestinationStatistics();
                         }
                     }
-                    AdminObjectSummary adminObjectSummary = new AdminObjectSummary(bean.getObjectName(),
queueName, physicalName, destType, bean.getState(), destinationStat);                    
                   
+                    AdminObjectSummary adminObjectSummary = new AdminObjectSummary(abstractName.getObjectName().toString(),
queueName, physicalName, destType, kernel.getGBeanState(abstractName), destinationStat); 
                                      
                     adminObjectSummary.setQueueBrowserSupported(true);
                     adminObjectSummary.setTopicHistoryBrowserSupported(false);
                     if(activeMQAdapter) {                        
@@ -228,8 +225,9 @@ public class ListScreenHandler extends A
                     target.getAdminObjects().add(adminObjectSummary);
                 }
             }
-        } catch (MalformedObjectNameException e) {
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
+            throw new PortletException(e);
         }
 
         Collections.sort(resources);
@@ -247,17 +245,17 @@ public class ListScreenHandler extends A
         private final String resourceAdapterModuleName;
         private final String name;
         private final String parentName;
-        private final int state;
+        //private final int state;
         private final List<ConnectionFactorySummary> connectionFactories = new ArrayList<ConnectionFactorySummary>();
         private final List<AdminObjectSummary> adminObjects = new ArrayList<AdminObjectSummary>();
         private boolean topicConnectionFactoryContained = false;
         private boolean queueConnectionFactoryContained = false;
 
-        public JMSResourceSummary(String configurationName, String adapterObjectName, String
resourceAdapterModuleName, String name, int state) {
+        public JMSResourceSummary(String configurationName, String adapterObjectName, String
resourceAdapterModuleName, String name) {
             this.configurationName = configurationName;
             this.adapterObjectName = adapterObjectName;
             this.resourceAdapterModuleName = resourceAdapterModuleName;
-            this.state = state;            
+            //this.state = state;            
             try {
                 ObjectName objectName = ObjectName.getInstance(adapterObjectName);
                 String parent = objectName.getKeyProperty(NameFactory.J2EE_APPLICATION);
@@ -290,11 +288,13 @@ public class ListScreenHandler extends A
         public String getParentName() {
             return parentName;
         }
-
+        
+        /*
         public int getState() {
             return state;
         }
-
+        */
+        
         public List<ConnectionFactorySummary> getConnectionFactories() {
             return connectionFactories;
         }
@@ -302,10 +302,12 @@ public class ListScreenHandler extends A
         public List<AdminObjectSummary> getAdminObjects() {
             return adminObjects;
         }
-
+        
+        /*
         public String getStateName() {
             return State.toString(state);
         }
+        */
         
         public int compareTo(JMSResourceSummary o) {            
             int names = name.toLowerCase().compareTo(o.name.toLowerCase());

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/connector/normal.jsp
Wed May  4 08:09:08 2011
@@ -48,8 +48,8 @@
           <tr class="${backgroundClass}">
             <td>${info.connectorURI}</td>
             <td>${info.brokerName}</td>
-            <td>${info.connector.protocol}</td>
-            <td>${info.connector.port}</td>
+            <td>${info.protocol}</td>
+            <td>${info.port}</td>
             <%--<td class="${backgroundClass}">--%>
              <%--<c:choose>--%>
                <%--<c:when test="${info.connector.stateInstance.name eq 'running'}">--%>

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/normal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/normal.jsp?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/normal.jsp
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/normal.jsp
Wed May  4 08:09:08 2011
@@ -30,7 +30,7 @@
         <tr>
             <th scope="col" class="DarkBackground"><fmt:message key="jmsmanager.common.name"/></th>
             <th scope="col" class="DarkBackground" align="center"><fmt:message key="jmsmanager.common.state"/></th>
-            <th class="DarkBackground" align="center"><fmt:message key="jmsmanager.common.actions"/></th>
+            <%--<th class="DarkBackground" align="center"><fmt:message key="jmsmanager.common.actions"/></th>--%>
           </tr>
           <c:forEach var="entry" items="${brokers}" varStatus="status">
           <c:choose>
@@ -44,6 +44,7 @@
           <tr class="${backgroundClass}">
             <td>${entry.brokerName}</td>
             <td>${entry.state.name}</td>
+            <%--
             <td>
              <c:choose>
                <c:when test="${entry.state.name eq 'running'}">
@@ -71,11 +72,14 @@
                    <fmt:message key="jmsmanager.common.delete"/>
                </a>
              </td>
+             --%>
           </tr>
 </c:forEach>
 </table>
 
+<%--
 <br />
 <a href="<portlet:renderURL portletMode="view">
            <portlet:param name="mode" value="create" />
          </portlet:renderURL>"><fmt:message key="jmsmanager.server.normal.addJMSBroker"/></a>
+--%>

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/web.xml?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/web.xml
(original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/web.xml
Wed May  4 08:09:08 2011
@@ -24,7 +24,7 @@ limitations under the License.
         <description>Automated generated Portlet Wrapper</description>
         <display-name>Pluto Wrapper for JMS Wizard Portlet</display-name>
         <servlet-name>JMSWizard</servlet-name>
-        <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
+        <servlet-class>org.apache.pluto.container.driver.PortletServlet</servlet-class>
         <init-param>
             <param-name>portlet-name</param-name>
             <param-value>JMSWizard</param-value>
@@ -36,7 +36,7 @@ limitations under the License.
         <description>Automated generated Portlet Wrapper</description>
         <display-name>Pluto Wrapper for JMS Portlet</display-name>
         <servlet-name>JMSServerManager</servlet-name>
-        <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
+        <servlet-class>org.apache.pluto.container.driver.PortletServlet</servlet-class>
         <init-param>
             <param-name>portlet-name</param-name>
             <param-value>JMSServerManager</param-value>
@@ -48,7 +48,7 @@ limitations under the License.
         <description>Automated generated Portlet Wrapper</description>
         <display-name>Pluto Wrapper for JMS Portlet</display-name>
         <servlet-name>JMSConnectorManager</servlet-name>
-        <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
+        <servlet-class>org.apache.pluto.container.driver.PortletServlet</servlet-class>
         <init-param>
             <param-name>portlet-name</param-name>
             <param-value>JMSConnectorManager</param-value>

Modified: geronimo/server/trunk/plugins/activemq/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/pom.xml?rev=1099362&r1=1099361&r2=1099362&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/pom.xml (original)
+++ geronimo/server/trunk/plugins/activemq/pom.xml Wed May  4 08:09:08 2011
@@ -39,9 +39,9 @@
         <module>activemq-ra</module>
         <module>geronimo-activemq-blueprint</module>
         <module>geronimo-activemq-management</module>
-        <!--<module>activemq-portlets</module>-->
-        <!--<module>activemq-console-jetty</module>-->
-        <!--<module>activemq-console-tomcat</module>-->
+        <module>activemq-portlets</module>
+        <module>activemq-console-jetty</module>
+        <module>activemq-console-tomcat</module>
         <!--<module>activemq-webconsole-jetty</module>-->
         <!--<module>activemq-webconsole-tomcat</module>-->
         <!--<module>activemq-webconsole</module>-->



Mime
View raw message