[jboss-cvs] JBossAS SVN: r82718 - in branches/Branch_5_x: messaging and 133 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 8 21:20:53 EST 2009


Author: gaohoward
Date: 2009-01-08 21:20:53 -0500 (Thu, 08 Jan 2009)
New Revision: 82718

Added:
   branches/Branch_5_x/messaging/src/etc/examples/bridge/
   branches/Branch_5_x/messaging/src/etc/examples/bridge/README.html
   branches/Branch_5_x/messaging/src/etc/examples/bridge/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/
   branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/test-bridge-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/bridge/src/
   branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/jboss/example/jms/bridge/
   branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/jboss/example/jms/bridge/BridgeExample.java
   branches/Branch_5_x/messaging/src/etc/examples/common/
   branches/Branch_5_x/messaging/src/etc/examples/common/etc/
   branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/
   branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/ejb-jar.xml
   branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/jboss.xml
   branches/Branch_5_x/messaging/src/etc/examples/common/src/
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/ExampleSupport.java
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/Util.java
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/Management.java
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/ManagementBean.java
   branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/ManagementHome.java
   branches/Branch_5_x/messaging/src/etc/examples/config/
   branches/Branch_5_x/messaging/src/etc/examples/config/clustered-hsqldb-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/db2-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/hsqldb-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/mssql-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/mysql-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/ndb-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/null-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/oracle-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/postgresql-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/remoting-bisocket-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/remoting-http-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/remoting-sslbisocket-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/config/sybase-persistence-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/destinations/
   branches/Branch_5_x/messaging/src/etc/examples/destinations/jbm-examples-destinations-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/README.html
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/distributed-queue-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java
   branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/README.html
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/distributed-topic-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/DistributedTopicExample.java
   branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/ExampleListener.java
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/README.html
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/META-INF/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java
   branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/Sender.java
   branches/Branch_5_x/messaging/src/etc/examples/http/
   branches/Branch_5_x/messaging/src/etc/examples/http/README.html
   branches/Branch_5_x/messaging/src/etc/examples/http/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/http/etc/
   branches/Branch_5_x/messaging/src/etc/examples/http/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/http/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/http/etc/messaging-http-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/http/src/
   branches/Branch_5_x/messaging/src/etc/examples/http/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/http/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/http/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/http/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/http/src/org/jboss/example/jms/http/
   branches/Branch_5_x/messaging/src/etc/examples/http/src/org/jboss/example/jms/http/HttpExample.java
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/README.html
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/ejb-jar.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/jboss.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/MDBFailureExample.java
   branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/Sender.java
   branches/Branch_5_x/messaging/src/etc/examples/mdb/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/README.html
   branches/Branch_5_x/messaging/src/etc/examples/mdb/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/application.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/jboss-app.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/ejb-jar.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/jboss.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/mdb/src/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/
   branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/MDBExample.java
   branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/README.html
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/distributed-queue-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/jboss/example/jms/failover/
   branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/jboss/example/jms/failover/QueueFailoverExample.java
   branches/Branch_5_x/messaging/src/etc/examples/queue/
   branches/Branch_5_x/messaging/src/etc/examples/queue/README.html
   branches/Branch_5_x/messaging/src/etc/examples/queue/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/queue/etc/
   branches/Branch_5_x/messaging/src/etc/examples/queue/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/queue/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/queue/src/
   branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/jboss/example/jms/queue/
   branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/jboss/example/jms/queue/QueueExample.java
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/README.html
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging-secure-socket-service.xml
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging.keystore
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging.truststore
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/jboss/example/jms/securesocket/
   branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/jboss/example/jms/securesocket/SecureSocketExample.java
   branches/Branch_5_x/messaging/src/etc/examples/stateless/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/README.html
   branches/Branch_5_x/messaging/src/etc/examples/stateless/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/ejb-jar.xml
   branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/jboss.xml
   branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleHome.java
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/client/
   branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java
   branches/Branch_5_x/messaging/src/etc/examples/topic/
   branches/Branch_5_x/messaging/src/etc/examples/topic/README.html
   branches/Branch_5_x/messaging/src/etc/examples/topic/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/topic/etc/
   branches/Branch_5_x/messaging/src/etc/examples/topic/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/topic/etc/log4j.xml
   branches/Branch_5_x/messaging/src/etc/examples/topic/src/
   branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/
   branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/ExampleListener.java
   branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/TopicExample.java
   branches/Branch_5_x/messaging/src/etc/examples/web-service/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/README.html
   branches/Branch_5_x/messaging/src/etc/examples/web-service/build.xml
   branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/WEB-INF/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/WEB-INF/web.xml
   branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/client-config/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/client-config/client-config.xml
   branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/jndi.properties
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/example/jms/webservices/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/example/jms/webservices/client/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/example/jms/webservices/client/Client.java
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExample.java
   branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExampleImpl.java
Modified:
   branches/Branch_5_x/build/build-distr.xml
   branches/Branch_5_x/messaging/README.txt
Log:
added JBM examples


Modified: branches/Branch_5_x/build/build-distr.xml
===================================================================
--- branches/Branch_5_x/build/build-distr.xml	2009-01-09 01:46:23 UTC (rev 82717)
+++ branches/Branch_5_x/build/build-distr.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -761,6 +761,7 @@
      </copy>
   	
      <!-- copy example jms configs -->
+     <!-- we don't need them anymore, they are all in examples/config now
      <mkdir dir="${install.examples.jms}"/>
      <copy todir="${install.examples.jms}" filtering="no">
        <fileset dir="${jboss.messaging.resources}">
@@ -768,10 +769,26 @@
          <include name="remoting-*-service.xml"/>
        </fileset>
      </copy>
+     -->
+
      <!-- the JBM bundled destinations-service.xml comes with many examples -->
      <copy file="${jboss.messaging.resources}/destinations-service.xml"
        tofile="${install.examples.jms}/example-destinations-service.xml"/>
 
+     <!-- JBM examples for JBoss 5 -->
+     <mkdir dir="${install.examples.jms}"/>
+     <copy todir="${install.examples.jms}" filtering="no">
+       <fileset dir="${_module.output}/etc/">
+       </fileset>
+     </copy>
+     <!-- need to copy the following files as AS5 build while change the contents of them -->
+     <copy todir="${install.examples.jms}/examples/secure-socket/etc/" overwrite="yes">
+       <fileset dir="${project.root}/${_module.name}/src/etc/examples/secure-socket/etc">
+         <include name="messaging.keystore"/>
+         <include name="messaging.truststore"/>
+       </fileset>
+     </copy>
+
    </target>
 
    <target name="_module-messaging-all" depends="_module-messaging-most">

Modified: branches/Branch_5_x/messaging/README.txt
===================================================================
--- branches/Branch_5_x/messaging/README.txt	2009-01-09 01:46:23 UTC (rev 82717)
+++ branches/Branch_5_x/messaging/README.txt	2009-01-09 02:20:53 UTC (rev 82718)
@@ -7,3 +7,4 @@
 src/etc/deploy/common - 
 src/etc/deploy/non-clustered - 
 src/etc/xmbean - XMBean descriptors
+src/etc/examples - messaging examples

