[jboss-cvs] JBoss Messaging SVN: r6215 - in trunk: examples/jms and 21 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 30 10:55:40 EDT 2009


Author: ataylor
Date: 2009-03-30 10:55:40 -0400 (Mon, 30 Mar 2009)
New Revision: 6215

Added:
   trunk/examples/jms/common/
   trunk/examples/jms/common/build.xml
   trunk/examples/jms/common/config/
   trunk/examples/jms/common/config/client-jndi.properties
   trunk/examples/jms/common/config/example-configuration.xml
   trunk/examples/jms/common/config/jbm-example-beans.xml
   trunk/examples/jms/common/config/jbm-jms.xml
   trunk/examples/jms/common/config/jbm-queues.xml
   trunk/examples/jms/common/config/jbm-security.xml
   trunk/examples/jms/common/config/log4j.xml
   trunk/examples/jms/common/src/
   trunk/examples/jms/common/src/org/
   trunk/examples/jms/common/src/org/jboss/
   trunk/examples/jms/common/src/org/jboss/jms/
   trunk/examples/jms/common/src/org/jboss/jms/example/
   trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java
   trunk/examples/jms/queue/
   trunk/examples/jms/queue/READ_ME.txt
   trunk/examples/jms/queue/build.xml
   trunk/examples/jms/queue/src/
   trunk/examples/jms/queue/src/org/
   trunk/examples/jms/queue/src/org/jboss/
   trunk/examples/jms/queue/src/org/jboss/jms/
   trunk/examples/jms/queue/src/org/jboss/jms/example/
   trunk/examples/jms/topic/
   trunk/examples/jms/topic/build.xml
   trunk/examples/jms/topic/src/
   trunk/examples/jms/topic/src/org/
   trunk/examples/jms/topic/src/org/jboss/
   trunk/examples/jms/topic/src/org/jboss/jms/
   trunk/examples/jms/topic/src/org/jboss/jms/example/
   trunk/examples/jms/topic/src/org/jboss/jms/example/TopicExample.java
Removed:
   trunk/examples/jms/src/org/jboss/jms/example/QueueExample.java
   trunk/examples/jms/src/org/jboss/jms/example/TopicExample.java
Modified:
   trunk/build-messaging.xml
   trunk/messaging.iml
   trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
   trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
Log:
new example structure

Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2009-03-30 13:46:12 UTC (rev 6214)
+++ trunk/build-messaging.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -638,6 +638,10 @@
 
       <jar jarfile="${build.jars.dir}/${core.jar.name}">
          <fileset dir="${build.core.classes.dir}" includes="**"/>
+         <fileset dir="${src.schemas.dir}">
+            <include name="**/*.xsd"/>
+            <exclude name="jbm-jms.xsd"/>
+         </fileset>
          <manifest>
             <attribute name="JBossMessaging-Version" value="${messaging.version.string}"/>
             <attribute name="JBossMessaging-SVN-URL" value="${messaging.version.svnurl}"/>
@@ -650,6 +654,9 @@
 
       <jar jarfile="${build.jars.dir}/${jms.jar.name}">
          <fileset dir="${build.jms.classes.dir}" includes="**"/>
+         <fileset dir="${src.schemas.dir}">
+            <include name="jbm-jms.xsd"/>
+         </fileset>
       </jar>
 
    </target>

