geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r803001 - in /geronimo/server/trunk/plugins/activemq/activemq-portlets/src/main: java/org/apache/geronimo/console/jmsmanager/wizard/ListScreenHandler.java webapp/WEB-INF/view/jmswizard/list.jsp
Date Tue, 11 Aug 2009 06:18:51 GMT
Author: xuhaihong
Date: Tue Aug 11 06:18:51 2009
New Revision: 803001

URL: http://svn.apache.org/viewvc?rev=803001&view=rev
Log:
GERONIMO-4625 JMS statistics does not work correctly while the server url is of vm protocol

First step change, at least the portlet could display correctly even if the broker name could
not be detected.

Modified:
    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/jmswizard/list.jsp

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=803001&r1=803000&r2=803001&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
Tue Aug 11 06:18:51 2009
@@ -47,7 +47,6 @@
 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;
@@ -69,7 +68,7 @@
  * @version $Rev$ $Date$
  */
 public class ListScreenHandler extends AbstractHandler {
-    private static final Logger log = LoggerFactory.getLogger(ListScreenHandler.class);
+    private static final Logger logger = LoggerFactory.getLogger(ListScreenHandler.class);
 
     public ListScreenHandler() {
         super(LIST_MODE, "/WEB-INF/view/jmswizard/list.jsp");
@@ -123,7 +122,7 @@
             try {
                 helper.purge(renderRequest, brokerName, adminObjType, physicalName);
             } catch (Exception e) {
-                log.error("Fail to purge the messages in [" + brokerName + "." + physicalName
+ "]", e);
+                logger.error("Fail to purge the messages in [" + brokerName + "." + physicalName
+ "]", e);
                 throw new PortletException("Fail to purge the messages in [" + brokerName
+ "." + physicalName + "]",e);
             }
         }                
@@ -147,9 +146,9 @@
                 }                
                 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);
                         }
@@ -157,7 +156,7 @@
                     if (name == null) {
                         name = ObjectName.getInstance(module.getObjectName()).getKeyProperty(NameFactory.J2EE_NAME);
                     }
-                    String sServerUrl = adapters.length > 0 ? getServerUrl(renderRequest,module)
: "";                                        
+                    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(), getBrokerName(renderRequest,
sServerUrl, name));
                     resources.add(target);
@@ -213,7 +212,7 @@
                     try {
                         physicalName = (String) admins[j].getConfigProperty("PhysicalName");
                     } catch (Exception e) {
-                        log.warn("PhysicalName undefined, using queueName as PhysicalName");
+                        logger.warn("PhysicalName undefined, using queueName as PhysicalName");
                         physicalName = queueName;
                     }
                     String destType = admins[j].getAdminObjectInterface().indexOf("Queue")
> -1 ? "Queue" : "Topic";
@@ -230,7 +229,7 @@
                 }
             }
         } catch (MalformedObjectNameException e) {
-            log.error(e.getMessage(), e);
+            logger.error(e.getMessage(), e);
         }
 
         Collections.sort(resources);
@@ -248,7 +247,7 @@
             }
             return "";
         } catch (Exception e) {
-            log.error("Fail to get server URL of the JMS resource",e);
+            logger.error("Fail to get server URL of the JMS resource",e);
             return "";
         }
     }
@@ -260,7 +259,7 @@
             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");            
+                logger.warn("More than one ActiveMQ Manager exist in kernel");          
 
             JMSManager activeMQManager = (JMSManager) geronimoManagedBeans[0];          
 
             JMSBroker targetJMSBroker = null;
             URI uri = new URI(serverURL);            
@@ -304,10 +303,11 @@
                 if (targetJMSBroker != null)
                     return ((BrokerServiceGBean) targetJMSBroker).getBrokerName();
             }
-            throw new PortletException("Could not find the broker according to the url ["
+ serverURL + "]");
+            logger.warn("Could not find the broker according to the url [" + serverURL +
"]");
+            return null;
         } catch (URISyntaxException e) {
-            log.error("Unrecognized server URL [" + serverURL + "]", e);
-            throw new PortletException("Unrecognized server URL [" + serverURL + "]", e);
+            logger.error("Unrecognized server URL [" + serverURL + "]", e);
+            return null;
         }
     }
     

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=803001&r1=803000&r2=803001&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
Tue Aug 11 06:18:51 2009
@@ -119,7 +119,7 @@
                           </c:if>
                       </td>
                       <td>
-                      <c:if test="${ admin.type == 'Queue' && !empty(resource.connectionFactories)}">
+                      <c:if test="${ admin.type == 'Queue' && !empty(resource.connectionFactories)
&& resource.brokerName != null}">
                          <a href="<portlet:actionURL portletMode="view">
         	                  <portlet:param name="mode" value="viewMessages-before" />
         	                  <portlet:param name="adminObjName" value="${admin.name}" />
@@ -129,7 +129,7 @@
             	                  <portlet:param name="brokerName" value="${resource.brokerName}"
/>
         	                </portlet:actionURL>"><fmt:message key="jmswizard.common.Browse"
/></a>
         	         </c:if>
-                     <c:if test="${!empty(resource.connectionFactories)}">
+                     <c:if test="${!empty(resource.connectionFactories) && resource.brokerName
!= null}">
                      <a href="<portlet:actionURL portletMode="view">
                           <portlet:param name="mode" value="sendmessage-before" />
                           <portlet:param name="adminObjName" value="${admin.name}" />
@@ -139,7 +139,7 @@
                               <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)}">
+                      <c:if test="${ admin.type == 'Queue' && !empty(resource.connectionFactories)
&& resource.brokerName != null}">
                         <a href="<portlet:actionURL portletMode="view">
                           <portlet:param name="mode" value="list-before" />
                           <portlet:param name="purge" value="purge" />



Mime
View raw message