Added: branches/Branch_5_x/messaging/src/etc/examples/bridge/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/bridge/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/bridge/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,115 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - JMS Bridge</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Bridge Example</h1>
+$Revision: 2310 $
+<h2>Overview</h2>
+<br>
+This example deploys a message bridge in JBoss AS, which is configured to 
+move messages from one destination to another.
+<br>
+The example then sends some message to the source destination, then consumes the
+same messages from the target destionation, demonstrating that the bridge has
+successfully moved the messages from the source to the target.
+<br>
+The example is somewhat artificial in that normally a bridge would be used to move messages
+from source and target destinations on different servers, but it serves to illustrate how to 
+use a bridge.
+<br>
+This example relies on having access to a running JBoss default
+instance, which is available when you have installed JBoss AS 5. <br>
+<span style="font-style: italic;"></span>
+<h2>Running the example</h2>
+
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+AS 5 installation. For example, <span style="font-family: monospace;">/home/user/jboss-5.0.0.GA</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">/home/user/</span><span
+ style="font-family: monospace;">jboss-5.0.0.GA</span><br>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+.../examples/bridge</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+      <div style="margin-left: 40px;"><br>
+      </div>
+
+[tim at Vigor14 bridge]$ ant<br>
+Buildfile: build.xml<br>
+<br>
+identify:<br>
+     [echo] ###########################################################################<br>
+     [echo] #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Running the BRIDGE example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#<br>
+     [echo] ###########################################################################<br>
+     [echo] The queue:      ${example.queue.name}<br>
+     [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar<br>
+<br>
+sanity-check:<br>
+<br>
+init:<br>
+    [mkdir] Created dir: /home/tim/dev/jboss-messaging/trunk/docs/examples/bridge/output/classes<br>
+    [mkdir] Created dir: /home/tim/dev/jboss-messaging/trunk/docs/examples/common/output/classes<br>
+<br>
+compile:<br>
+    [javac] Compiling 5 source files to /home/tim/dev/jboss-messaging/trunk/docs/examples/common/output/classes<br>
+    [javac] Compiling 1 source file to /home/tim/dev/jboss-messaging/trunk/docs/examples/bridge/output/classes><br>
+<br>
+deploy:<br>
+     [copy] Copying 1 file to /home/tim/dev/jboss-5.0.0.GA/server/messaging/deploy<br>
+<br>sleep:<br>     [echo] Sleeping for 5 seconds ...<br><br>run:<br>     [java] Queue JBossQueue[A] exists<br>     [java] Queue JBossQueue[B] exists<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was successfully sent to the A queue<br>     [java] The message was received successfully from the B queue<br>     [java] The message was received successfully from the B queue<br>     [java] The message was received successfully from t!
 he B queue<br>     [java] The message was received successfully from the B queue<br>     [java] The message was received successfully from the B queue<br>     [java] The message was received successfully from the B queue<br>     [java] The message was received successfully from the B queue<br>     [java] The message was received successfully from the B queue<br>     [java] The message was received successfully from the B queue<br>     [java] The message was received successfully from the B queue<br>     [java] The example connected to JBoss Messaging version 1.4.1.GA (1.4)<br><br>     [java] #####################<br>     [java] ###&nbsp;&nbsp;&nbsp;SUCCESS!&nbsp;&nbsp;&nbsp;&nbsp;###<br>     [java] #####################<br><br>undeploy:<br>   [delete] Deleting: /home/tim/dev/jboss-5.0.0.GA/server/messaging/deploy/test-bridge-service.xml<br><br>BUILD SUCCESSFUL<br>Total time: 9 seconds<br><br>  
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/bridge/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/bridge/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/bridge/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 2705 2007-05-17 21:34:07Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="BridgeExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="default" />
+	<property name="example.source.queue" value="A" />
+	<property name="example.target.queue" value="B" />
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                       Running the BRIDGE example                        #" />
+		<echo message="###########################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/classes" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="deploy" depends="compile">
+		<java classname="org.jboss.example.jms.common.Util" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.source.queue" value="${example.source.queue}" />
+			<sysproperty key="example.target.queue" value="${example.target.queue}" />
+			<arg value="bridge-deploy"/>
+		</java>
+		<copy file="./etc/test-bridge-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="5" />
+		</antcall>
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/test-bridge-service.xml" quiet="true" />
+		<java classname="org.jboss.example.jms.common.Util" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.source.queue" value="${example.source.queue}" />
+			<sysproperty key="example.target.queue" value="${example.target.queue}" />
+			<arg value="bridge-undeploy"/>
+		</java>
+	</target>
+
+	<target name="run" depends="deploy">
+		<java classname="org.jboss.example.jms.bridge.BridgeExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.source.queue" value="${example.source.queue}" />
+			<sysproperty key="example.target.queue" value="${example.target.queue}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+         -->
+		</java>
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="clean" depends="undeploy">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2318 2007-02-15 02:11:43Z ovidiu.feodorov at jboss.com $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+  <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/test-bridge-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/test-bridge-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/bridge/etc/test-bridge-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Example deployment descriptor for a message bridge
+
+     $Id: messaging-secure-socket-service.xml 2737 2007-05-29 17:56:49Z timfox $
+ -->
+
+<server>
+
+
+   <mbean code="org.jboss.jms.server.bridge.BridgeService"
+          name="jboss.messaging:service=Bridge,name=TestBridge"
+          xmbean-dd="xmdesc/Bridge-xmbean.xml">
+          
+      <!-- The JMS provider loader that is used to lookup the source destination -->   
+      <depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>     
+      
+      <!-- The JMS provider loader that is used to lookup the target destination -->
+      <depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>    
+      
+      <!-- The JNDI lookup for the source destination -->
+      <attribute name="SourceDestinationLookup">/queue/A</attribute> 
+      
+      <!-- The JNDI lookup for the target destination -->
+      <attribute name="TargetDestinationLookup">/queue/B</attribute>
+      
+      <!-- The username to use for the source connection 
+      <attribute name="SourceUsername">bob</attribute>
+      -->
+      
+      <!-- The password to use for the source connection
+      <attribute name="SourcePassword">cheesecake</attribute>
+      -->
+      
+      <!-- The username to use for the target connection
+      <attribute name="TargetUsername">mary</attribute>
+      -->
+      
+      <!-- The password to use for the target connection
+      <attribute name="TargetPassword">hotdog</attribute>
+      -->
+      
+      <!-- Optional: The Quality Of Service mode to use, one of:
+           QOS_AT_MOST_ONCE = 0;
+           QOS_DUPLICATES_OK = 1;
+           QOS_ONCE_AND_ONLY_ONCE = 2; -->
+      <attribute name="QualityOfServiceMode">0</attribute>
+      
+      <!-- JMS selector to use for consuming messages from the source
+      <attribute name="Selector">specify jms selector here</attribute>
+      -->
+      
+      <!-- The maximum number of messages to consume from the source before sending to the target -->
+      <attribute name="MaxBatchSize">5</attribute>     
+      
+      <!-- The maximum time to wait (in ms) before sending a batch to the target even if MaxBatchSize is not exceeded.
+           -1 means wait forever -->   
+      <attribute name="MaxBatchTime">-1</attribute>
+      
+      <!-- If consuming from a durable subscription this is the subscription name
+      <attribute name="SubName">mysub</attribute>
+      -->
+      
+      <!-- If consuming from a durable subscription this is the client ID to use
+      <attribute name="ClientID">myClientID</attribute>
+      -->
+      
+      <!-- The number of ms to wait between connection retrues in the event connections to source or target fail -->
+      <attribute name="FailureRetryInterval">5000</attribute>      
+      
+      <!-- The maximum number of connection retries to make in case of failure, before giving up
+           -1 means try forever-->
+      <attribute name="MaxRetries">-1</attribute>
+
+      <!-- If true then the message id of the message before bridging will be added as a header to the message so it is available
+           to the receiver. Can then be sent as correlation id to correlate in a distributed request-response -->
+      <attribute name="AddMessageIDInHeader">false</attribute>
+      
+    </mbean>
+ 
+ </server>

Added: branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/jboss/example/jms/bridge/BridgeExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/jboss/example/jms/bridge/BridgeExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/bridge/src/org/jboss/example/jms/bridge/BridgeExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.bridge;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+import org.jboss.example.jms.common.Util;
+
+/**
+ * This example creates a JMS Connection to a JBoss Messaging instance and then sends a message to a source queue.
+ * It then waits to receive the same messages from the target queue.
+ * 
+ * The example ant script will deploy a message bridge that moves messages from the source to the target queue.
+ * 
+ * 
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2674 $</tt>
+ *
+ * $Id: QueueExample.java 2674 2007-05-14 19:57:23Z timfox $
+ */
+public class BridgeExample extends ExampleSupport
+{
+   private String jndiSourceName;
+   private String jndiTargetName;
+   
+   public void example() throws Exception
+   {
+      String source = System.getProperty("example.source.queue");
+      
+      String target = System.getProperty("example.target.queue");
+      
+      InitialContext ic = null;
+      ConnectionFactory cf = null;
+      Connection connection =  null;
+
+      try
+      {         
+         ic = new InitialContext();
+         
+         cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+         Queue sourceQueue = (Queue)ic.lookup("/queue/" + source);
+         log("Queue " + sourceQueue + " exists");
+         
+         Queue targetQueue = (Queue)ic.lookup("/queue/" + target);
+         log("Queue " + targetQueue + " exists");
+         
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer sender = session.createProducer(sourceQueue);
+         
+         final int NUM_MESSAGES = 10;
+         
+         for (int i = 0; i < NUM_MESSAGES; i++)
+         {
+         	TextMessage message = session.createTextMessage("Hello!" + i);	
+         	
+         	sender.send(message);
+         	
+            log("The message was successfully sent to the " + sourceQueue.getQueueName() + " queue");
+         }
+         
+         MessageConsumer consumer =  session.createConsumer(targetQueue);
+         
+         connection.start();
+         
+         for (int i = 0; i < NUM_MESSAGES; i++)
+         {
+         	TextMessage message = (TextMessage)consumer.receive(10000);
+         	
+         	assertEquals("Hello!" + i, message.getText());
+         	
+         	log("The message was received successfully from the " + targetQueue.getQueueName() + " queue");
+         }
+                  
+         displayProviderInfo(connection.getMetaData());                 
+      }
+      finally
+      {         
+         if(ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch(Exception e)
+            {
+               throw e;
+            }
+         }
+         
+         // ALWAYS close your connection in a finally block to avoid leaks.
+         // Closing connection also takes care of closing its related objects e.g. sessions.
+         closeConnection(connection);
+      }
+   }
+   
+   private void closeConnection(Connection con)
+   {      
+      try
+      {
+         if (con != null)
+         {
+            con.close();
+         }         
+      }
+      catch(JMSException jmse)
+      {
+         log("Could not close connection " + con +" exception was " + jmse);
+      }
+   }
+      
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+   
+   public static void main(String[] args)
+   {
+      new BridgeExample().run();
+   }
+   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/ejb-jar.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+    "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+    <enterprise-beans>
+        <session>
+            <ejb-name>Management</ejb-name>
+            <home>org.jboss.example.jms.common.bean.ManagementHome</home>
+            <remote>org.jboss.example.jms.common.bean.Management</remote>
+            <ejb-class>org.jboss.example.jms.common.bean.ManagementBean</ejb-class>
+            <session-type>Stateless</session-type>
+            <transaction-type>Bean</transaction-type>
+        </session>
+    </enterprise-beans>
+</ejb-jar>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/jboss.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/jboss.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/common/etc/META-INF/jboss.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+   "-//JBoss//DTD JBOSS 3.0//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+   <enterprise-beans>
+      <session>
+         <ejb-name>Management</ejb-name>
+         <jndi-name>ejb/Management</jndi-name>
+      </session>
+   </enterprise-beans>
+</jboss>

Added: branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/ExampleSupport.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/ExampleSupport.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/ExampleSupport.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,271 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.common;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionMetaData;
+import javax.jms.ConnectionFactory;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.bean.Management;
+import org.jboss.example.jms.common.bean.ManagementHome;
+import org.jboss.jms.client.JBossConnection;
+import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate;
+import org.jboss.jms.client.state.ConnectionState;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 5084 $</tt>
+ *
+ * $Id: ExampleSupport.java 5084 2008-10-07 19:37:19Z clebert.suconic at jboss.com $
+ */
+public abstract class ExampleSupport
+{
+   // Constants -----------------------------------------------------
+   
+   public static final String DEFAULT_QUEUE_NAME = "testQueue";
+   public static final String DEFAULT_TOPIC_NAME = "testTopic";
+   
+   // Static --------------------------------------------------------
+   
+   public static int getServerID(Connection conn) throws Exception
+   {
+      if (!(conn instanceof JBossConnection))
+      {
+         throw new Exception("Connection not an instance of JBossConnection");
+      }
+      
+      JBossConnection jbconn = (JBossConnection)conn;
+      
+      DelegateSupport del = (DelegateSupport)jbconn.getDelegate();
+      
+      ConnectionState state = (ConnectionState)del.getState();
+      
+      return state.getServerID();
+   }
+   
+   public static void assertEquals(Object o, Object o2)
+   {
+      if (o == null && o2 == null)
+      {
+         return;
+      }
+      
+      if (o.equals(o2))
+      {
+         return;
+      }
+      
+      throw new RuntimeException("Assertion failed, " + o + " != " + o2);
+   }
+   
+   public static void assertEquals(int i, int i2)
+   {
+      if (i == i2)
+      {
+         return;
+      }
+      
+      throw new RuntimeException("Assertion failed, " + i + " != " + i2);
+   }
+   
+   public static void assertNotEquals(int i, int i2)
+   {
+      if (i != i2)
+      {
+         return;
+      }
+      
+      throw new RuntimeException("Assertion failed, " + i + " == " + i2);
+   }
+   
+   
+   public static void killActiveNode() throws Exception
+   {
+      // Currently it will always kill the primary node, ignoring nodeID
+      
+      try
+      {
+         InitialContext ic = new InitialContext();
+         
+         ManagementHome home = (ManagementHome)ic.lookup("ejb/Management");
+         Management bean = home.create();
+         try
+         {
+            bean.killAS();
+         }
+         catch(Exception e)
+         {
+            // OK, I expect exceptions following a VM kill
+         }
+      }
+      catch(Exception e)
+      {
+         throw new RuntimeException("Could not kill the active node", e);
+      }
+   }
+   
+   
+   // Attributes ----------------------------------------------------
+   
+   private boolean failure;
+   private boolean deployed;
+   private String jndiDestinationName;
+   
+   // Constructors --------------------------------------------------
+   
+   protected ExampleSupport()
+   {
+      failure = false;
+   }
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   protected abstract void example() throws Exception;
+   protected abstract boolean isQueueExample();
+   
+   protected final boolean isTopicExample()
+   {
+      return !isQueueExample();
+   }
+   
+   protected void run()
+   {
+      try
+      {
+         setup();
+         example();
+         tearDown();
+      }
+      catch(Throwable t)
+      {
+         t.printStackTrace();
+         System.out.println("");
+         System.out.println("Please verify if you have access to the server. If you are using JBossEAP maybe you don't have security access");
+         setFailure(true);
+      }
+      
+      reportResultAndExit();
+   }
+   
+   protected void setFailure(boolean b)
+   {
+      failure = b;
+   }
+   
+   protected boolean isFailure()
+   {
+      return failure;
+   }
+   
+   protected String getDestinationJNDIName()
+   {
+      return jndiDestinationName;
+   }
+   
+   protected void log(String s)
+   {
+      System.out.println(s);
+   }
+   
+   protected void displayProviderInfo(ConnectionMetaData metaData) throws Exception
+   {
+      String info =
+         "The example connected to " + metaData.getJMSProviderName() +
+         " version " + metaData.getProviderVersion() + " (" +
+         metaData.getProviderMajorVersion() + "." + metaData.getProviderMinorVersion() +
+         ")";
+      
+      System.out.println(info);
+   }
+   
+   // Private -------------------------------------------------------
+   
+   protected void setup() throws Exception
+   {
+      setup(null);
+   }
+   
+   protected void setup(InitialContext ic) throws Exception
+   {
+      String destinationName;
+      
+      if (isQueueExample())
+      {
+         destinationName = System.getProperty("example.queue.name");
+         jndiDestinationName =
+            "/queue/"  + (destinationName == null ? DEFAULT_QUEUE_NAME : destinationName);
+      
+         if (!Util.doesDestinationExist(jndiDestinationName,ic))
+         {
+            System.out.println("Destination " + jndiDestinationName + " does not exist, deploying it");
+            Util.deployQueue(jndiDestinationName,ic);
+            deployed = true;
+         }
+      }
+      else
+      {
+         destinationName = System.getProperty("example.topic.name");
+         jndiDestinationName =
+            "/topic/"  + (destinationName == null ? DEFAULT_TOPIC_NAME : destinationName);
+      
+         if (!Util.doesDestinationExist(jndiDestinationName,ic))
+         {
+            System.out.println("Destination " + jndiDestinationName + " does not exist, deploying it");
+            Util.deployTopic(jndiDestinationName,ic);
+            deployed = true;
+         }
+      }
+   }
+   
+   protected void tearDown() throws Exception
+   {
+      tearDown(null);
+   }
+   
+   protected void tearDown(InitialContext ic) throws Exception
+   {
+      if (deployed)
+      {
+         if (isQueueExample())
+         {
+            Util.undeployQueue(jndiDestinationName,ic);
+         }
+         else
+         {
+            Util.undeployTopic(jndiDestinationName, ic);
+         }
+      }
+   }
+   
+   protected void reportResultAndExit()
+   {
+      if (isFailure())
+      {
+         System.err.println();
+         System.err.println("#####################");
+         System.err.println("###    FAILURE!   ###");
+         System.err.println("#####################");
+         System.exit(1);
+      }
+      
+      System.out.println();
+      System.out.println("#####################");
+      System.out.println("###    SUCCESS!   ###");
+      System.out.println("#####################");
+      System.exit(0);
+   }
+
+   // Inner classes -------------------------------------------------
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/Util.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/Util.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/Util.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,232 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.common;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: Util.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class Util
+{
+   // Constants -----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+
+   public static boolean doesDestinationExist(String jndiName) throws Exception
+   {
+       return doesDestinationExist(jndiName, null);
+   }
+
+   public static boolean doesDestinationExist(String jndiName, InitialContext ic) throws Exception
+   {
+      if (ic == null)
+      {
+          ic = new InitialContext();
+      }
+      try
+      {
+         ic.lookup(jndiName);
+      }
+      catch(NameNotFoundException e)
+      {
+         return false;
+      }
+      return true;
+   }
+
+   public static void deployQueue(String jndiName) throws Exception
+   {
+       deployQueue(jndiName,null);
+   }
+
+   public static void deployQueue(String jndiName, InitialContext ic) throws Exception
+   {
+      MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
+
+      ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+
+      String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
+
+      mBeanServer.invoke(serverObjectName, "deployQueue",
+                         new Object[] {queueName, jndiName},
+                         new String[] {"java.lang.String", "java.lang.String"});
+
+      System.out.println("Queue " + jndiName + " deployed");
+   }
+
+   public static void undeployQueue(String jndiName) throws Exception
+   {
+       undeployQueue(jndiName,null);
+   }
+
+   public static void undeployQueue(String jndiName, InitialContext ic) throws Exception
+   {
+      MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
+
+      ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+
+      String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
+
+      mBeanServer.invoke(serverObjectName, "destroyQueue",
+                         new Object[] {queueName},
+                         new String[] {"java.lang.String"});
+
+      System.out.println("Queue " + jndiName + " undeployed");
+   }
+
+   public static void deployTopic(String jndiName) throws Exception
+   {
+       deployTopic(jndiName,null);
+   }
+
+   public static void deployTopic(String jndiName, InitialContext ic) throws Exception
+   {
+      MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
+
+      ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+
+      String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
+
+      mBeanServer.invoke(serverObjectName, "deployTopic",
+                         new Object[] {queueName, jndiName},
+                         new String[] {"java.lang.String", "java.lang.String"});
+
+      System.out.println("Topic " + jndiName + " deployed");
+   }
+
+   public static void undeployTopic(String jndiName) throws Exception
+   {
+       undeployTopic(jndiName,null);
+   }
+
+   public static void undeployTopic(String jndiName, InitialContext ic) throws Exception
+   {
+      MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
+
+      ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+
+      String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
+
+      mBeanServer.invoke(serverObjectName, "destroyTopic",
+                         new Object[] {queueName},
+                         new String[] {"java.lang.String"});
+
+      System.out.println("Topic " + jndiName + " undeployed");
+   }
+
+   public static MBeanServerConnection lookupMBeanServerProxy(InitialContext ic) throws Exception
+   {
+      if (ic == null)
+      {
+        ic = new InitialContext();
+      }
+      return (MBeanServerConnection)ic.lookup("jmx/invoker/RMIAdaptor");
+   }
+
+   public static void main(String[] args) throws Exception
+   {
+      if ("bridge-deploy".equals(args[0]))
+      {
+         String source = System.getProperty("example.source.queue");
+         String target = System.getProperty("example.target.queue");
+         String jndiSourceName =
+            "/queue/"  + source;
+
+         String jndiTargetName =
+            "/queue/"  + target;
+         if (!Util.doesDestinationExist(jndiSourceName, null))
+         {
+            deployQueue(jndiSourceName);
+         }
+         if (!Util.doesDestinationExist(jndiTargetName, null))
+         {
+            deployQueue(jndiTargetName);
+         }
+         return;
+      }
+      if ("bridge-undeploy".equals(args[0]))
+      {
+         String source = System.getProperty("example.source.queue");
+         String target = System.getProperty("example.target.queue");
+         String jndiSourceName =
+            "/queue/"  + source;
+
+         String jndiTargetName =
+            "/queue/"  + target;
+         if (Util.doesDestinationExist(jndiSourceName, null))
+         {
+            undeployQueue(jndiSourceName);
+         }
+         if (Util.doesDestinationExist(jndiTargetName, null))
+         {
+            undeployQueue(jndiTargetName);
+         }
+         return;
+      }
+      if ("ejb3mdb-deploy".equals(args[0]))
+      {
+         String source = System.getProperty("example.source.queue");
+
+         String jndiSourceName =
+            "/queue/"  + source;
+
+         if (!Util.doesDestinationExist(jndiSourceName, null))
+         {
+            deployQueue(jndiSourceName);
+         }
+         return;
+      }
+      if ("ejb3mdb-undeploy".equals(args[0]))
+      {
+         String source = System.getProperty("example.source.queue");
+         String jndiSourceName =
+            "/queue/"  + source;
+
+         if (Util.doesDestinationExist(jndiSourceName, null))
+         {
+            undeployQueue(jndiSourceName);
+         }
+         return;
+      }
+   }
+   // Attributes ----------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+   
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/Management.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/Management.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/Management.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,26 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.common.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1766 $</tt>
+
+ * $Id: StatelessSessionExample.java 1766 2006-12-11 22:29:27Z ovidiu.feodorov at jboss.com $
+ */
+
+public interface Management extends EJBObject
+{
+   /**
+    * It kills the VM running the node instance. Needed by the failover tests.
+    */
+   public void killAS() throws Exception, RemoteException;
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/ManagementBean.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/ManagementBean.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/ManagementBean.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,58 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.common.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1766 $</tt>
+
+ * $Id: StatelessSessionExampleBean.java 1766 2006-12-11 22:29:27Z ovidiu.feodorov at jboss.com $
+ */
+public class ManagementBean implements SessionBean
+{
+   public void killAS() throws Exception
+   {
+      System.out.println("######");
+      System.out.println("######");
+      System.out.println("######");
+      System.out.println("######");
+      System.out.println("###### SIMULATING A FAILURE, KILLING THE VM!");
+      System.out.println("######");
+      System.out.println("######");
+      System.out.println("######");
+      System.out.println("######");
+
+      Runtime.getRuntime().halt(1);
+   }
+
+   public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+   {
+   }
+
+   public void ejbCreate()
+   {
+   }
+
+   public void ejbRemove() throws EJBException
+   {
+   }
+
+   public void ejbActivate() throws EJBException, RemoteException
+   {
+   }
+
+   public void ejbPassivate() throws EJBException, RemoteException
+   {
+   }
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/ManagementHome.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/ManagementHome.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/common/src/org/jboss/example/jms/common/bean/ManagementHome.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,24 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.common.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 563 $</tt>
+
+ * $Id: StatelessSessionExampleHome.java 563 2005-12-30 22:04:19Z ovidiu $
+ */
+
+public interface ManagementHome extends EJBHome
+{
+   public Management create() throws RemoteException, CreateException;
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/config/clustered-hsqldb-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/clustered-hsqldb-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/clustered-hsqldb-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Hypersonic persistence deployment descriptor.
+
+     DO NOT USE HYPERSONIC IN PRODUCTION or in a clustered environment- Hypersonic does not have transaction isolation
+
+     This clustered example is provided for test purposes and integration with JBAS only. Do not use it in real situations!
+
+     $Id: clustered-hsqldb-persistence-service.xml 4698 2008-07-21 15:29:14Z jhowell at redhat.com $
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The datasource to use for the persistence manager -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- If true then will use JDBC batch updates -->
+
+      <attribute name="UsingBatchUpdates">false</attribute>
+
+      <!-- The maximum number of parameters to include in a prepared statement -->
+
+      <attribute name="MaxParams">500</attribute>
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+
+      <!-- The datasource used by the post office to access it's binding information -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- This config was not meant to be used in production. For a clustered setup you need a shared database -->
+
+      <attribute name="Clustered">true</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">5000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">50000</attribute>
+      
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+      
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+      
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/config/db2-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/db2-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/db2-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     DB2 persistence deployment descriptor.
+
+     Tested with DB2 v9.1
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================== -->
+
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The datasource to use for the persistence manager -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- If true then we will automatically detect and reject duplicate messages sent during failover -->
+
+      <attribute name="DetectDuplicates">true</attribute>
+
+      <!-- The size of the id cache to use when detecting duplicate messages -->
+
+      <attribute name="IDCacheSize">500</attribute>
+
+      <attribute name="SupportsBlobOnSelect">false</attribute>
+      
+      <attribute name="SupportsSetNullOnBlobs">false</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+   CREATE_DUAL=CREATE TABLE JBM_DUAL (DUAL_DUMMY INTEGER NOT NULL, PRIMARY KEY (DUAL_DUMMY))
+   CREATE_MESSAGE_REFERENCE=CREATE TABLE JBM_MSG_REF (MESSAGE_ID DECIMAL(19, 0) NOT NULL, CHANNEL_ID DECIMAL(19, 0) NOT NULL, TRANSACTION_ID DECIMAL(19, 0), STATE CHAR(1), ORD DECIMAL(19, 0), PAGE_ORD DECIMAL(19, 0) , DELIVERY_COUNT INTEGER, SCHED_DELIVERY DECIMAL(19, 0), PRIMARY KEY(MESSAGE_ID, CHANNEL_ID))
+   CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID, STATE)
+   CREATE_MESSAGE=CREATE TABLE JBM_MSG (MESSAGE_ID DECIMAL(19, 0) NOT NULL, RELIABLE CHAR(1), EXPIRATION DECIMAL(19, 0), TIMESTAMP DECIMAL(19, 0), PRIORITY SMALLINT, TYPE SMALLINT, HEADERS BLOB, PAYLOAD BLOB, PRIMARY KEY (MESSAGE_ID))
+   CREATE_TRANSACTION=CREATE TABLE JBM_TX (NODE_ID INTEGER, TRANSACTION_ID DECIMAL(19, 0) NOT NULL, BRANCH_QUAL BLOB(254), FORMAT_ID INTEGER, GLOBAL_TXID BLOB(254), PRIMARY KEY (TRANSACTION_ID))
+   CREATE_COUNTER=CREATE TABLE JBM_COUNTER (NAME VARCHAR(255) NOT NULL, NEXT_ID DECIMAL(19, 0), PRIMARY KEY(NAME))
+   CREATE_ID_CACHE=CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER NOT NULL, CNTR INTEGER NOT NULL, JBM_ID VARCHAR(255), PRIMARY KEY(NODE_ID, CNTR))
+   INSERT_DUAL=INSERT INTO JBM_DUAL VALUES (1)
+   CHECK_DUAL=SELECT 1 FROM JBM_DUAL
+   INSERT_MESSAGE_REF=INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   DELETE_MESSAGE_REF=DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_MESSAGE_REF=UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_PAGE_ORDER=UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?
+   COMMIT_MESSAGE_REF1=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'
+   COMMIT_MESSAGE_REF2=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'
+   ROLLBACK_MESSAGE_REF1=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'
+   ROLLBACK_MESSAGE_REF2=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'
+   LOAD_PAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD
+   LOAD_UNPAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
+   LOAD_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? ORDER BY ORD
+   UPDATE_REFS_NOT_PAGED=UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?
+   SELECT_MIN_MAX_PAGE_ORD=SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?
+   UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
+   MOVE_REFERENCE=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
+   INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   INSERT_MESSAGE_CONDITIONAL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE) SELECT (CAST(? AS DECIMAL(19,0))), (CAST(? AS CHAR)), (CAST(? AS DECIMAL(19,0))), (CAST(? AS DECIMAL(19,0))), (CAST(? AS DECIMAL(19,0))), (CAST(? AS DECIMAL(19,0))) FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   UPDATE_MESSAGE_4CONDITIONAL=UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?
+   INSERT_MESSAGE_CONDITIONAL_FULL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) SELECT (CAST(? AS DECIMAL)), (CAST(? AS CHAR)), (CAST(? AS DECIMAL)), (CAST(? AS DECIMAL)), (CAST(? AS DECIMAL)), (CAST(? AS DECIMAL)), (CAST(? AS DECIMAL)), (CAST(? AS DECIMAL)) FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   MESSAGE_ID_COLUMN=MESSAGE_ID
+   DELETE_MESSAGE=DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT JBM_MSG_REF.MESSAGE_ID FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)
+   INSERT_TRANSACTION=INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?, ?)
+   DELETE_TRANSACTION=DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?
+   SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?
+   SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
+   SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
+   UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER HOLDLOCK WHERE NAME=?
+   INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+   SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
+   UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?
+   UPDATE_ID_IN_CACHE=UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? AND CNTR = ?
+   INSERT_ID_IN_CACHE=INSERT INTO JBM_ID_CACHE (NODE_ID, CNTR, JBM_ID) VALUES (?, ?, ?)
+   LOAD_ID_CACHE=SELECT CNTR, JBM_ID FROM JBM_ID_CACHE WHERE NODE_ID = ?
+      ]]></attribute>
+
+      <!-- The maximum number of parameters to include in a prepared statement -->
+
+      <attribute name="MaxParams">500</attribute>
+
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+
+      <!-- The datasource used by the post office to access it's binding information -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255) NOT NULL, NODE_ID SMALLINT NOT NULL, QUEUE_NAME VARCHAR(255) NOT NULL, COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID INTEGER, CLSTERED CHAR(1), ALL_NODES CHAR(1), PRIMARY KEY(POSTOFFICE_NAME, NODE_ID, QUEUE_NAME))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
+LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
+      ]]></attribute>
+
+      <!-- This post office is non clustered. If you want a clustered post office then set to true -->
+      
+      <attribute name="Clustered">false</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">30000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">30000</attribute>
+      
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+      
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+      
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_USER_TABLE=CREATE TABLE JBM_USER (USER_ID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USER_ID))
+CREATE_ROLE_TABLE=CREATE TABLE JBM_ROLE (ROLE_ID VARCHAR(32) NOT NULL, USER_ID VARCHAR(32) NOT NULL, PRIMARY KEY(USER_ID, ROLE_ID))
+SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JBM_USER WHERE USER_ID=?
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/hsqldb-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/hsqldb-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/hsqldb-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Hypersonic persistence deployment descriptor.
+     
+     DO NOT USE HYPERSONIC IN PRODUCTION or in a clustered environment- Hypersonic does not have transaction isolation
+
+     $Id: hsqldb-persistence-service.xml 3339 2007-11-16 20:48:08Z clebert.suconic at jboss.com $
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================= -->
+   
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+      
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+            
+      <!-- The datasource to use for the persistence manager -->
+                                
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+                  
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      
+      <!-- If true then will use JDBC batch updates -->
+                 
+      <attribute name="UsingBatchUpdates">false</attribute>
+      
+      <!-- The maximum number of parameters to include in a prepared statement -->            
+      
+      <attribute name="MaxParams">500</attribute>
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+   
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"      
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+            
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      
+      <!-- The name of the post office -->      
+                 
+      <attribute name="PostOfficeName">JMS post office</attribute>
+      
+      <!-- The datasource used by the post office to access it's binding information -->                       
+      
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+                        
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      
+      <!-- This post office is NON CLUSTERED - do not use clustering with Hypersonic!! -->
+      
+      <attribute name="Clustered">false</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+   
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+      
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      
+      <attribute name="SqlProperties"><![CDATA[
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/config/mssql-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/mssql-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/mssql-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     MS SQL Server persistence deployment descriptor.
+
+     Tested with SQL Server 2005
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================== -->
+
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The datasource to use for the persistence manager -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- If true then we will automatically detect and reject duplicate messages sent during failover -->
+
+      <attribute name="DetectDuplicates">true</attribute>
+
+      <!-- The size of the id cache to use when detecting duplicate messages -->
+
+      <attribute name="IDCacheSize">500</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+   CREATE_DUAL=CREATE TABLE JBM_DUAL (DUMMY INTEGER, PRIMARY KEY (DUMMY))
+   CREATE_MESSAGE_REFERENCE=CREATE TABLE JBM_MSG_REF (MESSAGE_ID BIGINT, CHANNEL_ID BIGINT, TRANSACTION_ID BIGINT, STATE CHAR(1), ORD BIGINT, PAGE_ORD BIGINT, DELIVERY_COUNT INT, SCHED_DELIVERY BIGINT, PRIMARY KEY(MESSAGE_ID, CHANNEL_ID))
+   CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID, STATE)
+   CREATE_MESSAGE=CREATE TABLE JBM_MSG (MESSAGE_ID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, TYPE TINYINT, HEADERS IMAGE, PAYLOAD IMAGE, PRIMARY KEY (MESSAGE_ID))
+   CREATE_TRANSACTION=CREATE TABLE JBM_TX (NODE_ID INTEGER, TRANSACTION_ID BIGINT, BRANCH_QUAL VARBINARY(254), FORMAT_ID INT, GLOBAL_TXID VARBINARY(254), PRIMARY KEY (TRANSACTION_ID))
+   CREATE_COUNTER=CREATE TABLE JBM_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME))
+   CREATE_ID_CACHE=CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER, CNTR INTEGER, JBM_ID VARCHAR(255), PRIMARY KEY(NODE_ID, CNTR))
+   INSERT_DUAL=INSERT INTO JBM_DUAL VALUES (1)
+   CHECK_DUAL=SELECT 1 FROM JBM_DUAL
+   INSERT_MESSAGE_REF=INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   DELETE_MESSAGE_REF=DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_MESSAGE_REF=UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_PAGE_ORDER=UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?
+   COMMIT_MESSAGE_REF1=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'
+   COMMIT_MESSAGE_REF2=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'
+   ROLLBACK_MESSAGE_REF1=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'
+   ROLLBACK_MESSAGE_REF2=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'
+   LOAD_PAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD
+   LOAD_UNPAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
+   LOAD_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? ORDER BY ORD
+   UPDATE_REFS_NOT_PAGED=UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?
+   SELECT_MIN_MAX_PAGE_ORD=SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?
+   UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
+   MOVE_REFERENCE=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
+   INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   INSERT_MESSAGE_CONDITIONAL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE) SELECT ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   UPDATE_MESSAGE_4CONDITIONAL=UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?
+   INSERT_MESSAGE_CONDITIONAL_FULL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   MESSAGE_ID_COLUMN=MESSAGE_ID
+   DELETE_MESSAGE=DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT JBM_MSG_REF.MESSAGE_ID FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)
+   INSERT_TRANSACTION=INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?, ?)
+   DELETE_TRANSACTION=DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?
+   SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?
+   SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
+   SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
+   UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER WITH (HOLDLOCK, ROWLOCK) WHERE NAME=?
+   INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+   SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
+   UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?
+   UPDATE_ID_IN_CACHE=UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? AND CNTR = ?
+   INSERT_ID_IN_CACHE=INSERT INTO JBM_ID_CACHE (NODE_ID, CNTR, JBM_ID) VALUES (?, ?, ?)
+   LOAD_ID_CACHE=SELECT CNTR, JBM_ID FROM JBM_ID_CACHE WHERE NODE_ID = ?
+      ]]></attribute>
+
+      <!-- The maximum number of parameters to include in a prepared statement -->
+
+      <attribute name="MaxParams">500</attribute>
+
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+
+      <!-- The datasource used by the post office to access it's binding information -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(255), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID INTEGER, CLSTERED CHAR(1), ALL_NODES CHAR(1), PRIMARY KEY(POSTOFFICE_NAME, NODE_ID, QUEUE_NAME))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
+LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
+      ]]></attribute>
+
+      <!-- This post office is non clustered. If you want a clustered post office then set to true -->
+      
+      <attribute name="Clustered">false</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">30000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">30000</attribute>
+      
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+      
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+      
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_USER_TABLE=CREATE TABLE JBM_USER (USER_ID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USER_ID))
+CREATE_ROLE_TABLE=CREATE TABLE JBM_ROLE (ROLE_ID VARCHAR(32) NOT NULL, USER_ID VARCHAR(32) NOT NULL, PRIMARY KEY(USER_ID, ROLE_ID))
+SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JBM_USER WHERE USER_ID=?
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/mysql-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/mysql-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/mysql-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     MySql persistence deployment descriptor.
+
+     Tested with MySQL 5.0.27
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================== -->
+
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The datasource to use for the persistence manager -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- If true then we will automatically detect and reject duplicate messages sent during failover -->
+
+      <attribute name="DetectDuplicates">true</attribute>
+
+      <!-- The size of the id cache to use when detecting duplicate messages -->
+
+      <attribute name="IDCacheSize">500</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+   CREATE_DUAL=CREATE TABLE JBM_DUAL (DUMMY INTEGER, PRIMARY KEY (DUMMY)) ENGINE = INNODB
+   CREATE_MESSAGE_REFERENCE=CREATE TABLE JBM_MSG_REF (MESSAGE_ID BIGINT, CHANNEL_ID BIGINT, TRANSACTION_ID BIGINT, STATE CHAR(1), ORD BIGINT, PAGE_ORD BIGINT, DELIVERY_COUNT INTEGER, SCHED_DELIVERY BIGINT, PRIMARY KEY(MESSAGE_ID, CHANNEL_ID)) ENGINE = INNODB
+   CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID, STATE) 
+   CREATE_MESSAGE=CREATE TABLE JBM_MSG (MESSAGE_ID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, TYPE TINYINT, HEADERS MEDIUMBLOB, PAYLOAD LONGBLOB, PRIMARY KEY (MESSAGE_ID)) ENGINE = INNODB
+   CREATE_TRANSACTION=CREATE TABLE JBM_TX (NODE_ID INTEGER, TRANSACTION_ID BIGINT, BRANCH_QUAL VARBINARY(254), FORMAT_ID INTEGER, GLOBAL_TXID VARBINARY(254), PRIMARY KEY (TRANSACTION_ID)) ENGINE = INNODB
+   CREATE_COUNTER=CREATE TABLE JBM_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME)) ENGINE = INNODB
+   CREATE_ID_CACHE=CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER, CNTR INTEGER, JBM_ID VARCHAR(255), PRIMARY KEY(NODE_ID, CNTR)) ENGINE = INNODB
+   INSERT_DUAL=INSERT INTO JBM_DUAL VALUES (1)
+   CHECK_DUAL=SELECT 1 FROM JBM_DUAL
+   INSERT_MESSAGE_REF=INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   DELETE_MESSAGE_REF=DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_MESSAGE_REF=UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_PAGE_ORDER=UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?
+   COMMIT_MESSAGE_REF1=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'
+   COMMIT_MESSAGE_REF2=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'
+   ROLLBACK_MESSAGE_REF1=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'
+   ROLLBACK_MESSAGE_REF2=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'
+   LOAD_PAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD
+   LOAD_UNPAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
+   LOAD_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? ORDER BY ORD
+   UPDATE_REFS_NOT_PAGED=UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?
+   SELECT_MIN_MAX_PAGE_ORD=SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?
+   UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
+   MOVE_REFERENCE=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
+   INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   INSERT_MESSAGE_CONDITIONAL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE) SELECT ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   UPDATE_MESSAGE_4CONDITIONAL=UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?
+   INSERT_MESSAGE_CONDITIONAL_FULL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   MESSAGE_ID_COLUMN=MESSAGE_ID
+   DELETE_MESSAGE=DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT JBM_MSG_REF.MESSAGE_ID FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)
+   INSERT_TRANSACTION=INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?, ?)
+   DELETE_TRANSACTION=DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?
+   SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?
+   SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
+   SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
+   UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER WHERE NAME=? FOR UPDATE
+   INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+   SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
+   UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?
+   UPDATE_ID_IN_CACHE=UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? AND CNTR = ?
+   INSERT_ID_IN_CACHE=INSERT INTO JBM_ID_CACHE (NODE_ID, CNTR, JBM_ID) VALUES (?, ?, ?)
+   LOAD_ID_CACHE=SELECT CNTR, JBM_ID FROM JBM_ID_CACHE WHERE NODE_ID = ?
+      ]]></attribute>
+
+      <!-- The maximum number of parameters to include in a prepared statement -->
+
+      <attribute name="MaxParams">500</attribute>
+
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+
+      <!-- The datasource used by the post office to access it's binding information -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(255), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1), ALL_NODES CHAR(1), PRIMARY KEY(POSTOFFICE_NAME, NODE_ID, QUEUE_NAME)) ENGINE = INNODB
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
+LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
+      ]]></attribute>
+
+      <!-- This post office is non clustered. If you want a clustered post office then set to true -->
+      
+      <attribute name="Clustered">false</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">30000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">30000</attribute>
+      
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+      
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_USER_TABLE=CREATE TABLE JBM_USER (USER_ID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USER_ID)) ENGINE = INNODB
+CREATE_ROLE_TABLE=CREATE TABLE JBM_ROLE (ROLE_ID VARCHAR(32) NOT NULL, USER_ID VARCHAR(32) NOT NULL, PRIMARY KEY(USER_ID, ROLE_ID)) ENGINE = INNODB
+SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JBM_USER WHERE USER_ID=?
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/ndb-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/ndb-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/ndb-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     MySql persistence deployment descriptor.
+
+     Tested with MySQL 5.0.27
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================== -->
+
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The datasource to use for the persistence manager -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- If true then we will automatically detect and reject duplicate messages sent during failover -->
+
+      <attribute name="DetectDuplicates">true</attribute>
+
+      <!-- The size of the id cache to use when detecting duplicate messages -->
+
+      <attribute name="IDCacheSize">500</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+   CREATE_DUAL=CREATE TABLE JBM_DUAL (DUMMY INTEGER, PRIMARY KEY (DUMMY)) ENGINE = NDBCLUSTER
+   CREATE_MESSAGE_REFERENCE=CREATE TABLE JBM_MSG_REF (MESSAGE_ID BIGINT, CHANNEL_ID BIGINT, TRANSACTION_ID BIGINT, STATE CHAR(1), ORD BIGINT, PAGE_ORD BIGINT, DELIVERY_COUNT INTEGER, SCHED_DELIVERY BIGINT, PRIMARY KEY(MESSAGE_ID, CHANNEL_ID)) ENGINE = NDBCLUSTER
+   CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID, STATE)
+   CREATE_MESSAGE=CREATE TABLE JBM_MSG (MESSAGE_ID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, TYPE TINYINT, HEADERS MEDIUMBLOB, PAYLOAD LONGBLOB, PRIMARY KEY (MESSAGE_ID)) ENGINE = NDBCLUSTER
+   CREATE_TRANSACTION=CREATE TABLE JBM_TX (NODE_ID INTEGER, TRANSACTION_ID BIGINT, BRANCH_QUAL VARBINARY(254), FORMAT_ID INTEGER, GLOBAL_TXID VARBINARY(254), PRIMARY KEY (TRANSACTION_ID)) ENGINE = NDBCLUSTER
+   CREATE_COUNTER=CREATE TABLE JBM_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME)) ENGINE = NDBCLUSTER
+   CREATE_ID_CACHE=CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER, CNTR INTEGER, JBM_ID VARCHAR(255), PRIMARY KEY(NODE_ID, CNTR)) ENGINE = NDBCLUSTER
+   INSERT_DUAL=INSERT INTO JBM_DUAL VALUES (1)
+   CHECK_DUAL=SELECT 1 FROM JBM_DUAL
+   INSERT_MESSAGE_REF=INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   DELETE_MESSAGE_REF=DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_MESSAGE_REF=UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_PAGE_ORDER=UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?
+   COMMIT_MESSAGE_REF1=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'
+   COMMIT_MESSAGE_REF2=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'
+   ROLLBACK_MESSAGE_REF1=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'
+   ROLLBACK_MESSAGE_REF2=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'
+   LOAD_PAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD
+   LOAD_UNPAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
+   LOAD_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? ORDER BY ORD
+   UPDATE_REFS_NOT_PAGED=UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?
+   SELECT_MIN_MAX_PAGE_ORD=SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?
+   UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
+   MOVE_REFERENCE=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
+   INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   INSERT_MESSAGE_CONDITIONAL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE) SELECT ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   UPDATE_MESSAGE_4CONDITIONAL=UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?
+   INSERT_MESSAGE_CONDITIONAL_FULL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   MESSAGE_ID_COLUMN=MESSAGE_ID
+   DELETE_MESSAGE=DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT JBM_MSG_REF.MESSAGE_ID FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)
+   INSERT_TRANSACTION=INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?, ?)
+   DELETE_TRANSACTION=DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?
+   SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?
+   SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
+   SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
+   UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER WHERE NAME=? FOR UPDATE
+   INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+   SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
+   UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?
+   UPDATE_ID_IN_CACHE=UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? AND CNTR = ?
+   INSERT_ID_IN_CACHE=INSERT INTO JBM_ID_CACHE (NODE_ID, CNTR, JBM_ID) VALUES (?, ?, ?)
+   LOAD_ID_CACHE=SELECT CNTR, JBM_ID FROM JBM_ID_CACHE WHERE NODE_ID = ?
+      ]]></attribute>
+
+      <!-- The maximum number of parameters to include in a prepared statement -->
+
+      <attribute name="MaxParams">500</attribute>
+
+      <!-- This defines the retry strategy for failed sql statments-->
+      <attribute name="UseNDBFailoverStrategy">true</attribute>
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+
+      <!-- The datasource used by the post office to access it's binding information -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(255), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1), ALL_NODES CHAR(1), PRIMARY KEY(POSTOFFICE_NAME, NODE_ID, QUEUE_NAME)) ENGINE = NDBCLUSTER
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
+LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
+      ]]></attribute>
+
+      <!-- This post office is clustered. If you don't want a clustered post office then set to false -->
+
+      <attribute name="Clustered">true</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">300000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">300000</attribute>
+
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_USER_TABLE=CREATE TABLE JBM_USER (USER_ID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USER_ID)) ENGINE = NDBCLUSTER
+CREATE_ROLE_TABLE=CREATE TABLE JBM_ROLE (ROLE_ID VARCHAR(32) NOT NULL, USER_ID VARCHAR(32) NOT NULL, PRIMARY KEY(USER_ID, ROLE_ID)) ENGINE = NDBCLUSTER
+SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JBM_USER WHERE USER_ID=?
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/null-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/null-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/null-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Null persistence config.
+     
+     Use this if you don't actually want to persist anything
+     
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================== -->
+
+   <mbean code="org.jboss.messaging.core.jmx.NullPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/NullPersistenceManager-xmbean.xml"/>
+     
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+     
+      <!-- This post office is clustered. If you don't want a clustered post office then set to false -->
+
+      <attribute name="Clustered">false</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">30000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">30000</attribute>
+      
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+      
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+      
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml"/>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/oracle-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/oracle-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/oracle-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Oracle persistence deployment descriptor.
+
+     Tested with Oracle 10.2.0.1
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================== -->
+
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The datasource to use for the persistence manager -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- If true then we will automatically detect and reject duplicate messages sent during failover -->
+
+      <attribute name="DetectDuplicates">true</attribute>
+
+      <!-- The size of the id cache to use when detecting duplicate messages -->
+
+      <attribute name="IDCacheSize">500</attribute>
+
+      <!-- Some databases don't support inserting blobs using INSERT INTO ... SELECT FROM -->
+
+      <attribute name="SupportsBlobOnSelect">false</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+   CREATE_DUAL=CREATE TABLE JBM_DUAL (DUMMY INTEGER, PRIMARY KEY (DUMMY))
+   CREATE_MESSAGE_REFERENCE=CREATE TABLE JBM_MSG_REF (MESSAGE_ID INTEGER, CHANNEL_ID INTEGER, TRANSACTION_ID INTEGER, STATE CHAR(1), ORD INTEGER, PAGE_ORD INTEGER, DELIVERY_COUNT INTEGER, SCHED_DELIVERY INTEGER, PRIMARY KEY(MESSAGE_ID, CHANNEL_ID))
+   CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID, STATE)
+   CREATE_MESSAGE=CREATE TABLE JBM_MSG (MESSAGE_ID INTEGER, RELIABLE CHAR(1), EXPIRATION INTEGER, TIMESTAMP INTEGER, PRIORITY INTEGER, TYPE INTEGER, HEADERS BLOB, PAYLOAD BLOB, PRIMARY KEY (MESSAGE_ID))
+   CREATE_TRANSACTION=CREATE TABLE JBM_TX (NODE_ID INTEGER, TRANSACTION_ID INTEGER, BRANCH_QUAL RAW(254), FORMAT_ID INTEGER, GLOBAL_TXID RAW(254), PRIMARY KEY (TRANSACTION_ID))
+   CREATE_COUNTER=CREATE TABLE JBM_COUNTER (NAME VARCHAR2(255), NEXT_ID INTEGER, PRIMARY KEY(NAME))
+   CREATE_ID_CACHE=CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER, CNTR INTEGER, JBM_ID VARCHAR2(255), PRIMARY KEY(NODE_ID, CNTR))
+   INSERT_DUAL=INSERT INTO JBM_DUAL VALUES (1)
+   CHECK_DUAL=SELECT 1 FROM JBM_DUAL
+   INSERT_MESSAGE_REF=INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   DELETE_MESSAGE_REF=DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_MESSAGE_REF=UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_PAGE_ORDER=UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?
+   COMMIT_MESSAGE_REF1=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'
+   COMMIT_MESSAGE_REF2=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'
+   ROLLBACK_MESSAGE_REF1=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'
+   ROLLBACK_MESSAGE_REF2=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'
+   LOAD_PAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD
+   LOAD_UNPAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
+   LOAD_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? ORDER BY ORD
+   UPDATE_REFS_NOT_PAGED=UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?
+   SELECT_MIN_MAX_PAGE_ORD=SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?
+   UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
+   MOVE_REFERENCE=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
+   INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   INSERT_MESSAGE_CONDITIONAL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE) SELECT ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   UPDATE_MESSAGE_4CONDITIONAL=UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?
+   INSERT_MESSAGE_CONDITIONAL_FULL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   MESSAGE_ID_COLUMN=MESSAGE_ID
+   DELETE_MESSAGE=DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT JBM_MSG_REF.MESSAGE_ID FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)
+   INSERT_TRANSACTION=INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?, ?)
+   DELETE_TRANSACTION=DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?
+   SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?
+   SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
+   SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
+   UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER WHERE NAME=? FOR UPDATE
+   INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+   SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
+   UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?
+   UPDATE_ID_IN_CACHE=UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? AND CNTR = ?
+   INSERT_ID_IN_CACHE=INSERT INTO JBM_ID_CACHE (NODE_ID, CNTR, JBM_ID) VALUES (?, ?, ?)
+   LOAD_ID_CACHE=SELECT CNTR, JBM_ID FROM JBM_ID_CACHE WHERE NODE_ID = ?
+      ]]></attribute>
+
+      <!-- The maximum number of parameters to include in a prepared statement -->
+
+      <attribute name="MaxParams">500</attribute>
+
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+
+      <!-- The datasource used by the post office to access it's binding information -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR2(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR2(255), COND VARCHAR2(1023), SELECTOR VARCHAR2(1023), CHANNEL_ID INTEGER, CLUSTERED CHAR(1), ALL_NODES CHAR(1), PRIMARY KEY(POSTOFFICE_NAME, NODE_ID, QUEUE_NAME))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
+LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
+      ]]></attribute>
+
+      <!-- This post office is non clustered. If you want a clustered post office then set to true -->
+      
+      <attribute name="Clustered">false</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">30000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">30000</attribute>
+      
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+      
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+      
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_USER_TABLE=CREATE TABLE JBM_USER (USER_ID VARCHAR2(32) NOT NULL, PASSWD VARCHAR2(32) NOT NULL, CLIENTID VARCHAR2(128), PRIMARY KEY(USER_ID))
+CREATE_ROLE_TABLE=CREATE TABLE JBM_ROLE (ROLE_ID VARCHAR2(32) NOT NULL, USER_ID VARCHAR2(32) NOT NULL, PRIMARY KEY(USER_ID, ROLE_ID))
+SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JBM_USER WHERE USER_ID=?
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/postgresql-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/postgresql-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/postgresql-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Postgresql persistence deployment descriptor.
+
+     Tested with PostgresSQL 8.2.3
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================== -->
+
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The datasource to use for the persistence manager -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- If true then we will automatically detect and reject duplicate messages sent during failover -->
+
+      <attribute name="DetectDuplicates">true</attribute>
+
+      <!-- The size of the id cache to use when detecting duplicate messages -->
+
+      <attribute name="IDCacheSize">500</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+   CREATE_DUAL=CREATE TABLE JBM_DUAL (DUMMY INTEGER, PRIMARY KEY (DUMMY))
+   CREATE_MESSAGE_REFERENCE=CREATE TABLE JBM_MSG_REF (MESSAGE_ID BIGINT, CHANNEL_ID BIGINT, TRANSACTION_ID BIGINT, STATE CHAR(1), ORD BIGINT, PAGE_ORD BIGINT, DELIVERY_COUNT INTEGER, SCHED_DELIVERY BIGINT, PRIMARY KEY(MESSAGE_ID, CHANNEL_ID))
+   CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID, STATE)
+   CREATE_MESSAGE=CREATE TABLE JBM_MSG (MESSAGE_ID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY SMALLINT, TYPE SMALLINT, HEADERS BYTEA, PAYLOAD BYTEA, PRIMARY KEY (MESSAGE_ID))
+   CREATE_TRANSACTION=CREATE TABLE JBM_TX (NODE_ID INTEGER, TRANSACTION_ID BIGINT, BRANCH_QUAL BYTEA, FORMAT_ID INTEGER, GLOBAL_TXID BYTEA, PRIMARY KEY (TRANSACTION_ID))
+   CREATE_COUNTER=CREATE TABLE JBM_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME))
+   CREATE_ID_CACHE=CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER, CNTR INTEGER, JBM_ID VARCHAR(255), PRIMARY KEY(NODE_ID, CNTR))
+   INSERT_DUAL=INSERT INTO JBM_DUAL VALUES (1)
+   CHECK_DUAL=SELECT 1 FROM JBM_DUAL
+   INSERT_MESSAGE_REF=INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   DELETE_MESSAGE_REF=DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_MESSAGE_REF=UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_PAGE_ORDER=UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?
+   COMMIT_MESSAGE_REF1=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'
+   COMMIT_MESSAGE_REF2=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'
+   ROLLBACK_MESSAGE_REF1=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'
+   ROLLBACK_MESSAGE_REF2=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'
+   LOAD_PAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD
+   LOAD_UNPAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
+   LOAD_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? ORDER BY ORD
+   UPDATE_REFS_NOT_PAGED=UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?
+   SELECT_MIN_MAX_PAGE_ORD=SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?
+   UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
+   MOVE_REFERENCE=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
+   INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   INSERT_MESSAGE_CONDITIONAL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE) SELECT ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   UPDATE_MESSAGE_4CONDITIONAL=UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?
+   INSERT_MESSAGE_CONDITIONAL_FULL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   MESSAGE_ID_COLUMN=MESSAGE_ID
+   DELETE_MESSAGE=DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT JBM_MSG_REF.MESSAGE_ID FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)
+   INSERT_TRANSACTION=INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?, ?)
+   DELETE_TRANSACTION=DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?
+   SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?
+   SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
+   SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
+   UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER WHERE NAME=? FOR UPDATE
+   INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+   SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
+   UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?
+   UPDATE_ID_IN_CACHE=UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? AND CNTR = ?
+   INSERT_ID_IN_CACHE=INSERT INTO JBM_ID_CACHE (NODE_ID, CNTR, JBM_ID) VALUES (?, ?, ?)
+   LOAD_ID_CACHE=SELECT CNTR, JBM_ID FROM JBM_ID_CACHE WHERE NODE_ID = ?
+      ]]></attribute>
+
+      <!-- The maximum number of parameters to include in a prepared statement -->
+
+      <attribute name="MaxParams">500</attribute>
+
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+
+      <!-- The datasource used by the post office to access it's binding information -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(255), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1), ALL_NODES CHAR(1), PRIMARY KEY(POSTOFFICE_NAME, NODE_ID, QUEUE_NAME))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
+LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
+      ]]></attribute>
+
+      <!-- This post office is non clustered. If you want a clustered post office then set to true -->
+      
+      <attribute name="Clustered">false</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">30000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">30000</attribute>
+
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+      
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_USER_TABLE=CREATE TABLE JBM_USER (USER_ID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USER_ID))
+CREATE_ROLE_TABLE=CREATE TABLE JBM_ROLE (ROLE_ID VARCHAR(32) NOT NULL, USER_ID VARCHAR(32) NOT NULL, PRIMARY KEY(USER_ID, ROLE_ID))
+SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JBM_USER WHERE USER_ID=?
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/config/remoting-bisocket-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/remoting-bisocket-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/remoting-bisocket-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Standard bisocket-based Remoting service deployment descriptor.
+
+     $Id: remoting-bisocket-service.xml 3981 2008-03-28 18:00:41Z timfox $
+ -->
+
+<server>
+
+   <!-- Standard bisocket connector - the bisocket transport only opens connection from client->server
+        so can be used with firewalls where only outgoing connections are allowed.
+        For examples of HTTP and SSL transports see docs/examples -->
+   <mbean code="org.jboss.remoting.transport.Connector"
+          name="jboss.messaging:service=Connector,transport=bisocket"
+          display-name="Bisocket Transport Connector">
+      <attribute name="Configuration">
+         <config>
+            <invoker transport="bisocket">
+            
+               <!-- There should be no reason to change these parameters - warning!
+                    Changing them may stop JBoss Messaging working correctly -->            
+               <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="socket.check_connection" isParam="true">false</attribute>               
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">${jboss.messaging.connector.bisocket.port:4457}</attribute>
+               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
+               <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
+	       
+               <attribute name="numberOfCallRetries" isParam="true">1</attribute>
+               <attribute name="pingFrequency" isParam="true">214748364</attribute>
+               <attribute name="pingWindowFactor" isParam="true">10</attribute>
+               <attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>               
+               <!-- End immutable parameters -->
+               
+               <attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
+               
+               <!-- Periodicity of client pings. Server window by default is twice this figure -->                               
+               <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
+               <attribute name="validatorPingPeriod" isParam="true">10000</attribute>
+               <attribute name="validatorPingTimeout" isParam="true">5000</attribute>
+               <attribute name="registerCallbackListener">false</attribute>
+	       	       
+	            <attribute name="timeout" isParam="true">0</attribute>
+
+               <!-- Number of seconds to wait for a connection in the client pool to become free -->
+	            <attribute name="connectionWait" isParam="true">10</attribute>
+
+               <!-- Max Number of connections in client pool. This should be significantly higher than
+                    the max number of sessions/consumers you expect -->
+               <attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute>
+               
+               <!-- The maximum time to wait before timing out on trying to write a message to socket for delivery -->
+               <attribute name="callbackTimeout">10000</attribute> 
+               
+               <!-- Use these parameters to specify values for binding and connecting control connections to 
+                    work with your firewall/NAT configuration
+               <attribute name="secondaryBindPort">xyz</attribute>                           
+               <attribute name="secondaryConnectPort">abc</attribute>               
+               -->
+                          
+            </invoker>
+            <handlers>
+               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
+            </handlers>
+         </config>
+      </attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/remoting-http-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/remoting-http-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/remoting-http-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     HTTP-based Remoting service deployment descriptor.
+
+     $Id: remoting-http-service.xml 3222 2007-10-20 12:13:57Z timfox $
+ -->
+
+<server>
+
+   <mbean code="org.jboss.remoting.transport.Connector"
+          name="jboss.messaging:service=Connector,transport=http"
+          display-name="HTTP Transport Connector">
+      <attribute name="Configuration">
+         <config>
+            <invoker transport="http">
+               <!-- There should be no reason to change these parameters - warning!
+                    Changing them may stop JBoss Messaging working correctly -->
+               <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>               
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">${jboss.messaging.connector.http.port:4458}</attribute>               
+               <attribute name="callbackStore">org.jboss.remoting.callback.BlockingCallbackStore</attribute>    
+               <!-- End immutable parameters -->
+                  
+               <!-- The period of sending pings to the server -->
+               <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
+                      
+               <!-- Set this to true if you want the HTTP transport to block waiting for server->client traffic.
+               Or false if you want it to poll for new traffic periodically. Recommended is true -->                       
+               <attribute name="blockingMode" isParam="true">blocking</attribute>
+               
+               <!-- Timeout for blocking. Only has relevance if blockingMode = true -->
+               <attribute name="blockingTimeout" isParam="true">30000</attribute>
+                
+               <!-- The periodicity of polling. Only has relevance if blockingMode = false -->               
+               <attribute name="callbackPollPeriod" isParam="true">10000</attribute>                                                                               
+            </invoker>
+            <handlers>
+               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
+            </handlers>
+         </config>
+      </attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/remoting-sslbisocket-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/remoting-sslbisocket-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/remoting-sslbisocket-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     The deployment descriptor for the secure socket factory
+     service and secure connector.
+
+     $Id: remoting-sslbisocket-service.xml 3981 2008-03-28 18:00:41Z timfox $
+ -->
+
+<server>
+
+   <mbean code="org.jboss.remoting.transport.Connector"
+          name="jboss.messaging:service=Connector,transport=sslbisocket"
+          display-name="SSL Bisocket Transport Connector">
+      <attribute name="Configuration">
+         <config>
+            <invoker transport="sslbisocket">   
+            
+               <!-- There should be no reason to change these parameters - warning!
+                    Changing them may stop JBoss Messaging working correctly -->          
+               <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="socket.check_connection" isParam="true">false</attribute>              
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">4459</attribute>               
+               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
+               <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
+               <attribute name="serverSocketFactory">jboss.messaging:service=ServerSocketFactory,type=SSL</attribute>
+               <attribute name="numberOfCallRetries" isParam="true">1</attribute>
+               <attribute name="pingFrequency" isParam="true">214748364</attribute>
+               <attribute name="pingWindowFactor" isParam="true">10</attribute>
+               <attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>
+               <!-- End immutable parameters -->
+               
+               <attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
+                              
+               <!-- Periodicity of client pings. Server window by default is twice this figure -->                               
+               <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
+	       
+	       <attribute name="timeout" isParam="true">0</attribute>
+
+               <!-- Number of seconds to wait for a connection in the client pool to become free -->
+	       <attribute name="connectionWait" isParam="true">10</attribute>
+
+               <!-- Max Number of connections in client pool. This should be significantly higher than
+                    the max number of sessions/consumers you expect -->
+               <attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute> 
+               
+	       <!-- The maximum time to wait before timing out on trying to write a message to socket for delivery -->
+               <attribute name="callbackTimeout">10000</attribute> 
+                                                    
+               <!-- Use these parameters to specify values for binding and connecting control connections to 
+                    work with your firewall/NAT configuration
+               <attribute name="secondaryBindPort">xyz</attribute>                           
+               <attribute name="secondaryConnectPort">abc</attribute>               
+               -->
+               
+            </invoker>
+            <handlers>
+               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
+            </handlers>
+         </config>
+      </attribute>
+      <depends>jboss.messaging:service=ServerSocketFactory,type=SSL</depends>
+   </mbean>
+
+   <!-- This section is for custom (SSL) server socket factory  -->
+
+   <!--
+        The server socket factory mbean to be used as attribute to socket invoker (see
+        serverSocketFactory attribute above for where it is used). This service provides the exact
+        same API as the ServerSocketFactory, so can be set as an attribute of that type on any
+        MBean requiring an ServerSocketFactory.
+   -->
+   <mbean code="org.jboss.remoting.security.SSLServerSocketFactoryService"
+          name="jboss.messaging:service=ServerSocketFactory,type=SSL"
+          display-name="SSL Server Socket Factory">
+      <depends optional-attribute-name="SSLSocketBuilder"
+               proxy-type="attribute">jboss.messaging:service=SocketBuilder,type=SSL</depends>
+   </mbean>
+
+   <!--
+       This service is used to build the SSL Server socket factory. This will be where all the
+       store/trust information will be set. If do not need to make any custom configurations,
+       no extra attributes need to be set for the SSLSocketBuilder and just need to set the
+       javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword system properties.
+
+       This can be done by just adding something like the following to the run script for JBoss
+       (this one is for run.bat):
+       set JAVA_OPTS=-Djavax.net.ssl.keyStore=.keystore -Djavax.net.ssl.keyStorePassword=opensource %JAVA_OPTS%
+
+       Otherwise, if want to customize the attributes for SSLSocketBuilder, will need to uncomment
+       them below.
+   -->
+   <mbean code="org.jboss.remoting.security.SSLSocketBuilder"
+          name="jboss.messaging:service=SocketBuilder,type=SSL"
+          display-name="SSL Server Socket Factory Builder">
+      <!--
+           IMPORTANT - If making ANY customizations, this MUST be set to false.
+           Otherwise, will used default settings and the following attributes will be ignored.
+      -->
+      <attribute name="UseSSLServerSocketFactory">false</attribute>
+      <!-- This is the url string to the key store to use -->
+      <attribute name="KeyStoreURL">${jboss.server.home.url}/deploy/messaging/messaging.keystore</attribute>
+      <!-- The password for the key store -->
+      <attribute name="KeyStorePassword">secureexample</attribute>
+      <!-- The password for the keys (will use KeystorePassword if this is not set explicitly. -->
+      <attribute name="KeyPassword">secureexample</attribute>
+      <!-- The protocol for the SSLContext. Default is TLS. -->
+      <attribute name="SecureSocketProtocol">TLS</attribute>
+      <!-- The algorithm for the key manager factory.  Default is SunX509. -->
+      <attribute name="KeyStoreAlgorithm">SunX509</attribute>
+      <!--
+           The type to be used for the key store.
+           Defaults to JKS. Some acceptable values are JKS (Java Keystore - Sun's keystore format),
+           JCEKS (Java Cryptography Extension keystore - More secure version of JKS), and
+           PKCS12 (Public-Key Cryptography Standards #12 keystore - RSA's Personal Information
+           Exchange Syntax Standard). These are not case sensitive.
+      -->
+      <attribute name="KeyStoreType">JKS</attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/config/sybase-persistence-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/config/sybase-persistence-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/config/sybase-persistence-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Sybase persistence deployment descriptor.
+
+     Tested with Sybase Adaptive Server Enterprise 12.5.3
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================== -->
+
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The datasource to use for the persistence manager -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <!-- If true then we will automatically detect and reject duplicate messages sent during failover -->
+
+      <attribute name="DetectDuplicates">true</attribute>
+
+      <!-- The size of the id cache to use when detecting duplicate messages -->
+
+      <attribute name="IDCacheSize">500</attribute>
+
+      <!-- If true then will add a trailing byte to all byte arrays otherwise Sybase truncates them
+           Only known to be necessary for Sybase -->
+
+      <attribute name="UsingTrailingByte">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+   CREATE_DUAL=CREATE TABLE JBM_DUAL (DUAL_DUMMY INTEGER NOT NULL, PRIMARY KEY (DUAL_DUMMY))
+   CREATE_MESSAGE_REFERENCE=CREATE TABLE JBM_MSG_REF (MESSAGE_ID DECIMAL(19, 0) NOT NULL, CHANNEL_ID DECIMAL(19, 0) NOT NULL, TRANSACTION_ID DECIMAL(19, 0) NULL, STATE CHAR(1), ORD DECIMAL(19, 0), PAGE_ORD DECIMAL(19, 0) NULL, DELIVERY_COUNT INTEGER, SCHED_DELIVERY DECIMAL(19, 0), PRIMARY KEY(MESSAGE_ID, CHANNEL_ID))
+   CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JBM_MSG_REF_TX ON JBM_MSG_REF (TRANSACTION_ID, STATE)
+   CREATE_MESSAGE=CREATE TABLE JBM_MSG (MESSAGE_ID DECIMAL(19, 0) NOT NULL, RELIABLE CHAR(1), EXPIRATION DECIMAL(19, 0), TIMESTAMP DECIMAL(19, 0), PRIORITY TINYINT, TYPE TINYINT, HEADERS IMAGE NULL, PAYLOAD IMAGE NULL, PRIMARY KEY (MESSAGE_ID))
+   CREATE_TRANSACTION=CREATE TABLE JBM_TX (NODE_ID INTEGER, TRANSACTION_ID DECIMAL(19, 0) NOT NULL, BRANCH_QUAL VARBINARY(254) NULL, FORMAT_ID INTEGER NULL, GLOBAL_TXID VARBINARY(254) NULL, PRIMARY KEY (TRANSACTION_ID))
+   CREATE_COUNTER=CREATE TABLE JBM_COUNTER (NAME VARCHAR(255) NOT NULL, NEXT_ID DECIMAL(19, 0), PRIMARY KEY(NAME))
+   CREATE_ID_CACHE=CREATE TABLE JBM_ID_CACHE (NODE_ID INTEGER NOT NULL, CNTR INTEGER NOT NULL, JBM_ID VARCHAR(255), PRIMARY KEY(NODE_ID, CNTR))
+   INSERT_DUAL=INSERT INTO JBM_DUAL VALUES (1)
+   CHECK_DUAL=SELECT 1 FROM JBM_DUAL
+   INSERT_MESSAGE_REF=INSERT INTO JBM_MSG_REF (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID, STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   DELETE_MESSAGE_REF=DELETE FROM JBM_MSG_REF WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_MESSAGE_REF=UPDATE JBM_MSG_REF SET TRANSACTION_ID=?, STATE='-' WHERE MESSAGE_ID=? AND CHANNEL_ID=? AND STATE='C'
+   UPDATE_PAGE_ORDER=UPDATE JBM_MSG_REF SET PAGE_ORD = ? WHERE MESSAGE_ID=? AND CHANNEL_ID=?
+   COMMIT_MESSAGE_REF1=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='+'
+   COMMIT_MESSAGE_REF2=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='-'
+   ROLLBACK_MESSAGE_REF1=DELETE FROM JBM_MSG_REF WHERE TRANSACTION_ID=? AND STATE='+'
+   ROLLBACK_MESSAGE_REF2=UPDATE JBM_MSG_REF SET STATE='C', TRANSACTION_ID = NULL WHERE TRANSACTION_ID=? AND STATE='-'
+   LOAD_PAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, PAGE_ORD, SCHED_DELIVERY FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND PAGE_ORD BETWEEN ? AND ? ORDER BY PAGE_ORD
+   LOAD_UNPAGED_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? AND PAGE_ORD IS NULL ORDER BY ORD
+   LOAD_REFS=SELECT MESSAGE_ID, DELIVERY_COUNT, SCHED_DELIVERY FROM JBM_MSG_REF WHERE STATE = 'C' AND CHANNEL_ID = ? ORDER BY ORD
+   UPDATE_REFS_NOT_PAGED=UPDATE JBM_MSG_REF SET PAGE_ORD = NULL WHERE PAGE_ORD BETWEEN ? AND ? AND CHANNEL_ID=?
+   SELECT_MIN_MAX_PAGE_ORD=SELECT MIN(PAGE_ORD), MAX(PAGE_ORD) FROM JBM_MSG_REF WHERE CHANNEL_ID = ?
+   UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
+   MOVE_REFERENCE=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE MESSAGE_ID = ? AND CHANNEL_ID = ?
+   LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
+   INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+   INSERT_MESSAGE_CONDITIONAL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE) SELECT ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   UPDATE_MESSAGE_4CONDITIONAL=UPDATE JBM_MSG SET HEADERS=?, PAYLOAD=? WHERE MESSAGE_ID=?
+   INSERT_MESSAGE_CONDITIONAL_FULL=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, TYPE, HEADERS, PAYLOAD) SELECT ?, ?, ?, ?, ?, ?, ?, ? FROM JBM_DUAL WHERE NOT EXISTS (SELECT MESSAGE_ID FROM JBM_MSG WHERE MESSAGE_ID = ?)
+   MESSAGE_ID_COLUMN=MESSAGE_ID
+   DELETE_MESSAGE=DELETE FROM JBM_MSG WHERE MESSAGE_ID = ? AND NOT EXISTS (SELECT JBM_MSG_REF.MESSAGE_ID FROM JBM_MSG_REF WHERE JBM_MSG_REF.MESSAGE_ID = ?)
+   INSERT_TRANSACTION=INSERT INTO JBM_TX (NODE_ID, TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?, ?)
+   DELETE_TRANSACTION=DELETE FROM JBM_TX WHERE NODE_ID = ? AND TRANSACTION_ID = ?
+   SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTION_ID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JBM_TX WHERE NODE_ID = ?
+   SELECT_MESSAGE_ID_FOR_REF=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '+' ORDER BY ORD
+   SELECT_MESSAGE_ID_FOR_ACK=SELECT MESSAGE_ID, CHANNEL_ID FROM JBM_MSG_REF WHERE TRANSACTION_ID = ? AND STATE = '-' ORDER BY ORD
+   UPDATE_COUNTER=UPDATE JBM_COUNTER SET NEXT_ID = ? WHERE NAME=?
+   SELECT_COUNTER=SELECT NEXT_ID FROM JBM_COUNTER HOLDLOCK WHERE NAME=?
+   INSERT_COUNTER=INSERT INTO JBM_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+   SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNEL_ID) FROM JBM_MSG_REF
+   UPDATE_TX=UPDATE JBM_TX SET NODE_ID=? WHERE NODE_ID=?
+   UPDATE_ID_IN_CACHE=UPDATE JBM_ID_CACHE SET JBM_ID = ? WHERE NODE_ID = ? AND CNTR = ?
+   INSERT_ID_IN_CACHE=INSERT INTO JBM_ID_CACHE (NODE_ID, CNTR, JBM_ID) VALUES (?, ?, ?)
+   LOAD_ID_CACHE=SELECT CNTR, JBM_ID FROM JBM_ID_CACHE WHERE NODE_ID = ?
+      ]]></attribute>
+
+      <!-- The maximum number of parameters to include in a prepared statement -->
+
+      <attribute name="MaxParams">500</attribute>
+
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+
+      <!-- The name of the post office -->
+
+      <attribute name="PostOfficeName">JMS post office</attribute>
+
+      <!-- The datasource used by the post office to access it's binding information -->
+
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+
+      <attribute name="CreateTablesOnStartup">true</attribute>
+
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(255), COND VARCHAR(1023), SELECTOR VARCHAR(1023) NULL, CHANNEL_ID INTEGER, CLSTERED CHAR(1), ALL_NODES CHAR(1), PRIMARY KEY(POSTOFFICE_NAME, NODE_ID, QUEUE_NAME))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
+LOAD_BINDINGS=SELECT QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLSTERED, ALL_NODES FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=?
+      ]]></attribute>
+
+      <!-- This post office is non clustered. If you want a clustered post office then set to true -->
+
+      <attribute name="Clustered">false</attribute>
+
+      <!-- All the remaining properties only have to be specified if the post office is clustered.
+           You can safely comment them out if your post office is non clustered -->
+
+      <!-- The JGroups group name that the post office will use -->
+
+      <attribute name="GroupName">${jboss.messaging.groupname:MessagingPostOffice}</attribute>
+
+      <!-- Max time to wait for state to arrive when the post office joins the cluster -->
+
+      <attribute name="StateTimeout">30000</attribute>
+
+      <!-- Max time to wait for a synchronous call to node members using the MessageDispatcher -->
+
+      <attribute name="CastTimeout">30000</attribute>
+      
+      <!-- Set this to true if you want failover of connections to occur when a node is shut down -->
+      
+      <attribute name="FailoverOnNodeLeave">false</attribute>
+      
+      <depends optional-attribute-name="ChannelFactoryName">jboss.jgroups:service=ChannelFactory</depends>
+      <attribute name="ControlChannelName">jbm-control</attribute>
+      <attribute name="DataChannelName">jbm-data</attribute>
+      <attribute name="ChannelPartitionName">${jboss.partition.name:DefaultPartition}-JMS</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      <attribute name="SqlProperties"><![CDATA[
+CREATE_USER_TABLE=CREATE TABLE JBM_USER (USER_ID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USER_ID))
+CREATE_ROLE_TABLE=CREATE TABLE JBM_ROLE (ROLE_ID VARCHAR(32) NOT NULL, USER_ID VARCHAR(32) NOT NULL, PRIMARY KEY(USER_ID, ROLE_ID))
+SELECT_PRECONF_CLIENTID=SELECT CLIENTID FROM JBM_USER WHERE USER_ID=?
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/destinations/jbm-examples-destinations-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/destinations/jbm-examples-destinations-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/destinations/jbm-examples-destinations-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Messaging Example Destinations
+ -->
+
+<server>
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=testTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SecurityConfig">
+         <security>
+            <role name="guest" read="true" write="true"/>
+            <role name="publisher" read="true" write="true" create="false"/>
+            <role name="durpublisher" read="true" write="true" create="true"/>
+         </security>
+      </attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=securedTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SecurityConfig">
+         <security>
+            <role name="publisher" read="true" write="true" create="false"/>
+         </security>
+      </attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=testDurableTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SecurityConfig">
+         <security>
+            <role name="guest" read="true" write="true"/>
+            <role name="publisher" read="true" write="true" create="false"/>
+            <role name="durpublisher" read="true" write="true" create="true"/>
+         </security>
+      </attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=testQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SecurityConfig">
+         <security>
+            <role name="guest" read="true" write="true"/>
+            <role name="publisher" read="true" write="true" create="false"/>
+            <role name="noacc" read="false" write="false" create="false"/>
+         </security>
+      </attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=A"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=B"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=C"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=D"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=ex"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+   
+   <!-- It's possible for indiviual queues and topics to use a specific queue for
+   an expiry or DLQ -->
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=PrivateDLQ"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>      
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueWithOwnDLQAndExpiryQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=PrivateDLQ</attribute>
+      <attribute name="ExpiryQueue">jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue</attribute>
+   </mbean> 
+   
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=TopicWithOwnDLQAndExpiryQueue"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=PrivateDLQ</attribute>
+      <attribute name="ExpiryQueue">jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue</attribute>
+   </mbean>       
+   
+   <!-- Queues and Topics can also specify their own redelivery delay -->
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueWithOwnRedeliveryDelay"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="RedeliveryDelay">5000</attribute>
+   </mbean>
+   
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=TopicWithOwnRedeliveryDelay"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="RedeliveryDelay">5000</attribute>
+   </mbean>     
+   
+   <!--
+        Example clustered destinations.
+   -->
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=testDistributedQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="Clustered">true</attribute>
+   </mbean>   
+   
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=testDistributedTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="Clustered">true</attribute>
+   </mbean>   
+</server>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,135 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - Distributed Queue</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Distributed Queue Example</h1>
+$Revision: 1017 $
+<h2>Overview</h2>
+<br>
+This example demonstrates how to write JMS code that connects to a
+JBoss Messaging cluster and sends messages to a distributed queue.
+The example creates two connections to two distinct cluster nodes
+on which we have previously deployed a distributed queue.
+The example sends and receives messages using both connections.
+<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+cluster with at least two nodes. The JBoss Messaging cluster must be
+installed and started according to the user guide.
+<br><br>
+For JBoss5, you should copy all as messaging-node0, configure mysql as a database, make it clustered, and copy it as messaging-node1. Start each instance as:
+<br><br>
+./run.sh -c messaging-node0 -Djboss.service.binding.set=ports-01
+<br><br>
+<br>
+and in another window
+<br><br>
+./run.sh -c messaging-node1 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=1
+<br><br>
+<span style="font-style: italic;"></span><br>
+<h2>Running the example</h2>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+1. Make sure that a JBoss Messaging cluster with at least two nodes is
+up and running.<br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\distributed-queue</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+      <div style="margin-left: 40px;"><br>
+      </div>
+$ ant<br>
+Buildfile: build.xml<br>
+      <br>
+identify:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+###########################################################################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Running the DISTRIBUTED QUEUE
+example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+#<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+###########################################################################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The
+topic:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testDistributedQueue<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The client jar:
+../../../output/lib/jboss-messaging-client.jar<br>
+      <br>
+sanity-check:<br>
+      <br>
+init:<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\svn\messaging\docs\examples\distributed-queue\output<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\svn\messaging\docs\examples\common\output<br>
+      <br>
+compile:<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\svn\messaging\docs\examples\common\output<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\svn\messaging\docs\examples\distributed-queue\output<br>
+      <br>
+run:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Distributed queue
+/queue/testDistributedQueue exists<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The message was successfully sent
+to the distributed queue<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] MessageListener0 received message:
+Hello!<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] MessageListener1 received message:
+Another Hello!<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
+Messaging version 1.4.1.GA (1.4)<br>
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;
+SUCCESS!&nbsp;&nbsp; ###<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+      <br>
+BUILD SUCCESSFUL<br>
+Total time: 4 seconds<br>
+      <br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   The example requires a two nodes messaging-node0 and messaging-node1 to be running
+
+   $Id: build.xml 974 2006-05-22 21:35:38 -0600 (Mon, 22 May 2006) ovidiu $
+
+ -->
+
+<project name="DistributedQueueExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration.node0" value="messaging-node0" />
+	<property name="jboss.configuration.node1" value="messaging-node1" />
+	<property name="example.queue.name" value="testDistributedQueue" />
+	
+	<property name="messaging-deploy" value="messaging"/>
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                Running the DISTRIBUTED QUEUE example                    #" />
+		<echo message="###########################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/classes" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="deploy">
+		<copy file="./etc/distributed-queue-service.xml" todir="${jboss.home}/server/${jboss.configuration.node0}/deploy/${messaging-deploy}" />
+		<copy file="./etc/distributed-queue-service.xml" todir="${jboss.home}/server/${jboss.configuration.node1}/deploy/${messaging-deploy}" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="10" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="compile, deploy">
+		<!--
+           DistributedQueueExample expects to find the name of the queue to connect to as value of
+           the 'example.queue.name' property, which *may* be defined by calling ant when this
+           example is used in a smoke test.
+      -->
+		<java classname="org.jboss.example.jms.distributedqueue.DistributedQueueExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+		</java>
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration.node0}/deploy/${messaging-deploy}/distributed-queue-service.xml" quiet="true" />
+		<delete file="${jboss.home}/server/${jboss.configuration.node1}/deploy/${messaging-deploy}/distributed-queue-service.xml" quiet="true" />
+	</target>
+
+	<target name="clean">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/distributed-queue-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/distributed-queue-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/distributed-queue-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Messaging Destinations deployment descriptor.
+
+     $Id: destinations-service.xml 81065 2008-11-14 15:09:16Z dimitris at jboss.org $
+ -->
+
+<server>
+   
+   <!--
+        Example clustered destinations.
+   -->
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=testDistributedQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="Clustered">true</attribute>
+   </mbean>   
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,5 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+# Assuming ports-01 so naming running on 1199
+java.naming.provider.url=jnp://localhost:1199
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 00:28:39 -0600 (Thu, 22 Dec 2005) ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,170 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.distributedqueue;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example creates two connections to two distinct cluster nodes on which we have previously
+ * deployed a distributed queue. The example sends messages on one node and consumes them from another
+ *
+ * Since this example is also used as a smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1001 $</tt>
+ *
+ * $Id: TopicExample.java 1001 2006-06-24 09:05:40Z timfox $
+ */
+public class DistributedQueueExample extends ExampleSupport
+{
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+
+      InitialContext ic = null;
+
+      Connection connection0 = null;
+      Connection connection1 = null;
+
+      ConnectionFactory cf = null;
+
+      try
+      {
+         // connecting to the first node
+
+         ic = new InitialContext();
+
+         cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
+         Queue distributedQueue = (Queue)ic.lookup(destinationName);
+         log("Distributed queue " + destinationName + " exists");
+
+
+         // When connecting to a messaging cluster, the ConnectionFactory has the capability of
+         // transparently creating physical connections to different cluster nodes, in a round
+         // robin fashion ...
+
+         // ... so this is a connection to a cluster node
+         connection0 = cf.createConnection();
+
+         // ... and this is a connection to a different cluster node
+         connection1 = cf.createConnection();
+
+         // Let's make sure that (this example is also a smoke test)
+         assertNotEquals(getServerID(connection0), getServerID(connection1));
+
+         // Create a session, and a producer on the first connection
+
+         Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer publisher0 = session0.createProducer(distributedQueue);
+         
+         // Create another session, and consumer on the second connection
+
+         Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);      
+         MessageConsumer consumer1 = session1.createConsumer(distributedQueue);
+         ExampleListener messageListener1 = new ExampleListener("MessageListener1");
+         consumer1.setMessageListener(messageListener1);
+
+         // Start connections, so we can receive the message
+
+         connection0.start();
+         connection1.start();
+
+         // Send the message
+
+         TextMessage message = session0.createTextMessage("Hello!");
+         publisher0.send(message);
+
+         log("The message was successfully sent to the distributed queue");
+         
+         messageListener1.waitForMessage(3000);
+
+         message = (TextMessage)messageListener1.getMessage();
+         log(messageListener1.getName() + " received message: " + message.getText());
+         assertEquals("Hello!", message.getText());
+        
+         displayProviderInfo(connection0.getMetaData());
+      }
+      finally
+      {
+         if (ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch(Exception e)
+            {
+               throw e;
+            }
+         }
+
+         try
+         {
+            if (connection0 != null)
+            {
+               connection0.close();
+            }
+         }
+         catch(JMSException e)
+         {
+            log("Could not close connection " + connection0 + ", exception was " + e);
+            throw e;
+         }
+
+         try
+         {
+            if (connection1 != null)
+            {
+               connection1.close();
+            }
+         }
+         catch(JMSException e)
+         {
+            log("Could not close connection " + connection1 + ", exception was " + e);
+            throw e;
+         }
+
+      }
+   }
+
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+
+   public static void main(String[] args)
+   {
+      new DistributedQueueExample().run();
+   }
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,82 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.distributedqueue;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 536 $</tt>
+
+ * $Id: ExampleListener.java 536 2005-12-22 00:28:39 -0600 (Thu, 22 Dec 2005) ovidiu $
+ */
+public class ExampleListener implements MessageListener
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private String name;
+   private Message message;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public ExampleListener(String name)
+   {
+      this.name = name;
+   }
+
+   // MessageListener implementation ---------------------------------------------------------------
+
+   public synchronized void onMessage(Message message)
+   {
+      this.message = message;
+      notifyAll();
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public synchronized Message getMessage()
+   {
+      return message;
+   }
+
+   public synchronized void waitForMessage(long timeout)
+   {
+      if (message != null)
+      {
+         return;
+      }
+
+      try
+      {
+         wait(timeout);
+      }
+      catch(InterruptedException e)
+      {
+         // OK
+      }
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,136 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - JMS Distributed Topic</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Distributed Topic Example</h1>
+$Revision: 5409 $
+<h2>Overview</h2>
+<br>
+This example demonstrates how to write JMS code that connects to a
+JBoss Messaging cluster and sends messages to a distributed topic. The
+client code creates two distinct JMS connections to two different
+cluster nodes. Each connection is then used to create a subscriber for
+the distributed topic. The example is considered
+successful
+if both subscribers receive a message sent to the topic.<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+cluster with at least two nodes. The JBoss Messaging cluster must be
+installed and started according to the userguide.
+<br><br>
+For JBoss5, you should copy all as messaging-node0, configure mysql as a database, make it clustered, and copy it as messaging-node1. Start each instance as:
+<br><br>
+./run -c messaging-node0 -Djboss.service.binding.set=ports-01
+<br><br>
+<br>
+and in another window
+<br><br>
+./run.sh -c messaging-node1 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=1
+<br><br>
+<span style="font-style: italic;"></span><br>
+<h2>Running the example</h2>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+1. Make sure that a JBoss Messaging cluster with at least two nodes is
+up and running.<br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\distributed-topic</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+      <div style="margin-left: 40px;"><br>
+      </div>
+$ ant<br>
+Buildfile: build.xml<br>
+      <br>
+identify:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+###########################################################################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Running the DISTRIBUTED TOPIC
+example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+#<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+###########################################################################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The
+topic:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testDistributedTopic<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The client jar:
+../../../output/lib/jboss-messaging-client.jar<br>
+      <br>
+sanity-check:<br>
+      <br>
+init:<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\svn\messaging\docs\examples\distributed-topic\output<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\svn\messaging\docs\examples\common\output<br>
+      <br>
+compile:<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\svn\messaging\docs\examples\common\output<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\svn\messaging\docs\examples\distributed-topic\output<br>
+      <br>
+run:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Distributed topic
+/topic/testDistributedTopic exists<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The message was successfully published
+on the distributed topic<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] MessageListener 1 received message:
+Hello!<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] MessageListener 2 received message:
+Hello!<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
+Messaging version 1.4.1.GA (1.4)<br>
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;
+SUCCESS!&nbsp;&nbsp; ###<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+      <br>
+BUILD SUCCESSFUL<br>
+Total time: 4 seconds<br>
+      <br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="DistributedTopicExample" default="run">
+
+	<property environment="ENV" />
+
+	<property file="../examples.properties" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration.node0" value="messaging-node0" />
+	<property name="jboss.configuration.node1" value="messaging-node1" />
+	<property name="example.topic.name" value="testDistributedTopic" />
+	
+	<property name="messaging-deploy" value="messaging"/>
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                Running the DISTRIBUTED TOPIC example                    #" />
+		<echo message="###########################################################################" />
+		<echo message="The topic:      ${example.topic.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/classes" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="deploy">
+		<copy file="./etc/distributed-topic-service.xml" todir="${jboss.home}/server/${jboss.configuration.node0}/deploy/${messaging-deploy}" />
+		<copy file="./etc/distributed-topic-service.xml" todir="${jboss.home}/server/${jboss.configuration.node1}/deploy/${messaging-deploy}" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="10" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="compile, deploy">
+		<!--
+           DistributedTopicExample expects to find the name of the topic to connect to as value of
+           the 'example.topic.name' property, which *may* be defined by calling ant when this
+           example is used in a smoke test.
+      -->
+		<java classname="org.jboss.example.jms.distributedtopic.DistributedTopicExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.topic.name" value="${example.topic.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+		</java>
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration.node0}/deploy/${messaging-deploy}/distributed-topic-service.xml" quiet="true" />
+		<delete file="${jboss.home}/server/${jboss.configuration.node1}/deploy/${messaging-deploy}/distributed-topic-service.xml" quiet="true" />
+	</target>
+
+	<target name="clean">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/distributed-topic-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/distributed-topic-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/distributed-topic-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Messaging Destinations deployment descriptor.
+
+     $Id: destinations-service.xml 81065 2008-11-14 15:09:16Z dimitris at jboss.org $
+ -->
+
+<server>
+   
+   <!--
+        Example clustered destinations.
+   -->
+   
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=testDistributedTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="Clustered">true</attribute>
+   </mbean>   
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,5 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+# Asuming ports-01 where naming listens on 1199
+java.naming.provider.url=jnp://localhost:1199
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2744 2007-05-30 17:16:29Z sergeypk $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/DistributedTopicExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/DistributedTopicExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/DistributedTopicExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,183 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.distributedtopic;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example sends a message to a distributed topic deployed on the JMS cluster. The message is
+ * subsequently received by two different subscribers, connected to two distinct cluster nodes.
+ *
+ * Since this example is also used as a smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 3092 $</tt>
+ *
+ * $Id: DistributedTopicExample.java 3092 2007-09-10 21:42:30Z clebert.suconic at jboss.com $
+ */
+public class DistributedTopicExample extends ExampleSupport
+{
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+
+      InitialContext ic = null;
+
+      Connection connection0 = null;
+      Connection connection1 = null;
+
+      ConnectionFactory cf = null;
+      try
+      {
+         // connecting to the first node
+
+         ic = new InitialContext();
+
+         cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
+         Topic distributedTopic = (Topic)ic.lookup(destinationName);
+         log("Distributed topic " + destinationName + " exists");
+
+
+         // When connecting to a messaging cluster, the ConnectionFactory has the capability of
+         // transparently creating physical connections to different cluster nodes, in a round
+         // robin fashion ...
+
+         // ... so this is a connection to a cluster node
+         connection0 = cf.createConnection();
+
+         // ... and this is a connection to a different cluster node
+         connection1 = cf.createConnection();
+
+         // Let's make sure that (this example is also a smoke test)
+         assertNotEquals(getServerID(connection0), getServerID(connection1));
+
+         // Create a session, a producer and consumer for the distributed topic, using connection0
+
+         Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         MessageConsumer subscriber0 = session0.createConsumer(distributedTopic);
+         ExampleListener messageListener0 = new ExampleListener("MessageListener 0");
+         subscriber0.setMessageListener(messageListener0);
+
+         MessageProducer publisher = session0.createProducer(distributedTopic);
+
+
+         // Create a session and a consumer for the distributed topic, using connection1
+
+         Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         MessageConsumer subscriber1 = session1.createConsumer(distributedTopic);
+
+         ExampleListener messageListener1 = new ExampleListener("MessageListener 1");
+         subscriber1.setMessageListener(messageListener1);
+
+         // Starting the connections
+
+         connection0.start();
+         connection1.start();
+
+         // Sending the message
+
+         TextMessage message = session0.createTextMessage("Hello!");
+         publisher.send(message);
+
+         log("The message was successfully published on the distributed topic");
+
+         messageListener0.waitForMessage();
+         messageListener1.waitForMessage();
+
+         message = (TextMessage)messageListener0.getMessage();
+         log(messageListener0.getName() + " received message: " + message.getText());
+         assertEquals("Hello!", message.getText());
+
+         message = (TextMessage)messageListener1.getMessage();
+         log(messageListener1.getName() + " received message: " + message.getText());
+         assertEquals("Hello!", message.getText());
+
+         displayProviderInfo(connection0.getMetaData());
+
+      }
+      finally
+      {
+         if (ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch(Exception e)
+            {
+               throw e;
+            }
+         }
+
+         try
+         {
+            if (connection0 != null)
+            {
+               connection0.close();
+            }
+         }
+         catch(JMSException e)
+         {
+            log("Could not close connection " + connection0 + ", exception was " + e);
+            throw e;
+         }
+
+         try
+         {
+            if (connection1 != null)
+            {
+               connection1.close();
+            }
+         }
+         catch(JMSException e)
+         {
+            log("Could not close connection " + connection1 + ", exception was " + e);
+            throw e;
+         }
+
+      }
+   }
+
+   protected boolean isQueueExample()
+   {
+      return false;
+   }
+
+   public static void main(String[] args)
+   {
+      new DistributedTopicExample().run();
+   }
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/ExampleListener.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/ExampleListener.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/ExampleListener.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,82 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.distributedtopic;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: ExampleListener.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class ExampleListener implements MessageListener
+{
+   // Constants -----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private String name;
+   private Message message;
+
+   // Constructors --------------------------------------------------
+
+   public ExampleListener(String name)
+   {
+      this.name = name;
+   }
+
+   // MessageListener implementation --------------------------------
+
+   public synchronized void onMessage(Message message)
+   {
+      this.message = message;
+      notifyAll();
+   }
+
+   // Public --------------------------------------------------------
+
+   public synchronized Message getMessage()
+   {
+      return message;
+   }
+
+   public synchronized void waitForMessage()
+   {
+      if (message != null)
+      {
+         return;
+      }
+
+      try
+      {
+         wait(5000);
+      }
+      catch(InterruptedException e)
+      {
+         // OK
+      }
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,147 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - EJB3 Message Driven Bean</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging EJB3 Message Driven Bean Example</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example deploys a simple EJB3 Message Driven Bean that processes
+messages sent to a test queue.&nbsp; Once it receives a message and
+"processes" it, the EJB3 MDB sends an acknowledgment message to a&nbsp;
+temporary destination created by the sender for this purpose. The
+example is considered&nbsp; successful if the sender receives the
+acknowledgment message.<br>
+<br>
+<span style="font-style: italic;"></span><br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\messaging</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-5.0.0.GA</span><br>
+<span style="font-family: monospace;"><br>
+</span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\ejb3mdb</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+      <div style="margin-left: 40px;"><br>
+      </div>
+$ ant<br>
+Buildfile: build.xml<br>
+      <br>
+identify:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Running the EJB3 MDB
+example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+X<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The queue: testQueue<br>
+      <br>
+sanity-check:<br>
+      <br>
+init:<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\classes\META-INF<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\lib\META-INF<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+      <br>
+compile:<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\classes<br>
+      <br>
+jar:<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [jar] Building jar:
+C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\lib\mdb-example.ejb3<br>
+      <br>
+deploy:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [copy] Copying 1 file to
+C:\work\src\jboss-4.0.3SP1-src\build\output\jboss-4.0.3SP1\server\default\deploy<br>
+      <br>
+sleep:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] Sleeping for 5 seconds ...<br>
+      <br>
+run:<br>
+      <br>
+send:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Queue /queue/testQueue exists<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The Hello! message was successfully
+sent to the testQueue queue<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: !olleH<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
+Messaging version 1.4.1.GA (1.4)<br>
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;
+SUCCESS!&nbsp;&nbsp; ###<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+      <br>
+undeploy:<br>
+&nbsp;&nbsp; [delete] Deleting:
+C:\work\src\jboss-4.2.0.GA\build\output\jboss-4.0.3SP1\server\messaging\deploy\mdb-example.ejb3<br>
+      <br>
+BUILD SUCCESSFUL<br>
+Total time: 10 seconds<br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<br>
+<h2>Troubleshooting</h2>
+<br>
+<h3>2. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br style="font-family: courier new,courier,monospace;">
+<hr
+ style="width: 100%; height: 2px; font-family: courier new,courier,monospace;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="EJB3MDBExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="default" />
+	<property name="example.queue.name" value="testQueue" />
+	
+	<property name="ej3-extension" value="jar"/>
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                     Running the EJB3 MDB example                        #" />
+		<echo message="###########################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="init" >
+		<mkdir dir="./output/classes/META-INF" />
+		<mkdir dir="./output/lib/META-INF" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="jar" depends="compile">
+		<copy todir="./output/classes/META-INF" filtering="true">
+			<fileset dir="./etc/META-INF" includes="*" />
+			<filterset>
+				<filter token="QUEUE_NAME" value="${example.queue.name}" />
+			</filterset>
+		</copy>
+		<jar destfile="./output/lib/mdb-example.${ej3-extension}" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/EJB3MDBExample.class" />
+	</target>
+
+	<target name="deploy" depends="jar">
+		<java classname="org.jboss.example.jms.common.Util" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.source.queue" value="${example.queue.name}" />
+			<arg value="ejb3mdb-deploy"/>
+		</java>
+		<copy file="./output/lib/mdb-example.${ej3-extension}" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="5" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="deploy">
+		<antcall target="send" />
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="send">
+		<!-- MDBExample expects to find the name of the queue to connect to as value of the
+           'example.queue.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+		<java classname="org.jboss.example.jms.ejb3mdb.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+		</java>
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-example.${ej3-extension}" quiet="true" />
+		<java classname="org.jboss.example.jms.common.Util" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.source.queue" value="${example.queue.name}" />
+			<arg value="ejb3mdb-undeploy"/>
+		</java>
+	</target>
+
+	<target name="clean" depends="undeploy">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 892 2006-04-18 23:48:09Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,104 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.ejb3mdb;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+
+import javax.naming.InitialContext;
+import javax.jms.TextMessage;
+import javax.jms.Session;
+import javax.jms.MessageListener;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.Connection;
+import javax.jms.MessageProducer;
+
+/**
+ * A MDB3 EJB example.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: EJB3MDBExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+ at MessageDriven(activationConfig =
+{
+      @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+      @ActivationConfigProperty(propertyName="destination", propertyValue="queue/testQueue"),
+      @ActivationConfigProperty(propertyName="DLQMaxResent", propertyValue="10")
+})
+public class EJB3MDBExample implements MessageListener
+{
+   public void onMessage(Message m)
+   {
+      businessLogic(m);
+   }
+
+   private void businessLogic(Message m)
+   {
+      Connection conn = null;
+      Session session = null;
+
+      try
+      {
+         TextMessage tm = (TextMessage)m;
+
+         String text = tm.getText();
+         System.out.println("message " + text + " received");
+
+         // flip the string
+         String result = "";
+         for(int i = 0; i < text.length(); i++)
+         {
+            result = text.charAt(i) + result;
+         }
+
+         System.out.println("message processed, result: " + result);
+
+
+         InitialContext ic = new InitialContext();
+         ConnectionFactory cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+         ic.close();
+
+         conn = cf.createConnection();
+         conn.start();
+         session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Destination replyTo = m.getJMSReplyTo();
+         MessageProducer producer = session.createProducer(replyTo);
+         TextMessage reply = session.createTextMessage(result);
+
+         producer.send(reply);
+         producer.close();
+
+      }
+      catch(Exception e)
+      {
+         e.printStackTrace();
+         System.out.println("The Message Driven Bean failed!");
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            try
+            {
+               conn.close();
+            }
+            catch(Exception e)
+            {
+               System.out.println("Could not close the connection!" +e);
+            }
+         }
+      }
+   }
+}
+
+
+

Added: branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/Sender.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/Sender.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/Sender.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,133 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.ejb3mdb;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example deploys a simple EJB3 Message Driven Bean that processes messages sent to a test
+ * queue. Once it receives a message and "processes" it, the MDB sends an acknowledgment message to
+ * a temporary destination created by the sender for this purpose. The example is considered
+ * successful if the sender receives the acknowledgment message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: Sender.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class Sender extends ExampleSupport
+{
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+
+
+      InitialContext ic = new InitialContext();
+
+
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+      Queue queue = (Queue)ic.lookup(destinationName);
+
+
+
+      log("Queue " + destinationName + " exists");
+
+
+
+      Connection connection = cf.createConnection();
+      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      MessageProducer sender = session.createProducer(queue);
+
+
+
+      Queue temporaryQueue = session.createTemporaryQueue();
+      MessageConsumer consumer = session.createConsumer(temporaryQueue);
+
+
+
+      TextMessage message = session.createTextMessage("Hello!");
+      message.setJMSReplyTo(temporaryQueue);
+
+
+
+      sender.send(message);
+
+
+
+      log("The " + message.getText() + " message was successfully sent to the " + queue.getQueueName() + " queue");
+
+
+
+      connection.start();
+
+
+
+      message = (TextMessage)consumer.receive(5000);
+
+
+      if (message == null)
+      {
+         throw new Exception("Have not received any reply. The example failed!");
+      }
+
+
+      log("Received message: " + message.getText());
+
+
+
+      assertEquals("!olleH", message.getText());
+
+
+
+      displayProviderInfo(connection.getMetaData());
+
+
+
+      connection.close();
+   }
+
+
+
+
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+
+   public static void main(String[] args)
+   {
+      new Sender().run();
+   }
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/http/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/http/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/http/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,132 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+        http-equiv="content-type">
+  <title>JBoss Messaging Example - HTTP Transport</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging HTTP Transport Example</h1>
+$Revision: 5394 $
+<h2>Overview</h2>
+<p>
+This example shows how to configure a ConnectionFactory to send
+messages using the HTTP protocol. The example will use
+such a ConnectionFactory to create two JMS connections: the first one
+to send a message to the queue and the second one to read the message
+from the queue. In both cases, the message will be sent over
+an HTTP connection. The example is considered successful
+if the client receives without any error the message that was
+previously sent to the queue.</p>
+<p>
+This example needs to have access to a running JBoss default
+instance. However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed.
+</p>
+<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\jboss-5.0.0.GA</span><br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\http</span><br>
+</div>
+<span style="font-family: monospace;"></span><br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+<br>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+<pre>
+$ ant
+Buildfile: build.xml
+
+identify:
+     [echo] ############################################################################
+     [echo] #                         Running the HTTP example                         #
+     [echo] ############################################################################
+     [echo] The queue:      testQueue
+     [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+    [mkdir] Created dir: C:\java\messaging\docs\examples\http\output\classes
+    [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+    [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+    [javac] Compiling 1 source file to C:\java\messaging\docs\examples\http\output\classes
+
+deploy:
+     [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging\deploy
+
+sleep:
+     [echo] Sleeping for 10 seconds ...
+
+run:
+     [java] Queue /queue/testQueue exists
+     [java] The message was successfully sent to the testQueue queue
+     [java] Received message: Hello!
+     [java] The example connected to JBoss Messaging version 1.4.1.GA (1.4)
+     [java] 
+     [java] #####################
+     [java] ###    SUCCESS!   ###
+     [java] #####################
+
+undeploy:
+   [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\messaging-http-service.xml
+
+BUILD SUCCESSFUL
+Total time: 14 seconds</pre>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<h2>Troubleshooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/http/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/http/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/http/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="HttpExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="remoting.path" value="../config" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="default" />
+	<property name="example.queue.name" value="testQueue" />
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+
+	<target name="identify">
+		<echo message="############################################################################" />
+		<echo message="#                         Running the HTTP example                         #" />
+		<echo message="############################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="init" >
+		<mkdir dir="./output/classes" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="deploy">
+		<copy file="${remoting.path}/remoting-http-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<copy file="./etc/messaging-http-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="10" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="compile, deploy">
+		<!-- QueueExample expects to find the name of the queue to connect to as value of the
+           'example.queue.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+		<java classname="org.jboss.example.jms.http.HttpExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+         -->
+		</java>
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/messaging-http-service.xml" quiet="true" />
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/remoting-http-service.xml" quiet="true" />
+	</target>
+
+	<target name="clean" depends="undeploy">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/http/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/http/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/http/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
+java.naming.provider.url=http://localhost:8080/invoker/JNDIFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/http/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/http/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/http/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 952 2006-05-17 19:26:54Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/http/etc/messaging-http-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/http/etc/messaging-http-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/http/etc/messaging-http-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     HTTP Transport Example.
+
+     $Id: messaging-http-service.xml 2773 2007-06-12 13:31:30Z sergeypk $
+ -->
+
+<server>
+
+   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+      name="jboss.messaging.destination:service=HttpConnectionFactory"
+      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=http</depends>
+      <attribute name="JNDIBindings">
+         <bindings>
+            <binding>/HttpConnectionFactory</binding>
+         </bindings>
+      </attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/http/src/org/jboss/example/jms/http/HttpExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/http/src/org/jboss/example/jms/http/HttpExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/http/src/org/jboss/example/jms/http/HttpExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.http;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+
+/**
+ * The example creates a connection to the default provider and uses the connection to send a
+ * message to the queue "queue/testQueue". Then, the example creates a second connection to the
+ * provider and uses it to receive the message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: HttpExample.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class HttpExample extends ExampleSupport
+{
+   
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+      
+      InitialContext ic = null;
+      ConnectionFactory cf = null;
+      Connection connection =  null;
+      Connection connection2 =  null;
+      
+      try
+      {
+         ic = new InitialContext();
+         
+         cf = (ConnectionFactory)ic.lookup("/HttpConnectionFactory");
+         Queue queue = (Queue)ic.lookup(destinationName);
+         log("Queue " + destinationName + " exists");
+         
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer sender = session.createProducer(queue);
+         
+         TextMessage message = session.createTextMessage("Hello!");
+         sender.send(message);
+         log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+         
+         connection2 = cf.createConnection();
+         Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageConsumer consumer = session2.createConsumer(queue);
+         
+         connection2.start();
+         
+         message = (TextMessage)consumer.receive(2000);
+         log("Received message: " + message.getText());
+         assertEquals("Hello!", message.getText());
+         
+         displayProviderInfo(connection2.getMetaData());
+         
+      }
+      finally
+      {
+         if(ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch(Exception e)
+            {
+               throw e;
+            }
+         }
+         
+         //ALWAYS close your connection in a finally block to avoid leaks
+         //Closing connection also takes care of closing its related objects e.g. sessions
+         closeConnection(connection);
+         closeConnection(connection2);
+      }
+   }
+   
+   private void closeConnection(Connection con)
+   {
+      try
+      {
+         if (con != null)
+         {
+            con.close();
+         }         
+      }
+      catch(JMSException jmse)
+      {
+         log("Could not close connection " + con +" exception was " +jmse);         
+      }
+   }
+   
+   
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+   
+   public static void main(String[] args)
+   {
+      new HttpExample().run();
+   }
+   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,135 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - Message Driven Bean</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Message Driven Bean Example</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example deploys a simple Message Driven Bean that processes
+messages sent to a test queue.&nbsp; Once it receives a message and
+"processes" it, the MDB sends an acknowledgment message to a&nbsp;
+temporary destination created by the sender for this purpose. The
+example is considered&nbsp; successful if the sender receives the
+acknowledgment message.<br>
+<br>
+This example relies on having access to a running JBoss default
+instance.
+&nbsp; However,
+the example will automatically deploy its own queue, unless a queue
+with the same name is already deployed.<br>
+<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-5.0.0.GA.</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\mdb</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+<pre>$ ant
+Buildfile: build.xml
+
+identify:
+     [echo] ###########################################################################
+     [echo] #                        Running the MDB example                          #
+     [echo] ###########################################################################
+     [echo] The queue:      testQueue
+     [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+    [mkdir] Created dir: C:\java\messaging\docs\examples\mdb\output\classes\META-INF
+    [mkdir] Created dir: C:\java\messaging\docs\examples\mdb\output\lib\META-INF
+    [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+    [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+    [javac] Compiling 2 source files to C:\java\messaging\docs\examples\mdb\output\classes
+
+jar:
+     [copy] Copying 2 files to C:\java\messaging\docs\examples\mdb\output\classes\META-INF
+      [jar] Building jar: C:\java\messaging\docs\examples\mdb\output\lib\mdb-example.jar
+
+deploy:
+     [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging\deploy
+
+sleep:
+     [echo] Sleeping for 5 seconds ...
+
+run:
+
+send:
+     [java] Queue /queue/testQueue exists
+     [java] The Hello! message was successfully sent to the testQueue queue
+     [java] Received message: !olleH
+     [java] The example connected to JBoss Messaging version 1.4.1.GA (1.4)
+     [java] 
+     [java] #####################
+     [java] ###    SUCCESS!   ###
+     [java] #####################
+
+undeploy:
+   [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\mdb-example.jar
+
+BUILD SUCCESSFUL
+Total time: 10 seconds
+</pre>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+
+<br style="font-family: courier new,courier,monospace;">
+<hr
+ style="width: 100%; height: 2px; font-family: courier new,courier,monospace;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="MDBExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="default" />
+	<property name="example.queue.name" value="testQueue" />
+	
+	<property name="ej3-extension" value="jar"/>
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                        Running the MDB example                          #" />
+		<echo message="###########################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/classes/META-INF" />
+		<mkdir dir="./output/lib/META-INF" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="jar" depends="compile">
+		<copy todir="./output/classes/META-INF" filtering="true">
+			<fileset dir="./etc/META-INF" includes="*" />
+			<filterset>
+				<filter token="QUEUE_NAME" value="${example.queue.name}" />
+			</filterset>
+		</copy>
+		<jar destfile="./output/lib/mdb-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/MDBExample.class">
+		</jar>
+	</target>
+
+	<target name="ear" depends="jar">
+		<jar destfile="./output/lib/mdb-example.ear">
+			<zipfileset dir="./output/lib" includes="mdb-example.jar" />
+			<zipfileset dir="./etc/EAR-META-INF" prefix="META-INF" />
+		</jar>
+	</target>
+
+	<target name="deploy" depends="ear">
+		<copy file="./output/lib/mdb-example.ear" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="5" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="deploy">
+		<antcall target="send" />
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="send">
+		<!-- MDBExample expects to find the name of the queue to connect to as value of the
+           'example.queue.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+		<java classname="org.jboss.example.jms.mdb.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+		</java>
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-example.ear" quiet="true" />
+	</target>
+
+	<target name="clean" depends="undeploy">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/application.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/application.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/application.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE application PUBLIC
+        "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+        "http://java.sun.com/dtd/application_1_3.dtd">
+
+<application>
+
+  <display-name>MDB Example</display-name>
+  <module>
+    <ejb>mdb-example.jar</ejb>
+  </module>
+
+</application>

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/jboss-app.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/jboss-app.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/EAR-META-INF/jboss-app.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+
+<!DOCTYPE jboss-app
+    PUBLIC "-//JBoss//DTD J2EE Application 4.0//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
+
+<jboss-app>
+   <loader-repository>org.jboss.messaging.examples:loader=mdb-example.ear</loader-repository>
+</jboss-app>

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/ejb-jar.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+    "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+    <enterprise-beans>
+        <message-driven>
+            <ejb-name>MDBExample</ejb-name>
+            <ejb-class>org.jboss.example.jms.mdb.MDBExample</ejb-class>
+            <transaction-type>Container</transaction-type>
+            <message-driven-destination>
+               <destination-type>javax.jms.Queue</destination-type>
+            </message-driven-destination>
+        </message-driven>
+    </enterprise-beans>
+</ejb-jar>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/jboss.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/jboss.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/META-INF/jboss.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+   "-//JBoss//DTD JBOSS 3.0//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+
+   <enterprise-beans>
+      <message-driven>
+         <ejb-name>MDBExample</ejb-name>
+         <destination-jndi-name>queue/@QUEUE_NAME@</destination-jndi-name>
+      </message-driven>
+   </enterprise-beans>
+
+</jboss>

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 06:28:39Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/MDBExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/MDBExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/MDBExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,167 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.mdb;
+
+import javax.ejb.EJBException;
+import javax.ejb.MessageDrivenBean;
+import javax.ejb.MessageDrivenContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ 
+ * $Id: MDBExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class MDBExample implements MessageDrivenBean, MessageListener
+{
+   private MessageDrivenContext ctx;
+   
+   private ConnectionFactory cf = null;
+   
+   public void onMessage(Message m)
+   {
+      Session session = null;
+      Connection conn = null;
+      
+      try
+      {
+         TextMessage tm = (TextMessage)m;
+         
+         String text = tm.getText();
+         System.out.println("message " + text + " received");
+         String result = process(text);
+         System.out.println("message processed, result: " + result);
+         
+         conn = getConnection();
+         session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         
+         Destination replyTo = m.getJMSReplyTo();
+         MessageProducer producer = session.createProducer(replyTo);
+         TextMessage reply = session.createTextMessage(result);
+         
+         producer.send(reply);
+         producer.close();
+         
+      }
+      catch(Exception e)
+      {
+         ctx.setRollbackOnly();
+         e.printStackTrace();
+         System.out.println("The Message Driven Bean failed!");
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            try
+            {
+               closeConnection(conn);
+            }
+            catch(Exception e)
+            {
+               System.out.println("Could not close the connection!" +e);
+            }
+         }
+      }
+   }
+   
+   private String process(String text)
+   {
+      // flip the string
+      
+      String result = "";
+      
+      for(int i = 0; i < text.length(); i++)
+      {
+         result = text.charAt(i) + result;
+      }
+      return result;
+   }
+   
+   public Connection getConnection() throws Exception
+   {      
+      Connection connection = null;
+      
+      try
+      {
+         connection = cf.createConnection();
+         connection.start();        
+      }
+      catch(Exception e )
+      {
+         if(connection != null)
+         {
+            closeConnection(connection);
+         }
+         System.out.println("Failed to get connection...exception is " + e);
+         throw e;
+      }
+      
+      return connection;
+   }
+   
+   public void closeConnection(Connection con) throws Exception
+   {      
+      try
+      {
+         con.close();         
+      }
+      catch(JMSException e)
+      {
+         System.out.println("Could not close connection " + con + " exception was " + e);
+      }
+   }
+   
+   public void ejbCreate()
+   {
+      try
+      {
+         InitialContext ic = new InitialContext();
+         
+         cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+         
+         ic.close();
+      }
+      catch(Exception e)
+      {
+         e.printStackTrace();
+         throw new EJBException("Failure to get connection factory: " + e.getMessage());
+      }
+   }
+   
+   public void ejbRemove() throws EJBException
+   {
+      try
+      {
+         if(cf != null)
+         {
+            cf = null;
+         }
+      }
+      catch(Exception e)
+      {
+         throw new EJBException("ejbRemove", e);
+      }
+   }
+   
+   public void setMessageDrivenContext(MessageDrivenContext ctx)
+   {
+      this.ctx = ctx;
+   }
+   
+   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb/src/org/jboss/example/jms/mdb/Sender.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.mdb;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example deploys a simple Message Driven Bean that processes messages sent to a test queue.
+ * Once it receives a message and "processes" it, the MDB sends an acknowledgment message to a
+ * temporary destination created by the sender for this purpose. The example is considered
+ * successful if the sender receives the acknowledgment message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ *
+ * $Id: Sender.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class Sender extends ExampleSupport
+{
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+                  
+      InitialContext ic = new InitialContext();
+            
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+      Queue queue = (Queue)ic.lookup(destinationName);
+                 
+      log("Queue " + destinationName + " exists");            
+      
+      Connection connection = null;
+      
+      try
+      {
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer sender = session.createProducer(queue);      
+               
+         Queue temporaryQueue = session.createTemporaryQueue();
+         MessageConsumer consumer = session.createConsumer(temporaryQueue);            
+         
+         TextMessage message = session.createTextMessage("Hello!");
+         message.setJMSReplyTo(temporaryQueue);            
+         
+         sender.send(message);
+                     
+         log("The " + message.getText() + " message was successfully sent to the " + queue.getQueueName() + " queue");
+   
+         connection.start();
+         
+         message = (TextMessage)consumer.receive(5000);
+              
+         if (message == null)
+         {
+            throw new Exception("Have not received any reply. The example failed!");
+         }
+               
+         log("Received message: " + message.getText());
+         
+         assertEquals("!olleH", message.getText());
+                     
+         displayProviderInfo(connection.getMetaData());
+      }
+      finally
+      {
+         if (connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+           
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+   
+   public static void main(String[] args)
+   {
+      new Sender().run();
+   }
+   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,139 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - Message Driven Bean Failure</title>
+</head>
+<body>
+<br>
+<h1>Message Driven Bean Behavior on Failure Example</h1>
+$Revision: 1459 $
+<h2>Overview</h2>
+<br>
+This example deploys a simple Message Driven Bean that processes
+messages sent to a test queue. The Message Driven Bean is coded in such
+a way that upon the first arrival of a message, it throws a
+RuntimeException, simulating a runtime processing failure. <br>
+<br>
+The expected behavior of the MDB Container is to try to redeliver the
+message, which is what it hopefully does. Since the example framework
+took the precaution to insure that there is only one single type of MDB
+container listening on the example queue, the messages will be
+redelivered to an MDB of the same type. Upon the second arrival, the
+MDB
+instance will "let the message pass", will correctly "process" it and
+forward the result to temporary queue created by the sender for exactly
+this purpose. The
+example is considered&nbsp; successful if the sender receives the
+acknowledgment message. The successful example proves that message
+redelivery on failure works.<br>
+<br>
+This example relies on having access to a running JBoss default
+instance.
+&nbsp; However,
+the example will automatically deploy its own queue, unless a queue
+with the same name is already deployed.<br>
+<br>
+&nbsp;<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\jboss-5.0.0.GA</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\mdb-failure</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+<pre>
+$ ant
+Buildfile: build.xml
+
+identify:
+     [echo] ###########################################################################
+     [echo] #                    Running the MDB Failure example                      #
+     [echo] ###########################################################################
+     [echo] The queue:      testQueue
+     [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+    [mkdir] Created dir: C:\java\messaging\docs\examples\mdb-failure\output\classes\META-INF
+    [mkdir] Created dir: C:\java\messaging\docs\examples\mdb-failure\output\lib\META-INF
+    [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+    [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+    [javac] Compiling 2 source files to C:\java\messaging\docs\examples\mdb-failure\output\classes
+    [javac] Note: C:\java\messaging\docs\examples\mdb-failure\src\org\jboss\example\jms\mdbfailure\MDBFailureExample.java uses unchecked or unsafe operations.
+    [javac] Note: Recompile with -Xlint:unchecked for details.
+
+jar:
+     [copy] Copying 2 files to C:\java\messaging\docs\examples\mdb-failure\output\classes\META-INF
+      [jar] Building jar: C:\java\messaging\docs\examples\mdb-failure\output\lib\mdb-failure-example.jar
+
+deploy:
+     [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging\deploy
+
+sleep:
+     [echo] Sleeping for 5 seconds ...
+
+run:
+
+send:
+     [java] Queue /queue/testQueue exists
+     [java] The "Hello!" message was successfully sent to the testQueue queue
+     [java] Received message: !olleH
+     [java] The example connected to JBoss Messaging version 1.4.1.GA (1.4)
+     [java] 
+     [java] #####################
+     [java] ###    SUCCESS!   ###
+     [java] #####################
+
+sleep:
+     [echo] Sleeping for 10 seconds ...
+
+undeploy:
+   [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\mdb-failure-example.jar
+
+BUILD SUCCESSFUL
+Total time: 19 seconds
+</pre>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<br>
+<br style="font-family: courier new,courier,monospace;">
+<hr
+ style="width: 100%; height: 2px; font-family: courier new,courier,monospace;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 974 2006-05-23 03:35:38Z ovidiu $
+
+ -->
+
+<project name="MDBFailureExample" default="run">
+
+	<property environment="ENV" />
+
+	<property name="undeploy.quiet" value="false" />
+	<property name="undeploy.failonerror" value="true" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="default" />
+	<property name="example.queue.name" value="testQueue" />
+	
+	<property name="ej3-extension" value="jar"/>
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                    Running the MDB Failure example                      #" />
+		<echo message="###########################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/classes/META-INF" />
+		<mkdir dir="./output/lib/META-INF" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="jar" depends="compile">
+		<copy todir="./output/classes/META-INF" filtering="true">
+			<fileset dir="./etc/META-INF" includes="*" />
+			<filterset>
+				<filter token="QUEUE_NAME" value="${example.queue.name}" />
+			</filterset>
+		</copy>
+		<jar destfile="./output/lib/mdb-failure-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/MDBFailureExample.class" />
+	</target>
+
+	<target name="deploy" depends="jar">
+		<copy file="./output/lib/mdb-failure-example.jar" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="5" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="deploy">
+		<antcall target="send" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="10" />
+		</antcall>
+		<antcall target="undeploy">
+			<param name="undeploy.quiet" value="false" />
+			<param name="undeploy.failonerror" value="true" />
+		</antcall>
+	</target>
+
+	<target name="send">
+		<!-- MDBFailureExample expects to find the name of the queue to connect to as value of the
+           'example.queue.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+		<java classname="org.jboss.example.jms.mdbfailure.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+		</java>
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-failure-example.jar" quiet="${undeploy.quiet}" failonerror="${undeploy.failonerror}" />
+	</target>
+
+	<target name="clean" depends="undeploy">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/ejb-jar.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,26 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+    "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+    <enterprise-beans>
+        <message-driven>
+            <ejb-name>MDBFailureExample</ejb-name>
+            <ejb-class>org.jboss.example.jms.mdbfailure.MDBFailureExample</ejb-class>
+            <transaction-type>Container</transaction-type>
+            <message-driven-destination>
+               <destination-type>javax.jms.Queue</destination-type>
+            </message-driven-destination>
+        </message-driven>
+    </enterprise-beans>
+
+ <assembly-descriptor>
+        <container-transaction>
+            <method>
+                <ejb-name>MDBFailureExample</ejb-name>
+                <method-name>*</method-name>
+            </method>
+            <trans-attribute>Required</trans-attribute>
+        </container-transaction>
+    </assembly-descriptor>
+</ejb-jar>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/jboss.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/jboss.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/META-INF/jboss.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+   "-//JBoss//DTD JBOSS 3.0//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+
+   <enterprise-beans>
+      <message-driven>
+         <ejb-name>MDBFailureExample</ejb-name>
+         <destination-jndi-name>queue/@QUEUE_NAME@</destination-jndi-name>
+      </message-driven>
+   </enterprise-beans>
+
+</jboss>

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 06:28:39Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/MDBFailureExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/MDBFailureExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/MDBFailureExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,207 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.mdbfailure;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ejb.EJBException;
+import javax.ejb.MessageDrivenBean;
+import javax.ejb.MessageDrivenContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 849 $</tt>
+
+ * $Id: MDBFailureExample.java 849 2006-03-31 17:17:09Z ltexier $
+ */
+public class MDBFailureExample implements MessageDrivenBean, MessageListener
+{
+
+   private MessageDrivenContext ctx;
+
+   private ConnectionFactory cf = null;
+
+   private static Set messageIDs = new HashSet();
+
+   public void onMessage(Message m)
+   {
+      Session session = null;
+      Connection conn = null;
+
+      try
+      {
+
+         TextMessage tm = (TextMessage)m;
+
+         String text = tm.getText();
+
+         System.out.println("message " + text + " received");
+
+         System.out.println("message " + (tm.getJMSRedelivered() ? "" : "NOT ")+ "marked as \"redelivered\"");
+
+
+         // if it is the first time any of the MDB instances from the pool sees the message, the
+         // message will cause the MDB instance to "crash"
+
+         synchronized(messageIDs)
+         {
+            if (!messageIDs.contains(tm.getJMSMessageID()))
+            {
+               messageIDs.add(m.getJMSMessageID());
+
+               System.out.println("The message has \"broken\" our MDB ...");
+
+               // "crashing" the MDB. The exception won't be caught by our catch clause and it will
+               // bubble up
+
+               throw new RuntimeException("Unfortunate events happen ...");
+
+            }
+            else
+            {
+               System.out.println("The message is already \"known\", so let it be processed");
+            }
+         }
+
+         String result = process(text);
+         System.out.println("message processed, result: " + result);
+
+         conn = getConnection();
+         session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Destination replyTo = m.getJMSReplyTo();
+         MessageProducer producer = session.createProducer(replyTo);
+         TextMessage reply = session.createTextMessage(result);
+
+         producer.send(reply);
+         producer.close();
+
+      }
+      catch(JMSException e)
+      {
+         ctx.setRollbackOnly();
+         e.printStackTrace();
+         System.out.println("The Message Driven Bean failed!");
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            try
+            {
+                closeConnection(conn);
+            }
+            catch(Exception e)
+            {
+                System.out.println("Could not close the connection!" +e);
+            }
+         }
+      }
+   }
+
+   private String process(String text)
+   {
+      // flip the string
+
+      String result = "";
+
+      for(int i = 0; i < text.length(); i++)
+      {
+         result = text.charAt(i) + result;
+      }
+      return result;
+   }
+
+   public Connection getConnection() throws JMSException
+   {
+
+        Connection connection = null;
+
+        try
+        {
+            connection = cf.createConnection();
+            connection.start();
+
+        }
+        catch(JMSException e)
+        {
+           if(connection != null)
+           {
+               closeConnection(connection);
+           }
+           System.out.println("Failed to get connection... exception is " + e);
+           throw e;
+        }
+
+        return connection;
+    }
+
+    public void closeConnection(Connection con) throws JMSException
+    {
+
+       try
+       {
+           con.close();
+
+       }
+       catch(JMSException jmse)
+       {
+           System.out.println("Could not close connection " + con +" exception was " +jmse);
+           throw jmse;
+       }
+    }
+
+    public void ejbCreate()
+    {
+       try
+       {
+          InitialContext ic = new InitialContext();
+
+          cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+
+          ic.close();
+       }
+       catch(Exception e)
+       {
+          e.printStackTrace();
+          throw new EJBException("Failure to get connection factory: " + e.getMessage());
+       }
+    }
+
+    public void ejbRemove() throws EJBException
+    {
+       try
+       {
+          if(cf != null)
+          {
+              cf = null;
+          }
+       }
+       catch(Exception e)
+       {
+          throw new EJBException("ejbRemove", e);
+       }
+    }
+
+    public void setMessageDrivenContext(MessageDrivenContext ctx)
+    {
+       this.ctx = ctx;
+    }
+
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/Sender.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/Sender.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/Sender.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,142 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.mdbfailure;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example deploys a simple Message Driven Bean that processes messages sent to a test queue.
+ * The MDB container is configured to use CMT.
+ *
+ * We send a special tagged message (we do this by adding a custom property to the message) to the
+ * MDB. The MDB is programmed to "fail" when handling such a message, by throwing a
+ * RuntimeException, but not before "clearing" the failure-inducing tag.
+ *
+ * The expected behavior for the JMS provider is to redeliver the message, this time without the
+ * "failure tag". The MDB is supposed to process it and put it on response queue, from were it will
+ * be read by the client.
+ *
+ * The example is considered successful if the client receives the "processed" message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 884 $</tt>
+ *
+ * $Id: Sender.java 884 2006-04-12 01:04:10Z ovidiu $
+ */
+public class Sender extends ExampleSupport
+{
+   public void example() throws Exception
+   {
+
+      String destinationName = getDestinationJNDIName();
+
+      InitialContext ic = new InitialContext();
+
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+      Queue queue = (Queue)ic.lookup(destinationName);
+
+
+
+      log("Queue " + destinationName + " exists");
+
+
+
+      Connection connection = cf.createConnection();
+      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      MessageProducer sender = session.createProducer(queue);
+
+
+
+      Queue temporaryQueue = session.createTemporaryQueue();
+      MessageConsumer consumer = session.createConsumer(temporaryQueue);
+
+
+
+      TextMessage message = session.createTextMessage("Hello!");
+      message.setJMSReplyTo(temporaryQueue);
+
+
+
+      sender.send(message);
+
+
+
+      log("The \"" + message.getText() + "\" message was successfully sent to the " + queue.getQueueName() + " queue");
+
+
+
+      connection.start();
+
+
+
+      message = (TextMessage)consumer.receive(5000);
+
+
+      if (message == null)
+      {
+         throw new Exception("Have not received any reply. The example failed!");
+      }
+
+
+      log("Received message: " + message.getText());
+
+
+
+      assertEquals("!olleH", message.getText());
+
+
+
+      displayProviderInfo(connection.getMetaData());
+
+
+      connection.close();
+   }
+
+
+
+
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+
+
+
+
+   public static void main(String[] args)
+   {
+      new Sender().run();
+   }
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/queue/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - JMS Queue</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Queue Example</h1>
+$Revision: 2750 $
+<h2>Overview</h2>
+<br>
+This example creates a JMS Connection to a JBoss Messaging instance
+and uses it to create a session and a message producer, which sends a
+message to the queue "queue/testQueue".&nbsp; Then, the example uses
+the same connection to create a consumer that that reads
+a single message from the queue. The example is considered successful
+if the message consumer receives without any error the message that was
+sent by the producer. <br>
+<br>
+This example relies on having access to a running JBoss default
+instance.
+ However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed. <br>
+<br>
+
+<br>
+<span style="font-style: italic;"></span>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-5.0.0.GA</span><br>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\queue</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+<pre>
+Buildfile: build.xml
+
+identify:
+     [echo] ###########################################################################
+     [echo] #                       Running the QUEUE example                         #
+     [echo] ###########################################################################
+     [echo] The queue:      testQueue
+     [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+    [mkdir] Created dir: C:\java\messaging\docs\examples\queue\output\classes
+    [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+    [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+    [javac] Compiling 1 source file to C:\java\messaging\docs\examples\queue\output\classes
+
+run:
+     [java] Queue /queue/testQueue exists
+     [java] The message was successfully sent to the testQueue queue
+     [java] Received message: Hello!
+     [java] The example connected to JBoss Messaging version 1.4.1.GA (1.4)
+     [java] 
+     [java] #####################
+     [java] ###    SUCCESS!   ###
+     [java] #####################
+
+BUILD SUCCESSFUL
+Total time: 4 seconds
+</pre>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/queue/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="QueueExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="messaging" />
+	<property name="example.queue.name" value="testQueue" />
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                       Running the QUEUE example                         #" />
+		<echo message="###########################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/classes" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="run" depends="compile">
+		<!-- QueueExample expects to find the name of the queue to connect to as value of the
+           'example.queue.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+		<java classname="org.jboss.example.jms.queue.QueueExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+         -->
+		</java>
+	</target>
+
+	<target name="clean">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/queue/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/queue/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2318 2007-02-15 02:11:43Z ovidiu.feodorov at jboss.com $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+  <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/jboss/example/jms/queue/QueueExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/jboss/example/jms/queue/QueueExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue/src/org/jboss/example/jms/queue/QueueExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.queue;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example creates a JMS Connection to a JBoss Messaging instance and uses it to create a
+ * session and a message producer, which sends a message to the queue "queue/testQueue".  Then, the
+ * example uses the same connection to create a consumer that that reads a single message from the
+ * queue. The example is considered successful if the message consumer receives without any error
+ * the message that was sent by the producer.
+ * 
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:luc.texier at jboss.org">Luc Texier</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ *
+ * $Id: QueueExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class QueueExample extends ExampleSupport
+{
+   
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+      
+      InitialContext ic = null;
+      ConnectionFactory cf = null;
+      Connection connection =  null;
+
+      try
+      {         
+         ic = new InitialContext();
+         
+         cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+         Queue queue = (Queue)ic.lookup(destinationName);
+         log("Queue " + destinationName + " exists");
+         
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer sender = session.createProducer(queue);
+         
+         TextMessage message = session.createTextMessage("Hello!");
+         sender.send(message);
+         log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+         
+         MessageConsumer consumer =  session.createConsumer(queue);
+         
+         connection.start();
+         
+         message = (TextMessage)consumer.receive(2000);
+
+         log("Received message: " + message.getText());
+         assertEquals("Hello!", message.getText());
+         
+         displayProviderInfo(connection.getMetaData());
+                 
+      }
+      finally
+      {         
+         if(ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch(Exception e)
+            {
+               throw e;
+            }
+         }
+         
+         // ALWAYS close your connection in a finally block to avoid leaks.
+         // Closing connection also takes care of closing its related objects e.g. sessions.
+         closeConnection(connection);
+      }
+   }
+   
+   private void closeConnection(Connection con)
+   {      
+      try
+      {
+         if (con != null)
+         {
+            con.close();
+         }         
+      }
+      catch(JMSException jmse)
+      {
+         log("Could not close connection " + con +" exception was " + jmse);
+      }
+   }
+      
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+   
+   public static void main(String[] args)
+   {
+      new QueueExample().run();
+   }
+   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/queue-failover/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue-failover/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue-failover/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,223 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - Queue failover</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Queue Failover Example</h1>
+$Revision: 1017 $
+<h2>Overview</h2>
+<br>
+This example demonstrates the transparent failover of a JMS consumer. A
+connection is made on one node of the cluster and two messages are
+sent. A consumer is created and one of the messages is consumed. The
+node the connection is connected to then fails and the connection fails
+over onto the second node. The second message is then consumed using
+the same consumer.<span style="font-weight: bold;"></span>
+<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+cluster with at least two nodes. The JBoss Messaging cluster must be
+installed and started according to the userguide.
+<br>
+<span style="font-style: italic;"></span><br>
+<br>
+For JBoss5, you should copy all as messaging-node0, configure mysql as a database, make it clustered, and copy it as messaging-node1. Start each instance as:
+<br><br>
+./run -c messaging-node0 -Djboss.service.binding.set=ports-01
+<br><br>
+<br>
+and in another window
+<br><br>
+./run.sh -c messaging-node1 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=1
+<br><br>
+<h2>Running the example</h2>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+1. Make sure that a JBoss Messaging cluster with at least two nodes is
+up and running.<br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\queue-failover</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+      <div style="margin-left: 40px;"><br>
+      </div>
+$ ant<br>
+Buildfile: build.xml<br>
+      <br>
+identify:
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+###########################################################################
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Running the QUEUE FAILOVER example
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp; #
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+###########################################################################
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The
+queue:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testDistributedQueue
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The client jar:
+../../../output/lib/jboss-messaging-client.jar
+      <br>
+      <br>
+sanity-check:
+      <br>
+      <br>
+init:
+      <br>
+      <br>
+compile:
+      <br>
+      <br>
+jar:
+      <br>
+      <br>
+deploy:
+      <br>
+      <br>
+sleep:
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] Sleeping for 5 seconds ...
+      <br>
+      <br>
+run:
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Distributed queue
+/queue/testDistributedQueue exists
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The messages were successfully sent to
+the distributed queue
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: Hello1!
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] 11:12:22,359 ERROR @Timer-0
+[SocketClientInvoker] Got marshalling exception, exiting
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] java.io.IOException: Connection reset
+by peer: socket write error
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+java.net.SocketOutputStream.socketWrite0(Native Method)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+java.net.SocketOutputStream.write(SocketOutputStream.java:136)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+java.io.DataOutputStream.flush(DataOutputStream.java:106)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+org.jboss.serial.io.JBossObjectOutputStream.flush(JBossObjectOutputStream.java:248)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+org.jboss.jms.server.remoting.JMSWireFormat.serialize(JMSWireFormat.java:1035)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+org.jboss.jms.server.remoting.JMSWireFormat.write(JMSWireFormat.java:413)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedWrite(MicroSocketClientInvoker.java:518)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:340)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:125)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+org.jboss.remoting.ConnectionValidator.checkConnection(ConnectionValidator.java:184)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+org.jboss.remoting.ConnectionValidator.run(ConnectionValidator.java:114)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+java.util.TimerThread.mainLoop(Timer.java:512)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at
+java.util.TimerThread.run(Timer.java:462)
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] 11:12:24,406 INFO&nbsp; @Thread-3
+[HAAspect] HAAspect.ClusteredClientConnectionFactoryDelegate[1]
+completed client-side failover
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: Hello2!
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
+Messaging version 1.4.1.GA (1.4)
+      <br>
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;
+SUCCESS!&nbsp;&nbsp; ###
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################
+      <br>
+      <br>
+undeploy:
+      <br>
+&nbsp;&nbsp; [delete] Deleting:
+C:\dev\jboss-5.0.0.GA\server\messaging-node0\deploy\application-server-killer.jar
+      <br>
+      <br>
+BUILD SUCCESSFUL
+      <br>
+Total time: 41 seconds
+      <br>
+      <br>
+      <br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/queue-failover/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue-failover/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue-failover/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 974 2006-05-22 21:35:38 -0600 (Mon, 22 May 2006) ovidiu $
+
+ -->
+
+<project name="QueueFailoverExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration.node0" value="messaging-node0" />
+	<property name="jboss.configuration.node1" value="messaging-node1" />
+	<property name="example.queue.name" value="testDistributedQueue" />
+	
+	<property name="messaging-deploy" value="messaging"/>
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                Running the QUEUE FAILOVER example                       #" />
+		<echo message="###########################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/lib" />
+		<mkdir dir="./output/classes" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="jar" depends="compile">
+		<jar destfile="./output/lib/application-server-killer.jar">
+			<fileset dir="../common/etc" includes="META-INF/**" />
+			<fileset dir="../common/output/classes" includes="org/jboss/example/jms/common/bean/*.class" />
+		</jar>
+	</target>
+
+	<target name="deploy" depends="jar">
+		<copy file="./etc/distributed-queue-service.xml" todir="${jboss.home}/server/${jboss.configuration.node0}/deploy/${messaging-deploy}" />
+		<copy file="./etc/distributed-queue-service.xml" todir="${jboss.home}/server/${jboss.configuration.node1}/deploy/${messaging-deploy}" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="10" />
+		</antcall>
+		<copy file="./output/lib/application-server-killer.jar" todir="${jboss.home}/server/${jboss.configuration.node0}/deploy" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="5" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="deploy">
+		<java classname="org.jboss.example.jms.failover.QueueFailoverExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+		</java>
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration.node0}/deploy/application-server-killer.jar" quiet="true" />
+		<delete file="${jboss.home}/server/${jboss.configuration.node0}/deploy/${messaging-deploy}/distributed-queue-service.xml" quiet="true" />
+		<delete file="${jboss.home}/server/${jboss.configuration.node1}/deploy/${messaging-deploy}/distributed-queue-service.xml" quiet="true" />
+	</target>
+
+	<target name="clean" depends="undeploy">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/distributed-queue-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/distributed-queue-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/distributed-queue-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Messaging Destinations deployment descriptor.
+
+     $Id: destinations-service.xml 81065 2008-11-14 15:09:16Z dimitris at jboss.org $
+ -->
+
+<server>
+   
+   <!--
+        Example clustered destinations.
+   -->
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=testDistributedQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="Clustered">true</attribute>
+   </mbean>   
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,5 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+#Assuming ports-01 which binds jndi on 1199
+java.naming.provider.url=jnp://localhost:1199
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue-failover/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 00:28:39 -0600 (Thu, 22 Dec 2005) ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/jboss/example/jms/failover/QueueFailoverExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/jboss/example/jms/failover/QueueFailoverExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/queue-failover/src/org/jboss/example/jms/failover/QueueFailoverExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,162 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.failover;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example creates a connection to a clustered messaging instance and sends a message to a
+ * clustered queue. The example then kills the cluster node the connection was created to and then
+ * shows how the client code can receive the message with using the *same* connection (that, in
+ * the mean time, have transparently failed over to another cluster node).
+ *
+ * Since this example is also used as a smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1001 $</tt>
+ *
+ * $Id: TopicExample.java 1001 2006-06-24 09:05:40Z timfox $
+ */
+public class QueueFailoverExample extends ExampleSupport
+{
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+
+      InitialContext ic = null;
+
+      Connection connection = null;
+
+
+      ConnectionFactory cf = null;
+      
+      try
+      {
+         // Create a connection to the clustered messaging instance
+
+         ic = new InitialContext();
+
+         cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
+
+         Queue distributedQueue = (Queue)ic.lookup(destinationName);
+         log("Distributed queue " + destinationName + " exists");
+
+         // When connecting to a messaging cluster, the ConnectionFactory has the capability of
+         // transparently creating physical connections to different cluster nodes, in a round
+         // robin fashion ...
+
+         connection = cf.createConnection();
+
+         connection.start();
+
+         // Send 2 messages to the queue
+
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         MessageProducer producer = session.createProducer(distributedQueue);
+
+         TextMessage message1 = session.createTextMessage("Hello1!");
+
+         producer.send(message1);
+
+         TextMessage message2 = session.createTextMessage("Hello2!");
+
+         producer.send(message2);
+
+         log("The messages were successfully sent to the distributed queue");
+
+         // Now receive one of the messages
+
+         MessageConsumer consumer = session.createConsumer(distributedQueue);
+
+         TextMessage rm1 = (TextMessage)consumer.receive(2000);
+
+         log("Received message: " + rm1.getText());
+
+         assertEquals("Hello1!", rm1.getText());
+
+         // Kill the active node
+         killActiveNode();
+         
+         Thread.sleep(5000);
+
+         // receive the second message on the failed over node
+
+         TextMessage rm2 = (TextMessage)consumer.receive(2000);
+         log("Received message: " + rm2.getText());
+
+
+         assertEquals("Hello2!", rm2.getText());
+
+         displayProviderInfo(connection.getMetaData());
+      }
+      finally
+      {
+         if (ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch(Exception e)
+            {
+               throw e;
+            }
+         }
+
+         try
+         {
+            if (connection != null)
+            {
+               connection.close();
+            }
+         }
+         catch(JMSException e)
+         {
+            log("Could not close connection " + connection + ", exception was " + e);
+            throw e;
+         }
+
+      }
+   }
+
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+
+   public static void main(String[] args)
+   {
+      new QueueFailoverExample().run();
+   }
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/secure-socket/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/secure-socket/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,241 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - Secure Socket example</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Secure Socket Connection Example</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example shows how to use a secure ConnectionFactory, which creates
+a SSL socket connection between client and server. The example will use
+such a ConnectionFactory to create two JMS connections: the first one
+to send a message to the queue and the second one to read the message
+from the queue. In both cases, the message will be securely sent over
+an encrypted connection. The example is considered successful
+if the client receives without any error the message that was
+previously sent to the queue.<br>
+<br>
+This example needs to have access to a running JBoss default
+instance.
+ However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed. <br>
+<span style="font-style: italic;"></span></div>
+<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\jboss-5.0.0.GA</span><br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;"><br>
+&nbsp;&nbsp; <span style="font-family: monospace;">cd
+...\examples\secure-socket</span><br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<span style="font-family: monospace;"></span><br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;"><br>
+&nbsp;&nbsp; <span style="font-family: monospace;">ant</span><br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;"><br>
+$ ant<br>
+Buildfile: build.xml<br>
+      <br>
+identify:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+############################################################################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Running the SECURE SOCKET
+example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+#<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+############################################################################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The queue: testQueue<br>
+      <br>
+sanity-check:<br>
+      <br>
+init:<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\secure-socket\output<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+      <br>
+compile:<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 1 source file to
+C:\work\src\cvs\jboss-head\jms\docs\examples\secure-socket\output<br>
+      <br>
+deploy:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [copy] Copying 1 file to
+C:\jboss-4.2.0.GA\server\messaging\deploy\jboss-messaging.sar<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [copy] Copying 1 file to
+C:\jboss-4.2.0.GA\server\messaging\deploy<br>
+      <br>
+sleep:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] Sleeping for 10 seconds ...<br>
+      <br>
+run:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Queue /queue/testQueue exists<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The message was successfully sent to
+the testQueue queue<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: Hello!<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
+Messaging version 1.4.1.GA (1.4)<br>
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;
+SUCCESS!&nbsp;&nbsp; ###<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+      <br>
+BUILD SUCCESSFUL<br>
+Total time: 15 seconds<br>
+      <br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<h2>Configuration details</h2>
+<br>
+The example client looks up a specially-configured connection factory (<span
+ style="font-family: monospace;">"/SecureConnectionFactory"</span>)
+that is deployed by the example run script. The secure
+ConnectionFactory relies on a "secured" Remoting Connector to provide
+the SSL connection. The definition of the required services is
+specified in the <span style="font-family: monospace;">etc/messaging-secure-socket-service.xml
+</span>deployment descriptor. <br>
+
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+The SSLSocketBuilder needs a keystore with a public/private key pair.
+The example provides one (<span style="font-family: monospace;">etc/messaging.keystore</span>)
+which is deployed with the rest of the artifacts. In case you need to
+create your own keystore, this is how you do it:<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;"><br>
+      <pre> keytool -genkey -alias messaging.keypair -keyalg RSA -keystore messaging.keystore -validity 3650</pre>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<p>By default, the client will try to contact a Certificate Authority
+to
+insure the authenticity of the public key it uses to encrypt the
+communication. However, the example's certificate is self-signed, so no
+Certificate Authority will
+recognize it. In order to get the SSL client to trust it and the
+example to complete successfully, we use a client truststore (<span
+ style="font-family: monospace;">/etc/messaging.truststore</span>). In
+case you need to create your own truststore, this is how you do it:<br>
+</p>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;"><br>
+      <pre> keytool -export -alias messaging.keypair -keystore messaging.keystore -rfc -file messaging.cer<br> keytool -import -alias messaging.keypair -file messaging.cer -keystore messaging.truststore</pre>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<p> </p>
+<p>In order for the truststore to be recognized, the client's
+environment must contain the <tt>javax.net.ssl.trustStore</tt> and <tt>javax.net.ssl.trustStorePassword</tt>
+properties.<br>
+</p>
+<br>
+<h2>Troubleshooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/secure-socket/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/secure-socket/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5419 2008-11-24 05:21:45Z gaohoward $
+
+ -->
+
+<project name="SecureSocketExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="remoting.path" value="../config" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="default" />
+	<property name="example.queue.name" value="testQueue" />
+	
+	<property name="messaging-deploy" value="messaging"/>
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="############################################################################" />
+		<echo message="#                   Running the SECURE SOCKET example                      #" />
+		<echo message="############################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="init">
+		<mkdir dir="./output/classes" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="deploy">
+		<copy file="./etc/messaging.keystore" todir="${jboss.home}/server/${jboss.configuration}/deploy/${messaging-deploy}" />
+		<copy file="${remoting.path}/remoting-sslbisocket-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<copy file="./etc/messaging-secure-socket-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="5" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="compile, deploy">
+		<!-- QueueExample expects to find the name of the queue to connect to as value of the
+           'example.queue.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+		<java classname="org.jboss.example.jms.securesocket.SecureSocketExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="javax.net.ssl.trustStorePassword" value="secureexample" />
+			<sysproperty key="javax.net.ssl.trustStore" value="./etc/messaging.truststore" />
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+         -->
+		</java>
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/remoting-sslbisocket-service.xml" quiet="true" />
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/messaging-secure-socket-service.xml" quiet="true" />
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/${messaging-deploy}/messaging.keystore" quiet="true" />
+	</target>
+
+	<target name="clean" depends="undeploy">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 948 2006-05-17 01:24:49Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging-secure-socket-service.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging-secure-socket-service.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging-secure-socket-service.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Secure Socket Transport Example: the deployment descriptor for the secure socket factory
+     service, secure connector and secure connection factory.
+
+     $Id: messaging-secure-socket-service.xml 2773 2007-06-12 13:31:30Z sergeypk $
+ -->
+
+<server>
+
+   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+      name="jboss.messaging.destination:service=SecureConnectionFactory"
+      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=sslbisocket</depends>
+      <attribute name="JNDIBindings">
+         <bindings>
+            <binding>/SecureConnectionFactory</binding>
+         </bindings>
+      </attribute>
+   </mbean>
+
+</server>

