camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-7644: Adjust maven archetype for scala to work and use ScalaRouteBuilder
Date Tue, 03 Mar 2015 09:45:55 GMT
CAMEL-7644: Adjust maven archetype for scala to work and use ScalaRouteBuilder


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

Branch: refs/heads/master
Commit: 87c9a9da4ec409c82d710ebd806a08f24579e8c2
Parents: c0db627
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Mar 3 10:47:07 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Mar 3 10:47:07 2015 +0100

----------------------------------------------------------------------
 .../META-INF/maven/archetype-metadata.xml                   | 3 +++
 .../src/main/resources/archetype-resources/pom.xml          | 5 +++++
 .../archetype-resources/src/main/scala/MyRouteBuilder.scala | 8 ++++----
 .../archetype-resources/src/main/scala/MyRouteMain.scala    | 9 ++++++---
 4 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/87c9a9da/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
b/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index 6c15da2..7df63dc 100644
--- a/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -42,6 +42,9 @@
     <requiredProperty key="scala-version">
       <defaultValue>${scala-version}</defaultValue>
     </requiredProperty>
+    <requiredProperty key="scalaxml-version">
+      <defaultValue>${scalaxml-version}</defaultValue>
+    </requiredProperty>    
     <requiredProperty key="scala-maven-plugin-version">
       <defaultValue>${scala-maven-plugin-version}</defaultValue>
     </requiredProperty>

http://git-wip-us.apache.org/repos/asf/camel/blob/87c9a9da/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml
b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml
index efed7cd..4d1bff6 100644
--- a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml
@@ -50,6 +50,11 @@
       <artifactId>scala-library</artifactId>
       <version>${scala-version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.scala-lang.modules</groupId>
+      <artifactId>scala-xml_2.11</artifactId>
+      <version>${scalaxml-version}</version>
+    </dependency>
 
     <!-- logging -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/87c9a9da/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteBuilder.scala
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteBuilder.scala
b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteBuilder.scala
index a438cc1..885d5d0 100644
--- a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteBuilder.scala
+++ b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteBuilder.scala
@@ -16,13 +16,13 @@
 ## ------------------------------------------------------------------------
 package ${package}
 
-import org.apache.camel.Exchange
-import org.apache.camel.scala.dsl.builder.RouteBuilder
+import org.apache.camel.{CamelContext, Exchange}
+import org.apache.camel.scala.dsl.builder.ScalaRouteBuilder
 
 /**
  * A Camel Router using the Scala DSL
  */
-class MyRouteBuilder extends RouteBuilder {
+class MyRouteBuilder(override val context : CamelContext) extends ScalaRouteBuilder(context)
{
 
     // an example of a Processor method
    val myProcessorMethod = (exchange: Exchange) => {
@@ -34,4 +34,4 @@ class MyRouteBuilder extends RouteBuilder {
       process(myProcessorMethod)
       to("log:block")
    }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/87c9a9da/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteMain.scala
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteMain.scala
b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteMain.scala
index 0e60d07..46c78c3 100644
--- a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteMain.scala
+++ b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/src/main/scala/MyRouteMain.scala
@@ -27,10 +27,13 @@ object MyRouteMain extends RouteBuilderSupport {
   def main(args: Array[String]) {
     val main = new Main()
     // enable hangup support so you need to use ctrl + c to stop the running app
-    main.enableHangupSupport();
-    main.addRouteBuilder(new MyRouteBuilder())
+    main.enableHangupSupport()
+    // create the CamelContext
+    val context = main.getOrCreateCamelContext()
+    // add our route using the created CamelContext
+    main.addRouteBuilder(new MyRouteBuilder(context))
     // must use run to start the main application
-    main.run();
+    main.run()
   }
 }
 


Mime
View raw message