servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r798813 - in /servicemix/smx3/trunk/samples/clients: ./ jbi/ jbi/src/ jbi/src/main/ jbi/src/main/assembly/ jbi/src/main/java/ jbi/src/main/java/org/ jbi/src/main/java/org/apache/ jbi/src/main/java/org/apache/servicemix/ jbi/src/main/java/or...
Date Wed, 29 Jul 2009 08:54:18 GMT
Author: jbonofre
Date: Wed Jul 29 08:54:17 2009
New Revision: 798813

URL: http://svn.apache.org/viewvc?rev=798813&view=rev
Log:
[#SM-1865] Add samples for both JBI and JMX client.

Added:
    servicemix/smx3/trunk/samples/clients/jbi/
    servicemix/smx3/trunk/samples/clients/jbi/README.txt   (with props)
    servicemix/smx3/trunk/samples/clients/jbi/pom.xml   (with props)
    servicemix/smx3/trunk/samples/clients/jbi/src/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/assembly/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/assembly/src.xml   (with props)
    servicemix/smx3/trunk/samples/clients/jbi/src/main/java/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/clients/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/clients/jbi/
    servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/clients/jbi/Client.java
  (with props)
Modified:
    servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
    servicemix/smx3/trunk/samples/clients/pom.xml

Added: servicemix/smx3/trunk/samples/clients/jbi/README.txt
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jbi/README.txt?rev=798813&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jbi/README.txt (added)
+++ servicemix/smx3/trunk/samples/clients/jbi/README.txt Wed Jul 29 08:54:17 2009
@@ -0,0 +1,30 @@
+/*
+ * 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 JBI Client Example
+============================================
+
+This example shows how to code a basic JBI client to connect to a remote ServiceMix instance.
+
+First start a ServiceMix server (if not already started) by running
+    bin/servicemix
+in the root dir of this distribution.
+
+To run this sample, launch the following commands:
+    mvn install exec:java
+    
+By default, the client tries to send a message to the wsdl-first-cxfse-su deployed by the
cxf-wsdl-first sample.
\ No newline at end of file

Propchange: servicemix/smx3/trunk/samples/clients/jbi/README.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/smx3/trunk/samples/clients/jbi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jbi/pom.xml?rev=798813&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jbi/pom.xml (added)
+++ servicemix/smx3/trunk/samples/clients/jbi/pom.xml Wed Jul 29 08:54:17 2009
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+         
+<!--
+
+    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.
+-->
+
+    <modelVersion>4.0.0</modelVersion>     
+    
+    <parent>
+        <groupId>org.apache.servicemix.samples</groupId>
+        <artifactId>clients</artifactId>
+        <version>3.3.2-SNAPSHOT</version>
+    </parent>
+    
+    <groupId>org.apache.servicemix.samples.clients</groupId>
+    <artifactId>jbi</artifactId>
+    <name>ServiceMix :: Samples :: Clients :: JBI Client</name>
+    <packaging>jar</packaging>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix</groupId>
+            <artifactId>servicemix-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix</groupId>
+            <artifactId>servicemix-shared</artifactId>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.1</version>
+                <inherited>false</inherited>
+                <executions>
+                    <execution>
+                        <id>src</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/src.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>1.1.1</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>java</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <mainClass>org.apache.servicemix.samples.clients.jbi.Client</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+         
+</project>         
\ No newline at end of file

Propchange: servicemix/smx3/trunk/samples/clients/jbi/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/smx3/trunk/samples/clients/jbi/src/main/assembly/src.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jbi/src/main/assembly/src.xml?rev=798813&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jbi/src/main/assembly/src.xml (added)
+++ servicemix/smx3/trunk/samples/clients/jbi/src/main/assembly/src.xml Wed Jul 29 08:54:17
2009
@@ -0,0 +1,39 @@
+<?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.
+
+-->
+<assembly>
+  <id>src</id>
+  <formats>
+    <format>tar.gz</format>
+    <format>zip</format>
+  </formats>
+  <fileSets>
+    <fileSet>
+      <includes>
+        <include>README*</include>
+        <include>LICENSE*</include>
+        <include>NOTICE*</include>
+        <include>pom.xml</include>
+        <include>src/**/*</include>
+        <include>*/pom.xml</include>
+        <include>*/src/**/*</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file

Propchange: servicemix/smx3/trunk/samples/clients/jbi/src/main/assembly/src.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/clients/jbi/Client.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/clients/jbi/Client.java?rev=798813&view=auto
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/clients/jbi/Client.java
(added)
+++ servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/clients/jbi/Client.java
Wed Jul 29 08:54:17 2009
@@ -0,0 +1,70 @@
+/*
+ * 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.samples.clients.jbi;
+
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.client.RemoteServiceMixClient;
+import org.apache.servicemix.client.ServiceMixClient;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+
+/**
+ * <p>
+ * A simple JBI client to connect to a local ServiceMix instance (using remote type connection).
+ * </p>
+ * 
+ * @author jbonofre
+ */
+public class Client {
+    
+    /**
+     * <p>
+     * Main method to connect to the SMX instance and send a message.
+     * </p>
+     * 
+     * @param args main arguments.
+     * @throws Exception in case of error.
+     */
+    public static final void main(String[] args) throws Exception {
+        // get the JBI client (remote connection)
+        ServiceMixClient client =  new RemoteServiceMixClient("tcp://localhost:61616");
+        
+        // invoking a service
+        // create a in-out exchange
+        InOut exchange = client.createInOutExchange();
+        
+        // get the "in" normalized message of the exchange
+        NormalizedMessage inMessage = exchange.getInMessage();
+        inMessage.setProperty("name", "smx");
+        inMessage.setContent(new StringSource("<hello>world</hello>"));
+        
+        // define the destination endpoint
+        exchange.setService(new QName("http://servicemix.apache.org/samples/wsdl-first",
"PersonService"));
+        
+        // send the exchange 
+        client.sendSync(exchange);
+        
+        // get the "out" normalized message
+        NormalizedMessage outMessage = exchange.getOutMessage();
+        
+        // display the content of the "out" message
+        System.out.println(outMessage.getContent().toString());
+    }
+
+}

Propchange: servicemix/smx3/trunk/samples/clients/jbi/src/main/java/org/apache/servicemix/samples/clients/jbi/Client.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java?rev=798813&r1=798812&r2=798813&view=diff
==============================================================================
--- servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
(original)
+++ servicemix/smx3/trunk/samples/clients/jmx/src/main/java/org/apache/servicemix/samples/clients/jmx/Client.java
Wed Jul 29 08:54:17 2009
@@ -46,7 +46,7 @@
      * @param args main arguments.
      * @throws Exception in case of error.
      */
-    public static void main(String[] args) throws Exception {
+    public static final void main(String[] args) throws Exception {
         // create the JMX service URL.
         JMXServiceURL jmxServiceUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:"
+ ManagementContext.DEFAULT_CONNECTOR_PORT + ManagementContext.DEFAULT_CONNECTOR_PATH);
         // get the JMX connector.

Modified: servicemix/smx3/trunk/samples/clients/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/samples/clients/pom.xml?rev=798813&r1=798812&r2=798813&view=diff
==============================================================================
--- servicemix/smx3/trunk/samples/clients/pom.xml (original)
+++ servicemix/smx3/trunk/samples/clients/pom.xml Wed Jul 29 08:54:17 2009
@@ -36,6 +36,7 @@
     
     <modules>
         <module>jmx</module>
+        <module>jbi</module>
     </modules>
          
 </project>         
\ No newline at end of file



Mime
View raw message