Added: trunk/examples/jms/common/build.xml
===================================================================
--- trunk/examples/jms/common/build.xml	                        (rev 0)
+++ trunk/examples/jms/common/build.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+      <!ENTITY libraries SYSTEM "../../../thirdparty/libraries.ent">
+      ]>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- 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.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<project default="compile" name="jmsexample" basedir=".">
+   <dirname property="imported.basedir" file="${ant.file.jmsexample}"/>
+
+   <!--
+       This module is based on Java 1.5
+   -->
+
+   <property name="javac.target" value="1.5"/>
+   <property name="javac.source" value="1.5"/>
+
+   <property name="javac.debug" value="true"/>
+   <property name="javac.optimize" value="false"/>
+   <property name="javac.depend" value="false"/>
+   <property name="javac.verbose" value="false"/>
+   <property name="javac.deprecation" value="true"/>
+   <property name="javac.include.ant.runtime" value="false"/>
+   <property name="javac.include.java.runtime" value="true"/>
+   <property name="javac.fail.onerror" value="true"/>
+
+   <property name="src.dir" value="${imported.basedir}/src"/>
+   <property name="src.example.dir" location="src"/>
+   <property name="example.classname" value="this.shouldn't.be.run.directly"/>
+   <property name="jbm.example.runServer" value="true"/>
+
+   <property name="build.dir" value="build"/>
+   <property name="classes.dir" value="${build.dir}/classes"/>
+   <property name="config.dir" value="${imported.basedir}/config"/>
+
+   <property name="jbm.jars.dir" value="${imported.basedir}/../../../build/jars"/>
+
+   <property name="project.thirdparty" value="${imported.basedir}/../../../thirdparty"/>
+
+   <property name="logging.properties" value="${imported.basedir}/../../../src/config/logging.properties"/>
+
+   &libraries;
+   <path id="jms.compilation.classpath">
+      <fileset dir="${jbm.jars.dir}">
+         <include name="**/*.jar"/>
+      </fileset>
+      <path refid="jboss.microcontainer.classpath"/>
+      <path refid="jboss.common.classpath"/>
+      <path refid="jboss.jboss.javaee.classpath"/>
+   </path>
+
+   <path id="jms.runtime.classpath">
+      <path refid="jms.compilation.classpath"/>
+      <path refid="apache.log4j.classpath"/>
+      <pathelement location="${config.dir}"/>
+      <path refid="oswego.concurrent.classpath"/>
+      <path refid="apache.log4j.classpath"/>
+      <path refid="cglib.classpath"/>
+      <path refid="jboss.common.core.classpath"/>
+      <path refid="jboss.aop.classpath"/>
+      <path refid="trove.trove.classpath"/>
+      <path refid="javassist.classpath"/>
+      <path refid="jboss.jbossxb.classpath"/>
+      <path refid="apache.xerces.classpath"/>
+      <path refid="apache.logging.classpath"/>
+      <path refid="jboss.jnpserver.classpath"/>
+      <path refid="netty.netty.classpath"/>
+      <pathelement location="${classes.dir}"/>
+   </path>
+   <target name="init">
+      <mkdir dir="${build.dir}"/>
+      <mkdir dir="${classes.dir}"/>
+   </target>
+
+   <target name="compile" depends="init">
+      <echo message="src.example.dir=${src.example.dir}"/>
+      <javac destdir="${classes.dir}"
+             target="${javac.target}"
+             source="${javac.source}"
+             optimize="${javac.optimize}"
+             debug="${javac.debug}"
+             depend="${javac.depend}"
+             verbose="${javac.verbose}"
+             deprecation="${javac.deprecation}"
+             includeAntRuntime="${javac.include.ant.runtime}"
+             includeJavaRuntime="${javac.include.java.runtime}"
+             failonerror="${javac.fail.onerror}">
+         <src>
+            <pathelement path="${src.dir}"/>
+            <pathelement path="${src.example.dir}"/>
+         </src>
+         <classpath refid="jms.compilation.classpath"/>
+      </javac>
+   </target>
+
+   <target name="runExample" depends="compile">
+      <java classname="${example.classname}" fork="true">
+         <jvmarg value="-XX:+UseParallelGC"/>
+         <jvmarg value="-Xms512M"/>
+         <jvmarg value="-Xmx2048M"/>
+         <jvmarg value="-XX:+AggressiveOpts"/>
+         <jvmarg value="-XX:+UseFastAccessorMethods"/>
+         <jvmarg value="-Dcom.sun.management.jmxremote"/>
+         <jvmarg value="-Djava.util.logging.config.file=${logging.properties}"/>
+         <jvmarg
+               value="-Dorg.jboss.logging.Logger.pluginClass=org.jboss.messaging.integration.logging.JBMLoggerPlugin"/>
+         <!-- <jvmarg value="-Djava.library.path=${native.bin.dir}"/>-->
+         <jvmarg value="-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"/>
+         <jvmarg value="-Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"/>
+         <jvmarg value="-Djbm.example.runServer=${jbm.example.runServer}"/>
+         <!--<jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/>-->
+         <arg line="jbm-example-beans.xml"/>
+         <classpath refid="jms.runtime.classpath"/>
+      </java>
+   </target>
+</project>
\ No newline at end of file

