geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r736391 [2/2] - in /geronimo/server/trunk: framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/ plugins/activemq/activemq-broker/ plugins/activemq/activemq-broker/src/main/plan/ plugins/activemq/activ...
Date Wed, 21 Jan 2009 19:47:30 GMT
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=736391&r1=736390&r2=736391&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 Jan 21 11:47:28 2009
@@ -18,9 +18,14 @@
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.portlet.ActionRequest;
@@ -30,17 +35,25 @@
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 
+import org.apache.geronimo.activemq.BrokerServiceGBean;
+import org.apache.geronimo.activemq.management.ActiveMQManagerGBean;
 import org.apache.geronimo.console.MultiPageModel;
 import org.apache.geronimo.console.jmsmanager.DestinationStatistics;
 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.gbean.GBeanData;
 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;
 import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
 import org.apache.geronimo.management.geronimo.JCAResource;
+import org.apache.geronimo.management.geronimo.JMSBroker;
+import org.apache.geronimo.management.geronimo.JMSManager;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
 import org.apache.geronimo.management.geronimo.ResourceAdapter;
 import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
 import org.slf4j.Logger;
@@ -64,9 +77,11 @@
             String physicalName = request.getParameter(PHYSICAL_NAME);
             String adminObjType = request.getParameter(ADMIN_OBJ_TYPE);
             String adapterObjectName = request.getParameter(RA_ADAPTER_OBJ_NAME);
+            String brokerName = request.getParameter(BROKER_NAME);
             response.setRenderParameter(ADMIN_OBJ_TYPE, adminObjType);
             response.setRenderParameter(PHYSICAL_NAME, physicalName);
             response.setRenderParameter(RA_ADAPTER_OBJ_NAME, adapterObjectName);
+            response.setRenderParameter(BROKER_NAME, brokerName);
             response.setRenderParameter(PURGE, purgeStr);
         }
         return getMode();
@@ -95,20 +110,25 @@
             String physicalName = renderRequest.getParameter(PHYSICAL_NAME);
             String adminObjType = renderRequest.getParameter(ADMIN_OBJ_TYPE);
             String adapterObjectName = renderRequest.getParameter(RA_ADAPTER_OBJ_NAME);
+            String brokerName = renderRequest.getParameter(BROKER_NAME);
             JMSMessageHelper helper = JMSMessageHelperFactory.getMessageHelper(renderRequest, adapterObjectName);
-            helper.purge(renderRequest, adminObjType, physicalName);
-        }
-
+            try {
+                helper.purge(renderRequest, brokerName, adminObjType, physicalName);
+            } catch (Exception e) {
+                log.error("Fail to purge the messages in [" + brokerName + "." + physicalName + "]", e);
+                throw new PortletException("Fail to purge the messages in [" + brokerName + "." + physicalName + "]",e);
+            }
+        }                
+        
         // Prepare a list of JMS configurations
-        List resources = new ArrayList();
+        List<JMSResourceSummary> resources = new ArrayList<JMSResourceSummary>();
 
         // Get the list of connection factories
         ResourceAdapterModule[] modules = PortletManager.getOutboundRAModules(renderRequest, new String[]{
                 "javax.jms.ConnectionFactory", "javax.jms.QueueConnectionFactory", "javax.jms.TopicConnectionFactory",});
         try {
             for (int i = 0; i < modules.length; i++) {
-                ResourceAdapterModule module = modules[i];
-
+                ResourceAdapterModule module = modules[i];                 
                 JMSResourceSummary target = null;
                 for (int j = 0; j < resources.size(); j++) {
                     JMSResourceSummary data = (JMSResourceSummary) resources.get(j);
@@ -116,12 +136,12 @@
                         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]);
+                    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);
                         }
@@ -129,8 +149,9 @@
                     if (name == null) {
                         name = ObjectName.getInstance(module.getObjectName()).getKeyProperty(NameFactory.J2EE_NAME);
                     }
+                    String sServerUrl = adapters.length > 0 ? getServerUrl(renderRequest,module) : "";                                        
                     target = new JMSResourceSummary(PortletManager.getConfigurationFor(renderRequest, PortletManager.getNameFor(renderRequest, module)).toString(),
-                            module.getObjectName(), name, ((GeronimoManagedBean) module).getState());
+                            module.getObjectName(), name, ((GeronimoManagedBean) module).getState(), getBrokerName(renderRequest,sServerUrl));
                     resources.add(target);
                 }
 
@@ -159,7 +180,7 @@
                 }
                 if (target == null) {
                     ResourceAdapter[] adapters = PortletManager.getResourceAdapters(renderRequest, module);
-                    String name = null;
+                    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) {
@@ -169,8 +190,9 @@
                     if (name == null) {
                         name = ObjectName.getInstance(module.getObjectName()).getKeyProperty(NameFactory.J2EE_NAME);
                     }
+                    String sServerUrl = adapters.length > 0 ? getServerUrl(renderRequest,module) : "";
                     target = new JMSResourceSummary(PortletManager.getConfigurationFor(renderRequest, PortletManager.getNameFor(renderRequest, module)).toString(),
-                            module.getObjectName(), name, ((GeronimoManagedBean) module).getState());
+                            module.getObjectName(), name, ((GeronimoManagedBean) module).getState(), getBrokerName(renderRequest,sServerUrl));
                     resources.add(target);
                 }
 
@@ -188,7 +210,7 @@
                     }
                     String destType = admins[j].getAdminObjectInterface().indexOf("Queue") > -1 ? "Queue" : "Topic";
                     String vendorName = module.getVendorName();
-                    DestinationStatistics destinationStat = JMSMessageHelperFactory.getJMSMessageHelper(vendorName).getDestinationStatistics(destType, physicalName);
+                    DestinationStatistics destinationStat = JMSMessageHelperFactory.getJMSMessageHelper(vendorName).getDestinationStatistics(target.getBrokerName(), destType, physicalName);
                     target.getAdminObjects().add(
                             new AdminObjectSummary(bean.getObjectName(), queueName, physicalName,destType , bean
                                     .getState(),destinationStat));
@@ -203,22 +225,73 @@
         // Get the list of JMS providers
         renderRequest.setAttribute("providers", JMSProviderData.getAllProviders());
     }
