[jboss-svn-commits] JBL Code SVN: r23647 - in labs/jbossesb/workspace/skeagh/examples/jms-router: src/main/java/org/jboss/esb/examples and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Oct 31 08:20:03 EDT 2008
Author: beve
Date: 2008-10-31 08:20:02 -0400 (Fri, 31 Oct 2008)
New Revision: 23647
Added:
labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/
labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/JmsClient.java
labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/MyTestService.java
Removed:
labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/JmsClient.java
labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java
Modified:
labs/jbossesb/workspace/skeagh/examples/jms-router/pom.xml
labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/resources/jboss-esb.xml
Log:
Refactored package names.
Modified: labs/jbossesb/workspace/skeagh/examples/jms-router/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/pom.xml 2008-10-31 11:57:10 UTC (rev 23646)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/pom.xml 2008-10-31 12:20:02 UTC (rev 23647)
@@ -111,7 +111,7 @@
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
- <mainClass>org.jboss.esb.examples.JmsClient</mainClass>
+ <mainClass>org.jboss.esb.examples.jmsrouter.JmsClient</mainClass>
<arguments>
<argument>jbossesb.TestQueue</argument>
<!--argument>Message payload text...</argument-->
@@ -132,7 +132,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package>org.jboss.esb.examples.helloworld, org.apache.activemq.jndi</Export-Package>
+ <Export-Package>org.jboss.esb.examples.jmsrouter, org.apache.activemq.jndi</Export-Package>
<Import-Package>org.jboss.esb.jms, org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
<Embed-Dependency>activemq-core, backport-util-concurrent, log4j, commons-logging, geronimo-j2ee-management_1.1_spec</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
Deleted: labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/JmsClient.java
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/JmsClient.java 2008-10-31 11:57:10 UTC (rev 23646)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/JmsClient.java 2008-10-31 12:20:02 UTC (rev 23647)
@@ -1,181 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
- * LLC, and individual contributors by the @authors tag. See the copyright.txt
- * in the distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
- * site: http://www.fsf.org.
- */
-package org.jboss.esb.examples;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Arrays;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageProducer;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-/**
- * Client that post a message to a JMS destination.
- * <p/>
- * Usage:
- * java org.jboss.esb.examples.JmsClient destination "Message content goes here"
- *
- * The second argument is optional and if left out the user will be prompted
- * to enter a message payload.
- *
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
- */
-public final class JmsClient
-{
- /**
- * Private constructor.
- */
- private JmsClient()
- {
- }
-
- /**
- * Main method.
- *
- * @param args - the arguments from the command line. See class javadoc for usage
- */
- public static void main(final String... args)
- {
- if (args.length < 1)
- {
- printUsage();
- System.exit(-1);
- }
-
- final String destinationName = args[0];
- String payload = getPayload(args);
-
- try
- {
- sendMessage(payload, destinationName);
- }
- catch (final JMSException e)
- {
- e.printStackTrace();
- }
- catch (NamingException e)
- {
- e.printStackTrace();
- }
- }
-
- /**
- *
- * @param payload - the payload to send
- * @param destinationName - the jms destination to send to
- * @throws JMSException - is a JMS exception is thrown
- * @throws NamingException - if a JNDI lookup failes
- */
- private static void sendMessage(final String payload, final String destinationName) throws JMSException, NamingException
- {
- QueueConnection qConnection = null;
- QueueSession qSession = null;
- try
- {
- System.out.println("Sending payload [" + payload + "] to [" + destinationName + "]");
-
- final InitialContext ctx = new InitialContext();
-
- QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
- qConnection = factory.createQueueConnection();
- qConnection.start();
-
- qSession = qConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-
- final TextMessage textMessage = qSession.createTextMessage(payload);
-
- MessageProducer producer = qSession.createProducer((Destination)ctx.lookup(destinationName));
- producer.send(textMessage);
- }
- finally
- {
- if (qSession != null)
- {
- qSession.close();
- }
- if (qConnection != null)
- {
- qConnection.close();
- }
- }
- }
-
- /**
- * Simple prints the usage of this class.
- *
- * @param args - the arguments that were passed from the command line
- */
- private static void printUsage(final String... args)
- {
- System.err.println("*****************************************************************************");
- System.err.println("Usage: ");
- System.err.println("java org.jboss.esb.examples.JmsClient destination \"Message content goes here\"");
- System.err.println("");
- System.err.println("Arguments provided:");
- System.err.println(Arrays.asList(args));
- System.err.println("*****************************************************************************");
- }
-
- /**
- * Prompts for the message payload to be entered from the command line.
- *
- * @param message The message to be displayed to the user.
- * @return String The text typed at the command line by the user.
- */
- private static String getPayloadFromCommandLine(final String message)
- {
- try
- {
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- System.out.print("> " + message);
- return in.readLine();
- }
- catch (final IOException e)
- {
- e.printStackTrace();
- }
- System.out.println(System.getProperty("line.separator"));
- return null;
- }
-
- /**
- * Get the payload from either the command line of from the
- * second argument passed to the main method.
- *
- * @param args The args array passed to the main method.
- * @return String The message payload.
- */
- private static String getPayload(final String... args)
- {
- return args.length == 2 ? args[1] : getPayloadFromCommandLine("Specify message payload test >");
- }
-
-}
Deleted: labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java 2008-10-31 11:57:10 UTC (rev 23646)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java 2008-10-31 12:20:02 UTC (rev 23647)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.examples.helloworld;
-
-import org.jboss.esb.api.message.Message;
-import org.jboss.esb.api.service.Service;
-import org.jboss.esb.api.service.ServiceException;
-
-/**
- * Simple Test service.
- *
- * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
- */
-public final class MyTestService implements Service
-{
- /**
- * Processes the message.
- * @param msg - the esb message object instance.
- * @return Messsage - the esb message object instance.
- * @throws ServiceException - if an exception occurs during processing.
- */
- public Message process(final Message msg) throws ServiceException
- {
- System.out.println("MyTestService message payload : " + msg.getPayload());
- return msg;
- }
-
-}
Copied: labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/JmsClient.java (from rev 23646, labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/JmsClient.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/JmsClient.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/JmsClient.java 2008-10-31 12:20:02 UTC (rev 23647)
@@ -0,0 +1,181 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.esb.examples.jmsrouter;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * Client that post a message to a JMS destination.
+ * <p/>
+ * Usage:
+ * java org.jboss.esb.examples.JmsClient destination "Message content goes here"
+ *
+ * The second argument is optional and if left out the user will be prompted
+ * to enter a message payload.
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public final class JmsClient
+{
+ /**
+ * Private constructor.
+ */
+ private JmsClient()
+ {
+ }
+
+ /**
+ * Main method.
+ *
+ * @param args - the arguments from the command line. See class javadoc for usage
+ */
+ public static void main(final String... args)
+ {
+ if (args.length < 1)
+ {
+ printUsage();
+ System.exit(-1);
+ }
+
+ final String destinationName = args[0];
+ String payload = getPayload(args);
+
+ try
+ {
+ sendMessage(payload, destinationName);
+ }
+ catch (final JMSException e)
+ {
+ e.printStackTrace();
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ *
+ * @param payload - the payload to send
+ * @param destinationName - the jms destination to send to
+ * @throws JMSException - is a JMS exception is thrown
+ * @throws NamingException - if a JNDI lookup failes
+ */
+ private static void sendMessage(final String payload, final String destinationName) throws JMSException, NamingException
+ {
+ QueueConnection qConnection = null;
+ QueueSession qSession = null;
+ try
+ {
+ System.out.println("Sending payload [" + payload + "] to [" + destinationName + "]");
+
+ final InitialContext ctx = new InitialContext();
+
+ QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
+ qConnection = factory.createQueueConnection();
+ qConnection.start();
+
+ qSession = qConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ final TextMessage textMessage = qSession.createTextMessage(payload);
+
+ MessageProducer producer = qSession.createProducer((Destination)ctx.lookup(destinationName));
+ producer.send(textMessage);
+ }
+ finally
+ {
+ if (qSession != null)
+ {
+ qSession.close();
+ }
+ if (qConnection != null)
+ {
+ qConnection.close();
+ }
+ }
+ }
+
+ /**
+ * Simple prints the usage of this class.
+ *
+ * @param args - the arguments that were passed from the command line
+ */
+ private static void printUsage(final String... args)
+ {
+ System.err.println("*****************************************************************************");
+ System.err.println("Usage: ");
+ System.err.println("java org.jboss.esb.examples.JmsClient destination \"Message content goes here\"");
+ System.err.println("");
+ System.err.println("Arguments provided:");
+ System.err.println(Arrays.asList(args));
+ System.err.println("*****************************************************************************");
+ }
+
+ /**
+ * Prompts for the message payload to be entered from the command line.
+ *
+ * @param message The message to be displayed to the user.
+ * @return String The text typed at the command line by the user.
+ */
+ private static String getPayloadFromCommandLine(final String message)
+ {
+ try
+ {
+ BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+ System.out.print("> " + message);
+ return in.readLine();
+ }
+ catch (final IOException e)
+ {
+ e.printStackTrace();
+ }
+ System.out.println(System.getProperty("line.separator"));
+ return null;
+ }
+
+ /**
+ * Get the payload from either the command line of from the
+ * second argument passed to the main method.
+ *
+ * @param args The args array passed to the main method.
+ * @return String The message payload.
+ */
+ private static String getPayload(final String... args)
+ {
+ return args.length == 2 ? args[1] : getPayloadFromCommandLine("Specify message payload test >");
+ }
+
+}
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/JmsClient.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/MyTestService.java (from rev 23646, labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/MyTestService.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/MyTestService.java 2008-10-31 12:20:02 UTC (rev 23647)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.examples.jmsrouter;
+
+import org.jboss.esb.api.message.Message;
+import org.jboss.esb.api.service.Service;
+import org.jboss.esb.api.service.ServiceException;
+
+/**
+ * Simple Test service.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public final class MyTestService implements Service
+{
+ /**
+ * Processes the message.
+ * @param msg - the esb message object instance.
+ * @return Messsage - the esb message object instance.
+ * @throws ServiceException - if an exception occurs during processing.
+ */
+ public Message process(final Message msg) throws ServiceException
+ {
+ System.out.println("MyTestService message payload : " + msg.getPayload());
+ return msg;
+ }
+
+}
Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/java/org/jboss/esb/examples/jmsrouter/MyTestService.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/resources/jboss-esb.xml 2008-10-31 11:57:10 UTC (rev 23646)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/src/main/resources/jboss-esb.xml 2008-10-31 12:20:02 UTC (rev 23647)
@@ -1,6 +1,6 @@
<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<services>
- <service serviceCategory="examples" serviceName="helloworld" serviceDescription="First Example" class="org.jboss.esb.examples.helloworld.MyTestService">
+ <service serviceCategory="examples" serviceName="helloworld" serviceDescription="First Example" class="org.jboss.esb.examples.jmsrouter.MyTestService">
<inRouter name="inrouter1" class="org.jboss.esb.jms.JmsInboundRouter">
<property name="java.naming.provider.url">tcp://localhost:61717</property>
<property name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</property>
More information about the jboss-svn-commits
mailing list