Added: trunk/examples/jms/common/config/client-jndi.properties
===================================================================
--- trunk/examples/jms/common/config/client-jndi.properties	                        (rev 0)
+++ trunk/examples/jms/common/config/client-jndi.properties	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,3 @@
+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: trunk/examples/jms/common/config/example-configuration.xml
===================================================================
--- trunk/examples/jms/common/config/example-configuration.xml	                        (rev 0)
+++ trunk/examples/jms/common/config/example-configuration.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,194 @@
+<deployment xmlns="urn:jboss:messaging"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-configuration.xsd">
+   <configuration>
+
+      <clustered>false</clustered>
+
+      <!-- Maximum number of threads to use for scheduled deliveries -->
+      <scheduled-max-pool-size>30</scheduled-max-pool-size>
+
+      <security-enabled>true</security-enabled>
+
+      <security-invalidation-interval>10000</security-invalidation-interval>
+
+      <wild-card-routing-enabled>true</wild-card-routing-enabled>
+
+      <management-address>jbm.admin.management</management-address>
+      <management-notification-address>jbm.admin.notification</management-notification-address>
+
+      <!-- true to expose JBoss Messaging resources through JMX -->
+      <jmx-management-enabled>true</jmx-management-enabled>
+
+      <!-- by default, message counter is disabled -->
+      <message-counter-enabled>false</message-counter-enabled>
+
+      <connection-scan-period>10000</connection-scan-period>
+
+      <!--how long before timing a transaction out-->
+      <transaction-timeout>60000</transaction-timeout>
+      <!--how often to scan for timedout transactions-->
+      <transaction-timeout-scan-period>1000</transaction-timeout-scan-period>
+
+      <!-- how often do we scan the queues for expired messages-->
+      <message-expiry-scan-period>30000</message-expiry-scan-period>
+      <!-- the priority of the thread that expires th emessages (between 1 - 10 inclusive)-->
+      <message-expiry-thread-priority>3</message-expiry-thread-priority>
+
+      <!-- Example interceptors
+      <remoting-interceptors>
+         <class-name>org.jboss.messaging.tests.unit.core.config.impl.TestInterceptor1</class-name>
+         <class-name>org.jboss.messaging.tests.unit.core.config.impl.TestInterceptor2</class-name>
+      </remoting-interceptors>
+      -->
+
+      <queue-activation-timeout>30000</queue-activation-timeout>
+
+      <backup>false</backup>
+
+      <persist-delivery-count-before-delivery>false</persist-delivery-count-before-delivery>
+
+      <allow-route-when-no-bindings>false</allow-route-when-no-bindings>
+
+      <!--
+      <backup-connector-ref connector-name="netty-backup"/>
+      -->
+
+      <!-- Connectors -->
+
+      <connector name="netty-backup">
+      	<factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="6400" type="Integer"/>
+      </connector>
+
+      <connector name="netty">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+      </connector>
+
+      <connector name="netty-ssl">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="5500" type="Integer"/>
+         <param key="jbm.remoting.netty.sslenabled" value="true" type="Boolean"/>
+      </connector>
+
+      <connector name="netty-http">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="6100" type="Integer"/>
+         <param key="jbm.remoting.netty.httpenabled" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.httpclientidletime" value="500" type="Long"/>
+         <param key="jbm.remoting.netty.httpclientidlescanperiod" value="500" type="Long"/>
+      </connector>
+
+      <connector name="netty-servlet">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyConnectorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="8080" type="Integer"/>
+         <param key="jbm.remoting.netty.useservlet" value="true" type="Boolean"/>
+      </connector>
+
+      <connector name="in-vm">
+         <factory-class>org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+      </connector>
+
+      <!-- Acceptors -->
+
+      <!-- In VM acceptor -->
+      <acceptor name="in-vm">
+         <factory-class>org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+         <param key="jbm.remoting.invm.serverid" value="0" type="Integer"/>
+      </acceptor>
+      <!-- Netty standard TCP acceptor -->
+      <acceptor name="netty">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+      </acceptor>
+      <!-- Netty SSL Acceptor
+      <acceptor name="netty-ssl">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="5500" type="Integer"/>
+         <param key="jbm.remoting.netty.sslenabled" value="true" type="Boolean"/>
+      </acceptor>
+      -->
+        <!--Netty HTTP Acceptor-->
+      <!--<acceptor name-"netty-http">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+         <param key="jbm.remoting.netty.host" value="localhost" type="String"/>
+         <param key="jbm.remoting.netty.port" value="6100" type="Integer"/>
+         <param key="jbm.remoting.netty.httpenabled" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.httpresponsetime" value="10000" type="Long"/>
+         <param key="jbm.remoting.netty.httpserverscanperiod" value="5000" type="Long"/>
+      </acceptor>-->
+     <!-- netty invm acceptor, needed for the servlet transport-->
+     <!-- <acceptor name="netty-invm">
+         <factory-class>org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory</factory-class>
+         <param key="jbm.remoting.netty.useinvm" value="true" type="Boolean"/>
+         <param key="jbm.remoting.netty.host" value="org.jboss.jbm" type="String"/>
+      </acceptor>-->
+
+      <!-- Clustering configuration -->
+
+      <broadcast-group name="bg-group1">
+        <local-bind-port>1234</local-bind-port>
+        <group-address>231.7.7.7</group-address>
+        <group-port>9876</group-port>
+        <broadcast-period>5000</broadcast-period>
+        <connector-ref connector-name="netty" backup-connector-name="netty-backup"/>
+      </broadcast-group>
+
+      <discovery-group name="dg-group1">
+        <group-address>231.7.7.7</group-address>
+        <group-port>9876</group-port>
+        <refresh-timeout>10000</refresh-timeout>
+      </discovery-group>
+
+      <!--  Paging configuration -->
+
+      <paging-max-threads>10</paging-max-threads>
+
+      <paging-directory>build/data/paging</paging-directory>
+
+      <paging-global-watermark-size>10485760</paging-global-watermark-size>
+
+      <paging-max-global-size-bytes>104857600</paging-max-global-size-bytes>
+
+      <!-- Storage configuration -->
+
+      <bindings-directory>build/data/bindings</bindings-directory>
+
+      <create-bindings-dir>true</create-bindings-dir>
+
+      <journal-directory>build/data/journal</journal-directory>
+
+      <create-journal-dir>true</create-journal-dir>
+
+      <journal-type>NIO</journal-type>
+
+      <!-- The journal will reuse any buffers where the size < journal-buffer-reuse-size on write operations
+           Set this to -1 to disable this feature -->
+      <journal-buffer-reuse-size>1536</journal-buffer-reuse-size>
+
+      <!-- Does the journal sync to disk on each transaction commit, prepare or rollback? -->
+      <journal-sync-transactional>true</journal-sync-transactional>
+
+      <!-- Does the journal sync to disk for every non transactional persistent operation? -->
+      <journal-sync-non-transactional>false</journal-sync-non-transactional>
+
+      <!-- 10 MB journal file size -->
+      <journal-file-size>10485760</journal-file-size>
+
+      <journal-min-files>15</journal-min-files>
+
+      <!-- Maximum simultaneous asynchronous writes accepted by the native layer.
+      (parameter ignored on NIO)
+       You can verify the max AIO on the OS level at /proc/sys/fs/aio_max_nr. (aio-nr will give you the current max-aio being used)
+      -->
+      <journal-max-aio>10000</journal-max-aio>
+
+      <large-messages-directory>build/data/largeMessages</large-messages-directory>
+      
+   </configuration>
+
+</deployment>