-
-
-    public static class JMSResourceSummary implements Serializable, Comparable {
+    
+    private String getServerUrl(PortletRequest portletRequest, ResourceAdapterModule resourceAdapterModule) {
+        try {
+            Kernel kernel = PortletManager.getKernel();
+            AbstractName moduleAbstractName = PortletManager.getNameFor(portletRequest, resourceAdapterModule);
+            if (kernel.isRunning(moduleAbstractName)) {
+                GBeanData resourceAdapterGBeanData = (GBeanData) kernel.getAttribute(moduleAbstractName,
+                        "resourceAdapterGBeanData");
+                return (String) resourceAdapterGBeanData.getAttribute("ServerUrl");
+            }
+            return "";
+        } catch (Exception e) {
+            return "";
+        }
+    }
+    
+    private String getBrokerName(PortletRequest portletRequest, String serverURL) throws PortletException {
+        try {
+            GeronimoManagedBean[] geronimoManagedBeans = PortletManager.getManagedBeans(portletRequest,
+                    ActiveMQManagerGBean.class);
+            if (geronimoManagedBeans == null || geronimoManagedBeans.length == 0)
+                throw new PortletException("Could not find the ActiveMQ Manager");
+            if (geronimoManagedBeans.length > 1)
+                log.warn("More than one ActiveMQ Manager exist in kernel");            
+            JMSManager activeMQManager = (JMSManager) geronimoManagedBeans[0];            
+            JMSBroker findJMSBroker = null;
+            URI uri = new URI(serverURL);
+            //TODO 127.0.0.1 and localhost, shall we need to support the mapping between ip and host name ?
+            String sHostName = uri.getHost();
+            if (sHostName.equals("127.0.0.1") || sHostName.equals("localhost"))
+                try {
+                    sHostName = InetAddress.getLocalHost().getHostName();
+                } catch (UnknownHostException e) {
+                    log.warn("Fail to get the local machine name", e);
+                }            
+            for (JMSBroker jmsBroker : (JMSBroker[]) activeMQManager.getContainers()) {
+                NetworkConnector[] connectors = activeMQManager.getConnectorsForContainer(jmsBroker, uri.getScheme());
+                for (NetworkConnector connector : connectors) {                    
+                    if (connector.getHost().equals(sHostName) && connector.getPort() == uri.getPort())
+                        findJMSBroker = jmsBroker;
+                }
+                if (findJMSBroker != null)
+                    return ((BrokerServiceGBean) findJMSBroker).getBrokerName();
+            }
+            return null;
+        } catch (URISyntaxException e) {
+            log.error("Unrecognized server URL [" + serverURL + "]", e);
+            throw new PortletException("Unrecognized server URL [" + serverURL + "]", e);
+        }
+    }
+    
+    public static class JMSResourceSummary implements Serializable, Comparable<JMSResourceSummary> {
         private static final long serialVersionUID = -2788803234448047035L;
         private final String configurationName;
         private final String adapterObjectName;
         private final String name;
         private final String parentName;
         private final int state;
-        private final List connectionFactories = new ArrayList();
-        private final List adminObjects = new ArrayList();
+        private final String brokerName;
+        private final List<ConnectionFactorySummary> connectionFactories = new ArrayList<ConnectionFactorySummary>();
+        private final List<AdminObjectSummary> adminObjects = new ArrayList<AdminObjectSummary>();
 
-        public JMSResourceSummary(String configurationName, String adapterObjectName, String name, int state) {
+        public JMSResourceSummary(String configurationName, String adapterObjectName, String name, int state, String brokerName) {
             this.configurationName = configurationName;
             this.adapterObjectName = adapterObjectName;
             this.state = state;
+            this.brokerName = brokerName;
             try {
                 ObjectName objectName = ObjectName.getInstance(adapterObjectName);
                 String parent = objectName.getKeyProperty(NameFactory.J2EE_APPLICATION);
@@ -252,32 +325,35 @@
             return state;
         }
 
-        public List getConnectionFactories() {
+        public List<ConnectionFactorySummary> getConnectionFactories() {
             return connectionFactories;
         }
 
-        public List getAdminObjects() {
+        public List<AdminObjectSummary> getAdminObjects() {
             return adminObjects;
         }
 
         public String getStateName() {
             return State.toString(state);
         }
-
-        public int compareTo(Object o) {
-            final JMSResourceSummary pool = (JMSResourceSummary) o;
-            int names = name.toLowerCase().compareTo(pool.name.toLowerCase());
+        
+        public String getBrokerName() {
+            return brokerName;
+        }
+        
+        public int compareTo(JMSResourceSummary o) {            
+            int names = name.toLowerCase().compareTo(o.name.toLowerCase());
             if (parentName == null) {
-                if (pool.parentName == null) {
+                if (o.parentName == null) {
                     return names;
                 } else {
                     return -1;
                 }
             } else {
-                if (pool.parentName == null) {
+                if (o.parentName == null) {
                     return 1;
                 } else {
-                    int test = parentName.compareTo(pool.parentName);
+                    int test = parentName.compareTo(o.parentName);
                     if (test != 0) {
                         return test;
                     } else {
@@ -288,7 +364,7 @@
         }
     }
 
-    public static class ConnectionFactorySummary implements Serializable, Comparable {
+    public static class ConnectionFactorySummary implements Serializable, Comparable<ConnectionFactorySummary> {
         private static final long serialVersionUID = 5777507920880039759L;
         private final String factoryObjectName;
         private final String name;
@@ -316,14 +392,13 @@
             return State.toString(state);
         }
 
-        public int compareTo(Object o) {
-            final ConnectionFactorySummary pool = (ConnectionFactorySummary) o;
-            return name.compareTo(pool.name);
+        public int compareTo(ConnectionFactorySummary o) {            
+            return name.compareTo(o.name);
         }
     }
 
 
-    public static class AdminObjectSummary implements Serializable, Comparable {
+    public static class AdminObjectSummary implements Serializable, Comparable<AdminObjectSummary> {
         private static final long serialVersionUID = 3941332145785485903L;
         private final String adminObjectName;
         private final String name;
@@ -368,10 +443,9 @@
             return State.toString(state);
         }
 
-        public int compareTo(Object o) {
-            final AdminObjectSummary pool = (AdminObjectSummary) o;
-            int result = name.compareTo(pool.name);
-            return result == 0 ? type.compareTo(pool.type) : result;
+        public int compareTo(AdminObjectSummary o) {           
+            int result = name.compareTo(o.name);
+            return result == 0 ? type.compareTo(o.type) : result;
         }
     }
 }

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/activemq.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/activemq.properties?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/activemq.properties (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/activemq.properties Wed Jan 21 11:47:28 2009
@@ -1,3 +1,4 @@
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
 #=====================================================================
 #  Licensed to the Apache Software Foundation (ASF) under one or more
 #  contributor license agreements.  See the NOTICE file distributed with
@@ -39,6 +40,10 @@
 jmsmanager.activemq.help.stateExp                           = The state of the connection, either &quot;Running&quot; or &quot;Stopped.&quot;
 jmsmanager.activemq.help.testConnExp                        = This link can be used to test the connector. A result will be returned of either &quot;Connected&quot; or a failure message.
 jmsmanager.activemq.help.title                              = This portlet displays the JMS connectors that are configured with the Geronimo server.
+jmsmanager.broker.creationtip                               = Please edit the ActiveMQ XML template configuration file in the edit box below, then click the save buttion to save the changes and redeploy the broker
+jmsmanager.broker.emptybrokerconfig                         = ActiveMQ XML configuration could not be empty
+jmsmanager.broker.emptybrokername                           = Broker name could not be empty
+jmsmanager.broker.updatetip                                 = Please edit the ActiveMQ XML configuration file in the edit box below, then click the save buttion to save the changes and redeploy the broker.
 jmsmanager.common.actions                                   = Actions
 jmsmanager.common.addNewDatasource                          = Add New Datasource
 jmsmanager.common.addQueue_Topic                            = Add Queue/Topic
@@ -136,7 +141,7 @@
 jmsmanager.server.connector.normal.noJMSNetworkConnectors   = There are no JMS network connectors defined
 jmsmanager.server.connector.normal.title                    = Currently available JMS network connectors:
 jmsmanager.server.help.title                                = Shows the available JMS brokers
-jmsmanager.server.normal.addJMSBroker                       = JMS Broker
+jmsmanager.server.normal.addJMSBroker                       = Add JMS Broker
 jmsmanager.server.normal.noJMSBrokers                       = There are no JMS brokers defined
 jmsmanager.server.normal.title                              = The JMS brokers available in the server are
 jmsmanager.viewDLQ.deadLetterQueueName                      = Dead Letter Queue Name

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/activemq_zh.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/activemq_zh.properties?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/activemq_zh.properties (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/activemq_zh.properties Wed Jan 21 11:47:28 2009
@@ -1,3 +1,4 @@
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
 #=====================================================================
 #  Licensed to the Apache Software Foundation (ASF) under one or more
 #  contributor license agreements.  See the NOTICE file distributed with
@@ -39,6 +40,10 @@
 jmsmanager.activemq.help.stateExp                           = \u8FDE\u63A5\u7684\u72B6\u6001,\u5305\u542B"\u8FD0\u884C"\u548C"\u505C\u6B62"\u72B6\u6001
 jmsmanager.activemq.help.testConnExp                        = \u8BE5\u8FDE\u63A5\u7528\u4E8E\u6D4B\u8BD5\u8FDE\u63A5\u5668, \u5C06\u8FD4\u56DE"\u6210\u529F\u8FDE\u63A5"\u6216\u8005\u4E00\u4E2A\u9519\u8BEF\u4FE1\u606F\u3002
 jmsmanager.activemq.help.title                              = \u8BE5Portlet\u663E\u793A\u5728Geronimo\u670D\u52A1\u5668\u4E2D\u914D\u7F6E\u7684JMS\u8FDE\u63A5\u5668
+jmsmanager.broker.creationtip                               = \u8BF7\u7F16\u8F91\u4E0B\u9762\u7F16\u8F91\u6846\u4E2D\u7684 ActiveMQ XML \u6A21\u677F\u914D\u7F6E\u6587\u4EF6, \u7136\u540E\u70B9\u51FB\u4FDD\u5B58\u6309\u94AE\u4FDD\u5B58\u4FEE\u6539\u5E76\u90E8\u7F72\u8BE5 Broker
+jmsmanager.broker.emptybrokerconfig                         = ActiveMQ XML \u914D\u7F6E\u4E0D\u53EF\u4E3A\u7A7A
+jmsmanager.broker.emptybrokername                           = Broker \u540D\u79F0\u4E0D\u53EF\u4E3A\u7A7A
+jmsmanager.broker.updatetip                                 = \u8BF7\u7F16\u8F91\u4E0B\u9762\u7F16\u8F91\u6846\u4E2D\u7684 ActiveMQ XML \u914D\u7F6E\u6587\u4EF6, \u7136\u540E\u70B9\u51FB\u4FDD\u5B58\u6309\u94AE\u4FDD\u5B58\u4FEE\u6539\u5E76\u91CD\u65B0\u90E8\u7F72 Broker
 jmsmanager.common.actions                                   = \u64CD\u4F5C
 jmsmanager.common.addNewDatasource                          = \u6DFB\u52A0\u65B0\u6570\u636E\u6E90
 jmsmanager.common.addQueue_Topic                            = \u6DFB\u52A0\u961F\u5217\u6216\u4E3B\u9898

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/portletinfo.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/portletinfo.properties?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/portletinfo.properties (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/portletinfo.properties Wed Jan 21 11:47:28 2009
@@ -1,3 +1,4 @@
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
 #=====================================================================
 #  Licensed to the Apache Software Foundation (ASF) under one or more
 #  contributor license agreements.  See the NOTICE file distributed with
@@ -26,3 +27,24 @@
 errorMsg01 = Error encountered while sending message.
 
 infoMsg01 = Message sent successfully.
+
+jmsmanager.broker.failAddBroker             = Fail to add Broker {0} due to {1}
+jmsmanager.broker.failDeleteBroker          = Fail to delete the broker {0} due to {1}
+jmsmanager.broker.failDeleteBrokerConfig    = Fail to delete the broker configuration file {0}
+jmsmanager.broker.failDeleteBrokerData      = Fail to delete the broker data folder {0}
+jmsmanager.broker.failFindBroker            = Fail to find the broker {0} due to {1}
+jmsmanager.broker.failStartBroker           = Fail to start the broker {0} due to {1}
+jmsmanager.broker.failStartBrokerNoReason   = Fail to start the broker {0}
+jmsmanager.broker.failStopBroker            = Fail to stop the broker {0} due to {1}
+jmsmanager.broker.failStopBrokerNoReason    = Fail to stop the broker {0}
+jmsmanager.broker.failUpdateBroker          = Fail to update the broker {0} due to {1}
+jmsmanager.broker.failUpdateBrokerNoReason  = Fail to update the broker {0}
+jmsmanager.broker.invalidBrokerConfig       = Invalid Broker Configuration XML
+jmsmanager.broker.invalidBrokerName         = A broker or GBean named {0} already exists
+jmsmanager.broker.successAddBroker          = Broker {0} is successfully added
+jmsmanager.broker.successDeleteBroker       = Successfully delete the broker {0}
+jmsmanager.broker.successDeleteBrokerConfig = Successfully delete the broker configuration file {0}
+jmsmanager.broker.successDeleteBrokerData   = Successfully delete the broker data folder {0}
+jmsmanager.broker.successStartBroker        = Successfully start broker {0}
+jmsmanager.broker.successStopBroker         = Successfully stop the broker {0}
+jmsmanager.broker.successUpdateBroker       = Successfully update the broker {0}

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/portletinfo_zh.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/portletinfo_zh.properties?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/portletinfo_zh.properties (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/resources/portletinfo_zh.properties Wed Jan 21 11:47:28 2009
@@ -1,3 +1,4 @@
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
 #=====================================================================
 #  Licensed to the Apache Software Foundation (ASF) under one or more
 #  contributor license agreements.  See the NOTICE file distributed with
@@ -26,3 +27,24 @@
 errorMsg01 = \u53D1\u9001\u6D88\u606F\u65F6\u9047\u5230\u9519\u8BEF\u3002
 
 infoMsg01 = \u6210\u529F\u53D1\u9001\u6D88\u606F\u3002
+
+jmsmanager.broker.failAddBroker             = \u7531\u4E8E {1} \u800C\u672A\u80FD\u6DFB\u52A0 Broker {0}
+jmsmanager.broker.failDeleteBroker          = \u7531\u4E8E {1} \u800C\u672A\u80FD\u5220\u9664 Broker {0}
+jmsmanager.broker.failDeleteBrokerConfig    = \u672A\u80FD\u5220\u9664 Broker \u914D\u7F6E\u6587\u4EF6 {0}
+jmsmanager.broker.failDeleteBrokerData      = \u672A\u80FD\u5220\u9664 Broker \u6570\u636E\u76EE\u5F55 {0}
+jmsmanager.broker.failFindBroker            = \u7531\u4E8E {1} \u800C\u672A\u80FD\u627E\u5230 Broker {0}
+jmsmanager.broker.failStartBroker           = \u7531\u4E8E {1} \u800C\u672A\u80FD\u542F\u52A8 Broker {0}
+jmsmanager.broker.failStartBrokerNoReason   = \u672A\u80FD\u542F\u52A8 Broker {0}
+jmsmanager.broker.failStopBroker            = \u7531\u4E8E {1} \u672A\u80FD\u505C\u6B62 Broker {0}
+jmsmanager.broker.failStopBrokerNoReason    = \u672A\u80FD\u505C\u6B62 Broker {0}
+jmsmanager.broker.failUpdateBroker          = \u7531\u4E8E {1} \u672A\u80FD\u66F4\u65B0 Broker {0}
+jmsmanager.broker.failUpdateBrokerNoReason  = \u672A\u80FD\u66F4\u65B0 Broker {0}
+jmsmanager.broker.invalidBrokerConfig       = \u975E\u6CD5 Broker XML \u914D\u7F6E\u6587\u4EF6
+jmsmanager.broker.invalidBrokerName         = \u540D\u79F0\u4E3A {0} \u7684 Broker \u6216\u8005 GBean \u5DF2\u7ECF\u5B58\u5728
+jmsmanager.broker.successAddBroker          = \u6210\u529F\u6DFB\u52A0 Broker {0}
+jmsmanager.broker.successDeleteBroker       = \u6210\u529F\u5220\u9664 Broker {0}
+jmsmanager.broker.successDeleteBrokerConfig = \u6210\u529F\u5220\u9664 Broker \u7684\u914D\u7F6E\u6587\u4EF6 {0}
+jmsmanager.broker.successDeleteBrokerData   = \u6210\u529F\u5220\u9664 Broker \u7684\u6570\u636E\u76EE\u5F55 {0}
+jmsmanager.broker.successStartBroker        = \u6210\u529F\u542F\u52A8 Broker {0}
+jmsmanager.broker.successStopBroker         = \u6210\u529F\u505C\u6B62 Broker {0}
+jmsmanager.broker.successUpdateBroker       = \u6210\u529F\u66F4\u65B0 Broker {0}

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=736391&r1=736390&r2=736391&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 Jan 21 11:47:28 2009
@@ -25,7 +25,7 @@
 <!-- Show existing connectors -->
 <c:if test="${empty(connectors)}"><fmt:message key="jmsmanager.server.connector.normal.noJMSNetworkConnectors" /></c:if>
 <c:if test="${!empty(connectors)}">
-<table width="100%" class="TableLine" summary="JMS Network Listeners - Connectors">
+<table width="50%" class="TableLine" summary="JMS Network Listeners - Connectors">
 
 
           <tr>
@@ -36,8 +36,8 @@
             <%--<th scope="col" class="DarkBackground" align="center"><fmt:message key="jmsmanager.common.state"/></th>--%>
             <%--<th scope="col" class="DarkBackground" align="center"><fmt:message key="jmsmanager.common.actions"/></th>--%>
           </tr>
-<c:set var="backgroundClass" value='MediumBackground'/>
-<c:forEach var="info" items="${connectors}">
+          <c:set var="backgroundClass" value='MediumBackground'/>
+          <c:forEach var="info" items="${connectors}">
           <c:choose>
               <c:when test="${backgroundClass == 'MediumBackground'}" >
                   <c:set var="backgroundClass" value='LightBackground'/>
@@ -46,11 +46,11 @@
                   <c:set var="backgroundClass" value='MediumBackground'/>
               </c:otherwise>
           </c:choose>
-          <tr>
-            <td class="${backgroundClass}">${info.connectorURI}</td>
-            <td class="${backgroundClass}">${info.brokerName}</td>
-            <td class="${backgroundClass}">${info.connector.protocol}</td>
-            <td class="${backgroundClass}">${info.connector.port}</td>
+          <tr class="${backgroundClass}">
+            <td>${info.connectorURI}</td>
+            <td>${info.brokerName}</td>
+            <td>${info.connector.protocol}</td>
+            <td>${info.connector.port}</td>
             <%--<td class="${backgroundClass}">--%>
              <%--<c:choose>--%>
                <%--<c:when test="${info.connector.stateInstance.name eq 'running'}">--%>
@@ -85,6 +85,7 @@
 </c:if>
 
 <!-- Links to add new connectors -->
+<!--
 <c:forEach var="info" items="${brokers}">
 <p><fmt:message key="jmsmanager.server.connector.normal.addConnectorTo"><fmt:param value="${info.brokerName}"/></fmt:message>:</p>
 <ul>
@@ -98,3 +99,4 @@
          </fmt:message></a></li>
 </c:forEach>
 </c:forEach>
+-->

Added: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/edit.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/edit.jsp?rev=736391&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/edit.jsp (added)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/edit.jsp Wed Jan 21 11:47:28 2009
@@ -0,0 +1,85 @@
+<%--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+--%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<fmt:setBundle basename="activemq"/>
+<portlet:defineObjects/>
+<form name="<portlet:namespace/>ActiveMQForm" action="<portlet:actionURL/>" onsubmit="return <portlet:namespace/>validateForm();" method="post">
+<input type="hidden" name="mode" value="${mode}"/>
+<table width="100%" align="center" border="0" cellspacing="4">    		
+    <tr>
+        <td><fmt:message key="jmsmanager.common.broker"/>&nbsp;<fmt:message key="jmsmanager.common.name"/>:
+           <c:choose>
+                <c:when test="${mode eq 'create'}">
+                    <input type="text" value="" name="brokerName" id="<portlet:namespace/>brokerName"/>
+                </c:when>
+                <c:otherwise>
+                    <span>
+                        <c:out value="${brokerWrapper.brokerName}" default=""/>
+                        <input type="hidden" name="brokerName" value="${brokerWrapper.brokerName}"/>
+                        <input type="hidden" name="brokerURI" value="${brokerWrapper.brokerURI}"/>
+                    </span>    
+                </c:otherwise>        
+            </c:choose> 
+        </td>
+    </tr>
+    <tr>
+        <td>
+            <c:choose>
+                <c:when test="${mode eq 'create'}">                    
+                    <fmt:message key="jmsmanager.broker.creationtip"/>
+                </c:when>
+                <c:otherwise>
+                    <fmt:message key="jmsmanager.broker.updatetip"/>
+                </c:otherwise>                
+            </c:choose>
+            <br/>
+         </td>
+    </tr>
+    <tr>
+        <td>            
+            <textarea id="<portlet:namespace/>configXML" name="configXML" cols="120" rows="40"><c:out value="${configXML}" default=""/></textarea>
+        </td>
+    </tr>
+    <tr>
+        <td colspan="2">        
+            <input name="submit" type="submit" value='<fmt:message key="jmsmanager.common.save"/>'/>                   
+            <input name="reset" type="reset" value='<fmt:message key="jmsmanager.common.reset"/>'/>
+        </td>
+    </tr>
+</table>                
+</table>
+</form>
+<script>
+    function <portlet:namespace/>validateForm() {
+        var configXML = document.getElementById("<portlet:namespace/>configXML").value;
+        if(configXML == "")
+        {
+            alert("<fmt:message key="jmsmanager.broker.emptybrokerconfig"/>");
+            return false;
+        }
+        var brokerName = document.getElementById("<portlet:namespace/>brokerName").value;
+        if(brokerName == "")
+        {
+            alert("<fmt:message key="jmsmanager.broker.emptybrokername"/>");
+            return false;
+        }       
+        return true;
+    }
+</script>
+        
\ No newline at end of file

Propchange: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/server/edit.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

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=736391&r1=736390&r2=736391&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 Jan 21 11:47:28 2009
@@ -17,67 +17,70 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib uri="/WEB-INF/CommonMsg.tld" prefix="CommonMsg"%>
 <fmt:setBundle basename="activemq"/>
 <portlet:defineObjects/>
 
 <p><fmt:message key="jmsmanager.server.normal.title" />:</p>
-
-<!-- Show existing connectors -->
-<c:if test="${empty(brokers)}"><fmt:message key="jmsmanager.server.normal.noJMSBrokers"/></c:if>
-<c:if test="${!empty(brokers)}">
-<table width="50%" class="TableLine" summary="JMS Server Manager - Brokers">
-
-          <tr>
+<CommonMsg:commonMsg/><br>
+<c:choose>
+    <c:when test="${empty(brokers)}">
+           <fmt:message key="jmsmanager.server.normal.noJMSBrokers"/>
+    </c:when>
+    <c:otherwise>
+    <table width="50%" class="TableLine" summary="JMS Server Manager - Brokers">
+        <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">Actions</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>
           </tr>
-<c:set var="backgroundClass" value='MediumBackground'/>
-<c:forEach var="entry" items="${brokers}">
+          <c:forEach var="entry" items="${brokers}" varStatus="status">
           <c:choose>
-              <c:when test="${backgroundClass == 'MediumBackground'}" >
+              <c:when test="${status.count%2==0}">
                   <c:set var="backgroundClass" value='LightBackground'/>
               </c:when>
               <c:otherwise>
                   <c:set var="backgroundClass" value='MediumBackground'/>
               </c:otherwise>
           </c:choose>
-          <tr>
-            <td class="${backgroundClass}">${entry.brokerName}</td>
-            <%--<td class="${backgroundClass}">--%>
-             <%--<c:choose>--%>
-               <%--<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.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.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.brokerURI}" />--%>
-               <%--</portlet:actionURL>">edit</a>--%>
-               <%--<a href="<portlet:actionURL portletMode="view">--%>
-                 <%--<portlet:param name="mode" value="delete" />--%>
-                 <%--<portlet:param name="objectName" value="${entry.brokerURI}" />--%>
-               <%--</portlet:actionURL>" onClick="return confirm('Are you sure you want to delete ${entry.brokerName}?');">delete</a>--%>
-             <!--</td>-->
-
+          <tr class="${backgroundClass}">
+            <td>${entry.brokerName}</td>
+            <td>${entry.state.name}</td>
+            <td>
+             <c:choose>
+               <c:when test="${entry.state.name eq 'running'}">
+               <a href="<portlet:actionURL portletMode="view">
+                 <portlet:param name="mode" value="stop" />
+                 <portlet:param name="brokerURI" value="${entry.brokerURI}" />
+                 <portlet:param name="brokerName" value="${entry.brokerName}" />   
+               </portlet:actionURL>"><fmt:message key="jmsmanager.common.stop"/></a>
+               </c:when>
+               <c:otherwise>
+               <a href="<portlet:actionURL portletMode="view">
+                 <portlet:param name="mode" value="start" />
+                 <portlet:param name="brokerURI" value="${entry.brokerURI}" />
+                 <portlet:param name="brokerName" value="${entry.brokerName}" />   
+               </portlet:actionURL>"><fmt:message key="jmsmanager.common.start"/></a>
+               </c:otherwise>
+             </c:choose>
+               <a href="<portlet:renderURL portletMode="view">
+                 <portlet:param name="mode" value="update" />
+                 <portlet:param name="brokerURI" value="${entry.brokerURI}" />
+                 <portlet:param name="brokerName" value="${entry.brokerName}" />   
+               </portlet:renderURL>"><fmt:message key="jmsmanager.common.edit"/></a>
+               <a href="<portlet:actionURL portletMode="view">
+                 <portlet:param name="mode" value="delete" />
+                 <portlet:param name="brokerURI" value="${entry.brokerURI}" />
+                 <portlet:param name="brokerName" value="${entry.brokerName}" />   
+               </portlet:actionURL>" onClick="return confirm('Are you sure you want to delete ${entry.brokerName}?');"><fmt:message key="jmsmanager.common.delete"/></a>
+             </td>
           </tr>
 </c:forEach>
 </table>
-</c:if>
-<!--
+</c:otherwise>
+</c:choose>
+
 <br />
-<a href="<portlet:actionURL portletMode="view">
-           <portlet:param name="mode" value="new" />
-         </portlet:actionURL>"><fmt:message key="jmsmanager.server.normal.addJMSBroker"/></a>
--->
+<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/view/jmsmanager/viewDLQ.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/viewDLQ.jsp?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/viewDLQ.jsp (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/viewDLQ.jsp Wed Jan 21 11:47:28 2009
@@ -40,7 +40,7 @@
         <td class="DarkBackground" align="center"><b><fmt:message key="jmsmanager.common.correlationID" /></b></td>
     </tr>
     <c:choose>
-        <c:when test="${fn:length(messages) > 0}"> 
+        <c:when test="${!empty(dlqcontents)}"> 
         <% 
         String[] styles = {"LightBackground","MediumBackground"};
         List messages = (List)request.getAttribute("dlqcontents");

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/viewmessages.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/viewmessages.jsp?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/viewmessages.jsp (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmsmanager/viewmessages.jsp Wed Jan 21 11:47:28 2009
@@ -38,7 +38,7 @@
         <td class="DarkBackground" align="center"><b><fmt:message key="jmsmanager.common.correlationID" /></b></td>
     </tr>
     <c:choose>
-        <c:when test="${fn:length(messages) > 0}"> 
+        <c:when test="${!empty(messages)}"> 
         <% 
         String[] styles = {"LightBackground","MediumBackground"};
         List messages = (List)request.getAttribute("messages");

Modified: geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmswizard/list.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmswizard/list.jsp?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmswizard/list.jsp (original)
+++ geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main/webapp/WEB-INF/view/jmswizard/list.jsp Wed Jan 21 11:47:28 2009
@@ -25,22 +25,17 @@
 <c:choose>
   <c:when test="${empty(resources)}"><p><i><fmt:message key="jmswizard.list.noJMSResourceGroups" /></i></p></c:when>
   <c:otherwise>
-<!--
-<p>For each resource listed, you can click the <b>usage</b> link to see examples of how
-  to use the connection factories and destinations from your application.</p>
--->
-
     <c:forEach var="resource" items="${resources}">
       <b><c:out value="${resource.name}"/> (<c:out value="${resource.configurationName}"/>):</b>
       <table width="100%" class="TableLine" summary="JMS Resources">
-        <tr>
-          <th scope="col" class="DarkBackground"><fmt:message key="jmswizard.common.type"/></th>
-          <th scope="col" class="DarkBackground"><fmt:message key="jmswizard.common.name"/></th>
-          <th scope="col" class="DarkBackground" align="center"><fmt:message key="jmswizard.common.deployedAs"/></th>
-          <th scope="col" class="DarkBackground" align="center"><fmt:message key="jmswizard.common.state"/></th>
-          <th scope="col" class="DarkBackground" align="center"><fmt:message key="jmswizard.common.consumerCount"/></th>
-          <th scope="col" class="DarkBackground" align="center"><fmt:message key="jmswizard.common.queueSize"/></th>
-          <th scope="col" class="DarkBackground" align="center"><fmt:message key="jmswizard.common.actions"/></th>
+        <tr class="DarkBackground">
+          <th scope="col"><fmt:message key="jmswizard.common.type"/></th>
+          <th scope="col"><fmt:message key="jmswizard.common.name"/></th>
+          <th scope="col" align="center"><fmt:message key="jmswizard.common.deployedAs"/></th>
+          <th scope="col" align="center"><fmt:message key="jmswizard.common.state"/></th>
+          <th scope="col" align="center"><fmt:message key="jmswizard.common.consumerCount"/></th>
+          <th scope="col" align="center"><fmt:message key="jmswizard.common.queueSize"/></th>
+          <th scope="col" align="center"><fmt:message key="jmswizard.common.actions"/></th>
         </tr>
         <c:set var="backgroundClass" value='MediumBackground'/>
         <c:forEach var="factory" items="${resource.connectionFactories}">
@@ -52,10 +47,10 @@
                     <c:set var="backgroundClass" value='MediumBackground'/>
                 </c:otherwise>
             </c:choose>
-            <tr>
-              <td class="${backgroundClass}"><fmt:message key="jmswizard.common.connFactory" /> </td>
-              <td class="${backgroundClass}">${factory.name}</td>
-              <td class="${backgroundClass}">
+            <tr class="${backgroundClass}">
+              <td><fmt:message key="jmswizard.common.connFactory" /> </td>
+              <td>${factory.name}</td>
+              <td>
                 <c:choose>
                   <c:when test="${empty resource.parentName}">
                     <fmt:message key="jmswizard.list.serverWide" /> 
@@ -65,8 +60,10 @@
                   </c:otherwise>
                 </c:choose>
               </td>
-              <td class="${backgroundClass}">${factory.stateName}</td>
-              <td class="${backgroundClass}">
+              <td>${factory.stateName}</td>
+              <td>&nbsp;</td>
+              <td>&nbsp;</td>
+              <td>&nbsp;
                 <%--
                 <a href="<portlet:actionURL portletMode="view">
                   <portlet:param name="mode" value="editExisting" />
@@ -93,10 +90,10 @@
                     <c:set var="backgroundClass" value='MediumBackground'/>
                 </c:otherwise>
             </c:choose>
-            <tr>
-              <td class="${backgroundClass}">${admin.type}</td>
-              <td class="${backgroundClass}">${admin.name}</td>
-              <td class="${backgroundClass}">
+            <tr class="${backgroundClass}">
+              <td>${admin.type}</td>
+              <td>${admin.name}</td>
+              <td>
                 <c:choose>
                   <c:when test="${empty resource.parentName}">
                     <fmt:message key="jmswizard.list.serverWide" /> 
@@ -106,59 +103,73 @@
                   </c:otherwise>
                 </c:choose>
               </td>
-              <td class="${backgroundClass}">${admin.stateName}</td>
-              <td class="${backgroundClass}">
-              <c:if test="${admin.destinationStat != null}">
-              	${admin.destinationStat.consumerCount}
-              </c:if>
-              </td>
-              <td class="${backgroundClass}">
-              <c:if test="${admin.destinationStat != null}">
-              	${admin.destinationStat.queueSize}
-              </c:if>
-              </td>
-              <td class="${backgroundClass}">
-              <c:if test="${ admin.type == 'Queue'}">
-                 <a href="<portlet:actionURL portletMode="view">
-	                  <portlet:param name="mode" value="viewMessages-before" />
-	                  <portlet:param name="adminObjName" value="${admin.name}" />
-	                  <portlet:param name="physicalName" value="${admin.physicalName}" />
-	                  <portlet:param name="adminObjType" value="${admin.type}" />
-	                  <portlet:param name="adapterObjectName" value="${resource.adapterObjectName}" />
-	                </portlet:actionURL>"><fmt:message key="jmswizard.common.Browse" /></a>
-	         </c:if>
-             <a href="<portlet:actionURL portletMode="view">
-                  <portlet:param name="mode" value="sendmessage-before" />
-                  <portlet:param name="adminObjName" value="${admin.name}" />
-                  <portlet:param name="physicalName" value="${admin.physicalName}" />
-                  <portlet:param name="adminObjType" value="${admin.type}" />
-                  <portlet:param name="adapterObjectName" value="${resource.adapterObjectName}" />
-                </portlet:actionURL>"><fmt:message key="jmswizard.common.Send" /></a>
-              <c:if test="${ admin.type == 'Queue'}">
-                <a href="<portlet:actionURL portletMode="view">
-                  <portlet:param name="mode" value="list-before" />
-                  <portlet:param name="purge" value="purge" />
-                  <portlet:param name="adminObjName" value="${admin.name}" />
-                  <portlet:param name="physicalName" value="${admin.physicalName}" />
-                  <portlet:param name="adminObjType" value="${admin.type}" />
-                  <portlet:param name="adapterObjectName" value="${resource.adapterObjectName}" />
-                </portlet:actionURL>" onclick="return confirm('Confirm message purge?');"><fmt:message key="jmswizard.common.Purge"/></a>
-              </c:if>
-                <%--
-                <a href="<portlet:actionURL portletMode="view">
-                  <portlet:param name="mode" value="editExisting" />
-                  <portlet:param name="adapterObjectName" value="${pool.adapterObjectName}" />
-                  <portlet:param name="objectName" value="${pool.factoryObjectName}" />
-                </portlet:actionURL>">edit</a>
-                <a href="<portlet:actionURL portletMode="view">
-                  <portlet:param name="mode" value="usage" />
-                  <portlet:param name="name" value="${pool.name}" />
-                  <portlet:param name="objectName" value="${pool.factoryObjectName}" />
-                </portlet:actionURL>">usage</a>
-                Test
-                Statistics
-                --%>
-              </td>
+              <td>${admin.stateName}</td>
+              <c:choose>
+                  <c:when test="${admin.stateName == 'running'}">
+                      <td>
+                          <c:if test="${admin.destinationStat != null}">
+                          	${admin.destinationStat.consumerCount}
+                          </c:if>
+                      </td>
+                      <td>
+                          <c:if test="${admin.destinationStat != null}">
+                          	${admin.destinationStat.queueSize}
+                          </c:if>
+                      </td>
+                      <td>
+                      <c:if test="${ admin.type == 'Queue' && !empty(resource.connectionFactories)}">
+                         <a href="<portlet:actionURL portletMode="view">
+        	                  <portlet:param name="mode" value="viewMessages-before" />
+        	                  <portlet:param name="adminObjName" value="${admin.name}" />
+        	                  <portlet:param name="physicalName" value="${admin.physicalName}" />
+        	                  <portlet:param name="adminObjType" value="${admin.type}" />
+        	                  <portlet:param name="adapterObjectName" value="${resource.adapterObjectName}" />
+            	                  <portlet:param name="brokerName" value="${resource.brokerName}" />
+        	                </portlet:actionURL>"><fmt:message key="jmswizard.common.Browse" /></a>
+        	         </c:if>
+                     <c:if test="${!empty(resource.connectionFactories)}">
+                     <a href="<portlet:actionURL portletMode="view">
+                          <portlet:param name="mode" value="sendmessage-before" />
+                          <portlet:param name="adminObjName" value="${admin.name}" />
+                          <portlet:param name="physicalName" value="${admin.physicalName}" />
+                          <portlet:param name="adminObjType" value="${admin.type}" />
+                          <portlet:param name="adapterObjectName" value="${resource.adapterObjectName}" />
+                              <portlet:param name="brokerName" value="${resource.brokerName}" />  
+                        </portlet:actionURL>"><fmt:message key="jmswizard.common.Send" /></a>
+                      </c:if>
+                      <c:if test="${ admin.type == 'Queue' && !empty(resource.connectionFactories)}">
+                        <a href="<portlet:actionURL portletMode="view">
+                          <portlet:param name="mode" value="list-before" />
+                          <portlet:param name="purge" value="purge" />
+                          <portlet:param name="adminObjName" value="${admin.name}" />
+                          <portlet:param name="physicalName" value="${admin.physicalName}" />
+                          <portlet:param name="adminObjType" value="${admin.type}" />
+                          <portlet:param name="adapterObjectName" value="${resource.adapterObjectName}" />
+                              <portlet:param name="brokerName" value="${resource.brokerName}" />   
+                        </portlet:actionURL>" onclick="return confirm('Confirm message purge?');"><fmt:message key="jmswizard.common.Purge"/></a>
+                      </c:if>
+                        <%--
+                        <a href="<portlet:actionURL portletMode="view">
+                          <portlet:param name="mode" value="editExisting" />
+                          <portlet:param name="adapterObjectName" value="${pool.adapterObjectName}" />
+                          <portlet:param name="objectName" value="${pool.factoryObjectName}" />
+                        </portlet:actionURL>">edit</a>
+                        <a href="<portlet:actionURL portletMode="view">
+                          <portlet:param name="mode" value="usage" />
+                          <portlet:param name="name" value="${pool.name}" />
+                          <portlet:param name="objectName" value="${pool.factoryObjectName}" />
+                        </portlet:actionURL>">usage</a>
+                        Test
+                        Statistics
+                        --%>
+                      </td>
+                </c:when>
+            <c:otherwise>
+                <td>&nbsp;</td>
+                <td>&nbsp;</td>
+                <td>&nbsp;</td>
+            </c:otherwise>
+            </c:choose>    
             </tr>
         </c:forEach>
       </table><br/>

Modified: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java (original)
+++ geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/BrokerServiceGBeanImpl.java Wed Jan 21 11:47:28 2009
@@ -19,7 +19,6 @@
 
 import java.io.File;
 import java.net.URI;
-import java.util.Properties;
 
 import javax.jms.JMSException;
 
@@ -56,7 +55,8 @@
 //    private ResourceSource<ResourceException> dataSource;
     private JMSManager manager;
 
-    public BrokerServiceGBeanImpl(@ParamAttribute (name="amqBaseDir") URI amqBaseDir, 
+    public BrokerServiceGBeanImpl(@ParamAttribute (name="brokerName") String brokerName,
+                                  @ParamAttribute (name="amqBaseDir") URI amqBaseDir, 
                                   @ParamAttribute (name="amqDataDir") String amqDataDir, 
                                   @ParamAttribute (name="amqConfigFile") String amqConfigFile, 
                                   @ParamAttribute (name="useShutdownHook") boolean useShutdownHook, 
@@ -76,9 +76,14 @@
         try {
             BrokerFactoryBean brokerFactory = new BrokerFactoryBean(
                     new FileSystemResource(new File(amqConfigUri)));
-            System.setProperty("activemq.home", new File(baseDir).toString());
-            System.setProperty("activemq.data", new File(dataDir).toString());
-            brokerFactory.afterPropertiesSet();
+            //TODO There should be a better way to avoid the concurrent broker creations
+            synchronized (BrokerServiceGBeanImpl.class) {
+                System.setProperty("activemq.brokerName", brokerName);
+                System.setProperty("activemq.home", new File(baseDir).toString());
+                System.setProperty("activemq.data", new File(dataDir).toString());
+                System.setProperty("activemq.geronimo.home.url", new File(serverInfo.getBaseDirectory()).toURI().toURL().toString());
+                brokerFactory.afterPropertiesSet();                
+            }
             brokerService = brokerFactory.getBroker();
 //            brokerService = BrokerFactory.createBroker(new URI(brokerUri));
             
@@ -93,8 +98,7 @@
             // Setup the persistence adapter to use the right datasource and directory
 //            DefaultPersistenceAdapterFactory persistenceFactory = (DefaultPersistenceAdapterFactory) brokerService.getPersistenceFactory();
 //            persistenceFactory.setDataDirectoryFile(serverInfo.resolveServer(dataDirectory));
-//            persistenceFactory.setDataSource((DataSource) dataSource.getResource());
-
+//            persistenceFactory.setDataSource((DataSource) dataSource.getResource());            
             brokerService.start();
         }
         finally {

Added: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/GeronimoPropertyPlaceholderConfigurer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/GeronimoPropertyPlaceholderConfigurer.java?rev=736391&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/GeronimoPropertyPlaceholderConfigurer.java (added)
+++ geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/GeronimoPropertyPlaceholderConfigurer.java Wed Jan 21 11:47:28 2009
@@ -0,0 +1,83 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.activemq;
+
+import java.util.Properties;
+
+import org.apache.commons.jexl.Expression;
+import org.apache.commons.jexl.ExpressionFactory;
+import org.apache.commons.jexl.JexlContext;
+import org.apache.commons.jexl.JexlHelper;
+import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
+
+/**
+ * Samples: 1. ${a}
+ *          2. ${a${a}}
+ *          3. ${${a} + 10}
+ */
+public class GeronimoPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
+
+    @Override
+    protected String resolveSystemProperty(String placeholder) {
+        String sPropertyValue = super.resolveSystemProperty(placeholder);
+        if (sPropertyValue == null) {
+            sPropertyValue = parseSystemProperty(placeholder);
+            //TODO No way to get the SearchSystemEnvironment property
+            if (sPropertyValue == null)
+                sPropertyValue = parseEnvProperty(placeholder);
+        }
+        return sPropertyValue;
+    }
+
+    @Override
+    protected String resolvePlaceholder(String placeholder, Properties props) {
+        String sPropertyValue = super.resolvePlaceholder(placeholder, props);
+        if (sPropertyValue == null) {
+            try {
+                Expression expression = ExpressionFactory.createExpression(placeholder);
+                JexlContext jexlContext = JexlHelper.createContext();
+                jexlContext.setVars(props);
+                sPropertyValue = expression.evaluate(jexlContext).toString();
+            } catch (Throwable t) {
+            }
+        }
+        return sPropertyValue;
+    }
+
+    private String parseSystemProperty(String placeholder) {
+        try {
+            Expression expression = ExpressionFactory.createExpression(placeholder);
+            JexlContext jexlContext = JexlHelper.createContext();
+            jexlContext.setVars(System.getProperties());
+            return expression.evaluate(jexlContext).toString();
+        } catch (Throwable t) {
+            return null;
+        }
+    }
+
+    private String parseEnvProperty(String placeholder) {
+        try {
+            Expression expression = ExpressionFactory.createExpression(placeholder);
+            JexlContext jexlContext = JexlHelper.createContext();
+            jexlContext.setVars(System.getenv());
+            return expression.evaluate(jexlContext).toString();
+        } catch (Throwable t) {
+            return null;
+        }
+    }
+}

Propchange: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/GeronimoPropertyPlaceholderConfigurer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQManagerGBean.java?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQManagerGBean.java (original)
+++ geronimo/server/trunk/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/management/ActiveMQManagerGBean.java Wed Jan 21 11:47:28 2009
@@ -22,34 +22,27 @@
 import java.util.List;
 import java.util.Set;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import org.apache.activemq.broker.TransportConnector;
 import org.apache.geronimo.activemq.ActiveMQBroker;
-import org.apache.geronimo.activemq.ActiveMQConnector;
 import org.apache.geronimo.activemq.ActiveMQManager;
 import org.apache.geronimo.activemq.BrokerServiceGBean;
-//import org.apache.geronimo.activemq.TransportConnectorGBeanImpl;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
-//import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelException;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.EditableConfigurationManager;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.management.geronimo.JMSBroker;
 import org.apache.geronimo.management.geronimo.JMSConnector;
 import org.apache.geronimo.management.geronimo.NetworkConnector;
-import org.apache.activemq.broker.TransportConnector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Implementation of the ActiveMQ management interface.  These are the ActiveMQ
@@ -88,25 +81,31 @@
     public boolean isStatisticsProvider() {
         return false;
     }
-
+    
+    /*
+     * Only running JMS brokers are returned. 
+     */
     public Object[] getContainers() {
         AbstractNameQuery query = new AbstractNameQuery(ActiveMQBroker.class.getName());
         Set<AbstractName> names = kernel.listGBeans(query);
-        ActiveMQBroker[] results = new ActiveMQBroker[names.size()];
-        int i=0;
-        for (AbstractName name: names) {
+        List<ActiveMQBroker> results = new ArrayList<ActiveMQBroker>(names.size());
+        for (AbstractName name : names) {
             try {
-                results[i] = (ActiveMQBroker) kernel.getGBean(name);
+                if (kernel.isRunning(name)) {
+                    results.add((ActiveMQBroker)kernel.getGBean(name));
+                }
             } catch (GBeanNotFoundException e) {
                 log.info("broker not found", e);
             }
         }
-        return results;
+        return results.toArray(new ActiveMQBroker[]{});
     }
 
     public String[] getSupportedProtocols() {
         // see files in modules/core/src/conf/META-INF/services/org/activemq/transport/server/
-        return new String[]{};// "tcp", "stomp", "vm", "peer", "udp", "multicast", "failover"};
+        //TODO No sure how to list the files in the classpath, temporary hard coded the supported protocols in the code
+        return new String[] { "tcp", "stomp", "vm", "peer", "udp", "multicast", "failover", "stomp+ssl", "nio", "mock",
+                "fanout", "discovery" };
     }
 
     public NetworkConnector[] getConnectors() {
@@ -134,7 +133,7 @@
 
     private void filterConnectorsByProtocol(String protocol, List<NetworkConnector> connectors) {
         for (Iterator<NetworkConnector> connectorIterator = connectors.iterator(); connectorIterator.hasNext();) {
-            if (protocol.equals(connectorIterator.next().getProtocol())) {
+            if (!protocol.equals(connectorIterator.next().getProtocol())) {
                 connectorIterator.remove();
             }
         }
@@ -175,5 +174,45 @@
     public void removeConnector(AbstractName connectorName) {
         throw new RuntimeException("not implemented");
    }
+    
+    public JMSBroker addBroker(String brokerName, GBeanData brokerGBeanData) throws KernelException,
+            InvalidConfigException {
+        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
+        if (mgr != null) {
+            AbstractName brokerAbstractName = null;
+            try {
+                mgr.addGBeanToConfiguration(kernel.getAbstractNameFor(this).getArtifact(), brokerGBeanData, false);
+                brokerAbstractName = brokerGBeanData.getAbstractName();
+                return (JMSBroker) kernel.getProxyManager().createProxy(brokerAbstractName,
+                        ActiveMQBroker.class.getClassLoader());
+            } catch (InvalidConfigException e) {
+                log.error("Unable to add ActiveMQ broker [" + brokerName + "]", e);
+                throw e;
+            } finally {
+                ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
+            }
+        } else {
+            log.warn("The ConfigurationManager in the kernel does not allow editing");
+            return null;
+        }
+    }
 
+    public void removeBroker(AbstractName brokerAbstractName) throws KernelException, InvalidConfigException {
+        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
+        if (mgr != null) {
+            try {
+                mgr.removeGBeanFromConfiguration(brokerAbstractName.getArtifact(), brokerAbstractName);
+            } catch (InvalidConfigException e) {
+                log.error("Unable to remove ActiveMQ broker [" + brokerAbstractName + "]", e);
+                throw e;
+            } catch (GBeanNotFoundException e) {
+                log.error("Fail to get ActiveMQ broker from kernel [" + brokerAbstractName + "]");
+                throw e;
+            } finally {
+                ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
+            }
+        } else {
+            log.warn("The ConfigurationManager in the kernel does not allow editing");
+        }
+    } 
 }

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml?rev=736391&r1=736390&r2=736391&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml Wed Jan 21 11:47:28 2009
@@ -77,6 +77,14 @@
             <type>car</type>
         </dependency>
 
+        <!-- Hack, due to new AMQ 5.3 + Spring integration -->
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>activemq-ra</artifactId>
+            <version>${pom.version}</version>
+            <type>car</type>
+        </dependency>
+
         <!--<dependency>-->
             <!--<groupId>org.apache.geronimo.plugins</groupId>-->
             <!--<artifactId>sysdb-console-jetty</artifactId>-->



Mime
View raw message