camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: Align cdi example with archetype
Date Mon, 16 Nov 2015 10:46:17 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 378344ba1 -> 69882c15f
  refs/heads/master aa4191fec -> c87aa3cf7


Align cdi example with archetype


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

Branch: refs/heads/master
Commit: c87aa3cf72d1be9340f4e435f5fe483d819fac59
Parents: aa4191f
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Nov 16 11:46:02 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Nov 16 11:49:27 2015 +0100

----------------------------------------------------------------------
 examples/camel-example-cdi/README.txt                |  3 +--
 examples/camel-example-cdi/src/data/message1.xml     |  6 ------
 examples/camel-example-cdi/src/data/message2.xml     |  6 ------
 .../java/org/apache/camel/example/cdi/MyRoutes.java  | 15 ++++++---------
 .../java/org/apache/camel/example/cdi/SomeBean.java  |  9 +++++++--
 .../META-INF/maven/archetype-metadata.xml            |  6 ------
 .../archetype-resources/src/main/java/MyRoutes.java  |  2 +-
 7 files changed, 15 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c87aa3cf/examples/camel-example-cdi/README.txt
----------------------------------------------------------------------
diff --git a/examples/camel-example-cdi/README.txt b/examples/camel-example-cdi/README.txt
index a44f33b..d0978cc 100644
--- a/examples/camel-example-cdi/README.txt
+++ b/examples/camel-example-cdi/README.txt
@@ -4,8 +4,7 @@ CDI Example
 This example shows how to work with Camel using CDI to configure components,
 endpoints and beans.
 
-The example consumes messages from a queue and writes them to the file
-system.
+A timer triggers a Camel route to run every 5th second which creates a message that is logged
to the console.
 
 You will need to compile this example first:
   mvn compile

http://git-wip-us.apache.org/repos/asf/camel/blob/c87aa3cf/examples/camel-example-cdi/src/data/message1.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-cdi/src/data/message1.xml b/examples/camel-example-cdi/src/data/message1.xml
deleted file mode 100644
index f215844..0000000
--- a/examples/camel-example-cdi/src/data/message1.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<person user="james">
-  <firstName>James</firstName>
-  <lastName>Strachan</lastName>
-  <city>London</city>
-</person>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c87aa3cf/examples/camel-example-cdi/src/data/message2.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-cdi/src/data/message2.xml b/examples/camel-example-cdi/src/data/message2.xml
deleted file mode 100644
index 5caa192..0000000
--- a/examples/camel-example-cdi/src/data/message2.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<person user="hiram">
-  <firstName>Hiram</firstName>
-  <lastName>Chirino</lastName>
-  <city>Tampa</city>
-</person>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c87aa3cf/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRoutes.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRoutes.java
b/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRoutes.java
index ba1bef7..c95de3c 100644
--- a/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRoutes.java
+++ b/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRoutes.java
@@ -30,23 +30,20 @@ import org.apache.camel.cdi.Uri;
 public class MyRoutes extends RouteBuilder {
 
     @Inject
-    @Uri("file://target/testdata/result")
-    private Endpoint resultEndpoint;
+    @Uri("timer:foo?period=5000")
+    private Endpoint inputEndpoint;
 
     @Inject
-    private SomeBean someBean;
+    @Uri("log:output")
+    private Endpoint resultEndpoint;
 
     @Override
     public void configure() throws Exception {
         // you can configure the route rule with Java DSL here
 
-        // populate the message queue with some messages
-        from("file:src/data?noop=true")
-            .bean(someBean)
+        from(inputEndpoint)
+            .to("bean:counterBean")
             .to(resultEndpoint);
     }
 
-    public Endpoint getResultEndpoint() {
-        return resultEndpoint;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c87aa3cf/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java
b/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java
index 1a45cd4..796e044 100644
--- a/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java
+++ b/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/SomeBean.java
@@ -16,12 +16,17 @@
  */
 package org.apache.camel.example.cdi;
 
+import javax.inject.Named;
 import javax.inject.Singleton;
 
 @Singleton
+@Named("counterBean")
 public class SomeBean {
 
-    public void someMethod(String body) {
-        System.out.println("Received: " + body);
+    private int counter;
+
+    public String someMethod(String body) {
+        return "Saying Hello World " + ++counter + " times";
     }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c87aa3cf/tooling/archetypes/camel-archetype-cdi/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-cdi/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
b/tooling/archetypes/camel-archetype-cdi/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index 2f5e78e..b797ba7 100644
--- a/tooling/archetypes/camel-archetype-cdi/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-cdi/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -75,12 +75,6 @@
       </includes>
     </fileSet>
     <fileSet filtered="true" encoding="UTF-8">
-      <directory>src/data</directory>
-      <includes>
-        <include>**/*.xml</include>
-      </includes>
-    </fileSet>
-    <fileSet filtered="true" encoding="UTF-8">
       <directory></directory>
       <includes>
         <include>ReadMe.txt</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/c87aa3cf/tooling/archetypes/camel-archetype-cdi/src/main/resources/archetype-resources/src/main/java/MyRoutes.java
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-cdi/src/main/resources/archetype-resources/src/main/java/MyRoutes.java
b/tooling/archetypes/camel-archetype-cdi/src/main/resources/archetype-resources/src/main/java/MyRoutes.java
index 7624d7d..03c8740 100644
--- a/tooling/archetypes/camel-archetype-cdi/src/main/resources/archetype-resources/src/main/java/MyRoutes.java
+++ b/tooling/archetypes/camel-archetype-cdi/src/main/resources/archetype-resources/src/main/java/MyRoutes.java
@@ -42,7 +42,7 @@ public class MyRoutes extends RouteBuilder {
         // you can configure the route rule with Java DSL here
 
         from(inputEndpoint)
-            .beanRef("counterBean")
+            .to("bean:counterBean")
             .to(resultEndpoint);
     }
 


Mime
View raw message