Copied: trunk/examples/jms/common/config/jbm-example-beans.xml (from rev 6208, trunk/src/config/jbm-standalone-beans.xml)
===================================================================
--- trunk/examples/jms/common/config/jbm-example-beans.xml	                        (rev 0)
+++ trunk/examples/jms/common/config/jbm-example-beans.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="Naming" class="org.jnp.server.NamingBeanImpl"/>
+
+   <!-- JNDI server. Disable this if you don't want JNDI -->
+   <bean name="JNDIServer" class="org.jnp.server.Main">
+      <property name="namingInfo">
+         <inject bean="Naming"/>
+      </property>
+      <property name="port">1099</property>
+      <property name="bindAddress">localhost</property>
+      <property name="rmiPort">1098</property>
+      <property name="rmiBindAddress">localhost</property>
+   </bean>
+
+   <bean name="DeploymentManager" class="org.jboss.messaging.core.deployers.impl.FileDeploymentManager">
+      <constructor>
+         <!-- The scan time in milliseconds -->
+         <parameter>5000</parameter>
+      </constructor>
+   </bean>
+   
+   <bean name="Configuration" class="org.jboss.messaging.core.config.impl.FileConfiguration">
+      <property name="configurationUrl">example-configuration.xml</property>
+   </bean>
+
+   <!--<bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBossASSecurityManager"/>-->
+
+   <bean name="JBMSecurityManager" class="org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl">
+   </bean>
+
+   <bean name="BasicSecurityDeployer" class="org.jboss.messaging.core.deployers.impl.BasicSecurityDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+      </constructor>
+      <property name="jbmSecurityManager">
+         <inject bean="JBMSecurityManager"/>
+      </property>
+   </bean>
+
+   <bean name="MessagingServer" class="org.jboss.messaging.core.server.impl.MessagingServerImpl">
+      <depends>AddressSettingsDeployer</depends>
+      <depends>QueueDeployer</depends>
+      
+      <property name="storageManager">
+         <inject bean="StorageManager"/>
+      </property>
+      <property name="remotingService">
+         <inject bean="RemotingService"/>
+      </property>
+      <property name="configuration">
+         <inject bean="Configuration"/>
+      </property>
+      <property name="securityManager">
+         <inject bean="JBMSecurityManager"/>
+      </property>
+      <property name="managementService">
+         <inject bean="ManagementService"/>
+      </property>      
+   </bean>
+
+   <bean name="StorageManager" class="org.jboss.messaging.core.persistence.impl.journal.JournalStorageManager">
+      <constructor>
+         <parameter>
+            <inject bean="Configuration"/>
+         </parameter>
+      </constructor>
+   </bean>
+
+   <bean name="RemotingService" class="org.jboss.messaging.core.remoting.server.impl.RemotingServiceImpl">
+      <constructor>
+         <parameter>
+            <inject bean="Configuration"/>
+         </parameter>
+      </constructor>
+      <property name="managementService">
+         <inject bean="ManagementService"/>
+      </property>
+   </bean>
+   
+   <bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
+      <constructor>
+         <parameter>
+            <inject bean="MessagingServer" property="serverManagement"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="postOffice"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="storageManager"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="addressSettingsRepository"/>
+         </parameter>
+         <parameter>
+            <inject bean="JMSManagementService"/>
+         </parameter>
+      </constructor>
+   </bean>
+
+   <bean name="JMSServerDeployer" class="org.jboss.messaging.jms.server.impl.JMSServerDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+          <parameter>
+            <inject bean="Configuration"/>
+         </parameter>
+      </constructor>
+      <property name="jmsServerManager">
+         <inject bean="JMSServerManager"/>
+      </property>
+   </bean>
+
+   <bean name="AddressSettingsDeployer" class="org.jboss.messaging.core.deployers.impl.AddressSettingsDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="addressSettingsRepository" state="Configured"/>
+         </parameter>
+      </constructor>
+   </bean>
+
+   <bean name="QueueDeployer" class="org.jboss.messaging.core.deployers.impl.QueueDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+         <parameter>
+            <inject bean="Configuration"/>
+         </parameter>
+      </constructor>
+   </bean>
+   
+   <bean name="SecurityDeployer" class="org.jboss.messaging.core.deployers.impl.SecurityDeployer">
+      <constructor>
+         <parameter>
+            <inject bean="DeploymentManager"/>
+         </parameter>
+         <parameter>
+            <inject bean="MessagingServer" property="securityRepository"/>
+         </parameter>
+      </constructor>
+   </bean>
+
+   <bean name="ManagementService" class="org.jboss.messaging.core.management.impl.ManagementServiceImpl">
+      <constructor>
+         <parameter>
+            <inject bean="MBeanServer"/>
+         </parameter>
+         <parameter>
+            <inject bean="Configuration" property="JMXManagementEnabled" />
+         </parameter>
+      </constructor>
+   </bean>
+   
+   <bean name="JMSManagementService" class="org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl">
+      <constructor>
+         <parameter>
+            <inject bean="ManagementService"/>
+         </parameter>
+      </constructor>
+   </bean>
+   
+   <bean name="MBeanServer" class="javax.management.MBeanServer">
+      <constructor factoryClass="java.lang.management.ManagementFactory"
+                   factoryMethod="getPlatformMBeanServer"/>
+   </bean> 
+   
+</deployment>
\ No newline at end of file


Property changes on: trunk/examples/jms/common/config/jbm-example-beans.xml
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/examples/jms/common/config/jbm-jms.xml (from rev 6208, trunk/src/config/jbm-jms.xml)
===================================================================
--- trunk/examples/jms/common/config/jbm-jms.xml	                        (rev 0)
+++ trunk/examples/jms/common/config/jbm-jms.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,21 @@
+<deployment xmlns="urn:jboss:messaging" 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-jms.xsd ">
+
+   <connection-factory name="ConnectionFactory">
+      <connector-ref connector-name="netty"/>
+      <entry name="ConnectionFactory"/>
+      <entry name="XAConnectionFactory"/>
+      <entry name="java:/ConnectionFactory"/>
+      <entry name="java:/XAConnectionFactory"/>
+   </connection-factory>
+
+   <queue name="queue">
+      <entry name="/queue/exampleQueue"/>
+   </queue>
+
+   <topic name="topic">
+      <entry name="/topic/exampleTopic"/>
+   </topic>
+
+</deployment>
\ No newline at end of file


