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/11/28 12:36:47 UTC

svn commit: r598967 - in /activemq/camel/trunk/examples: ./ camel-example-osgi/ camel-example-osgi/src/ camel-example-osgi/src/main/ camel-example-osgi/src/main/java/ camel-example-osgi/src/main/java/org/ camel-example-osgi/src/main/java/org/apache/ ca...

Author: jstrachan
Date: Wed Nov 28 03:36:44 2007
New Revision: 598967

URL: http://svn.apache.org/viewvc?rev=598967&view=rev
Log:
added a simple example for testing out the deployment of Camel routes inside the ServiceMix 4 runtime (http://cwiki.apache.org/SMX4/runtime.html)

Added:
    activemq/camel/trunk/examples/camel-example-osgi/
    activemq/camel/trunk/examples/camel-example-osgi/pom.xml   (with props)
    activemq/camel/trunk/examples/camel-example-osgi/src/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/java/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyTransform.java   (with props)
    activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/LICENSE.txt
      - copied unchanged from r598567, activemq/camel/trunk/examples/camel-example-spring/src/main/resources/META-INF/LICENSE.txt
    activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/NOTICE.txt
      - copied unchanged from r598567, activemq/camel/trunk/examples/camel-example-spring/src/main/resources/META-INF/NOTICE.txt
    activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/
    activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml   (with props)
Modified:
    activemq/camel/trunk/examples/pom.xml

Added: activemq/camel/trunk/examples/camel-example-osgi/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-osgi/pom.xml?rev=598967&view=auto
==============================================================================
--- activemq/camel/trunk/examples/camel-example-osgi/pom.xml (added)
+++ activemq/camel/trunk/examples/camel-example-osgi/pom.xml Wed Nov 28 03:36:44 2007
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>examples</artifactId>
+    <version>1.3-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-osgi</artifactId>
+  <packaging>bundle</packaging>
+  <name>Camel :: Example :: OSGi</name>
+  <description>A simple OSGi example which creates a bundle that can be dropped into any OSGi container</description>
+
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.example.osgi*</camel.osgi.export.pkg>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+    </dependency>
+
+    <!-- for testing -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </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>
+      </plugin>
+    </plugins>
+
+  </build>
+
+  <reporting>
+    <plugins>
+      <!-- lets generate nice PNG / SVG diagrams from our routes -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Propchange: activemq/camel/trunk/examples/camel-example-osgi/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyTransform.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyTransform.java?rev=598967&view=auto
==============================================================================
--- activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyTransform.java (added)
+++ activemq/camel/trunk/examples/camel-example-osgi/src/main/java/org/apache/camel/example/osgi/MyTransform.java Wed Nov 28 03:36:44 2007
@@ -0,0 +1,57 @@
+/**
+ *
+ * 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 java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class MyTransform  {
+    private static final transient Log LOG = LogFactory.getLog(MyTransform.class);
+    private boolean verbose = true;
+    private String prefix = "MyTransform";
+
+    public Object transform(Object body) {
+        String answer = prefix + " body at:  " + new Date() + " body: " + body;
+        if (verbose) {
+            System.out.println(">>>> " + answer);
+        }
+        LOG.info(">>>> " + answer);
+        return answer;
+    }
+
+    public boolean isVerbose() {
+        return verbose;
+    }
+
+    public void setVerbose(boolean verbose) {
+        this.verbose = verbose;
+    }
+
+    public String getPrefix() {
+        return prefix;
+    }
+
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+}

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

Added: activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml?rev=598967&view=auto
==============================================================================
--- activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml (added)
+++ activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml Wed Nov 28 03:36:44 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
+
+  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="timer://myTimer?fixedRate=true&amp;period=2000"/>
+      <bean ref="myTransform" method="transform"/>
+      <to uri="log:ExampleRouter"/>
+    </route>
+  </camelContext>
+
+  <bean id="myTransform" class="org.apache.camel.example.osgi.MyTransform">
+    <property name="prefix" value="MyTransform"/>
+  </bean>
+
+</beans>

Propchange: activemq/camel/trunk/examples/camel-example-osgi/src/main/resources/META-INF/spring/camelContext.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/examples/pom.xml?rev=598967&r1=598966&r2=598967&view=diff
==============================================================================
--- activemq/camel/trunk/examples/pom.xml (original)
+++ activemq/camel/trunk/examples/pom.xml Wed Nov 28 03:36:44 2007
@@ -61,6 +61,7 @@
     <module>camel-example-jms-file</module>
     <module>camel-example-spring</module>
     <module>camel-example-spring-xquery</module>
+    <module>camel-example-osgi</module>
     <module>camel-example-etl</module>
     <module>camel-example-bam</module>
     <module>camel-example-docs</module>