camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1470579 - in /camel/branches/camel-2.11.x: ./ platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/
Date Mon, 22 Apr 2013 15:33:33 GMT
Author: davsclaus
Date: Mon Apr 22 15:33:33 2013
New Revision: 1470579

URL: http://svn.apache.org/r1470579
Log:
CAMEL-6297 camel karaf command supports a custom JMX Agent, with thanks to Michael

Modified:
    camel/branches/camel-2.11.x/   (props changed)
    camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
    camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
    camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteProfile.java
    camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteResetStats.java

Propchange: camel/branches/camel-2.11.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1469819

Propchange: camel/branches/camel-2.11.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Apr 22 15:33:33 2013
@@ -1 +1 @@
-/camel/trunk:1-1468763,1470420,1470429,1470508
+/camel/trunk:1-1468763,1469819,1470420,1470429,1470508

Modified: camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java?rev=1470579&r1=1470578&r2=1470579&view=diff
==============================================================================
--- camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
(original)
+++ camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/ContextInfo.java
Mon Apr 22 15:33:33 2013
@@ -27,7 +27,6 @@ import javax.management.ObjectName;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Route;
-import org.apache.camel.management.DefaultManagementAgent;
 import org.apache.camel.spi.ManagementAgent;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
@@ -74,7 +73,7 @@ public class ContextInfo extends OsgiCom
         if (agent != null) {
             MBeanServer mBeanServer = agent.getMBeanServer();
 
-            Set<ObjectName> set = mBeanServer.queryNames(new ObjectName(DefaultManagementAgent.DEFAULT_DOMAIN
+ ":type=context,name=\"" + name + "\",*"), null);
+            Set<ObjectName> set = mBeanServer.queryNames(new ObjectName(agent.getMBeanObjectDomainName()
+ ":type=context,name=\"" + name + "\",*"), null);
             Iterator<ObjectName> iterator = set.iterator();
             if (iterator.hasNext()) {
                 contextMBean = iterator.next();

Modified: camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java?rev=1470579&r1=1470578&r2=1470579&view=diff
==============================================================================
--- camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
(original)
+++ camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteInfo.java
Mon Apr 22 15:33:33 2013
@@ -26,7 +26,6 @@ import javax.management.ObjectName;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
-import org.apache.camel.management.DefaultManagementAgent;
 import org.apache.camel.model.ModelHelper;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.spi.ManagementAgent;
@@ -75,7 +74,7 @@ public class RouteInfo extends OsgiComma
             ManagementAgent agent = camelContext.getManagementStrategy().getManagementAgent();
             if (agent != null) {
                 MBeanServer mBeanServer = agent.getMBeanServer();
-                Set<ObjectName> set = mBeanServer.queryNames(new ObjectName(DefaultManagementAgent.DEFAULT_DOMAIN
+ ":type=routes,name=\"" + route + "\",*"), null);
+                Set<ObjectName> set = mBeanServer.queryNames(new ObjectName(agent.getMBeanObjectDomainName()
+ ":type=routes,name=\"" + route + "\",*"), null);
                 Iterator<ObjectName> iterator = set.iterator();
                 if (iterator.hasNext()) {
                     ObjectName routeMBean = iterator.next();
@@ -83,6 +82,8 @@ public class RouteInfo extends OsgiComma
                     // the route must be part of the camel context
                     String camelId = (String) mBeanServer.getAttribute(routeMBean, "CamelId");
                     if (camelId != null && camelId.equals(camelContext.getName()))
{
+                        Integer inflightExchange = (Integer) mBeanServer.getAttribute(routeMBean,
"InflightExchanges");
+                        System.out.println(StringEscapeUtils.unescapeJava("\tInflight Exchanges:
" + inflightExchange));
                         Long exchangesTotal = (Long) mBeanServer.getAttribute(routeMBean,
"ExchangesTotal");
                         System.out.println(StringEscapeUtils.unescapeJava("\tExchanges Total:
" + exchangesTotal));
                         Long exchangesCompleted = (Long) mBeanServer.getAttribute(routeMBean,
"ExchangesCompleted");
@@ -90,17 +91,17 @@ public class RouteInfo extends OsgiComma
                         Long exchangesFailed = (Long) mBeanServer.getAttribute(routeMBean,
"ExchangesFailed");
                         System.out.println(StringEscapeUtils.unescapeJava("\tExchanges Failed:
" + exchangesFailed));
                         Long minProcessingTime = (Long) mBeanServer.getAttribute(routeMBean,
"MinProcessingTime");
-                        System.out.println(StringEscapeUtils.unescapeJava("\tMin Processing
Time: " + minProcessingTime + "ms"));
+                        System.out.println(StringEscapeUtils.unescapeJava("\tMin Processing
Time: " + minProcessingTime + " ms"));
                         Long maxProcessingTime = (Long) mBeanServer.getAttribute(routeMBean,
"MaxProcessingTime");
-                        System.out.println(StringEscapeUtils.unescapeJava("\tMax Processing
Time: " + maxProcessingTime + "ms"));
+                        System.out.println(StringEscapeUtils.unescapeJava("\tMax Processing
Time: " + maxProcessingTime + " ms"));
                         Long meanProcessingTime = (Long) mBeanServer.getAttribute(routeMBean,
"MeanProcessingTime");
-                        System.out.println(StringEscapeUtils.unescapeJava("\tMean Processing
Time: " + meanProcessingTime + "ms"));
+                        System.out.println(StringEscapeUtils.unescapeJava("\tMean Processing
Time: " + meanProcessingTime + " ms"));
                         Long totalProcessingTime = (Long) mBeanServer.getAttribute(routeMBean,
"TotalProcessingTime");
-                        System.out.println(StringEscapeUtils.unescapeJava("\tTotal Processing
Time: " + totalProcessingTime + "ms"));
+                        System.out.println(StringEscapeUtils.unescapeJava("\tTotal Processing
Time: " + totalProcessingTime + " ms"));
                         Long lastProcessingTime = (Long) mBeanServer.getAttribute(routeMBean,
"LastProcessingTime");
-                        System.out.println(StringEscapeUtils.unescapeJava("\tLast Processing
Time: " + lastProcessingTime + "ms"));
+                        System.out.println(StringEscapeUtils.unescapeJava("\tLast Processing
Time: " + lastProcessingTime + " ms"));
                         Long deltaProcessingTime = (Long) mBeanServer.getAttribute(routeMBean,
"DeltaProcessingTime");
-                        System.out.println(StringEscapeUtils.unescapeJava("\tDelta Processing
Time: " + deltaProcessingTime + "ms"));
+                        System.out.println(StringEscapeUtils.unescapeJava("\tDelta Processing
Time: " + deltaProcessingTime + " ms"));
                         String load01 = (String) mBeanServer.getAttribute(routeMBean, "Load01");
                         String load05 = (String) mBeanServer.getAttribute(routeMBean, "Load05");
                         String load15 = (String) mBeanServer.getAttribute(routeMBean, "Load15");

Modified: camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteProfile.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteProfile.java?rev=1470579&r1=1470578&r2=1470579&view=diff
==============================================================================
--- camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteProfile.java
(original)
+++ camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteProfile.java
Mon Apr 22 15:33:33 2013
@@ -25,11 +25,9 @@ import javax.xml.bind.Unmarshaller;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
-import org.apache.camel.management.DefaultManagementAgent;
 import org.apache.camel.spi.ManagementAgent;
 import org.apache.camel.util.ProcessorStatDump;
 import org.apache.camel.util.RouteStatDump;
-import org.apache.camel.util.URISupport;
 import org.apache.felix.gogo.commands.Command;
 import org.apache.karaf.util.StringEscapeUtils;
 
@@ -68,7 +66,7 @@ public class RouteProfile extends Abstra
         ManagementAgent agent = camelContext.getManagementStrategy().getManagementAgent();
         if (agent != null) {
             MBeanServer mBeanServer = agent.getMBeanServer();
-            Set<ObjectName> set = mBeanServer.queryNames(new ObjectName(DefaultManagementAgent.DEFAULT_DOMAIN
+ ":type=routes,name=\"" + camelRoute.getId() + "\",*"), null);
+            Set<ObjectName> set = mBeanServer.queryNames(new ObjectName(agent.getMBeanObjectDomainName()
+ ":type=routes,name=\"" + camelRoute.getId() + "\",*"), null);
             for (ObjectName routeMBean : set) {
                 // the route must be part of the camel context
                 String camelId = (String) mBeanServer.getAttribute(routeMBean, "CamelId");

Modified: camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteResetStats.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteResetStats.java?rev=1470579&r1=1470578&r2=1470579&view=diff
==============================================================================
--- camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteResetStats.java
(original)
+++ camel/branches/camel-2.11.x/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteResetStats.java
Mon Apr 22 15:33:33 2013
@@ -23,7 +23,6 @@ import javax.management.ObjectName;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
-import org.apache.camel.management.DefaultManagementAgent;
 import org.apache.camel.spi.ManagementAgent;
 import org.apache.felix.gogo.commands.Command;
 
@@ -42,7 +41,7 @@ public class RouteResetStats extends Abs
             MBeanServer mBeanServer = agent.getMBeanServer();
 
             // reset route mbeans
-            ObjectName query = ObjectName.getInstance(DefaultManagementAgent.DEFAULT_DOMAIN
+ ":type=routes,*");
+            ObjectName query = ObjectName.getInstance(agent.getMBeanObjectDomainName() +
":type=routes,*");
             Set<ObjectName> set = mBeanServer.queryNames(query, null);
             Iterator<ObjectName> iterator = set.iterator();
             while (iterator.hasNext()) {
@@ -55,7 +54,7 @@ public class RouteResetStats extends Abs
             }
 
             // reset processor mbeans that belongs to the given route
-            query = ObjectName.getInstance(DefaultManagementAgent.DEFAULT_DOMAIN + ":type=processors,*");
+            query = ObjectName.getInstance(agent.getMBeanObjectDomainName() + ":type=processors,*");
             set = mBeanServer.queryNames(query, null);
             iterator = set.iterator();
             while (iterator.hasNext()) {



Mime
View raw message