camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-8044: Camel commands useable for remote JVMs using jolokia
Date Tue, 16 Dec 2014 19:03:58 GMT
Repository: camel
Updated Branches:
  refs/heads/master a2300894c -> a87849838


CAMEL-8044: Camel commands useable for remote JVMs using jolokia


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9544da82
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9544da82
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9544da82

Branch: refs/heads/master
Commit: 9544da824cee97e9190b1847055d55c7533a80f6
Parents: a230089
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Dec 16 16:09:51 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Dec 16 16:09:51 2014 +0100

----------------------------------------------------------------------
 .../jolokia/DefaultJolokiaCamelController.java  | 49 ++++++++++++++------
 1 file changed, 35 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9544da82/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
index 6462cff..ce44a3e 100644
--- a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
+++ b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
@@ -101,26 +101,47 @@ public class DefaultJolokiaCamelController extends AbstractCamelController
imple
             throw new IllegalStateException("Need to connect to remote jolokia first");
         }
 
+        // org.apache.camel:context=camel-1,type=services,name=DefaultTypeConverter
+
         Map<String, Object> answer = new LinkedHashMap<String, Object>();
 
         ObjectName found = lookupCamelContext(camelContextName);
         if (found != null) {
-            J4pReadResponse rr = jolokia.execute(new J4pReadRequest(found));
-            if (rr != null) {
-                for (String key : rr.getAttributes()) {
-                    answer.put(asKey(key), rr.getValue(key));
+
+            String pattern = String.format("%s:context=%s,type=services,name=DefaultTypeConverter",
found.getDomain(), found.getKeyProperty("context"));
+            ObjectName tc = ObjectName.getInstance(pattern);
+
+            List<J4pReadRequest> list = new ArrayList<>();
+            list.add(new J4pReadRequest(found));
+            list.add(new J4pReadRequest(tc));
+
+            List<J4pReadResponse> rr = jolokia.execute(list);
+            if (rr != null && rr.size() > 0) {
+                // camel context attributes
+                J4pReadResponse first = rr.get(0);
+                for (String key : first.getAttributes()) {
+                    answer.put(asKey(key), first.getValue(key));
                 }
-            }
 
-            // store some data using special names as that is what the core-commands expects
-            answer.put("name", answer.get("camelId"));
-            answer.put("status", answer.get("state"));
-            answer.put("version", answer.get("camelVersion"));
-            answer.put("suspended", "Suspended".equals(answer.get("state")));
-            TimeUnit unit = TimeUnit.valueOf((String) answer.get("timeUnit"));
-            long timeout = (Long) answer.get("timeout");
-            answer.put("shutdownTimeout", "" + unit.toSeconds(timeout));
-            answer.put("applicationContextClassLoader", answer.get("applicationContextClassName"));
+                // type converter attributes
+                if (rr.size() == 2) {
+                    J4pReadResponse second = rr.get(1);
+                    for (String key : second.getAttributes()) {
+
+                        answer.put("typeConverter." + asKey(key), second.getValue(key));
+                    }
+                }
+
+                // store some data using special names as that is what the core-commands
expects
+                answer.put("name", answer.get("camelId"));
+                answer.put("status", answer.get("state"));
+                answer.put("version", answer.get("camelVersion"));
+                answer.put("suspended", "Suspended".equals(answer.get("state")));
+                TimeUnit unit = TimeUnit.valueOf((String) answer.get("timeUnit"));
+                long timeout = (Long) answer.get("timeout");
+                answer.put("shutdownTimeout", "" + unit.toSeconds(timeout));
+                answer.put("applicationContextClassLoader", answer.get("applicationContextClassName"));
+            }
         }
 
         return answer;


Mime
View raw message