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

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


Author: ataylor
Date: 2009-07-27 10:50:08 -0400 (Mon, 27 Jul 2009)
New Revision: 7615

Added:
   trunk/examples/javaee/mdb-cmt-setrollbackonly/
   trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/MDB_CMT_SetRollbackOnlyClientExample.java
   trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMT_SetRollbackOnlyExample.java
Removed:
   trunk/examples/javaee/mdb-cmp-setrollbackonly/
   trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/MDB_CMP_SetRollbackOnlyClientExample.java
   trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMP_SetRollbackOnlyExample.java
Modified:
   trunk/examples/javaee/mdb-cmt-setrollbackonly/build.xml
   trunk/examples/javaee/mdb-cmt-setrollbackonly/config/ant.properties
Log:
renamed examples

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

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

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

Deleted: trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/MDB_CMP_SetRollbackOnlyClientExample.java
===================================================================
--- trunk/examples/javaee/mdb-cmp-setrollbackonly/src/org/jboss/javaee/example/MDB_CMP_SetRollbackOnlyClientExample.java	2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/MDB_CMP_SetRollbackOnlyClientExample.java	2009-07-27 14:50:08 UTC (rev 7615)
@@ -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_SetRollbackOnlyClientExample
-{
-   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_SetRollbackOnlyExample
-      }
-      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-setrollbackonly/src/org/jboss/javaee/example/MDB_CMT_SetRollbackOnlyClientExample.java (from rev 7610, trunk/examples/javaee/mdb-cmp-setrollbackonly/src/org/jboss/javaee/example/MDB_CMP_SetRollbackOnlyClientExample.java)
===================================================================
--- trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/MDB_CMT_SetRollbackOnlyClientExample.java	                        (rev 0)
+++ trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/MDB_CMT_SetRollbackOnlyClientExample.java	2009-07-27 14:50:08 UTC (rev 7615)
@@ -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_CMP_SetRollbackOnlyClientExample
+{
+   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_SetRollbackOnlyExample
+      }
+      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-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMP_SetRollbackOnlyExample.java
===================================================================
--- trunk/examples/javaee/mdb-cmp-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMP_SetRollbackOnlyExample.java	2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMP_SetRollbackOnlyExample.java	2009-07-27 14:50:08 UTC (rev 7615)
@@ -1,82 +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.MessageDrivenContext;
-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;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
- at MessageDriven(name = "MDB_CMP_SetRollbackOnlyExample",
-               activationConfig =
-                     {
-                        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
-                        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue")
-                     })
- at TransactionManagement(value= TransactionManagementType.CONTAINER)
- at TransactionAttribute(value= TransactionAttributeType.REQUIRED)
-public class MDB_CMP_SetRollbackOnlyExample implements MessageListener
-{
-   @Resource
-   MessageDrivenContext ctx;
-
-   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();
-
-         if(!textMessage.getJMSRedelivered())
-         {
-            //Step 11. rollback delivery of message if the first time
-            System.out.println("message " + text + " received for the first time");
-            ctx.setRollbackOnly();
-         }
-         else
-         {
-            //Step 12. read the message
-            System.out.println("message " + text + " received for the second time");  
-         }
-
-
-      }
-      catch (JMSException e)
-      {
-         e.printStackTrace();
-      }
-   }
-}
\ No newline at end of file

Copied: trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMT_SetRollbackOnlyExample.java (from rev 7610, trunk/examples/javaee/mdb-cmp-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMP_SetRollbackOnlyExample.java)
===================================================================
--- trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMT_SetRollbackOnlyExample.java	                        (rev 0)
+++ trunk/examples/javaee/mdb-cmt-setrollbackonly/src/org/jboss/javaee/example/server/MDB_CMT_SetRollbackOnlyExample.java	2009-07-27 14:50:08 UTC (rev 7615)
@@ -0,0 +1,82 @@
+/*
+ * 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.MessageDrivenContext;
+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;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+ at MessageDriven(name = "MDB_CMT_SetRollbackOnlyExample",
+               activationConfig =
+                     {
+                        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+                        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue")
+                     })
+ at TransactionManagement(value= TransactionManagementType.CONTAINER)
+ at TransactionAttribute(value= TransactionAttributeType.REQUIRED)
+public class MDB_CMP_SetRollbackOnlyExample implements MessageListener
+{
+   @Resource
+   MessageDrivenContext ctx;
+
+   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();
+
+         if(!textMessage.getJMSRedelivered())
+         {
+            //Step 11. rollback delivery of message if the first time
+            System.out.println("message " + text + " received for the first time");
+            ctx.setRollbackOnly();
+         }
+         else
+         {
+            //Step 12. read the message
+            System.out.println("message " + text + " received for the second time");  
+         }
+
+
+      }
+      catch (JMSException e)
+      {
+         e.printStackTrace();
+      }
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list