Property changes on: trunk/examples/jms/common/config/jbm-jms.xml
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/examples/jms/common/config/jbm-queues.xml (from rev 6212, trunk/src/config/jbm-queues.xml)
===================================================================
--- trunk/examples/jms/common/config/jbm-queues.xml	                        (rev 0)
+++ trunk/examples/jms/common/config/jbm-queues.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,65 @@
+<settings xmlns="urn:jboss:messaging" 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-queues.xsd ">
+
+   <!--  manangement address -->
+   <security match="jbm.admin.management">
+      <!--  only the admin role can interact with the management address  -->
+      <permission type="consume" roles="admin"/>
+      <permission type="send" roles="admin"/>
+      <permission type="createDurableQueue" roles="admin"/>
+      <permission type="deleteDurableQueue" roles="admin"/>
+      <permission type="createTempQueue" roles="admin"/>
+      <permission type="deleteTempQueue" roles="admin"/>
+      <permission type="manage" roles="admin"/>
+   </security>
+   
+   <security match="topicjms.exampleTopic">
+      <permission type="createDurableQueue" roles="durpublisher"/>
+      <permission type="deleteDurableQueue" roles="durpublisher"/>
+      <permission type="consume" roles="guest,publisher,durpublisher"/>
+      <permission type="send" roles="guest,publisher,durpublisher"/>
+   </security>
+
+   <security match="queuejms.exampleQueue">
+      <permission type="consume" roles="guest,publisher"/>
+      <permission type="send" roles="guest,publisher"/>
+   </security>
+
+   <security match="queuetempjms.*">
+      <permission type="createTempQueue" roles="guest"/>
+      <permission type="deleteTempQueue" roles="guest"/>
+      <permission type="consume" roles="guest"/>
+      <permission type="send" roles="guest"/>
+   </security>
+
+   <security match="topictempjms.*">
+      <permission type="createTempQueue" roles="guest"/>
+      <permission type="deleteTempQueue" roles="guest"/>
+      <permission type="consume" roles="guest"/>
+      <permission type="send" roles="guest"/>
+   </security>
+
+   <!--default security to catch all-->
+   <security match="#">
+      <permission type="createDurableQueue" roles="guest,def"/>
+      <permission type="deleteDurableQueue" roles="guest,def"/>
+      <permission type="createTempQueue" roles="guest,def"/>
+      <permission type="deleteTempQueue" roles="guest,def"/>
+      <permission type="consume" roles="guest,def"/>
+      <permission type="send" roles="guest,def"/>
+   </security>
+
+
+   <!--default for catch all-->
+   <address-settings match="#">
+      <clustered>false</clustered>
+      <dead-letter-address>queuejms.DLQ</dead-letter-address>
+      <expiry-address>queuejms.ExpiryQueue</expiry-address>
+      <redelivery-delay>0</redelivery-delay>
+      <max-size-bytes>-1</max-size-bytes>
+      <page-size-bytes>10485760</page-size-bytes>
+      <distribution-policy-class>org.jboss.messaging.core.server.impl.RoundRobinDistributor</distribution-policy-class>
+      <message-counter-history-day-limit>10</message-counter-history-day-limit>
+   </address-settings>
+</settings>

Copied: trunk/examples/jms/common/config/jbm-security.xml (from rev 6208, trunk/src/config/jbm-security.xml)
===================================================================
--- trunk/examples/jms/common/config/jbm-security.xml	                        (rev 0)
+++ trunk/examples/jms/common/config/jbm-security.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,11 @@
+<deployment xmlns="urn:jboss:messaging" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-security.xsd ">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+   <user name="admin" password="admin">
+      <role name="admin"/>
+      <role name="guest"/>
+   </user>
+</deployment>
\ No newline at end of file


Property changes on: trunk/examples/jms/common/config/jbm-security.xml
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/examples/jms/common/config/log4j.xml (from rev 6208, trunk/src/config/log4j.xml)
===================================================================
--- trunk/examples/jms/common/config/log4j.xml	                        (rev 0)
+++ trunk/examples/jms/common/config/log4j.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,50 @@
+<?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>
+
+   <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
+      <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
+
+      <param name="File" value="./build/logs/messaging.log"/>
+
+      <!-- since majority of the tests are ran in fork mode by ant, the log file is overwritten
+           for each test. We need to append if we want to preserve a full testsuite run log.
+           Make sure the build script clears this log at the beginning of each run.
+      -->
+      <param name="Append" value="false"/>
+      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <!-- <param name="ConversionPattern" value="%d %-5p @%t [%c] %m%n"/> -->
+         <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n -->
+         <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+
+      </layout>
+   </appender>
+
+   <category name="org.jboss">
+      <priority value="INFO"/>
+   </category>
+   
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+
+   
+</log4j:configuration>