Added: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging.keystore
===================================================================
(Binary files differ)


Property changes on: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging.keystore
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging.truststore
===================================================================
(Binary files differ)


Property changes on: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/etc/messaging.truststore
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/jboss/example/jms/securesocket/SecureSocketExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/jboss/example/jms/securesocket/SecureSocketExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/secure-socket/src/org/jboss/example/jms/securesocket/SecureSocketExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.securesocket;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example creates a connection to the default provider and uses the connection to send a
+ * message to the queue "queue/testQueue". Then, the example creates a second connection to the
+ * provider and uses it to receive the message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: SecureSocketExample.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class SecureSocketExample extends ExampleSupport
+{
+   
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+      
+      InitialContext ic = null;
+      ConnectionFactory cf = null;
+      Connection connection =  null;
+      Connection connection2 =  null;
+      
+      try
+      {         
+         ic = new InitialContext();
+         
+         cf = (ConnectionFactory)ic.lookup("/SecureConnectionFactory");
+         Queue queue = (Queue)ic.lookup(destinationName);
+         log("Queue " + destinationName + " exists");
+         
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer sender = session.createProducer(queue);
+         
+         TextMessage message = session.createTextMessage("Hello!");
+         sender.send(message);
+         log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+         
+         connection2 = cf.createConnection();
+         Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageConsumer consumer =  session2.createConsumer(queue);
+         
+         connection2.start();
+         
+         message = (TextMessage)consumer.receive(2000);
+         log("Received message: " + message.getText());
+         assertEquals("Hello!", message.getText());
+         
+         displayProviderInfo(connection2.getMetaData());                  
+      }
+      finally
+      {
+         if(ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch(Exception e)
+            {
+               throw e;
+            }
+         }
+         
+         //ALWAYS close your connection in a finally block to avoid leaks
+         //Closing connection also takes care of closing its related objects e.g. sessions
+         closeConnection(connection);
+         
+         closeConnection(connection2);
+         
+      }
+      
+   }
+   
+   private void closeConnection(Connection con)
+   {
+      try
+      {
+         if (con != null)
+         {
+            con.close();
+         }
+      }
+      catch(JMSException jmse)
+      {
+         log("Could not close connection " + con +" exception was " +jmse);
+      }
+   }
+   
+   
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+   
+   public static void main(String[] args)
+   {
+      new SecureSocketExample().run();
+   }
+   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,149 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - Stateless Session Bean</title>
+</head>
+<body>
+<br>
+<h1>Sending JMS messages from a Stateless Session Bean<br>
+</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example deploys a stateless session bean that then sends and
+receives messages from a queue. This is a very simple example that
+demonstrates using JBoss Messaging in a managed environment. The
+session bean sends a message to a test queue and then pulls the message
+from the queue using a different connection. The
+example is considered successful if the message is received correctly.<br>
+<br>
+This example relies on having access to a running JBoss default
+instance.
+&nbsp; However,
+the example will automatically deploy its own queue, unless a queue
+with the same name is already deployed. <br>
+<br>
+
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-5.0.0.GA.</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\stateless</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+      <div style="margin-left: 40px;"><br>
+      </div>
+$ ant<br>
+Buildfile: build.xml<br>
+      <br>
+identify:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Running the STATELESS SESSION BEAN
+example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+X<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The queue: testQueue<br>
+      <br>
+sanity-check:<br>
+      <br>
+init:<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\classes\META-INF<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\lib<br>
+      <br>
+compile:<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 4 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\classes<br>
+      <br>
+jar:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [copy] Copying 2 files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\classes\META-INF<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [jar] Building jar:
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\lib\stateless-example.jar<br>
+      <br>
+deploy:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [copy] Copying 1 file to
+C:\work\src\jboss-4.2.0.GA\build\output\jboss-4.0.3SP1\server\messaging\deploy<br>
+      <br>
+sleep:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] Sleeping for 5 seconds ...<br>
+      <br>
+run:<br>
+      <br>
+send-and-receive:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The Hello! message was successfully
+sent to the /queue/testQueue queue<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Queue browse result: Hello!<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Received Hello!<br>
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;
+SUCCESS!&nbsp;&nbsp; ###<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+      <br>
+undeploy:<br>
+&nbsp;&nbsp; [delete] Deleting:
+C:\work\src\jboss-4.2.0.GA\build\output\jboss-4.0.3SP1\server\messaging\deploy\stateless-example.jar<br>
+      <br>
+BUILD SUCCESSFUL<br>
+Total time: 9 seconds<br>
+      <br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5408 2008-11-21 04:43:36Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="StatelessExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="default" />
+	<property name="example.queue.name" value="testQueue" />
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#              Running the STATELESS SESSION BEAN example                 #" />
+		<echo message="###########################################################################" />
+		<echo message="The queue:      ${example.queue.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/classes/META-INF" />
+		<mkdir dir="./output/lib" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="jar" depends="compile">
+		<copy todir="./output/classes/META-INF">
+			<fileset dir="./etc/META-INF" includes="*" />
+		</copy>
+		<jar destfile="./output/lib/stateless-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/jms/stateless/bean/*.class" />
+	</target>
+
+	<target name="deploy" depends="jar">
+		<copy file="./output/lib/stateless-example.jar" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+		<antcall target="sleep">
+			<param name="sleep.interval" value="5" />
+		</antcall>
+	</target>
+
+	<target name="run" depends="deploy">
+		<antcall target="send-and-receive" />
+		<antcall target="undeploy" />
+	</target>
+
+	<target name="send-and-receive">
+		<!-- The client expects to find the name of the queue to connect to as value of the
+           'example.queue.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+		<java classname="org.jboss.example.jms.stateless.client.Client" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.queue.name" value="${example.queue.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+		</java>
+	</target>
+
+	<target name="undeploy">
+		<delete file="${jboss.home}/server/${jboss.configuration}/deploy/stateless-example.jar" quiet="true" />
+	</target>
+
+	<target name="clean" depends="undeploy">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+	<target name="sleep">
+		<echo message="Sleeping for ${sleep.interval} seconds ..." />
+		<sleep seconds="${sleep.interval}" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/ejb-jar.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+    "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+    <enterprise-beans>
+        <session>
+            <ejb-name>StatelessSessionExample</ejb-name>
+            <home>org.jboss.example.jms.stateless.bean.StatelessSessionExampleHome</home>
+            <remote>org.jboss.example.jms.stateless.bean.StatelessSessionExample</remote>
+            <ejb-class>org.jboss.example.jms.stateless.bean.StatelessSessionExampleBean</ejb-class>
+            <session-type>Stateless</session-type>
+            <transaction-type>Container</transaction-type>
+        </session>
+    </enterprise-beans>
+</ejb-jar>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/jboss.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/jboss.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/META-INF/jboss.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+   "-//JBoss//DTD JBOSS 3.0//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+   <enterprise-beans>
+      <session>
+         <ejb-name>StatelessSessionExample</ejb-name>
+         <jndi-name>ejb/StatelessSessionExample</jndi-name>
+      </session>
+   </enterprise-beans>
+</jboss>

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 563 2005-12-30 22:04:19Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,29 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.stateless.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: StatelessSessionExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+
+public interface StatelessSessionExample extends EJBObject
+{
+   public void drain(String queueName) throws RemoteException, Exception;
+   
+   public void send(String txt, String queueName) throws RemoteException, Exception;
+   
+   public int browse(String queueName) throws RemoteException, Exception;
+   
+   public String receive(String queueName) throws RemoteException, Exception;
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,253 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.stateless.bean;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ 
+ * $Id: StatelessSessionExampleBean.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class StatelessSessionExampleBean implements SessionBean
+{   
+
+   private ConnectionFactory cf = null;
+   
+   public void drain(String queueName) throws Exception
+   {
+      InitialContext ic = new InitialContext();
+      Queue queue = (Queue)ic.lookup(queueName);
+      ic.close();
+      
+      Session session = null;
+      Connection conn = null;
+      
+      try
+      {
+         conn = getConnection();
+         session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageConsumer consumer = session.createConsumer(queue);
+         Message m = null;
+         do
+         {
+            m = consumer.receive(1L);
+         }
+         while(m != null);
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            closeConnection(conn);
+         }
+      }
+   }
+   
+   public void send(String txt, String queueName) throws Exception
+   {
+      InitialContext ic = new InitialContext();
+      
+      Queue queue = (Queue)ic.lookup(queueName);
+      
+      ic.close();
+      
+      Session session = null;
+      Connection conn = null;
+      
+      try
+      {
+         conn = getConnection();
+         
+         session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         
+         MessageProducer producer = session.createProducer(queue);
+         
+         TextMessage tm = session.createTextMessage(txt);
+         
+         producer.send(tm);
+         
+         System.out.println("message " + txt + " sent to " + queueName);         
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            closeConnection(conn);
+         }
+      }
+   }
+   
+   public int browse(String queueName) throws Exception
+   {
+      InitialContext ic = new InitialContext();
+      Queue queue = (Queue)ic.lookup(queueName);
+      ic.close();
+      
+      Session session = null;
+      Connection conn = null;
+      
+      try
+      {
+         conn = getConnection();
+         session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         QueueBrowser browser = session.createBrowser(queue);
+         
+         ArrayList list = new ArrayList();
+         for(Enumeration e = browser.getEnumeration(); e.hasMoreElements(); )
+         {
+            list.add(e.nextElement());
+         }
+         
+         return list.size();
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            closeConnection(conn);
+         }
+      }
+   }
+   
+   public String receive(String queueName) throws Exception
+   {
+      InitialContext ic = new InitialContext();
+      Queue queue = (Queue)ic.lookup(queueName);
+      ic.close();
+      
+      Session session = null;
+      Connection conn = null;
+      
+      try
+      {
+         conn = getConnection();
+         session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         
+         MessageConsumer consumer = session.createConsumer(queue);
+         
+         System.out.println("blocking to receive message from queue " + queueName + " ...");
+         TextMessage tm = (TextMessage)consumer.receive(5000);
+         
+         if (tm == null)
+         {
+            throw new Exception("No message!");
+         }
+         
+         System.out.println("Message " + tm.getText() + " received");
+         
+         return tm.getText();         
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            closeConnection(conn);
+         }
+      }
+   }
+   
+   public Connection getConnection() throws Exception
+   {
+      
+      Connection connection = null;
+      
+      try
+      {
+         connection = cf.createConnection();
+         
+         connection.start();         
+      }
+      catch(Exception e )
+      {
+         if(connection != null)
+         {
+            closeConnection(connection);
+         }
+         System.out.println("Failed to get connection...exception is " + e);
+         throw e;
+      }
+      
+      return connection;
+   }
+   
+   public void closeConnection(Connection con) throws Exception
+   {      
+      try
+      {
+         con.close();         
+      }
+      catch(JMSException jmse)
+      {
+         System.out.println("Could not close connection " + con +" exception was " + jmse);
+         throw jmse;
+      }
+   }
+   
+   public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+   {      
+   }
+   
+   public void ejbCreate()
+   {
+      try
+      {
+         InitialContext ic = new InitialContext();
+         
+         cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+         
+         ic.close();
+      }
+      catch(Exception e)
+      {
+         e.printStackTrace();
+         throw new EJBException("Initalization failure: " + e.getMessage());
+      }
+   }
+   
+   public void ejbRemove() throws EJBException
+   {
+      try
+      {
+         if(cf != null)
+         {
+            cf = null;
+         }
+      }
+      catch(Exception e)
+      {
+         throw new EJBException("ejbRemove ", e);
+      }
+   }
+   
+   public void ejbActivate() throws EJBException, RemoteException
+   {
+   }
+   
+   public void ejbPassivate() throws EJBException, RemoteException
+   {
+   }
+      
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleHome.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleHome.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleHome.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,25 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.stateless.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: StatelessSessionExampleHome.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+
+public interface StatelessSessionExampleHome extends EJBHome
+{
+   public StatelessSessionExample create() throws RemoteException, CreateException;
+}
+
+

