You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2007/06/18 14:04:09 UTC

svn commit: r548336 - in /activemq/camel/trunk: components/camel-spring/src/main/java/org/apache/camel/spring/ examples/camel-example-spring/ examples/camel-example-spring/src/main/resources/ tooling/maven/camel-maven-plugin/ tooling/maven/camel-maven-...

Author: jstrachan
Date: Mon Jun 18 05:04:08 2007
New Revision: 548336

URL: http://svn.apache.org/viewvc?view=rev&rev=548336
Log:
patched the camel-maven-plugin so it compiles the main/test code first before trying to boot up the camel context. Also added log4j/clogging in there so examples typically get logging too

Added:
    activemq/camel/trunk/examples/camel-example-spring/src/main/resources/log4j.properties
Modified:
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
    activemq/camel/trunk/examples/camel-example-spring/pom.xml
    activemq/camel/trunk/tooling/maven/camel-maven-plugin/pom.xml
    activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunCamelMojo.java

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?view=diff&rev=548336&r1=548335&r2=548336
==============================================================================
--- 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 Mon Jun 18 05:04:08 2007
@@ -16,10 +16,11 @@
  */
 package org.apache.camel.spring;
 
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.context.support.AbstractApplicationContext;
 import org.apache.camel.impl.ServiceSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -35,6 +36,7 @@
  * @version $Revision: $
  */
 public class Main extends ServiceSupport {
+    private static final Log log = LogFactory.getLog(Main.class);
     private String applicationContextUri = "META-INF/spring/*.xml";
 
     private AbstractApplicationContext applicationContext;
@@ -74,8 +76,7 @@
                 stop();
             }
             catch (Exception e) {
-                System.out.println("Failed: " + e);
-                e.printStackTrace();
+                log.error("Failed: " + e, e);
             }
         }
     }
@@ -213,6 +214,7 @@
     // Implementation methods
     //-------------------------------------------------------------------------
     protected void doStart() throws Exception {
+        log.info("Apache Camel " + getVersion() + " starting");
         if (applicationContext == null) {
             applicationContext = createDefaultApplicationContext();
         }
@@ -224,6 +226,8 @@
     }
 
     protected void doStop() throws Exception {
+        log.info("Apache Camel terminating");
+
         if (applicationContext != null) {
             applicationContext.close();
         }
@@ -239,4 +243,20 @@
             }
         }
     }
+
+    protected String getVersion() {
+        Package aPackage = Package.getPackage("org.apache.camel");
+        if (aPackage != null) {
+            String version = aPackage.getImplementationVersion();
+            if (version == null) {
+                version = aPackage.getSpecificationVersion();
+                if (version == null) {
+                    version = "";
+                }
+            }
+            return version;
+        }
+        return "";
+    }
+
 }

Modified: activemq/camel/trunk/examples/camel-example-spring/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring/pom.xml?view=diff&rev=548336&r1=548335&r2=548336
==============================================================================
--- activemq/camel/trunk/examples/camel-example-spring/pom.xml (original)
+++ activemq/camel/trunk/examples/camel-example-spring/pom.xml Mon Jun 18 05:04:08 2007
@@ -39,13 +39,14 @@
     </dependency>
 
     <dependency>
-      <groupId>org.apache.activemq</groupId>
-      <artifactId>apache-activemq</artifactId>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-activemq</artifactId>
     </dependency>
   </dependencies>
 
   <build>
     <plugins>
+      <!-- allows the routes to be ran via 'mvn camel:run' -->
       <plugin>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-maven-plugin</artifactId>

Added: activemq/camel/trunk/examples/camel-example-spring/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring/src/main/resources/log4j.properties?view=auto&rev=548336
==============================================================================
--- activemq/camel/trunk/examples/camel-example-spring/src/main/resources/log4j.properties (added)
+++ activemq/camel/trunk/examples/camel-example-spring/src/main/resources/log4j.properties Mon Jun 18 05:04:08 2007
@@ -0,0 +1,32 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for eclipse testing, We want to see debug output on the console.
+#
+log4j.rootLogger=INFO, out
+
+#log4j.logger.org.apache.activemq=DEBUG
+
+#log4j.logger.org.apache.camel=DEBUG
+log4j.logger.org.apache.camel.impl.converter=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n

Modified: activemq/camel/trunk/tooling/maven/camel-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/pom.xml?view=diff&rev=548336&r1=548335&r2=548336
==============================================================================
--- activemq/camel/trunk/tooling/maven/camel-maven-plugin/pom.xml (original)
+++ activemq/camel/trunk/tooling/maven/camel-maven-plugin/pom.xml Mon Jun 18 05:04:08 2007
@@ -57,5 +57,16 @@
       <artifactId>plexus-container-default</artifactId>
       <version>1.0-alpha-9</version>
     </dependency>
+
+
+    <!-- add some logging to the classpath -->
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
   </dependencies>
 </project>

Modified: activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunCamelMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunCamelMojo.java?view=diff&rev=548336&r1=548335&r2=548336
==============================================================================
--- activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunCamelMojo.java (original)
+++ activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunCamelMojo.java Mon Jun 18 05:04:08 2007
@@ -59,15 +59,18 @@
  *
  * @goal run
  * @requiresDependencyResolution runtime
- * @execute phase="validate"
+ * @execute phase="test-compile"
  */
 public class RunCamelMojo
     extends AbstractExecMojo
 {
 
     // TODO
-    // if we could avoid the mega-cut-n-paste it would really really help!
+    // this code is based on a copy-and-paste of maven-exec-plugin
+    //
+    // If we could avoid the mega-cut-n-paste it would really really help!
     // ideally all I wanna do is auto-default 2 values!
+    // namely the main and the command line arguments..
 
     /**
 	 * The maven project.