[jboss-svn-commits] JBL Code SVN: r11268 - in labs/jbossesb/trunk/product/samples/quickstarts/business_service: src and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Apr 23 16:56:50 EDT 2007
Author: beve
Date: 2007-04-23 16:56:50 -0400 (Mon, 23 Apr 2007)
New Revision: 11268
Added:
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/HelloWorld.java
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/HelloWorldBean.java
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/client/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/client/Client.java
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/MyAction.java
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/test/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/test/SendJMSMessage.java
Removed:
labs/jbossesb/trunk/product/samples/quickstarts/business_service/ejb3/
labs/jbossesb/trunk/product/samples/quickstarts/business_service/esb_actions/
Modified:
labs/jbossesb/trunk/product/samples/quickstarts/business_service/build.xml
Log:
moved the contents of ejb3 and esb_actions to src.
"Fixed a classpath problem by setting the classpath explicitly in build.xml and adding the run target in build.xml aswell. Will look at a better solution but in the mean while this quickstart should run. I tested against JBoss AS with ejb3 and jboss MQ. Is not tested with by deploying as an .esb archive.
Modified: labs/jbossesb/trunk/product/samples/quickstarts/business_service/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_service/build.xml 2007-04-23 20:33:14 UTC (rev 11267)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_service/build.xml 2007-04-23 20:56:50 UTC (rev 11268)
@@ -4,6 +4,8 @@
${ant.project.name}
${line.separator}
</description>
+
+
<!-- Import the base Ant build script... -->
<import file="../conf/base-build.xml"/>
@@ -13,57 +15,48 @@
<property name="classes" value="build/classes"/>
- <path id="compile-classpath">
- <fileset dir="../../../lib/ext" includes="*.jar"/>
- <!-- Product Dependencies. -->
- <fileset dir="${esb.product.lib.dir}" includes="*.jar"/>
- <fileset dir="${org.jboss.esb.server.home}/client" includes="*.jar"/>
- <!-- Product Jars. -->
- </path>
- <path id="exec-classpath">
- <pathelement location="."/>
- <pathelement location="build/classes"/>
- <pathelement location="src"/>
- <path refid="compile-classpath"/>
- <fileset dir="${org.jboss.esb.server.home}/client" includes="*.jar"/>
- <!-- Required for JMS Client Code. -->
- </path>
+ <path id="quickstart.classpath">
+ <fileset dir="${org.jboss.esb.server.home}/client" >
+ <include name="jbossmq-client.jar"/>
+ <include name="jboss-ejb3-client.jar"/>
+ <include name="jboss-aop-jdk50-client.jar"/>
+ <include name="jboss-annotations-ejb3.jar"/>
+ <include name="jboss-ejb3x.jar"/>
+ <include name="jboss-aspect-jdk50-client.jar"/>
+ <include name="jbossmq-client.jar"/>
+ </fileset>
+ <fileset dir="${product.dir}/lib/ext">
+ <include name="*.jar"/>
+ <exclude name="jboss.jar"/>
+ <exclude name="jbossall.jar"/>
+ <exclude name="jboss-messaging-client.jar"/>
+ </fileset>
+ <pathelement location="."/>
+ <pathelement location="build/classes"/>
+ <pathelement location="src"/>
+ <fileset dir="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/lib" includes="jboss-remoting.jar"/>
+ <fileset dir="${esb.product.lib.dir}" includes="*.jar" excludes="jboss-remoting.jar"/>
+ </path>
+
+ <target name="run" depends="compile,config">
+ <echo>Launching Quickstart in standalone mode...</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.listeners.StandAloneBootStrapper" failonerror="true">
+ <arg value="${basedir}/jboss-esb.xml" />
+ <classpath refid="quickstart.classpath" />
+ </java>
+ </target>
- <!--
- <target name="compile">
- <mkdir dir="${classes}"/>
- <javac srcdir="ejb3/src" destdir="${classes}">
- <classpath refid="compile-classpath"/>
- </javac>
- <javac srcdir="esb_actions/src" destdir="${classes}">
- <classpath refid="compile-classpath"/>
- </javac>
- </target>
- -->
-
<target name="quickstart-specific-assemblies">
<jar destfile="${ejb.jar.name}">
<fileset dir="build/classes" includes="org/jboss/tutorial/stateless/bean/*.class"/>
</jar>
</target>
- <!--
- <target name="deploy" depends="compile">
- <echo>Deploying Quickstart to JBoss ESB Server...</echo>
- <jar destfile="build/${ant.project.name}.esb">
- <fileset dir="build" includes="helloworld-ejb.jar"/>
- <fileset dir="build/classes" includes="quickstart/**/*"/>
- <fileset dir="build" includes="META-INF/**"/>
- <fileset dir="${basedir}" includes="jboss-mq-queue-service.xml"/>
- </jar>
- </target>
- -->
-
<target name="testaspojo" depends="compile"
description="tests a pojo">
<java classname="org.jboss.tutorial.stateless.client.Client" fork="yes" dir=".">
<arg value="-pojo"/>
- <classpath refid="exec-classpath"/>
+ <classpath refid="quickstart.classpath" />
</java>
</target>
@@ -71,7 +64,7 @@
description="tests an EJB">
<java classname="org.jboss.tutorial.stateless.client.Client" fork="yes" dir=".">
<arg value="-ejb"/>
- <classpath refid="exec-classpath"/>
+ <classpath refid="quickstart.classpath" />
</java>
</target>
@@ -80,18 +73,8 @@
<echo>Runs Test JMS Sender</echo>
<java fork="yes" classname="quickstart.business_service.test.SendJMSMessage" failonerror="true">
<arg value="Your Name"/>
- <classpath refid="exec-classpath"/>
+ <classpath refid="quickstart.classpath" />
</java>
</target>
- <target name="deploy">
- <property name="ejb.jar.name" value="${basedir}/build/helloworld-ejb.jar"/>
- <echo>
- ######################################################################
- This quickstart can only run in standalone mode.
- Please run 'ant help' for information about how to run this quickstart
- ######################################################################
- </echo>
- </target>
-
</project>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/HelloWorld.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/HelloWorld.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/HelloWorld.java 2007-04-23 20:56:50 UTC (rev 11268)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.tutorial.stateless.bean;
+
+public interface HelloWorld
+{
+ public String sayHello(String toWhom);
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/HelloWorldBean.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/HelloWorldBean.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/bean/HelloWorldBean.java 2007-04-23 20:56:50 UTC (rev 11268)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.tutorial.stateless.bean;
+
+import javax.ejb.Stateless;
+import javax.ejb.Remote;
+
+ at Stateless
+ at Remote(HelloWorld.class)
+public class HelloWorldBean
+ implements HelloWorld
+{
+ public String sayHello(String toWhom) {
+ System.out.println("Saying Hello to " + toWhom);
+ return "Hello World: " + toWhom + " " + new java.util.Date();
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/client/Client.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/client/Client.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/org/jboss/tutorial/stateless/client/Client.java 2007-04-23 20:56:50 UTC (rev 11268)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.tutorial.stateless.client;
+
+import org.jboss.tutorial.stateless.bean.HelloWorld;
+import org.jboss.tutorial.stateless.bean.HelloWorldBean;
+
+import javax.naming.InitialContext;
+
+public class Client
+{
+ public static void main(String[] args) throws Exception
+ {
+ // Store a reference to the calculator interface
+ HelloWorld hw = null;
+
+ // Decide whether to use a POJO or connect to an EJB
+ if (args.length != 1)
+ {
+ System.err.println("Usage: java org.jboss.tutorial.client.Client [-pojo|-ejb]");
+ System.exit(1);
+ }
+ else if (args[0].equals("-pojo"))
+ {
+ // Simply create a new POJO to act as the HelloWorld
+ System.out.println("Creating a new HelloWorldBean POJO");
+ hw = new HelloWorldBean();
+ }
+ else if (args[0].equals("-ejb"))
+ {
+ // Obtain an initial context
+ InitialContext ctx = new InitialContext();
+
+ // Look up a remote interface to a calculator EJB
+ System.out.println("Obtaining a reference to a remote HelloWorldBean EJB");
+ hw = (HelloWorld) ctx.lookup("HelloWorldBean/remote");
+ }
+ else
+ {
+ System.err.println("Usage: java org.jboss.tutorial.client.Client [-pojo|-ejb]");
+ System.exit(1);
+ }
+
+ if (hw != null)
+ {
+ System.out.println("[Client] " + hw.sayHello("JBoss"));
+ }
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/MyAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/MyAction.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/MyAction.java 2007-04-23 20:56:50 UTC (rev 11268)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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-2006,
+ * @author JBoss Inc.
+ */
+package quickstart.business_service;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.tutorial.stateless.bean.HelloWorld;
+import javax.naming.InitialContext;
+
+public class MyAction extends AbstractActionLifecycle
+{
+
+ protected ConfigTree _config;
+
+ public MyAction(ConfigTree config) { _config = config; }
+
+ public Message noOperation(Message message) { return message; }
+
+ public Message displayMessage(Message message) throws Exception{
+ logHeader();
+ System.out.println("Body: " + new String(message.getBody().getContents()));
+ logFooter();
+ return message;
+ }
+
+ public Message playWithMessage(Message message) throws Exception {
+ Body msgBody = message.getBody();
+ String results = new String();
+ String contents = new String(msgBody.getContents());
+ try {
+ InitialContext ctx = new InitialContext();
+
+ HelloWorld client = (HelloWorld) ctx.lookup("HelloWorldBean/remote");
+ results = client.sayHello(contents);
+ System.out.println("Invoked EJB3: " + results);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println(e);
+ }
+ msgBody.setContents(results.getBytes());
+ return message;
+ }
+
+ public void exceptionHandler(Message message, Throwable exception) {
+ logHeader();
+ System.out.println("!ERROR!");
+ System.out.println(exception.getMessage());
+ System.out.println("For Message: ");
+ System.out.println(message.getBody().getContents());
+ exception.printStackTrace();
+ logFooter();
+ }
+
+ // This makes it easier to read on the console
+ private void logHeader() {
+ System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+ }
+ private void logFooter() {
+ System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/business_service/src/quickstart/business_service/test/SendJMSMessage.java 2007-04-23 20:56:50 UTC (rev 11268)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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-2006,
+ * @author JBoss Inc.
+ */
+package quickstart.business_service.test;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class SendJMSMessage {
+ QueueConnection conn;
+ QueueSession session;
+ Queue que;
+
+
+ public void setupConnection() throws JMSException, NamingException
+ {
+ InitialContext iniCtx = new InitialContext();
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup("queue/quickstart_helloworld_Request");
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+ System.out.println("Connection Started");
+ }
+
+ public void stop() throws JMSException
+ {
+ conn.stop();
+ session.close();
+ conn.close();
+ }
+
+ public void sendAMessage(String msg) throws JMSException {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm = session.createObjectMessage(msg);
+ send.send(tm);
+ send.close();
+ }
+
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ sm.sendAMessage(args[0]);
+ sm.stop();
+
+ }
+
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list