You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cs...@apache.org on 2011/10/12 22:21:14 UTC

svn commit: r1182571 - in /camel/branches/camel-2.8.x/camel-core: ./ src/main/java/org/apache/camel/management/mbean/

Author: cschneider
Date: Wed Oct 12 20:21:13 2011
New Revision: 1182571

URL: http://svn.apache.org/viewvc?rev=1182571&view=rev
Log:
CAMEL-4500 use Standard JMX classes for annotations to avoid the need for spring-core

Added:
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracerMXBean.java
Modified:
    camel/branches/camel-2.8.x/camel-core/pom.xml
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java

Modified: camel/branches/camel-2.8.x/camel-core/pom.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/pom.xml?rev=1182571&r1=1182570&r2=1182571&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/pom.xml (original)
+++ camel/branches/camel-2.8.x/camel-core/pom.xml Wed Oct 12 20:21:13 2011
@@ -86,6 +86,10 @@
         <!-- we only need spring-context.jar as optional as we need the JMX export annotations -->
         <exclusion>
           <groupId>org.springframework</groupId>
+          <artifactId>spring-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.springframework</groupId>
           <artifactId>spring-beans</artifactId>
         </exclusion>
         <exclusion>

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java?rev=1182571&r1=1182570&r2=1182571&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java Wed Oct 12 20:21:13 2011
@@ -21,10 +21,12 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
+import org.apache.camel.management.JmxNotificationBroadcasterAware;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.processor.Traceable;
 import org.apache.camel.processor.interceptor.DefaultTraceEventHandler;
@@ -32,13 +34,11 @@ import org.apache.camel.processor.interc
 import org.apache.camel.processor.interceptor.TraceInterceptor;
 import org.apache.camel.processor.interceptor.Tracer;
 import org.apache.camel.util.MessageHelper;
-import org.springframework.jmx.export.notification.NotificationPublisher;
-import org.springframework.jmx.export.notification.NotificationPublisherAware;
 
