Author: gertv
Date: Mon Jan 10 08:13:07 2011
New Revision: 1057110
URL: http://svn.apache.org/viewvc?rev=1057110&view=rev
Log:
SMX4-710: Add a Camel NMR Blueprint example
Added:
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/README.txt
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/org.apache.servicemix.examples.cfg
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/pom.xml
- copied, changed from r1057080,
servicemix/smx4/features/trunk/examples/pom.xml
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/servicemix/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/servicemix/examples/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/servicemix/examples/camel/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/servicemix/examples/camel/MyTransform.java
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/resources/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/resources/OSGI-INF/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/resources/OSGI-INF/blueprint/
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Modified:
servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml
servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml
servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml
servicemix/smx4/features/trunk/examples/pom.xml
Modified:
servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=1057110&r1=1057109&r2=1057110&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml
(original)
+++ servicemix/smx4/features/trunk/assembly/src/main/descriptors/unix-bin.xml
Mon Jan 10 08:13:07 2011
@@ -292,6 +292,13 @@
<lineEnding>unix</lineEnding>
</file>
<file>
+
<source>${basedir}/../examples/camel-nmr-blueprint/README.txt</source>
+ <outputDirectory>/examples/camel-nmr-blueprint</outputDirectory>
+ <filtered>true</filtered>
+ <fileMode>0644</fileMode>
+ <lineEnding>unix</lineEnding>
+ </file>
+ <file>
<source>${basedir}/../examples/cxf-nmr/README.txt</source>
<outputDirectory>/examples/cxf-nmr</outputDirectory>
<filtered>true</filtered>
Modified:
servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=1057110&r1=1057109&r2=1057110&view=diff
==============================================================================
---
servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml
(original)
+++
servicemix/smx4/features/trunk/assembly/src/main/descriptors/windows-bin.xml
Mon Jan 10 08:13:07 2011
@@ -272,6 +272,13 @@
<fileMode>0644</fileMode>
<lineEnding>dos</lineEnding>
</file>
+ <file>
+
<source>${basedir}/../examples/camel-nmr-blueprint/README.txt</source>
+ <outputDirectory>/examples/camel-nmr-blueprint</outputDirectory>
+ <filtered>true</filtered>
+ <fileMode>0644</fileMode>
+ <lineEnding>dos</lineEnding>
+ </file>
<file>
<source>${basedir}/../examples/cxf-nmr/README.txt</source>
<outputDirectory>/examples/cxf-nmr</outputDirectory>
Modified:
servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml?rev=1057110&r1=1057109&r2=1057110&view=diff
==============================================================================
---
servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml
(original)
+++
servicemix/smx4/features/trunk/assembly/src/main/filtered-resources/features.xml
Mon Jan 10 08:13:07 2011
@@ -137,6 +137,11 @@
<feature version="${version}">camel-nmr</feature>
<bundle>mvn:org.apache.servicemix.examples/camel-nmr/${version}</bundle>
</feature>
+ <feature name="examples-camel-nmr-blueprint" version="${version}">
+ <feature version="${version}">camel-nmr</feature>
+ <feature version="${camel.version}">camel-blueprint</feature>
+
<bundle>mvn:org.apache.servicemix.examples/camel-nmr-blueprint/${version}</bundle>
+ </feature>
<feature name="examples-cxf-camel-nmr" version="${version}">
<feature version="${version}">camel-nmr</feature>
<feature version="${version}">cxf-nmr</feature>
Added: servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/README.txt
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/README.txt?rev=1057110&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/README.txt
(added)
+++ servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/README.txt Mon
Jan 10 08:13:07 2011
@@ -0,0 +1,239 @@
+/*
+ * 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.
+ */
+
+CAMEL BLUEPRINT NMR EXAMPLE
+===========================
+
+Purpose
+-------
+Using Blueprint, this example deploys two Camel EIP routes that communicate
+with each other via the ServiceMix NMR.
+
+
+Explanation
+-----------
+The NMR is a general-purpose message bus that applications can
+use to communicate within the ServiceMix OSGi container. It is
+modeled on the Normalized Message Router (NMR) defined in the
+Java Business Integration (JBI) specification.
+
+The Camel routes are defined in the beans.xml file that is located
+in the src/main/resources/OSGI-INF/blueprint directory of this example.
+The contents of the blueprint.xml file can be explained as follows:
+
+1. Defines a route that generates a heartbeat message every
+ 2000ms and sends it to the NMR.
+
+2. Defines a second route that receives the message from the NMR,
+ transforms the heartbeat into a message containing the current
+ date and time, and logs the message.
+
+The routes are deployed in an OSGi bundle.
+
+
+Prerequisites for Building and Running the Example
+--------------------------------------------------
+1. You must have the following installed on your machine:
+
+ - JDK 1.5 or higher
+
+ - Maven 2.0.9 or higher (for building)
+
+ For more information, see the README in the top-level examples
+ directory.
+
+
+2. Start ServiceMix by running the following command:
+
+ <servicemix_home>/bin/servicemix (on UNIX)
+ <servicemix_home>\bin\servicemix (on Windows)
+
+
+Running the Example
+-------------------
+You can run the example in two ways:
+
+- A. Using a Prebuilt Deployment Bundle: Quick and Easy
+ This option is useful if you want to see the example up and
+ running quickly.
+
+- B. Building the Example Bundle Yourself
+ This option is useful if you want to change the example in any
+ way. It tells you how to build and deploy the example. This
+ option might be slower than option A because if you do not
+ already have the required bundles in your local Maven
+ repository, Maven will have to download the bundles it needs.
+
+
+Updating and Redeploying the Properties File from the Console
+-------------------------------------------------------------
+You can update and redeploy the properties file that is used by the
+properties placeholder in the blueprint.xml from console as follows:
+
+1. Edit the org.apache.servicemix.examples.cfg file, located in the
+ same folder as this README, by changing the value of the "prefix"
+ key to whatever you want (for example, YourTransform).
+
+2. Copy the updated configuration file to your <servicemix_home>/etc
+ directory. You can do this from the ServiceMix console by typing:
+
+ copy
$YOUR_SERVICEMIX_HOME/examples/camel-osgi/org.apache.servicemix.examples.cfg
+ $YOUR_SERVICEMIX_HOME/etc
+
+ On Windows you need to replace / in the path with \\.
+
+ Note, the text you are typing might intermingle with the output
+ being logged. This is nothing to worry about.
+
+3. Restart the example bundle:
+
+ (i) First you must know the bundle ID that ServiceMix has assigned
+ to it. To get the bundle ID, enter the following command in the
+ ServiceMix console:
+
+ osgi:list
+
+ At the end of the listing, you should see an entry similar to
+ the following:
+
+ [ 185] [Active ] [Created ] [ ] [ 60] Apache ServiceMix
:: Features :: Examples :: Camel NMR Blueprint (${project.version})
+
+ In this case, the bundle ID is 185.
+
+ (ii) Enter the following command in the ServiceMix console to
+ restart the bundle:
+
+ osgi:restart <bundle_id>
+
+ The prefix of the output should change, and the output should look
+ similar to the following:
+
+ >>>> YourTransform set body: Tue Aug 11 17:14:12 BST 2009
+ >>>> YourTransform set body: Tue Aug 11 17:14:14 BST 2009
+ >>>> YourTransform set body: Tue Aug 11 17:14:16 BST 2009
+
+For information on how to stop and/or uninstall the example, see
+"Stopping and Uninstalling the Example" below.
+
+
+A. Using a Prebuilt Deployment Bundle:Quick and Easy
+----------------------------------------------------
+To install and run a prebuilt version of this example, enter
+the following command in the ServiceMix console:
+
+ features:install examples-camel-nmr-blueprint
+
+This command makes use of the ServiceMix features facility. For
+more information about the features facility, see the README.txt
+file in the examples parent directory.
+
+Once the example is running you should see output similar to
+the following being logged to the console screen:
+
+>>>> Blueprint-NMR-Example set body: Mon Jan 10 09:00:24 CET 2011
+>>>> Blueprint-NMR-Example set body: Mon Jan 10 09:00:26 CET 2011
+>>>> Blueprint-NMR-Example set body: Mon Jan 10 09:00:28 CET 2011
+
+For information on how to stop and/or uninstall the example,
+see "Stopping and Uninstalling the Example" below.
+
+B. Building the Example Bundle Yourself
+---------------------------------------
+To install and run the example where you build the example
+bundle yourself, complete the following steps:
+
+1. If you have already run the example using the prebuilt
+ version as described above, you must first uninstall the
+ examples-camel-nmr feature by entering the following command
+ in the ServiceMix console:
+
+ features:uninstall examples-camel-nmr-blueprint
+
+2. Build the example by opening a command prompt, changing
+ directory to examples/camel-nmr (this example) and entering
+ the following Maven command:
+
+ mvn install
+
+ If all of the required OSGi bundles are available in your
+ local Maven repository, the example will build quickly.
+ Otherwise it may take some time for Maven to download
+ everything it needs.
+
+ The mvn install command builds the example deployment bundle and
+ copies it to your local Maven repository and to the target
+ directory of this example.
+
+3. Install the example by entering the following command in
+ the ServiceMix console:
+
+ features:install examples-camel-nmr-blueprint
+
+ This command makes use of the ServiceMix features facility. For
+ more information about the features facility, see the README.txt
+ file in the examples parent directory.
+
+Once the example is running you should see output similar to the
+following being logged to the console screen:
+
+>>>> Blueprint-NMR-Example set body: Mon Jan 10 09:00:24 CET 2011
+>>>> Blueprint-NMR-Example set body: Mon Jan 10 09:00:26 CET 2011
+>>>> Blueprint-NMR-Example set body: Mon Jan 10 09:00:28 CET 2011
+
+Stopping and Uninstalling the Example
+-------------------------------------
+To stop the example, first you must know the bundle ID that ServiceMix
+has assigned to it. To get the bundle ID, enter the following command
+in the ServiceMix console (Note, the text you are typing will
+intermingle with the output being logged. This is nothing to worry
+about.):
+
+ osgi:list
+
+At the end of the listing, you should see an entry similar to the
+following:
+
+ [ 185] [Active ] [Created ] [ ] [ 60] Apache ServiceMix ::
Features :: Examples :: Camel NMR Blueprint (${project.version})
+
+In this case, the bundle ID is 185.
+
+To stop the example, enter the following command in the ServiceMix
+console:
+
+ osgi:stop <bundle_id>
+
+For example:
+
+ osgi:stop 185
+
+To uninstall the example, enter one of the following commands
+in the ServiceMix console:
+
+ features:uninstall examples-camel-nmr-blueprint
+
+or
+
+ osgi:uninstall <bundle_id>
+
+
+Viewing the Log Entries
+-----------------------
+You can view the entries in the log file in the data/log
+directory of your ServiceMix installation, or by typing the
+following command in the ServiceMix console:
+
+ log:display
Added:
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/org.apache.servicemix.examples.cfg
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/org.apache.servicemix.examples.cfg?rev=1057110&view=auto
==============================================================================
---
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/org.apache.servicemix.examples.cfg
(added)
+++
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/org.apache.servicemix.examples.cfg
Mon Jan 10 08:13:07 2011
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+#
+
+
+prefix=YourTransform
Copied: servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/pom.xml
(from r1057080, servicemix/smx4/features/trunk/examples/pom.xml)
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/pom.xml?p2=servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/pom.xml&p1=servicemix/smx4/features/trunk/examples/pom.xml&r1=1057080&r2=1057110&rev=1057110&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/examples/pom.xml (original)
+++ servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/pom.xml Mon Jan
10 08:13:07 2011
@@ -22,35 +22,29 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.servicemix.features</groupId>
- <artifactId>features</artifactId>
+ <groupId>org.apache.servicemix.examples</groupId>
+ <artifactId>examples</artifactId>
<version>4.3.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.servicemix.examples</groupId>
- <artifactId>examples</artifactId>
- <packaging>pom</packaging>
- <name>Apache ServiceMix :: Features :: Examples</name>
+ <artifactId>camel-nmr-blueprint</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache ServiceMix :: Features :: Examples :: Camel NMR
Blueprint</name>
- <modules>
- <module>bridge</module>
- <module>bridge-camel</module>
- <module>camel</module>
- <module>camel-blueprint</module>
- <module>cxf-wsdl-first</module>
- <module>wsdl-first</module>
- <module>loan-broker-bpel</module>
- <module>camel-nmr</module>
- <module>camel-osgi</module>
- <module>cxf-camel-nmr</module>
- <module>cxf-nmr</module>
- <module>cxf-osgi</module>
- <module>cxf-jaxrs</module>
- <module>cxf-ws-addressing</module>
- <module>cxf-wsdl-first-osgi-package</module>
- <module>cxf-ws-security-osgi</module>
- <module>cxf-ws-rm</module>
- <module>itests</module>
- </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+
<Import-Package>org.apache.servicemix.camel.nmr,org.apache.servicemix.nmr.api,*</Import-Package>
+
<Private-Package>org.apache.servicemix.examples.camel</Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added:
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/servicemix/examples/camel/MyTransform.java
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/servicemix/examples/camel/MyTransform.java?rev=1057110&view=auto
==============================================================================
---
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/servicemix/examples/camel/MyTransform.java
(added)
+++
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/java/org/apache/servicemix/examples/camel/MyTransform.java
Mon Jan 10 08:13:07 2011
@@ -0,0 +1,54 @@
+/**
+ * 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.servicemix.examples.camel;
+
+import java.util.Date;
+import java.util.logging.Logger;
+
+/**
+ * @version $Revision: 640450 $
+ */
+public class MyTransform {
+ private static final transient Logger logger =
Logger.getLogger(MyTransform.class.getName());
+ private boolean verbose = true;
+ private String prefix = "MyTransform";
+
+ public Object transform(Object body) {
+ String answer = prefix + " set body: " + new Date();
+ if (verbose) {
+ System.out.println(">>>> " + answer);
+ }
+ logger.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;
+ }
+}
Added:
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1057110&view=auto
==============================================================================
---
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml
(added)
+++
servicemix/smx4/features/trunk/examples/camel-nmr-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Mon Jan 10 08:13:07 2011
@@ -0,0 +1,50 @@
+<?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.
+
+-->
+<blueprint
+ xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <!-- Route periodically sent events into the NMR -->
+ <route>
+ <from
uri="timer://myTimer?fixedRate=true&period=2000" />
+ <to uri="nmr:ExampleRouter" />
+ </route>
+ <!-- Route exchange from the NMR endpoint to a log endpoint -->
+ <route>
+ <from uri="nmr:ExampleRouter" />
+ <bean ref="myTransform" method="transform" />
+ <to uri="log:ExampleRouter" />
+ </route>
+ </camelContext>
+
+ <bean id="myTransform"
class="org.apache.servicemix.examples.camel.MyTransform">
+ <property name="prefix" value="${prefix}" />
+ </bean>
+
+ <cm:property-placeholder persistent-id="org.apache.servicemix.examples">
+ <cm:default-properties>
+ <cm:property name="prefix" value="Blueprint-NMR-Example"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+</blueprint>
\ No newline at end of file
Modified: servicemix/smx4/features/trunk/examples/pom.xml
URL:
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/pom.xml?rev=1057110&r1=1057109&r2=1057110&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/examples/pom.xml (original)
+++ servicemix/smx4/features/trunk/examples/pom.xml Mon Jan 10 08:13:07 2011
@@ -37,6 +37,7 @@
<module>bridge-camel</module>
<module>camel</module>
<module>camel-blueprint</module>
+ <module>camel-nmr-blueprint</module>
<module>cxf-wsdl-first</module>
<module>wsdl-first</module>
<module>loan-broker-bpel</module>