Property changes on: trunk/examples/jms/common/config/log4j.xml
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java
===================================================================
--- trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java	                        (rev 0)
+++ trunk/examples/jms/common/src/org/jboss/jms/example/JMSExample.java	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.example;
+
+import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS;
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.integration.bootstrap.JBMBootstrapServer;
+import org.jboss.messaging.jms.JBossQueue;
+import org.jboss.messaging.jms.server.management.impl.JMSManagementHelper;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.QueueRequestor;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.naming.InitialContext;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.logging.Logger;
+
+/**
+ * a baee class for examples. This takes care of starting and stopping the server as well as deploying any queue needed.
+ *
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public abstract class JMSExample
+{
+   protected static Logger log = Logger.getLogger(JMSExample.class.getName());
+
+   private JBMBootstrapServer server;
+
+   private Connection conn;
+
+   protected void run(String[] args)
+   {
+      String runServerProp = System.getProperty("jbm.example.runServer");
+      boolean runServer = runServerProp == null ? true : Boolean.valueOf(runServerProp);
+      log.info("jbm.example.runServer is " + runServer);
+      try
+      {
+         if (runServer)
+         {
+            startServer(args);
+         }
+         InitialContext ic = new InitialContext();
+         ConnectionFactory cf = (ConnectionFactory) ic.lookup("/ConnectionFactory");
+         conn = cf.createConnection("admin", "admin");
+         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         conn.start();
+         JBossQueue managementQueue = new JBossQueue(DEFAULT_MANAGEMENT_ADDRESS.toString(),
+                                                     DEFAULT_MANAGEMENT_ADDRESS.toString());
+         QueueRequestor requestor = new QueueRequestor((QueueSession) session, managementQueue);
+         deployQueues(session, requestor);
+         deployTopics(session, requestor);
+         runExample();
+      }
+      catch (Throwable e)
+      {
+         e.printStackTrace();
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            try
+            {
+               conn.close();
+            }
+            catch (JMSException e)
+            {
+               //ignore
+            }
+         }
+         if (runServer)
+         {
+            try
+            {
+               stopServer();
+            }
+            catch (Throwable throwable)
+            {
+               throwable.printStackTrace();
+            }
+         }
+      }
+   }
+
+
+   public Set<String> getQueues()
+   {
+      Set<String> queues = new HashSet<String>();
+      queues.add("exampleQueue");
+      return queues;
+   }
+
+   public Set<String> getTopics()
+   {
+      Set<String> topics = new HashSet<String>();
+      topics.add("exampleTopic");
+      return topics;
+   }
+
+   protected InitialContext getContext() throws Exception
+   {
+      URL url = Thread.currentThread().getContextClassLoader().getResource("client-jndi.properties");
+      Properties props = new Properties();
+      props.load(url.openStream());
+      return new InitialContext(props);
+   }
+
+   private void startServer(String[] args) throws Throwable
+   {
+      server = new JBMBootstrapServer(args);
+      server.run();
+   }
+
+   private void stopServer() throws Throwable
+   {
+      server.shutDown();
+   }
+
+   private void deployQueues(Session session, QueueRequestor requestor) throws Exception
+   {
+      Set<String> queues = getQueues();
+      for (String queue : queues)
+      {
+         Message m = session.createMessage();
+         JMSManagementHelper.putOperationInvocation(m, ObjectNames.getJMSServerObjectName(), "createQueue", queue, "/queue/" + queue);
+         ObjectMessage reply = (ObjectMessage) requestor.request(m);
+         if (JMSManagementHelper.hasOperationSucceeded(reply))
+         {
+            Boolean created = (Boolean) reply.getObject();
+            if (created)
+            {
+               log.info("created queue " + queue);
+            }
+            else
+            {
+               log.info("queue " + queue + " already exists not creating");
+            }
+         }
+         else
+         {
+            throw new Exception(JMSManagementHelper.getOperationExceptionMessage(reply));
+         }
+      }
+   }
+
+   private void deployTopics(Session session, QueueRequestor requestor) throws Exception
+   {
+      Set<String> topics = getTopics();
+      for (String topic : topics)
+      {
+         Message m = session.createMessage();
+         JMSManagementHelper.putOperationInvocation(m, ObjectNames.getJMSServerObjectName(), "createTopic", topic, "/topic/" + topic);
+         ObjectMessage reply = (ObjectMessage) requestor.request(m);
+         if (JMSManagementHelper.hasOperationSucceeded(reply))
+         {
+            Boolean created = (Boolean) reply.getObject();
+            if (created)
+            {
+               log.info("created topic " + topic);
+            }
+            else
+            {
+               log.info("topic " + topic + " already exists not creating");
+            }
+         }
+         else
+         {
+            throw new Exception(JMSManagementHelper.getOperationExceptionMessage(reply));
+         }
+      }
+   }
+
+   public abstract void runExample();
+
+
+}

Added: trunk/examples/jms/queue/READ_ME.txt
===================================================================

Added: trunk/examples/jms/queue/build.xml
===================================================================
--- trunk/examples/jms/queue/build.xml	                        (rev 0)
+++ trunk/examples/jms/queue/build.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+      <!ENTITY libraries SYSTEM "../../../thirdparty/libraries.ent">
+      ]>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- 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.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<project default="run" name="JBoss Messaging JMS Queue Example">
+
+   <import file="../common/build.xml"/>
+
+   <target name="run">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.QueueExample"/>
+      </antcall>
+   </target>
+
+   <target name="runRemote">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.QueueExample"/>
+         <param name="jbm.example.runServer" value="false"/>
+      </antcall>
+   </target>
+
+</project>
\ No newline at end of file

Deleted: trunk/examples/jms/src/org/jboss/jms/example/QueueExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/QueueExample.java	2009-03-30 13:46:12 UTC (rev 6214)
+++ trunk/examples/jms/src/org/jboss/jms/example/QueueExample.java	2009-03-30 14:55:40 UTC (rev 6215)
@@ -1,89 +0,0 @@
-/*
-   * JBoss, Home of Professional Open Source
-   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-   * by the @authors tag. See the copyright.txt in the distribution for a
-   * full listing of individual contributors.
-   *
-   * This is free software; you can redistribute it and/or modify it
-   * under the terms of the GNU Lesser General Public License as
-   * published by the Free Software Foundation; either version 2.1 of
-   * the License, or (at your option) any later version.
-   *
-   * This software is distributed in the hope that it will be useful,
-   * but WITHOUT ANY WARRANTY; without even the implied warranty of
-   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   * Lesser General Public License for more details.
-   *
-   * You should have received a copy of the GNU Lesser General Public
-   * License along with this software; if not, write to the Free
-   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-   */
-package org.jboss.jms.example;
-
-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.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * A simple JMS Queue example that creates a producer and consumer on a queue and sends a message.
- *
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class QueueExample
-{
-   final static Logger log = Logger.getLogger(QueueExample.class);
-
-   public static void main(final String[] args)
-   {
-      Connection connection = null;
-      try
-      {
-         //create an initial context, env will be picked up from jndi.properties
-         InitialContext initialContext = new InitialContext();
-         Queue queue = (Queue) initialContext.lookup("/queue/testQueue");
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-         
-         connection = cf.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer producer = session.createProducer(queue);
-         Message message = session.createTextMessage("This is a text message!");
-         
-         log.info("sending message to queue");
-         producer.send(message);
-         
-         MessageConsumer messageConsumer = session.createConsumer(queue);
-         connection.start();
-         TextMessage message2 = (TextMessage) messageConsumer.receive(5000);
-         log.info("message received from queue");
-         log.info("message = " + message2.getText());
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-      finally
-      {
-         if(connection != null)
-         {
-            try
-            {
-               connection.close();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   }
-}

Deleted: trunk/examples/jms/src/org/jboss/jms/example/TopicExample.java
===================================================================
--- trunk/examples/jms/src/org/jboss/jms/example/TopicExample.java	2009-03-30 13:46:12 UTC (rev 6214)
+++ trunk/examples/jms/src/org/jboss/jms/example/TopicExample.java	2009-03-30 14:55:40 UTC (rev 6215)
@@ -1,116 +0,0 @@
-/*
-   * JBoss, Home of Professional Open Source
-   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-   * by the @authors tag. See the copyright.txt in the distribution for a
-   * full listing of individual contributors.
-   *
-   * This is free software; you can redistribute it and/or modify it
-   * under the terms of the GNU Lesser General Public License as
-   * published by the Free Software Foundation; either version 2.1 of
-   * the License, or (at your option) any later version.
-   *
-   * This software is distributed in the hope that it will be useful,
-   * but WITHOUT ANY WARRANTY; without even the implied warranty of
-   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   * Lesser General Public License for more details.
-   *
-   * You should have received a copy of the GNU Lesser General Public
-   * License along with this software; if not, write to the Free
-   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-   */
-package org.jboss.jms.example;
-
-import java.util.concurrent.CountDownLatch;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-
-/**
- * A simple JMS Topic example that creates a producer and consumer on a queue and sends and receives a message via a
- * Message Listener..
- *
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class TopicExample
-{
-   final static Logger log = Logger.getLogger(TopicExample.class);
-
-   public static void main(final String[] args)
-   {
-      Connection connection = null;
-      try
-      {
-         //create an initial context, env will be picked up from jndi.properties
-         InitialContext initialContext = new InitialContext();
-         Topic topic = (Topic) initialContext.lookup("/topic/testTopic");
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-         connection = cf.createConnection();
-         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer messageProducer = session.createProducer(topic);
-
-         MessageConsumer messageConsumer = session.createConsumer(topic);
-         Message message = session.createTextMessage("This is a text message!");
-         final CountDownLatch latch = new CountDownLatch(1);
-         messageConsumer.setMessageListener(new MessageListener()
-         {
-            public void onMessage(Message message)
-            {
-               try
-               {
-                  log.info("message received from topic");
-                  TextMessage textMessage = (TextMessage) message;
-                  log.info("message = " + textMessage.getText());
-               }
-               catch (JMSException e)
-               {
-                  e.printStackTrace();
-               }
-               latch.countDown();
-            }
-         });
-         connection.start();
-
-         log.info("publishing message to topic");
-         messageProducer.send(message);
-
-         try
-         {
-            latch.await();
-         }
-         catch (InterruptedException e)
-         {
-         }
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
-
-      finally
-      {
-         if (connection != null)
-         {
-            try
-            {
-               connection.close();
-            }
-            catch (JMSException e)
-            {
-               e.printStackTrace();
-            }
-         }
-      }
-   }
-}

Added: trunk/examples/jms/topic/build.xml
===================================================================
--- trunk/examples/jms/topic/build.xml	                        (rev 0)
+++ trunk/examples/jms/topic/build.xml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+      <!ENTITY libraries SYSTEM "../../../thirdparty/libraries.ent">
+      ]>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- 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.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<project default="run" name="JBoss Messaging JMS Topic Example">
+
+   <import file="../common/build.xml"/>
+
+   <target name="run">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.TopicExample"/>
+      </antcall>
+   </target>
+
+   <target name="runRemote">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.TopicExample"/>
+         <param name="jbm.example.runServer" value="false"/>
+      </antcall>
+   </target>
+
+</project>
\ No newline at end of file

Copied: trunk/examples/jms/topic/src/org/jboss/jms/example/TopicExample.java (from rev 6212, trunk/examples/jms/src/org/jboss/jms/example/TopicExample.java)
===================================================================
--- trunk/examples/jms/topic/src/org/jboss/jms/example/TopicExample.java	                        (rev 0)
+++ trunk/examples/jms/topic/src/org/jboss/jms/example/TopicExample.java	2009-03-30 14:55:40 UTC (rev 6215)
@@ -0,0 +1,116 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+   * by the @authors tag. See the copyright.txt in the distribution for a
+   * full listing of individual contributors.
+   *
+   * This is free software; you can redistribute it and/or modify it
+   * under the terms of the GNU Lesser General Public License as
+   * published by the Free Software Foundation; either version 2.1 of
+   * the License, or (at your option) any later version.
+   *
+   * This software is distributed in the hope that it will be useful,
+   * but WITHOUT ANY WARRANTY; without even the implied warranty of
+   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   * Lesser General Public License for more details.
+   *
+   * You should have received a copy of the GNU Lesser General Public
+   * License along with this software; if not, write to the Free
+   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+   */
+package org.jboss.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * A simple JMS Topic example that creates a producer and consumer on a queue and sends and receives a message via a
+ * Message Listener..
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class TopicExample extends JMSExample
+{
+   public static void main(String[] args)
+   {
+      new TopicExample().run(args);
+   }
+
+   public void runExample()
+   {
+      Connection connection = null;
+      try
+      {
+         //create an initial context, env will be picked up from client-jndi.properties
+         InitialContext initialContext = getContext();
+         Topic topic = (Topic) initialContext.lookup("/topic/exampleTopic");
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer messageProducer = session.createProducer(topic);
+
+         MessageConsumer messageConsumer = session.createConsumer(topic);
+         Message message = session.createTextMessage("This is a text message!");
+         final CountDownLatch latch = new CountDownLatch(1);
+         messageConsumer.setMessageListener(new MessageListener()
+         {
+            public void onMessage(Message message)
+            {
+               try
+               {
+                  log.info("message received from topic");
+                  TextMessage textMessage = (TextMessage) message;
+                  log.info("message = " + textMessage.getText());
+               }
+               catch (JMSException e)
+               {
+                  e.printStackTrace();
+               }
+               latch.countDown();
+            }
+         });
+         connection.start();
+
+         log.info("publishing message to topic");
+         messageProducer.send(message);
+
+         try
+         {
+            latch.await();
+         }
+         catch (InterruptedException e)
+         {
+         }
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+
+      finally
+      {
+         if (connection != null)
+         {
+            try
+            {
+               connection.close();
+            }
+            catch (JMSException e)
+            {
+               e.printStackTrace();
+            }
+         }
+      }
+   }
+}

Modified: trunk/messaging.iml
===================================================================
--- trunk/messaging.iml	2009-03-30 13:46:12 UTC (rev 6214)
+++ trunk/messaging.iml	2009-03-30 14:55:40 UTC (rev 6215)
@@ -18,7 +18,10 @@
       <sourceFolder url="file://$MODULE_DIR$/docs/examples/secure-socket/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/docs/examples/stateless/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/docs/examples/topic/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/examples/jms/common/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/examples/jms/queue/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/examples/jms/src" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/examples/jms/topic/src" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/examples/messaging/src" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/native/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/output/gen-parsers" isTestSource="false" />
@@ -27,6 +30,7 @@
       <sourceFolder url="file://$MODULE_DIR$/src/main" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/tests/jms-tests/src" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/tests/joram-tests/src" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/tests/src" isTestSource="true" />
       <excludeFolder url="file://$MODULE_DIR$/build/api" />
       <excludeFolder url="file://$MODULE_DIR$/build/classes" />

Modified: trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java	2009-03-30 13:46:12 UTC (rev 6214)
+++ trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java	2009-03-30 14:55:40 UTC (rev 6215)
@@ -22,19 +22,14 @@
 
 package org.jboss.messaging.core.security.impl;
 
-import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD;
-import static org.jboss.messaging.core.management.NotificationType.SECURITY_AUTHENTICATION_VIOLATION;
-
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
 import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.management.Notification;
 import org.jboss.messaging.core.management.NotificationService;
 import org.jboss.messaging.core.management.NotificationType;
+import static org.jboss.messaging.core.management.NotificationType.SECURITY_AUTHENTICATION_VIOLATION;
 import org.jboss.messaging.core.security.CheckType;
 import org.jboss.messaging.core.security.JBMSecurityManager;
 import org.jboss.messaging.core.security.Role;
@@ -46,6 +41,10 @@
 import org.jboss.messaging.utils.SimpleString;
 import org.jboss.messaging.utils.TypedProperties;
 
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
 /**
  * The JBM SecurityStore implementation
  *
@@ -179,7 +178,7 @@
                notificationService.sendNotification(notification);
             }
 
-            throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "Unable to validate user: " + session.getUsername());
+            throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "Unable to validate user: " + session.getUsername() + " for check type " + checkType + " for address " + saddress);
          }
          // if we get here we're granted, add to the cache
          ConcurrentHashSet<SimpleString> set = new ConcurrentHashSet<SimpleString>();

Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java	2009-03-30 13:46:12 UTC (rev 6214)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java	2009-03-30 14:55:40 UTC (rev 6215)
@@ -22,16 +22,6 @@
 
 package org.jboss.messaging.jms.server.impl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.NotificationBroadcasterSupport;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
 import org.jboss.messaging.core.config.TransportConfiguration;
 import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
 import org.jboss.messaging.core.logging.Logger;
@@ -53,6 +43,16 @@
 import org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl;
 import org.jboss.messaging.utils.Pair;
 
+import javax.management.NotificationBroadcasterSupport;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * A Deployer used to create and add to JNDI queues, topics and connection
  * factories. Typically this would only be used in an app server env.
@@ -381,7 +381,14 @@
       }
       for (String jndiBinding : jndiBindings)
       {
-         context.unbind(jndiBinding);
+         try
+         {
+            context.unbind(jndiBinding);
+         }
+         catch (NameNotFoundException e)
+         {
+            //this is ok.
+         }
       }
       connectionFactoryBindings.remove(name);
       connectionFactories.remove(name);




More information about the jboss-cvs-commits mailing list