-public final class JMXNotificationTraceEventHandler implements TraceEventHandler, NotificationPublisherAware {
+public final class JMXNotificationTraceEventHandler implements TraceEventHandler, JmxNotificationBroadcasterAware {
     private static final int MAX_MESSAGE_LENGTH = 60;
     private long num;
-    private NotificationPublisher notificationSender;
+    private NotificationBroadcasterSupport notificationSender;
     private Tracer tracer;
     private DefaultTraceEventHandler defaultTracer;
 
@@ -112,8 +112,9 @@ public final class JMXNotificationTraceE
     }
 
     @Override
-    public void setNotificationPublisher(NotificationPublisher notificationPublisher) {
-        this.notificationSender = notificationPublisher;
+    public void setNotificationBroadcaster(
+            NotificationBroadcasterSupport notificationSender) {
+        this.notificationSender = notificationSender;
     }
 
 }

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java?rev=1182571&r1=1182570&r2=1182571&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracer.java Wed Oct 12 20:21:13 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.management.mbean;
 
+import javax.management.NotificationBroadcasterSupport;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.processor.interceptor.Tracer;
@@ -25,8 +27,6 @@ import org.springframework.jmx.export.an
 import org.springframework.jmx.export.annotation.ManagedNotification;
 import org.springframework.jmx.export.annotation.ManagedNotifications;
 import org.springframework.jmx.export.annotation.ManagedResource;
-import org.springframework.jmx.export.notification.NotificationPublisher;
-import org.springframework.jmx.export.notification.NotificationPublisherAware;
 
 /**
  * @version 
@@ -35,7 +35,7 @@ import org.springframework.jmx.export.no
 @ManagedNotifications(@ManagedNotification(name = "javax.management.Notification", 
 description = "Fine grained trace events", 
 notificationTypes = {"TraceNotification"}))
-public class ManagedTracer implements NotificationPublisherAware {
+public class ManagedTracer extends NotificationBroadcasterSupport implements ManagedTracerMXBean {
     private final CamelContext camelContext;
     private final Tracer tracer;
     private JMXNotificationTraceEventHandler jmxTraceHandler;
@@ -44,6 +44,7 @@ public class ManagedTracer implements No
         this.camelContext = camelContext;
         this.tracer = tracer;
         this.jmxTraceHandler = new JMXNotificationTraceEventHandler(tracer);
+        this.jmxTraceHandler.setNotificationBroadcaster(this);
         if (this.tracer.getTraceHandler() == null) {
             this.tracer.setTraceHandler(this.jmxTraceHandler);
         }
@@ -442,9 +443,4 @@ public class ManagedTracer implements No
         this.tracer.setTraceBodySize(traceBodySize);
     }
 
-    @Override
-    public void setNotificationPublisher(NotificationPublisher notificationPublisher) {
-        this.jmxTraceHandler.setNotificationPublisher(notificationPublisher);
-    }
-
 }

Added: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracerMXBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracerMXBean.java?rev=1182571&view=auto
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracerMXBean.java (added)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTracerMXBean.java Wed Oct 12 20:21:13 2011
@@ -0,0 +1,187 @@
+/**
+ * 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.camel.management.mbean;
+
+import org.springframework.jmx.export.annotation.ManagedAttribute;
+
+public interface ManagedTracerMXBean {
+
+    @ManagedAttribute(description = "Tracer enabled")
+    boolean getEnabled();
+
+    @ManagedAttribute(description = "Tracer enabled")
+    void setEnabled(boolean enabled);
+
+    @ManagedAttribute(description = "Additional destination Uri")
+    String getDestinationUri();
+
+    @ManagedAttribute(description = "Additional destination Uri")
+    void setDestinationUri(String uri);
+
+    @ManagedAttribute(description = "Logging Name")
+    String getLogName();
+
+    @ManagedAttribute(description = "Logging Name")
+    void setLogName(String logName);
+
+    @ManagedAttribute(description = "Logging Level")
+    String getLogLevel();
+
+    @ManagedAttribute(description = "Logging Level")
+    void setLogLevel(String logLevel);
+
+    @ManagedAttribute(description = "Log Stacktrace")
+    boolean getLogStackTrace();
+
+    @ManagedAttribute(description = "Log Stacktrace")
+    void setLogStackTrace(boolean logStackTrace);
+
+    @ManagedAttribute(description = "Trace Interceptors")
+    boolean getTraceInterceptors();
+
+    @ManagedAttribute(description = "Trace Interceptors")
+    void setTraceInterceptors(boolean traceInterceptors);
+
+    @ManagedAttribute(description = "Trace Exceptions")
+    boolean getTraceExceptions();
+
+    @ManagedAttribute(description = "Trace Exceptions")
+    void setTraceExceptions(boolean traceExceptions);
+
+    @ManagedAttribute(description = "Trace Out Exchanges")
+    boolean getTraceOutExchanges();
+
+    @ManagedAttribute(description = "Trace Out Exchanges")
+    void setTraceOutExchanges(boolean traceOutExchanges);
+
+    boolean getUseJpa();
+
+    @ManagedAttribute(description = "Formatter show body")
+    boolean getFormatterShowBody();
+
+    @ManagedAttribute(description = "Formatter show body")
+    void setFormatterShowBody(boolean showBody);
+
+    @ManagedAttribute(description = "Formatter show body type")
+    boolean getFormatterShowBodyType();
+
+    @ManagedAttribute(description = "Formatter show body type")
+    void setFormatterShowBodyType(boolean showBodyType);
+
+    @ManagedAttribute(description = "Formatter show out body")
+    boolean getFormatterShowOutBody();
+
+    @ManagedAttribute(description = "Formatter show out body")
+    void setFormatterShowOutBody(boolean showOutBody);
+
+    @ManagedAttribute(description = "Formatter show out body type")
+    boolean getFormatterShowOutBodyType();
+
+    @ManagedAttribute(description = "Formatter show out body type")
+    void setFormatterShowOutBodyType(boolean showOutBodyType);
+
+    @ManagedAttribute(description = "Formatter show breadcrumb")
+    boolean getFormatterShowBreadCrumb();
+
+    @ManagedAttribute(description = "Formatter show breadcrumb")
+    void setFormatterShowBreadCrumb(boolean showBreadCrumb);
+
+    @ManagedAttribute(description = "Formatter show exchange id")
+    boolean getFormatterShowExchangeId();
+
+    @ManagedAttribute(description = "Formatter show exchange id")
+    void setFormatterShowExchangeId(boolean showExchangeId);
+
+    @ManagedAttribute(description = "Formatter show headers")
+    boolean getFormatterShowHeaders();
+
+    @ManagedAttribute(description = "Formatter show headers")
+    void setFormatterShowHeaders(boolean showHeaders);
+
+    @ManagedAttribute(description = "Formatter show out headers")
+    boolean getFormatterShowOutHeaders();
+
+    @ManagedAttribute(description = "Formatter show out headers")
+    void setFormatterShowOutHeaders(boolean showOutHeaders);
+
+    @ManagedAttribute(description = "Formatter show properties")
+    boolean getFormatterShowProperties();
+
+    @ManagedAttribute(description = "Formatter show properties")
+    void setFormatterShowProperties(boolean showProperties);
+
+    @ManagedAttribute(description = "Formatter show node")
+    boolean getFormatterShowNode();
+
+    @ManagedAttribute(description = "Formatter show node")
+    void setFormatterShowNode(boolean showNode);
+
+    @ManagedAttribute(description = "Formatter show exchange pattern")
+    boolean getFormatterShowExchangePattern();
+
+    @ManagedAttribute(description = "Formatter show exchange pattern")
+    void setFormatterShowExchangePattern(boolean showExchangePattern);
+
+    @ManagedAttribute(description = "Formatter show exception")
+    boolean getFormatterShowException();
+
+    @ManagedAttribute(description = "Formatter show exception")
+    void setFormatterShowException(boolean showException);
+
+    @ManagedAttribute(description = "Formatter show route id")
+    boolean getFormatterShowRouteId();
+
+    @ManagedAttribute(description = "Formatter show route id")
+    void setFormatterShowRouteId(boolean showRouteId);
+
+    @ManagedAttribute(description = "Formatter breadcrumb length")
+    int getFormatterBreadCrumbLength();
+
+    @ManagedAttribute(description = "Formatter breadcrumb length")
+    void setFormatterBreadCrumbLength(int breadCrumbLength);
+
+    @ManagedAttribute(description = "Formatter show short exchange id")
+    boolean getFormatterShowShortExchangeId();
+
+    @ManagedAttribute(description = "Formatter show short exchange id")
+    void setFormatterShowShortExchangeId(boolean showShortExchangeId);
+
+    @ManagedAttribute(description = "Formatter node length")
+    int getFormatterNodeLength();
+
+    @ManagedAttribute(description = "Formatter node length")
+    void setFormatterNodeLength(int nodeLength);
+
+    @ManagedAttribute(description = "Formatter max chars")
+    int getFormatterMaxChars();
+
+    @ManagedAttribute(description = "Formatter max chars")
+    void setFormatterMaxChars(int maxChars);
+
+    @ManagedAttribute(description = "Should trace events be sent as jmx notifications")
+    boolean isJmxTraceNotifications();
+
+    @ManagedAttribute
+    void setJmxTraceNotifications(boolean jmxTraceNotifications);
+
+    @ManagedAttribute(description = "Maximum size of a message body for trace notification")
+    int getTraceBodySize();
+
+    @ManagedAttribute
+    void setTraceBodySize(int traceBodySize);
+
+}
\ No newline at end of file