Author: ningjiang
Date: Tue Apr 22 23:14:26 2008
New Revision: 650758

URL: http://svn.apache.org/viewvc?rev=650758&view=rev
Log:
Renamed the spring jms example's package name

Added:
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java
   (with props)
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClientRemoting.java
   (with props)
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/CamelServer.java
   (with props)
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/JmsBroker.java
   (with props)
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Multiplier.java
   (with props)
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/ServerRoutes.java
   (with props)
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Treble.java
   (with props)
Removed:
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/example/
Modified:
    
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml

Added: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java?rev=650758&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java
 Tue Apr 22 23:14:26 2008
@@ -0,0 +1,47 @@
+/**
+ * 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.client;
+
+import org.apache.camel.CamelTemplate;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.component.jms.JmsExchange;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Requires that the JMS broker is running, as well as CamelServer
+ *
+ * @author martin.gilday
+ */
+public final class CamelClient {
+
+    private CamelClient() {
+        // The main class
+    }
+
+    public static void main(final String[] args) {
+
+        ApplicationContext context = new 
ClassPathXmlApplicationContext("camel-client.xml");
+        CamelTemplate<JmsExchange> camelTemplate = 
(CamelTemplate)context.getBean("camelTemplate");
+
+        int response = (Integer)camelTemplate.sendBody("jms:queue:numbers", 
ExchangePattern.InOut, 22);
+        System.out.println("Invoking the multiply with 22, the result is " + 
response);
+        System.exit(0);
+
+    }
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClientRemoting.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClientRemoting.java?rev=650758&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClientRemoting.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClientRemoting.java
 Tue Apr 22 23:14:26 2008
@@ -0,0 +1,44 @@
+/**
+ * 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.client;
+
+import org.apache.camel.example.server.Multiplier;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Requires that the JMS broker is running, as well as CamelServer
+ *
+ * @author martin.gilday
+ */
+public final class CamelClientRemoting {
+
+    private CamelClientRemoting() {
+        // the main class
+    }
+
+    public static void main(final String[] args) {
+
+        ApplicationContext context = new 
ClassPathXmlApplicationContext("camel-client-remoting.xml");
+        Multiplier multiplier = (Multiplier)context.getBean("multiplierProxy");
+        int response = multiplier.multiply(22);
+        System.out.println("Invoking the multiply with 22, the result is " + 
response);
+        System.exit(0);
+
+    }
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClientRemoting.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/client/CamelClientRemoting.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/CamelServer.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/CamelServer.java?rev=650758&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/CamelServer.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/CamelServer.java
 Tue Apr 22 23:14:26 2008
@@ -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.camel.example.server;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @author martin.gilday
+ */
+public final class CamelServer {
+    private CamelServer() {
+        // the main class
+    }
+
+    /**
+     * @param args
+     */
+    public static void main(final String[] args) {
+        JmsBroker broker = new JmsBroker();
+
+        try {
+            broker.start();
+            ApplicationContext context = new 
ClassPathXmlApplicationContext("META-INF/spring/camel-server.xml");
+            Thread.sleep(5 * 60 * 1000);
+        } catch (Exception e) {
+            // get the exception
+            e.printStackTrace();
+        } finally {
+            try {
+                broker.stop();
+            } catch (Exception e) {
+                // do nothing here
+            }
+            System.exit(0);
+        }
+
+    }
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/CamelServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/CamelServer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/JmsBroker.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/JmsBroker.java?rev=650758&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/JmsBroker.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/JmsBroker.java
 Tue Apr 22 23:14:26 2008
@@ -0,0 +1,104 @@
+/**
+ * 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.server;
+
+import java.io.File;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
+
+public final class JmsBroker {
+    JMSEmbeddedBroker jmsBrokerThread;
+    String jmsBrokerUrl = "tcp://localhost:61616";
+    String activeMQStorageDir;
+    public JmsBroker() {
+    }
+
+    public JmsBroker(String url) {
+        jmsBrokerUrl = url;
+    }
+    
+    public void start() throws Exception {
+        jmsBrokerThread = new JMSEmbeddedBroker(jmsBrokerUrl);
+        jmsBrokerThread.startBroker();
+    }
+    
+    public void stop() throws Exception {
+        synchronized (this) {
+            jmsBrokerThread.shutdownBroker = true;
+        }
+        if (jmsBrokerThread != null) {
+            jmsBrokerThread.join();
+        }
+        
+        jmsBrokerThread = null;
+    }
+    
+    class JMSEmbeddedBroker extends Thread {
+        boolean shutdownBroker;
+        final String brokerUrl;
+        Exception exception;
+        
+        
+        public JMSEmbeddedBroker(String url) {
+            brokerUrl = url;
+        }
+        
+        public void startBroker() throws Exception {
+            synchronized (this) {
+                super.start();
+                try {
+                    wait();
+                    if (exception != null) {
+                        throw exception;
+                    }
+                } catch (InterruptedException ex) {
+                    ex.printStackTrace();
+                }
+            }
+        }
+        
+        public void run() {
+            try {  
+                //ContainerWapper container;
+                BrokerService broker = new BrokerService();
+                synchronized (this) {                                     
+                    broker.setPersistenceAdapter(new 
MemoryPersistenceAdapter());                    
+                    broker.setTmpDataDirectory(new File("./target"));
+                    broker.addConnector(brokerUrl);
+                    broker.start();
+                    Thread.sleep(200);
+                    notifyAll();
+                }
+                synchronized (this) {
+                    while (!shutdownBroker) {
+                        wait(1000);
+                    }
+                }                
+                broker.stop();              
+                broker = null;                
+            } catch (Exception e) {
+                exception = e;
+                e.printStackTrace();
+            }
+        }
+        
+       
+    }
+}
+

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/JmsBroker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/JmsBroker.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Multiplier.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Multiplier.java?rev=650758&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Multiplier.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Multiplier.java
 Tue Apr 22 23:14:26 2008
@@ -0,0 +1,32 @@
+/**
+ * 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.server;
+
+/**
+ * @author martin.gilday
+ */
+public interface Multiplier {
+
+    /**
+     * Multiplies the given number by a pre-defined constant.
+     *
+     * @param originalNumber The number to be multiplied
+     * @return The result of the multiplication
+     */
+    int multiply(int originalNumber);
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Multiplier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Multiplier.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/ServerRoutes.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/ServerRoutes.java?rev=650758&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/ServerRoutes.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/ServerRoutes.java
 Tue Apr 22 23:14:26 2008
@@ -0,0 +1,36 @@
+/**
+ * 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.server;
+
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @author martin.gilday
+ */
+public class ServerRoutes extends RouteBuilder {
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.camel.builder.RouteBuilder#configure()
+     */
+    @Override
+    public void configure() throws Exception {
+        from("jms:queue:numbers").beanRef("multiplier", "multiply");
+    }
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/ServerRoutes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/ServerRoutes.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Treble.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Treble.java?rev=650758&view=auto
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Treble.java
 (added)
+++ 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Treble.java
 Tue Apr 22 23:14:26 2008
@@ -0,0 +1,36 @@
+/**
+ * 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.server;
+
+import org.springframework.stereotype.Service;
+
+/**
+ * @author martin.gilday
+ */
[EMAIL PROTECTED](value = "multiplier")
+public class Treble implements Multiplier {
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.example.server.Multiplier#multiply(int)
+     */
+    public int multiply(final int originalNumber) {
+        return originalNumber * 3;
+    }
+
+}

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Treble.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/java/org/apache/camel/example/server/Treble.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml?rev=650758&r1=650757&r2=650758&view=diff
==============================================================================
--- 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml
 (original)
+++ 
activemq/camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml
 Tue Apr 22 23:14:26 2008
@@ -10,10 +10,10 @@
                http://activemq.apache.org/camel/schema/spring
                
http://activemq.apache.org/camel/schema/spring/camel-spring-1.3.0.xsd";>
 
-       <context:component-scan base-package="org.example.server" />
+       <context:component-scan base-package="org.apache.camel.example.server" 
/>
 
        <camel:camelContext id="camel">
-               <camel:package>org.example.server</camel:package>
+               <camel:package>org.apache.camel.example.server</camel:package>
        </camel:camelContext>
 
        <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">


Reply via email to