Author: gertv
Date: Fri Aug  8 05:40:52 2008
New Revision: 683954

URL: http://svn.apache.org/viewvc?rev=683954&view=rev
Log:
SMX4-83: Adding the simple XML examples

Added:
    servicemix/smx4/features/trunk/examples/simple/
    servicemix/smx4/features/trunk/examples/simple/README.txt
    servicemix/smx4/features/trunk/examples/simple/groovy.xml
    servicemix/smx4/features/trunk/examples/simple/quartz.xml

Added: servicemix/smx4/features/trunk/examples/simple/README.txt
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/simple/README.txt?rev=683954&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/simple/README.txt (added)
+++ servicemix/smx4/features/trunk/examples/simple/README.txt Fri Aug  8 
05:40:52 2008
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+Welcome to the ServiceMix simple xml deployment examples
+========================================================
+
+This example leverages ServiceMix 4 support for deploying simple XML files to 
add new endpoints.
+
+Quick steps to install the sample
+---------------------------------
+
+Launch the ServiceMix Kernel by running
+  bin/servicemix
+in the root dir of this distribution.
+
+Just copy any of the XML files in this directory to the /deploy directory in 
the root dir of this distribution 
+to deploy the sample.
+
+
+Testing the example
+-------------------
+
+When the groovy.xml file is copied to the deploy directory, you should see 
output in the console:
+
+Starting JSR-223 groovy processor
[EMAIL PROTECTED]
+Hello, I got an input message <?xml version="1.0" encoding="UTF-8" 
standalone="no"?><timer><name>{http://servicemix.apache.org/examples/groovy}service:endpoint</name><group>DEFAULT</group><fullname>DEFAULT.{http://servicemix.apache.org/examples/groovy}service:endpoint</fullname><description/><fireTime>Fri
 Aug 08 13:50:16 CEST 2008</fireTime></timer>
+
+
+When the quartz.xml file is copied to the deploy directory, you can use the 
'log d' command in the console to see this output in the log files:
+
+14:04:53,709 | INFO  | x-camel-thread-3 | test                             | 
rg.apache.camel.processor.Logger   88 | Exchange[null]
+
+
+How does it work?
+-----------------
+
+The installation leverages ServiceMix Kernel by installing a plain Spring XML 
file.
+The JBI endpoints in the Spring XML file will automatically be registered in 
the NMR.  
+The quartz.xml file also shows how you can deploy a Camel route together with 
JBI endpoints from the same XML file.
+
+Both files have a servicemix-quartz endpoint that sends a new message exchange 
on a regular interval.
+In groovy.xml, this exchange is handled by a Groovy script through the 
servicemix-scripting SE.
+In quartz.xml, the exchange is sent directly to a Camel route.

Added: servicemix/smx4/features/trunk/examples/simple/groovy.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/simple/groovy.xml?rev=683954&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/simple/groovy.xml (added)
+++ servicemix/smx4/features/trunk/examples/simple/groovy.xml Fri Aug  8 
05:40:52 2008
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<!--
+    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:util="http://www.springframework.org/schema/util";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:quartz="http://servicemix.apache.org/quartz/1.0";
+       xmlns:scripting="http://servicemix.apache.org/scripting/1.0";
+       xmlns:camel="http://activemq.apache.org/camel/schema/spring";
+       xmlns:osgi="http://www.springframework.org/schema/osgi";
+       xmlns:b="http://servicemix.apache.org/examples/groovy";
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://www.springframework.org/schema/util  
http://www.springframework.org/schema/util/spring-util.xsd
+         http://www.springframework.org/schema/osgi  
http://www.springframework.org/schema/osgi/spring-osgi.xsd
+         http://www.springframework.org/schema/osgi-compendium   
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
+         http://servicemix.apache.org/quartz/1.0     
http://servicemix.apache.org/quartz/1.0/servicemix-quartz.xsd
+         http://servicemix.apache.org/scripting/1.0  
http://servicemix.apache.org/scripting/1.0/servicemix-scripting.xsd
+         http://activemq.apache.org/camel/schema/spring  
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+         http://www.springframework.org/schema/osgi  
http://www.springframework.org/schema/osgi/spring-osgi.xsd";>
+
+    <quartz:endpoint service="b:service" endpoint="endpoint" 
targetService="b:receiver">
+       <quartz:trigger>
+          <quartz:simple repeatCount="500" repeatInterval="1000" 
startDelay="2000" />
+       </quartz:trigger>
+    </quartz:endpoint>
+
+    <scripting:endpoint service="b:receiver" endpoint="endpoint" 
+                        script="document-name:myscript"
+                        language="groovy" />
+       
+    <bean id="myscript" 
class="org.apache.servicemix.document.factory.DocumentFactory">
+      <property name="repository" ref="repository" />
+      <property name="document">
+        <value>
+           import javax.jbi.messaging.MessageExchange;
+           import javax.jbi.messaging.NormalizedMessage;
+           import org.apache.servicemix.jbi.jaxp.StringSource;
+           import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+
+           println "Starting JSR-223 groovy processor";
+
+           println exchange;       
+           def inputMessage = new 
SourceTransformer().toString(inMessage.getContent());
+           println "Hello, I got an input message " + inputMessage;
+           NormalizedMessage out = exchange.createMessage();
+           out.setContent(new StringSource("&lt;response>" + 
bindings.get("answerGroovy") + "&lt;/response>"));
+           exchange.setMessage(out, "out");
+           println exchange;
+
+           println "Stopping JSR-223 groovy processor";
+        </value>
+      </property>
+    </bean>
+
+    <osgi:reference id="repository" 
interface="org.apache.servicemix.document.DocumentRepository" />
+
+    <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
+
+</beans>

Added: servicemix/smx4/features/trunk/examples/simple/quartz.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/simple/quartz.xml?rev=683954&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/examples/simple/quartz.xml (added)
+++ servicemix/smx4/features/trunk/examples/simple/quartz.xml Fri Aug  8 
05:40:52 2008
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+    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:util="http://www.springframework.org/schema/util";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:quartz="http://servicemix.apache.org/quartz/1.0";
+       xmlns:camel="http://activemq.apache.org/camel/schema/spring";
+       xmlns:osgi="http://www.springframework.org/schema/osgi";
+       xmlns:b="http://servicemix.apache.org/examples/camel";
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans
+         http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://www.springframework.org/schema/util
+         http://www.springframework.org/schema/util/spring-util.xsd
+         http://www.springframework.org/schema/osgi
+         http://www.springframework.org/schema/osgi/spring-osgi.xsd
+         http://www.springframework.org/schema/osgi-compendium
+         
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
+         http://servicemix.apache.org/quartz/1.0
+         http://servicemix.apache.org/quartz/1.0/servicemix-quartz.xsd
+         http://activemq.apache.org/camel/schema/spring 
+         http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+         http://www.springframework.org/schema/osgi
+         http://www.springframework.org/schema/osgi/spring-osgi.xsd";>
+
+       <camel:camelContext>
+           <camel:route>
+               <camel:from 
uri="jbi:endpoint:http://servicemix.apache.org/examples/camel/receiver/endpoint";
 />
+               <camel:to uri="log:test" />
+        </camel:route>
+       </camel:camelContext>
+       
+       <quartz:endpoint service="b:service" endpoint="endpoint" 
targetService="b:receiver">
+        <quartz:trigger>
+            <quartz:simple repeatCount="500" repeatInterval="1000" 
startDelay="2000" />
+        </quartz:trigger>
+       </quartz:endpoint>
+       
+       <osgi:reference id="jbi" interface="org.apache.camel.Component">
+       </osgi:reference>
+
+    <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
+
+</beans>


Reply via email to