camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r671233 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/processor/interceptor/ components/camel-spring/src/main/java/org/apache/camel/spring/ components/camel-spring/src/...
Date Tue, 24 Jun 2008 16:26:36 GMT
Author: jstrachan
Date: Tue Jun 24 09:26:35 2008
New Revision: 671233

URL: http://svn.apache.org/viewvc?rev=671233&view=rev
Log:
minor refactor of the Tracer and made it available to the mvn camel:run plugin and the Spring
Main via -Dcamel.trace=true or -t respectively

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java
  (contents, props changed)
      - copied, changed from r671167, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceStrategy.java
    activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/trace.xml
      - copied, changed from r671167, activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/debug.xml
Removed:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceStrategy.java
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java
    activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=671233&r1=671232&r2=671233&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
Tue Jun 24 09:26:35 2008
@@ -18,8 +18,7 @@
 
 
 import org.apache.camel.*;
-import org.apache.camel.processor.interceptor.TraceStrategy;
-import org.apache.camel.converter.ObjectConverter;
+import org.apache.camel.processor.interceptor.Tracer;
 import org.apache.camel.impl.converter.DefaultTypeConverter;
 import org.apache.camel.management.InstrumentationLifecycleStrategy;
 import org.apache.camel.management.JmxSystemPropertyKeys;
@@ -446,12 +445,12 @@
             boolean found = false;
             final List<InterceptStrategy> list = getInterceptStrategies();
             for (InterceptStrategy strategy : list) {
-                if (strategy instanceof TraceStrategy) {
+                if (strategy instanceof Tracer) {
                     found = true;    
                 }
             }
             if (!found) {
-                addInterceptStrategy(new TraceStrategy());
+                addInterceptStrategy(new Tracer());
             }
         }
         lifecycleStrategy.onContextStart(this);

Copied: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java
(from r671167, activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceStrategy.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java?p2=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java&p1=activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceStrategy.java&r1=671167&r2=671233&rev=671233&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceStrategy.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java
Tue Jun 24 09:26:35 2008
@@ -25,7 +25,7 @@
  *
  * @version $Revision$
  */
-public class TraceStrategy implements InterceptStrategy {
+public class Tracer implements InterceptStrategy {
 
     private TraceFormatter formatter = new TraceFormatter();
 

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=671233&r1=671232&r2=671233&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
(original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
Tue Jun 24 09:26:35 2008
@@ -40,6 +40,7 @@
 import org.apache.camel.model.RouteType;
 import org.apache.camel.model.dataformat.DataFormatType;
 import org.apache.camel.processor.interceptor.Debugger;
+import org.apache.camel.processor.interceptor.Tracer;
 import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.Registry;
 import org.apache.commons.logging.Log;
@@ -128,6 +129,10 @@
         if (debugger != null) {
             getContext().addInterceptStrategy(debugger);
         }
+        Tracer tracer = getBeanForType(Tracer.class);
+        if (tracer != null) {
+            getContext().addInterceptStrategy(tracer);
+        }
 
         // set the lifecycle strategy if defined
         LifecycleStrategy lifecycleStrategy = getBeanForType(LifecycleStrategy.class);

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java?rev=671233&r1=671232&r2=671233&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
(original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
Tue Jun 24 09:26:35 2008
@@ -59,6 +59,7 @@
     private String dotOutputDir;
     private boolean aggregateDot;
     private boolean debug;
+    private boolean trace;
     private List<RouteBuilder> routeBuilders = new ArrayList<RouteBuilder>();
     private List<SpringCamelContext> camelContexts = new ArrayList<SpringCamelContext>();
     private AbstractApplicationContext parentApplicationContext;
@@ -109,7 +110,12 @@
 
         addOption(new Option("x", "debug", "Enables the debugger") {
             protected void doProcess(String arg, LinkedList<String> remainingArgs)
{
-                enableDebugging();
+                enableDebug();
+            }
+        });
+        addOption(new Option("t", "trace", "Enables tracing") {
+            protected void doProcess(String arg, LinkedList<String> remainingArgs)
{
+                enableTrace();
             }
         });
     }
@@ -359,16 +365,25 @@
         return debug;
     }
 
-    public void enableDebugging() {
+    public void enableDebug() {
         this.debug = true;
         setParentApplicationContextUri("/META-INF/services/org/apache/camel/spring/debug.xml");
     }
 
+    public boolean isTrace() {
+        return trace;
+    }
+
+    public void enableTrace() {
+        this.trace = true;
+        setParentApplicationContextUri("/META-INF/services/org/apache/camel/spring/trace.xml");
+    }
+
     /**
      * Returns the currently active debugger if one is enabled
      *
      * @return the current debugger or null if none is active
-     * @see #enableDebugging()
+     * @see #enableDebug()
      */
     public Debugger getDebugger() {
         for (SpringCamelContext camelContext : camelContexts) {

Copied: activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/trace.xml
(from r671167, activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/debug.xml)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/trace.xml?p2=activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/trace.xml&p1=activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/debug.xml&r1=671167&r2=671233&rev=671233&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/debug.xml
(original)
+++ activemq/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/trace.xml
Tue Jun 24 09:26:35 2008
@@ -22,6 +22,6 @@
        http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
     ">
 
-  <!-- lets define a debugger -->
-  <bean id="camelDebugger" class="org.apache.camel.processor.interceptor.Debugger"/>
+  <!-- lets define a tracer -->
+  <bean id="camelTracer" class="org.apache.camel.processor.interceptor.Tracer"/>
 </beans>

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java?rev=671233&r1=671232&r2=671233&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/debug/DebugTest.java
Tue Jun 24 09:26:35 2008
@@ -43,7 +43,7 @@
         // START SNIPPET: example
         // lets run the camel route in debug mode
         main = new Main();
-        main.enableDebugging();
+        main.enableDebug();
         main.setApplicationContextUri("org/apache/camel/spring/debug/applicationContext.xml");
         main.start();
 

Modified: activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java?rev=671233&r1=671232&r2=671233&view=diff
==============================================================================
--- activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
(original)
+++ activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
Tue Jun 24 09:26:35 2008
@@ -145,6 +145,24 @@
     private List pluginDependencies;
 
     /**
+     * Whether to enable the debugger or not
+     *
+     * @parameter expression="${camel.debug}"
+     *            default-value="false"
+     * @required
+     */
+    private boolean debug;
+
+    /**
+     * Whether to enable the tracer or not
+     *
+     * @parameter expression="${camel.trace}"
+     *            default-value="false"
+     * @required
+     */
+    private boolean trace;
+
+    /**
      * The main class to execute.
      *
      * @parameter expression="${camel.mainClass}"
@@ -310,6 +328,12 @@
             args.add("-o");
             args.add(dotDir);
         }
+        if (debug) {
+            args.add("-x");
+        }
+        if (trace) {
+            args.add("-t");
+        }
 
         if (applicationContextUri != null) {
             args.add("-a");



Mime
View raw message