camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/8] camel git commit: CAMEL-9157: JMX - Add dataformat as mbean category
Date Thu, 24 Sep 2015 11:36:15 GMT
CAMEL-9157: JMX - Add dataformat as mbean category


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

Branch: refs/heads/master
Commit: 5f399e6b5fc2c7ad045cd056eca7d6fea55646ea
Parents: 4935c1e
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Sep 24 11:20:09 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Sep 24 11:20:09 2015 +0200

----------------------------------------------------------------------
 .../management/DefaultManagementNamingStrategy.java   | 14 ++++++++++++++
 .../camel/management/ManagedManagementStrategy.java   |  8 +++++++-
 .../apache/camel/spi/ManagementNamingStrategy.java    |  2 ++
 3 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5f399e6b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
index fdd538a..a9c8a70 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
@@ -34,6 +34,7 @@ import org.apache.camel.Route;
 import org.apache.camel.Service;
 import org.apache.camel.StaticService;
 import org.apache.camel.builder.ErrorHandlerBuilderRef;
+import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.EventNotifier;
 import org.apache.camel.spi.InterceptStrategy;
 import org.apache.camel.spi.ManagementNamingStrategy;
@@ -52,6 +53,7 @@ public class DefaultManagementNamingStrategy implements ManagementNamingStrategy
     public static final String KEY_CONTEXT = "context";
     public static final String TYPE_CONTEXT = "context";
     public static final String TYPE_ENDPOINT = "endpoints";
+    public static final String TYPE_DATAFORMAT = "dataformats";
     public static final String TYPE_PROCESSOR = "processors";
     public static final String TYPE_CONSUMER = "consumers";
     public static final String TYPE_PRODUCER = "producers";
@@ -119,6 +121,18 @@ public class DefaultManagementNamingStrategy implements ManagementNamingStrategy
         return createObjectName(buffer);
     }
 
+    public ObjectName getObjectNameForDataFormat(CamelContext context, DataFormat dataFormat)
throws MalformedObjectNameException {
+        StringBuilder buffer = new StringBuilder();
+        buffer.append(domainName).append(":");
+        buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(",");
+        buffer.append(KEY_TYPE + "=" + TYPE_DATAFORMAT + ",");
+        buffer.append(KEY_NAME + "=").append(dataFormat.getClass().getSimpleName());
+        if (!(dataFormat instanceof StaticService)) {
+            buffer.append("(").append(ObjectHelper.getIdentityHashCode(dataFormat)).append(")");
+        }
+        return createObjectName(buffer);
+    }
+
     public ObjectName getObjectNameForComponent(Component component, String name) throws
MalformedObjectNameException {
         StringBuilder buffer = new StringBuilder();
         buffer.append(domainName).append(":");

http://git-wip-us.apache.org/repos/asf/camel/blob/5f399e6b/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
b/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
index 6f0966b..942df5f 100644
--- a/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
@@ -35,6 +35,7 @@ import org.apache.camel.management.mbean.ManagedService;
 import org.apache.camel.management.mbean.ManagedThreadPool;
 import org.apache.camel.management.mbean.ManagedTracer;
 import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.ManagementAgent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -133,7 +134,12 @@ public class ManagedManagementStrategy extends DefaultManagementStrategy
{
             if (ms.getService() instanceof Endpoint) {
                 return null;
             }
-            objectName = getManagementNamingStrategy().getObjectNameForService(ms.getContext(),
ms.getService());
+            if (ms.getService() instanceof DataFormat) {
+                DataFormat df = (DataFormat) ms.getService();
+                objectName = getManagementNamingStrategy().getObjectNameForDataFormat(ms.getContext(),
df);
+            } else {
+                objectName = getManagementNamingStrategy().getObjectNameForService(ms.getContext(),
ms.getService());
+            }
         }
 
         return nameType.cast(objectName);

http://git-wip-us.apache.org/repos/asf/camel/blob/5f399e6b/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java b/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
index 6d5d4ff..0c4adf4 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
@@ -46,6 +46,8 @@ public interface ManagementNamingStrategy {
 
     ObjectName getObjectNameForEndpoint(Endpoint endpoint) throws MalformedObjectNameException;
 
+    ObjectName getObjectNameForDataFormat(CamelContext context, DataFormat endpoint) throws
MalformedObjectNameException;
+
     ObjectName getObjectNameForErrorHandler(RouteContext routeContext, Processor errorHandler,
ErrorHandlerFactory builder) throws MalformedObjectNameException;
 
     ObjectName getObjectNameForProcessor(CamelContext context, Processor processor, NamedNode
definition) throws MalformedObjectNameException;


Mime
View raw message