[jboss-cvs] JBoss Messaging SVN: r7616 - in trunk/examples/javaee: mdb-cmt-tx-local and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 27 10:52:27 EDT 2009


Author: ataylor
Date: 2009-07-27 10:52:26 -0400 (Mon, 27 Jul 2009)
New Revision: 7616

Added:
   trunk/examples/javaee/mdb-cmt-tx-local/
   trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/MDB_CMT_TxLocalClientExample.java
   trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/server/MDB_CMT_TxLocalExample.java
Removed:
   trunk/examples/javaee/mdb-cmp-tx-local/
   trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/MDB_CMP_TxLocalClientExample.java
   trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/server/MDB_CMP_TxLocalExample.java
Modified:
   trunk/examples/javaee/mdb-cmt-tx-local/build.xml
   trunk/examples/javaee/mdb-cmt-tx-local/config/ant.properties
Log:
renamed examples

Copied: trunk/examples/javaee/mdb-cmt-tx-local (from rev 7610, trunk/examples/javaee/mdb-cmp-tx-local)

Modified: trunk/examples/javaee/mdb-cmt-tx-local/build.xml
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-local/build.xml	2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-local/build.xml	2009-07-27 14:52:26 UTC (rev 7616)
@@ -31,7 +31,7 @@
    
    <target name="run">
       <antcall target="runExample">
-         <param name="example.classname" value="org.jboss.javaee.example.MDB_CMP_TxLocalClientExample"/>
+         <param name="example.classname" value="org.jboss.javaee.example.MDB_CMT_TxLocalClientExample"/>
       </antcall>
    </target>
 </project>
\ No newline at end of file

Modified: trunk/examples/javaee/mdb-cmt-tx-local/config/ant.properties
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-local/config/ant.properties	2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-local/config/ant.properties	2009-07-27 14:52:26 UTC (rev 7616)
@@ -1 +1 @@
-example.name=mdb-cmp-tx-local
\ No newline at end of file
+example.name=mdb-cmt-tx-local
\ No newline at end of file

Deleted: trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/MDB_CMP_TxLocalClientExample.java
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-local/src/org/jboss/javaee/example/MDB_CMP_TxLocalClientExample.java	2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/MDB_CMP_TxLocalClientExample.java	2009-07-27 14:52:26 UTC (rev 7616)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-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.javaee.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class MDB_CMP_TxLocalClientExample
-{
-   public static void main(String[] args) throws Exception
-   {
-      Connection connection = null;
-      InitialContext initialContext = null;
-      try
-      {
-         //Step 1. Create an initial context to perform the JNDI lookup.
-         initialContext = new InitialContext();
-
-         //Step 2. Perfom a lookup on the queue
-         Queue queue = (Queue) initialContext.lookup("/queue/testQueue");
-
-         //Step 3. Perform a lookup on the Connection Factory
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-
-         //Step 4.Create a JMS Connection
-         connection = cf.createConnection();
-
-         //Step 5. Create a JMS Session
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-         //Step 6. Create a JMS Message Producer
-         MessageProducer producer = session.createProducer(queue);
-
-         //Step 7. Create a Text Message
-         TextMessage message = session.createTextMessage("This is a text message");
-
-         System.out.println("Sent message: " + message.getText());
-
-         //Step 8. Send the Message
-         producer.send(message);
-
-          //Step 9,,10, 11 and 12 in MDB_CMP_TxLocalExample
-      }
-      finally
-      {
-         //Step 13. Be sure to close our JMS resources!
-         if (initialContext != null)
-         {
-            initialContext.close();
-         }
-         if(connection != null)
-         {
-            connection.close();
-         }
-      }
-   }
-}
\ No newline at end of file