Added: branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.stateless.client;
+
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+import org.jboss.example.jms.stateless.bean.StatelessSessionExample;
+import org.jboss.example.jms.stateless.bean.StatelessSessionExampleHome;
+
+/**
+ * This example deploys a simple Stateless Session Bean that is used as a proxy to send and receive
+ * JMS messages in a managed environment.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: Client.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class Client extends ExampleSupport
+{
+   public void example() throws Exception
+   {            
+      InitialContext ic = new InitialContext();
+                  
+      StatelessSessionExampleHome home =
+         (StatelessSessionExampleHome)ic.lookup("ejb/StatelessSessionExample");            
+      
+      StatelessSessionExample bean = home.create();
+                  
+      String queueName = getDestinationJNDIName();
+      String text = "Hello!";                  
+      
+      bean.drain(queueName);
+                       
+      bean.send("Hello!", queueName);
+      log("The " + text + " message was successfully sent to the " + queueName + " queue");
+          
+      int num = bean.browse(queueName);
+                  
+      assertEquals(1, num);
+          
+      log("Queue browse result: " + num);            
+      
+      String result = bean.receive(queueName);
+      log("Received " + result);            
+      
+      assertEquals("Hello!", result);            
+      
+      bean.remove();
+   }
+   
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+   
+   public static void main(String[] args)
+   {
+      new Client().run();
+   }   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/topic/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/topic/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/topic/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,134 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - JMS Topic</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Topic Example</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example creates a JMS Connection to a JBoss Messaging instance
+and uses it to create a session, a publisher and a subscriber. The
+publisher sends a message to the topic. The example is considered
+successful
+if the topic subscriber receives the message.<br>
+<br>
+This example relies on having access to a running JBoss default
+instance.
+ However,
+the example will automatically deploy its own topic, unless a topic
+with the same name is already deployed. <br>
+<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-5.0.0.GA.</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\topic</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+      <div style="margin-left: 40px;"><br>
+      </div>
+$ ant<br>
+Buildfile: build.xml<br>
+      <br>
+identify:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Running the TOPIC
+example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+X<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The topic: testTopic<br>
+      <br>
+sanity-check:<br>
+      <br>
+init:<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\topic\output<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+      <br>
+compile:<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\topic\output<br>
+      <br>
+run:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Topic /topic/testTopic exists<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The message was successfully published
+on the topic<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Received message: Hello!<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] The example connected to JBoss
+Messaging version 1.4.1.GA (1.4)<br>
+      <br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;
+SUCCESS!&nbsp;&nbsp; ###<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+      <br>
+BUILD SUCCESSFUL<br>
+Total time: 4 seconds<br>
+      <br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/topic/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/topic/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/topic/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5408 2008-11-21 04:43:36Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="TopicExample" default="run">
+
+	<property environment="ENV" />
+
+	<!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+	<property file="../examples.properties" />
+	<property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+	<property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+	<property name="jboss.configuration" value="default" />
+	<property name="example.topic.name" value="testTopic" />
+
+	<path id="common.compilation.classpath">
+		<fileset file="${jboss.home}/client/jboss-javaee.jar" />
+		<fileset file="${messaging.client.jar.name}" />
+	</path>
+
+	<path id="example.compilation.classpath">
+		<path refid="common.compilation.classpath" />
+		<pathelement path="../common/output/classes" />
+	</path>
+
+	<path id="execution.classpath">
+		<pathelement path="./etc" />
+		<pathelement path="../common/output/classes" />
+		<pathelement path="./output/classes" />
+		<fileset dir="${jboss.home}/client" includes="*.jar" />
+	</path>
+
+	<target name="identify">
+		<echo message="###########################################################################" />
+		<echo message="#                       Running the TOPIC example                         #" />
+		<echo message="###########################################################################" />
+		<echo message="The topic:      ${example.topic.name}" />
+		<echo message="The client jar: ${messaging.client.jar.name}" />
+	</target>
+
+	<target name="sanity-check" depends="identify">
+		<available property="client.jar.present" file="${messaging.client.jar.name}" />
+		<fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+	</target>
+
+	<target name="init" depends="sanity-check">
+		<mkdir dir="./output/classes" />
+		<mkdir dir="../common/output/classes" />
+	</target>
+
+	<target name="compile" depends="init">
+		<javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="../common/src" />
+			<classpath refid="common.compilation.classpath" />
+		</javac>
+		<javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+			<src path="./src" />
+			<classpath refid="example.compilation.classpath" />
+		</javac>
+	</target>
+
+	<target name="run" depends="compile">
+		<!-- TopicExample expects to find the name of the topic to connect to as value of the
+           'example.topic.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+		<java classname="org.jboss.example.jms.topic.TopicExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+			<sysproperty key="example.topic.name" value="${example.topic.name}" />
+			<!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+		</java>
+	</target>
+
+	<target name="clean">
+		<delete dir="./output" quiet="true" />
+		<delete dir="../common/output" quiet="true" />
+	</target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/topic/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/topic/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/topic/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/topic/etc/log4j.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/topic/etc/log4j.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/topic/etc/log4j.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 06:28:39Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/ExampleListener.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/ExampleListener.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/ExampleListener.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,49 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.topic;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ 
+ * $Id: ExampleListener.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class ExampleListener implements MessageListener
+{   
+   private Message message;
+      
+   public synchronized void onMessage(Message message)
+   {
+      this.message = message;
+      notifyAll();
+   }
+   
+   public synchronized Message getMessage()
+   {
+      return message;
+   }
+      
+   protected synchronized void waitForMessage()
+   {
+      if (message != null)
+      {
+         return;
+      }
+      
+      try
+      {
+         wait(5000);
+      }
+      catch(InterruptedException e)
+      {
+         // OK
+      }
+   }
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/TopicExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/TopicExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/topic/src/org/jboss/example/jms/topic/TopicExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.topic;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example creates a connection to the default provider and uses the connection to send a
+ * message to the topic "queue/testTopic". The message must be received by a topic subscriber.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:luc.texier at jboss.org">Luc Texier</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ *
+ * $Id: TopicExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class TopicExample extends ExampleSupport
+{
+   public void example() throws Exception
+   {
+      String destinationName = getDestinationJNDIName();
+      
+      InitialContext ic = null;
+      Connection connection = null;
+      
+      try
+      {         
+         ic = new InitialContext();
+         
+         ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+         Topic topic = (Topic)ic.lookup(destinationName);
+         log("Topic " + destinationName + " exists");
+         
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer publisher = session.createProducer(topic);
+         MessageConsumer subscriber = session.createConsumer(topic);
+         
+         ExampleListener messageListener = new ExampleListener();
+         subscriber.setMessageListener(messageListener);
+         connection.start();
+         
+         TextMessage message = session.createTextMessage("Hello!");
+         publisher.send(message);
+         log("The message was successfully published on the topic");
+         
+         messageListener.waitForMessage();
+         
+         message = (TextMessage)messageListener.getMessage();
+         log("Received message: " + message.getText());
+         assertEquals("Hello!", message.getText());
+         
+         displayProviderInfo(connection.getMetaData());
+         
+      }
+      finally
+      {
+         if (ic != null)
+         {
+            try
+            {
+               ic.close();
+            }
+            catch(Exception e)
+            {
+               throw e;
+            }
+         }
+         
+         // ALWAYS close your connection in a finally block to avoid leaks.
+         // Closing connection also takes care of closing its related objects e.g. sessions.
+         closeConnection(connection);
+      }
+   }
+   
+   private void closeConnection(Connection con) throws JMSException
+   {
+      
+      try
+      {
+         if (con != null)
+         {
+            con.close();
+         }
+      }
+      catch(JMSException jmse)
+      {
+         log("Could not close connection " + con +" exception was " + jmse);
+      }
+   }
+   
+   protected boolean isQueueExample()
+   {
+      return false;
+   }
+   
+   public static void main(String[] args)
+   {
+      new TopicExample().run();
+   }
+   
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/web-service/README.html
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/web-service/README.html	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/web-service/README.html	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,171 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+  <title>JBoss Messaging Example - WebService Environment</title>
+</head>
+<body>
+<br>
+<h1>Sending JMS messages from a WebService<br>
+</h1>
+<h2>Overview</h2>
+<br>
+This example deploys a WebServices that sends messages to a queue.
+The same client will then read the message from the queue, validating
+if the WebService could complete the message send.
+<br>
+This example relies on having access to a running JBoss default
+instance.
+ However,
+the example will automatically deploy its own queue, unless a queue
+with the same name is already deployed. <br>
+<br>
+<br>
+This example will also generate client classes using wsdltools from
+JBoss Web Services.<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-5.0.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-5.0.0.GA</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\web-services</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">
+      <div style="margin-left: 40px;"><br>
+      </div>
+example at example:/workspace/jboss-messaging-1.3.0.GA/examples/web-services$
+ant<br>
+Buildfile: build.xml<br>
+      <br>
+identify:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+###########################################################################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Running the WebServices
+example&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+#<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo]
+###########################################################################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The
+queue:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; testQueue<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] The client jar:
+../..//jboss-messaging-client.jar<br>
+      <br>
+sanity-check:<br>
+      <br>
+init:<br>
+      <br>
+compile:<br>
+      <br>
+war:<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [jar] Building jar:
+/workspace/jboss-messaging-1.3.0.GA/examples/web-services/output/lib/jms-web-service.war<br>
+      <br>
+deploy:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [copy] Copying 1 file to
+/jboss-4.2.0.GA/server/messaging/deploy<br>
+      <br>
+sleep:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [echo] Sleeping for 5 seconds ...<br>
+      <br>
+run-wsdl-client:<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [get] Getting:
+http://127.0.0.1:8080/jms-web-service/JMSWebServiceExample?wsdl<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [get] To:
+/workspace/jboss-messaging-1.3.0.GA/examples/web-services/output/service.wsdl<br>
+&nbsp; [wstools] log4j:WARN No appenders could be found for logger
+(org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory).<br>
+&nbsp; [wstools] log4j:WARN Please initialize the log4j system properly.<br>
+      <br>
+compile-client:<br>
+&nbsp;&nbsp;&nbsp; [mkdir] Created dir:
+/workspace/jboss-messaging-1.2.0.SP2/examples/web-services/output/client-classes<br>
+&nbsp;&nbsp;&nbsp; [javac] Compiling 5 source files to
+/workspace/jboss-messaging-1.2.0.SP2/examples/web-services/output/client-classes<br>
+      <br>
+run:<br>
+      <br>
+send-and-receive:<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] log4j:WARN No appenders could be found
+for logger
+(org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder).<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] log4j:WARN Please initialize the log4j
+system properly.<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] Message was received ok!<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java]<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] ###&nbsp;&nbsp;&nbsp;
+SUCCESS!&nbsp;&nbsp; ###<br>
+&nbsp;&nbsp;&nbsp;&nbsp; [java] #####################<br>
+      <br>
+undeploy:<br>
+&nbsp;&nbsp; [delete] Deleting:
+/jboss-4.2.0.GA/server/messaging/deploy/jms-web-service.war<br>
+      <br>
+BUILD SUCCESSFUL<br>
+Total time: 12 seconds<br>
+      <br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain.&nbsp; Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<h3>2. <span style="font-family: monospace;">wstools doesn't work</span></h3>
+You could aways using "ant -debug" to verify what Exceptions wstools is
+generating. A common error is a NullPointerException due to a xerces
+update required by JBoss Web Services. You could have more information
+at this <a
+ href="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWSFAQXercesNPE">page</a>:<br>
+<br>
+<a href="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWSFAQXercesNPE">http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWSFAQXercesNPE</a><br>
+<br>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</span>
+</body>
+</html>

Added: branches/Branch_5_x/messaging/src/etc/examples/web-service/build.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/web-service/build.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/web-service/build.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+   To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+   $Id: build.xml 5302 2008-11-07 05:44:31Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="WebServicesExample" default="run">
+
+   <property environment="ENV"/>
+
+   <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+   <property file="../examples.properties"/>
+   <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+   <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+   <property name="jboss.configuration" value="default"/>
+   <property name="example.queue.name" value="testQueue"/>
+
+   <path id="common.compilation.classpath">
+      <fileset file="${jboss.home}/client/jboss-j2ee.jar"/>
+      <fileset dir="${jboss.home}/client" includes="*.jar" />
+      <fileset file="${messaging.client.jar.name}"/>
+   </path>
+
+   <property name="jboss.client" value="${jboss.home}/client"/>
+
+   <path id="runtime.classpath">
+      <path refid="common.compilation.classpath"/>
+      <pathelement path="./etc"/>
+      <pathelement path="../common/output/classes"/>
+      <pathelement path="./output/classes"/>
+      <pathelement location="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+
+      <!-- all this stuff for WebServices -->
+      <pathelement location="${jboss.home}/lib/endorsed/xercesImpl.jar"/>
+      <pathelement location="${jboss.client}/activation.jar"/>
+      <pathelement location="${jboss.client}/commons-logging.jar"/>
+      <pathelement location="${jboss.client}/javassist.jar"/>
+      <pathelement location="${jboss.client}/jbossall-client.jar"/>
+      <pathelement location="${jboss.client}/jbossws-client.jar"/>
+      <pathelement location="${jboss.client}/log4j.jar"/>
+      <pathelement location="${jboss.client}/mail.jar"/>
+      <pathelement location="${jboss.client}/jboss-xml-binding.jar"/>
+      <pathelement location="${jboss.client}/jboss-jaxws.jar"/>
+      <pathelement location="${jboss.client}/jboss-jaxrpc.jar"/>
+      <pathelement location="${jboss.client}/jboss-saaj.jar"/>
+      <pathelement location="${jboss.client}/wsdl4j.jar"/>
+      <pathelement location="${jboss.client}/jaxb-api.jar"/>
+   </path>
+
+   <path id="client.classpath">
+      <path refid="common.compilation.classpath"/>
+      <pathelement path="./etc"/>
+      <pathelement path="../common/output/classes"/>
+      <pathelement path="./output/client-classes"/>
+
+      <!-- all this stuff for WebServices -->
+      <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar"/>
+      <pathelement location="${jboss.client}/activation.jar"/>
+      <pathelement location="${jboss.client}/commons-logging.jar"/>
+      <pathelement location="${jboss.client}/javassist.jar"/>
+      <pathelement location="${jboss.client}/jbossall-client.jar"/>
+      <pathelement location="${jboss.client}/jbossws-client.jar"/>
+      <pathelement location="${jboss.client}/log4j.jar"/>
+      <pathelement location="${jboss.client}/mail.jar"/>
+      <pathelement location="${jboss.client}/jboss-xml-binding.jar"/>
+      <pathelement location="${jboss.client}/jboss-jaxws.jar"/>
+      <pathelement location="${jboss.client}/jboss-jaxrpc.jar"/>
+      <pathelement location="${jboss.client}/jboss-saaj.jar"/>
+      <pathelement location="${jboss.client}/wsdl4j.jar"/>
+      <pathelement location="${jboss.client}/jaxb-api.jar"/>
+      <pathelement location="${jboss.home}/lib/endorsed/xercesImpl.jar"/>
+
+
+      <pathelement location="${messaging.client.jar.name}"/>
+      <pathelement location="${jboss.home}/client/jbossall-client.jar"/>
+      <pathelement location="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar"/>
+      <pathelement location="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar"/>
+      <pathelement location="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
+      <pathelement location="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar"/>
+
+
+   </path>
+
+   <target name="identify">
+      <echo message="###########################################################################"/>
+      <echo message="#              Running the WebServices example                            #"/>
+      <echo message="###########################################################################"/>
+      <echo message="The queue:      ${example.queue.name}"/>
+      <echo message="The client jar: ${messaging.client.jar.name}"/>
+   </target>
+
+   <target name="sanity-check" depends="identify">
+      <available property="client.jar.present" file="${messaging.client.jar.name}"/>
+      <fail message="Could not find client jar ${messaging.client.jar.name}"
+            unless="client.jar.present"/>
+   </target>
+
+   <target name="init" depends="sanity-check">
+      <mkdir dir="./output/classes/META-INF"/>
+      <mkdir dir="./output/lib"/>
+      <mkdir dir="../common/output/classes"/>
+   </target>
+
+   <target name="compile" depends="init">
+      <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+         <src path="../common/src"/>
+         <classpath refid="common.compilation.classpath"/>
+      </javac>
+      <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+         <src path="./src"/>
+         <classpath refid="runtime.classpath"/>
+      </javac>
+   </target>
+
+   <target name="run-wsdl-client" depends="compile">
+      <taskdef name="wstools" classname="org.jboss.ws.tools.ant.wstools">
+        <classpath refid="runtime.classpath"/>
+      </taskdef>
+
+      <mkdir dir="./output/client"/>
+
+      <get src="http://127.0.0.1:8080/jms-web-service/JMSWebServiceExample?wsdl" dest="./output/service.wsdl" />
+
+      <wstools config="./etc/client-config/client-config.xml"
+               dest="./output/client"/>
+   </target>
+
+
+   <target name="war" depends="compile">
+      <jar destfile="./output/lib/jms-web-service.war">
+         <zipfileset dir="./output/classes" prefix="WEB-INF/classes"/>
+         <zipfileset dir="./etc/WEB-INF" prefix="WEB-INF"/>
+      </jar>
+   </target>
+
+   <target name="deploy" depends="war">
+      <copy file="./output/lib/jms-web-service.war"
+            todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
+      <antcall target="sleep"><param name="sleep.interval" value="10"/></antcall>
+   </target>
+
+   <target name="compile-client">
+      <mkdir dir="./output/client-classes"/>
+      <javac destdir="./output/client-classes" debug="on" debuglevel="lines,vars,source">
+         <src path="./output/client"/>
+         <src path="./src-client"/>
+         <classpath refid="runtime.classpath"/>
+      </javac>
+   </target>
+
+
+   <target name="run" depends="deploy, run-wsdl-client, compile-client">
+      <antcall target="send-and-receive"/>
+      <antcall target="undeploy"/>
+   </target>
+
+   <target name="send-and-receive">
+      <!-- The client expects to find the name of the queue to connect to as value of the
+           'example.queue.name' property, which *may* be defined by calling ants when this example
+            is used in a smoke test -->
+      <java classname="org.jboss.example.jms.webservices.client.Client"
+            classpathref="client.classpath" fork="yes" failonerror="true">
+         <sysproperty key="example.queue.name" value="${example.queue.name}"/>
+         <!--
+         <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+          -->
+      </java>
+   </target>
+
+   <target name="undeploy">
+      <delete file="${jboss.home}/server/${jboss.configuration}/deploy/jms-web-service.war"
+              quiet="true"/>
+   </target>
+
+   <target name="clean" depends="undeploy">
+      <delete dir="./output" quiet="true"/>
+      <delete dir="../common/output" quiet="true"/>
+   </target>
+
+   <target name="sleep">
+      <echo message="Sleeping for ${sleep.interval} seconds ..."/>
+      <sleep seconds="${sleep.interval}"/>
+   </target>
+
+</project>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/WEB-INF/web.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/WEB-INF/web.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/WEB-INF/web.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
+   <servlet>
+      <servlet-name>JMSWebServiceExample</servlet-name> 
+      <servlet-class>org.jboss.example.jms.webservices.endpoint.WebServiceExampleImpl</servlet-class>
+   </servlet>
+   <servlet-mapping>
+      <servlet-name>JMSWebServiceExample</servlet-name>
+      <url-pattern>/JMSWebServiceExample</url-pattern>
+   </servlet-mapping>
+</web-app>
\ No newline at end of file

Added: branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/client-config/client-config.xml
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/client-config/client-config.xml	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/client-config/client-config.xml	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,8 @@
+<!-- This is a WebServices config file used by wsstools as showed on JBoss WebServices documentation -->
+
+<configuration>
+      <wsdl-java location="./output/service.wsdl">
+        <mapping location="jaxrpc-mapping.xml" />
+      </wsdl-java>
+</configuration>
+

Added: branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/jndi.properties
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/jndi.properties	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/web-service/etc/jndi.properties	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExample.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExample.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExample.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,56 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005, JBoss Inc., and individual contributors as indicated
+   * 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.example.jms.webservices.endpoint;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 2699 $</tt>
+ *          $Id: WebServiceExample.java 2699 2007-05-17 05:59:03Z clebert.suconic at jboss.com $
+ */
+public interface WebServiceExample extends Remote
+{
+
+   // Constants ------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public String sendMessage(String queueName, String message) throws RemoteException;
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExampleImpl.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExampleImpl.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExampleImpl.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,106 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005, JBoss Inc., and individual contributors as indicated
+   * 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.example.jms.webservices.endpoint;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.naming.InitialContext;
+import javax.jms.Destination;
+import javax.jms.ConnectionFactory;
+import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.MessageProducer;
+import java.rmi.RemoteException;
+
+
+/**
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 3971 $</tt>
+ *          $Id: WebServiceExampleImpl.java 3971 2008-03-28 10:31:21Z jmesnil $
+ */
+ at WebService(serviceName="JMSSampleService", name="JMSSample")
+public class WebServiceExampleImpl implements WebServiceExample
+{
+
+   // Constants ------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   // Public ---------------------------------------------------------------------------------------
+
+   @WebMethod(operationName = "sendMessage")
+   public String sendMessage(String queueName, String message) throws RemoteException
+   {
+
+      Connection conn = null;
+      try
+      {
+         System.out.println("sending queue = " + queueName + " message = " + message);
+
+         InitialContext ctx = new InitialContext();
+         Destination dest = (Destination)ctx.lookup(queueName);
+
+         ConnectionFactory factory = (ConnectionFactory)ctx.lookup("/ConnectionFactory");
+         conn = factory.createConnection();
+
+         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         MessageProducer producer = sess.createProducer(dest);
+         producer.send(sess.createTextMessage(message));
+
+
+         return "ok!";
+      }
+      catch (Exception e)
+      {
+         throw new RemoteException(e.getMessage());
+      }
+      finally
+      {
+         try
+         {
+            if (conn != null)
+            {
+               conn.close();
+            }
+         }
+         catch (Exception ignored)
+         {
+            ignored.printStackTrace();
+         }
+      }
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}

Added: branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/example/jms/webservices/client/Client.java
===================================================================
--- branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/example/jms/webservices/client/Client.java	                        (rev 0)
+++ branches/Branch_5_x/messaging/src/etc/examples/web-service/src-client/org/jboss/example/jms/webservices/client/Client.java	2009-01-09 02:20:53 UTC (rev 82718)
@@ -0,0 +1,119 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005, JBoss Inc., and individual contributors as indicated
+   * 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.example.jms.webservices.client;
+
+import org.jboss.example.jms.common.ExampleSupport;
+import org.jboss.example.jms.webservices.endpoint.JMSSample;
+import org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl;
+import org.jboss.ws.core.jaxrpc.client.ServiceImpl;
+import javax.xml.rpc.ServiceFactory;
+import javax.xml.rpc.ServiceException;
+import javax.xml.namespace.QName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.Destination;
+import javax.jms.ConnectionFactory;
+import javax.jms.Session;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.File;
+import java.rmi.RemoteException;
+
+import javax.jms.*;
+import javax.jms.IllegalStateException;
+
+/**
+ * This Client will use auto generated classes from WebServices. You need to compile this class using ant.
+ * 
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 3971 $</tt>
+ *          $Id: Client.java 3971 2008-03-28 10:31:21Z jmesnil $
+ */
+public class Client extends ExampleSupport
+{
+   private static final String MESSAGE_TEXT = "Hello from a WebService!";
+
+   public void example() throws Exception
+   {
+      sendMessage();
+
+      receiveMessage();
+
+      System.out.println("Message was received ok!");
+   }
+
+   private void sendMessage()
+      throws ServiceException, MalformedURLException, RemoteException
+   {
+      ServiceFactoryImpl factory = (ServiceFactoryImpl) ServiceFactory.newInstance();
+
+      URL wsdlLocation = new URL("http://127.0.0.1:8080/jms-web-service/JMSWebServiceExample?wsdl");
+      QName serviceName = new QName("http://endpoint.webservices.jms.example.jboss.org/", "JMSSampleService");
+
+      File fileMapping = new File("./output/client/jaxrpc-mapping.xml");
+
+      ServiceImpl service = (ServiceImpl)factory.createService(wsdlLocation, serviceName, fileMapping.toURL());
+
+      JMSSample proxy = (JMSSample)service.getPort(JMSSample.class);
+
+      proxy.sendMessage(getDestinationJNDIName(), MESSAGE_TEXT);
+   }
+
+   private void receiveMessage()
+      throws NamingException, JMSException
+   {
+      InitialContext ctx = new InitialContext();
+      Destination dest = (Destination)ctx.lookup(getDestinationJNDIName());
+
+      ConnectionFactory cf = (ConnectionFactory)ctx.lookup("/ConnectionFactory");
+      Connection conn = cf.createConnection();
+      conn.start();
+
+      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      MessageConsumer consumer = sess.createConsumer(dest);
+      TextMessage msg = (TextMessage)consumer.receive(10000);
+
+      conn.close();
+
+      if (msg == null)
+      {
+         throw new IllegalStateException("Couldn't receive message");
+      }
+
+      if (!msg.getText().equals(MESSAGE_TEXT))
+      {
+         throw new IllegalStateException("Couldn't receive message");
+      }
+   }
+
+   protected boolean isQueueExample()
+   {
+      return true;
+   }
+
+   public static void main(String[] args) throws Exception
+   {
+      new Client().run();
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list