You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/05/19 14:25:58 UTC

svn commit: r776289 - in /camel/trunk/examples/camel-example-osgi/src/main: java/org/apache/camel/example/osgi/MyRouteBuilder.java resources/META-INF/spring/camelContext.xml

Author: ningjiang
Date: Tue May 19 12:25:58 2009
New Revision: 776289

URL: http://svn.apache.org/viewvc?rev=776289&view=rev
Log:
CAMEL-1629 add Java DSL example for the camel-example-osgi

Added:
    camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyRouteBuilder.java   (with props)
Modified:
    camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml

Added: camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyRouteBuilder.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyRouteBuilder.java?rev=776289&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyRouteBuilder.java (added)
+++ camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyRouteBuilder.java Tue May 19 12:25:58 2009
@@ -0,0 +1,48 @@
+/**
+ * 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.example.osgi;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.Main;
+
+/**
+ * A simple example router to show how to define the route with Java DSL
+ *
+ * @version $Revision$
+ */
+public class MyRouteBuilder extends RouteBuilder {
+    /**
+     * Allow this route to be run as an application
+     *
+     * @param args
+     */
+    public static void main(String[] args) {
+        new Main().run(args);
+    }
+
+    public void configure() {
+        // set up the transform bean
+        MyTransform transform = new MyTransform();
+        transform.setPrefix("JavaDSL");
+        
+        from("timer://myTimer?fixedRate=true&period=2000")
+        .bean(transform, "transform")
+        .to("log:ExampleRouter");        
+    }
+
+    
+}

Propchange: camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyRouteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyRouteBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml?rev=776289&r1=776288&r2=776289&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml (original)
+++ camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml Tue May 19 12:25:58 2009
@@ -26,6 +26,7 @@
        http://camel.apache.org/schema/osgi http://camel.apache.org/schema/osgi/camel-osgi.xsd">
 
   <camelContext xmlns="http://camel.apache.org/schema/osgi">
+    <camel:package>org.apache.camel.example.osgi</camel:package>
     <camel:route>
       <camel:from uri="timer://myTimer?fixedRate=true&amp;period=2000"/>
       <camel:bean ref="myTransform" method="transform"/>
@@ -34,7 +35,7 @@
   </camelContext>
 
   <bean id="myTransform" class="org.apache.camel.example.osgi.MyTransform">
-    <property name="prefix" value="MyTransform"/>
+    <property name="prefix" value="SpringDSL"/>
   </bean>
 
 </beans>