Copied: trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/MDB_CMT_TxLocalClientExample.java (from rev 7610, trunk/examples/javaee/mdb-cmp-tx-local/src/org/jboss/javaee/example/MDB_CMP_TxLocalClientExample.java)
===================================================================
--- trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/MDB_CMT_TxLocalClientExample.java	                        (rev 0)
+++ trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/MDB_CMT_TxLocalClientExample.java	2009-07-27 14:52:26 UTC (rev 7616)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.javaee.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class MDB_CMT_TxLocalClientExample
+{
+   public static void main(String[] args) throws Exception
+   {
+      Connection connection = null;
+      InitialContext initialContext = null;
+      try
+      {
+         //Step 1. Create an initial context to perform the JNDI lookup.
+         initialContext = new InitialContext();
+
+         //Step 2. Perfom a lookup on the queue
+         Queue queue = (Queue) initialContext.lookup("/queue/testQueue");
+
+         //Step 3. Perform a lookup on the Connection Factory
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
+
+         //Step 4.Create a JMS Connection
+         connection = cf.createConnection();
+
+         //Step 5. Create a JMS Session
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         //Step 6. Create a JMS Message Producer
+         MessageProducer producer = session.createProducer(queue);
+
+         //Step 7. Create a Text Message
+         TextMessage message = session.createTextMessage("This is a text message");
+
+         System.out.println("Sent message: " + message.getText());
+
+         //Step 8. Send the Message
+         producer.send(message);
+
+          //Step 9,,10, 11 and 12 in MDB_CMP_TxLocalExample
+      }
+      finally
+      {
+         //Step 13. Be sure to close our JMS resources!
+         if (initialContext != null)
+         {
+            initialContext.close();
+         }
+         if(connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+}
\ No newline at end of file

Deleted: trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/server/MDB_CMP_TxLocalExample.java
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-local/src/org/jboss/javaee/example/server/MDB_CMP_TxLocalExample.java	2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/server/MDB_CMP_TxLocalExample.java	2009-07-27 14:52:26 UTC (rev 7616)
@@ -1,100 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-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.javaee.example.server;
-
-import javax.annotation.Resource;
-import javax.ejb.ActivationConfigProperty;
-import javax.ejb.MessageDriven;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.ejb.TransactionManagement;
-import javax.ejb.TransactionManagementType;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.TextMessage;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
- at MessageDriven(name = "MDB_CMP_TxLocalExample",
-               activationConfig =
-                     {
-                           @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
-                           @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"),
-                           @ActivationConfigProperty(propertyName = "useLocalTx", propertyValue = "true")
-                     })
- at TransactionManagement(value = TransactionManagementType.CONTAINER)
- at TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
-public class MDB_CMP_TxLocalExample implements MessageListener
-{
-   @Resource(mappedName = "java:/TransactionManager")
-   private TransactionManager tm;
-
-   public void onMessage(Message message)
-   {
-      try
-      {
-         //Step 9. We know the client is sending a text message so we cast
-         TextMessage textMessage = (TextMessage) message;
-
-         //Step 10. get the text from the message.
-         String text = textMessage.getText();
-
-         System.out.println("message " + text + " received");
-
-         if (!textMessage.getJMSRedelivered())
-         {
-            //Step 11. On first delivery get the transaction, take a look, and throw an exception
-            Transaction tx = tm.getTransaction();
-
-            if (tx != null)
-            {
-               System.out.println("something is wrong, there should be no global transaction: " + tx);
-            }
-            else
-            {
-               System.out.println("there is no global transaction, altho the messge delivery is using a local transaction");
-               System.out.println("lets throw an exception and see what happens");
-               throw new RuntimeException("DOH!");
-            }
-         }
-         else
-         {
-            //Step 12. Print the message
-            System.out.println("The message was redelivered since the message delivery used a local transaction");
-         }
-
-      }
-      catch (JMSException e)
-      {
-         e.printStackTrace();
-      }
-      catch(SystemException e)
-      {
-         e.printStackTrace();
-      }
-   }
-}
\ No newline at end of file

Copied: trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/server/MDB_CMT_TxLocalExample.java (from rev 7610, trunk/examples/javaee/mdb-cmp-tx-local/src/org/jboss/javaee/example/server/MDB_CMP_TxLocalExample.java)
===================================================================
--- trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/server/MDB_CMT_TxLocalExample.java	                        (rev 0)
+++ trunk/examples/javaee/mdb-cmt-tx-local/src/org/jboss/javaee/example/server/MDB_CMT_TxLocalExample.java	2009-07-27 14:52:26 UTC (rev 7616)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.javaee.example.server;
+
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+ at MessageDriven(name = "MDB_CMT_TxLocalExample",
+               activationConfig =
+                     {
+                           @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+                           @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"),
+                           @ActivationConfigProperty(propertyName = "useLocalTx", propertyValue = "true")
+                     })
+ at TransactionManagement(value = TransactionManagementType.CONTAINER)
+ at TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
+public class MDB_CMT_TxLocalExample implements MessageListener
+{
+   @Resource(mappedName = "java:/TransactionManager")
+   private TransactionManager tm;
+
+   public void onMessage(Message message)
+   {
+      try
+      {
+         //Step 9. We know the client is sending a text message so we cast
+         TextMessage textMessage = (TextMessage) message;
+
+         //Step 10. get the text from the message.
+         String text = textMessage.getText();
+
+         System.out.println("message " + text + " received");
+
+         if (!textMessage.getJMSRedelivered())
+         {
+            //Step 11. On first delivery get the transaction, take a look, and throw an exception
+            Transaction tx = tm.getTransaction();
+
+            if (tx != null)
+            {
+               System.out.println("something is wrong, there should be no global transaction: " + tx);
+            }
+            else
+            {
+               System.out.println("there is no global transaction, altho the messge delivery is using a local transaction");
+               System.out.println("lets throw an exception and see what happens");
+               throw new RuntimeException("DOH!");
+            }
+         }
+         else
+         {
+            //Step 12. Print the message
+            System.out.println("The message was redelivered since the message delivery used a local transaction");
+         }
+
+      }
+      catch (JMSException e)
+      {
+         e.printStackTrace();
+      }
+      catch(SystemException e)
+      {
+         e.printStackTrace();
+      }
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list