qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r1411155 [5/6] - in /qpid/branches/java-broker-config-qpid-4390/qpid: ./ cpp/ cpp/bindings/ cpp/bindings/qpid/dotnet/ cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver/ cpp/bindings/qpid/dotnet/msvc9/ cpp/bindings/qpid/dotnet/s...
Date Mon, 19 Nov 2012 12:48:08 GMT
Modified: qpid/branches/java-broker-config-qpid-4390/qpid/cpp/src/tests/ha_tests.py
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/cpp/src/tests/ha_tests.py?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/cpp/src/tests/ha_tests.py (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/cpp/src/tests/ha_tests.py Mon Nov 19 12:47:53 2012
@@ -26,10 +26,24 @@ from brokertest import *
 from ha_test import *
 from threading import Thread, Lock, Condition
 from logging import getLogger, WARN, ERROR, DEBUG, INFO
-from qpidtoollibs import BrokerAgent
+from qpidtoollibs import BrokerAgent, EventHelper
 from uuid import UUID
 
-class ReplicationTests(BrokerTest):
+log = getLogger(__name__)
+
+def grep(filename, regexp):
+    for line in open(filename).readlines():
+        if (regexp.search(line)): return True
+    return False
+
+class HaBrokerTest(BrokerTest):
+    """Base class for HA broker tests"""
+    def assert_log_no_errors(self, broker):
+        log = broker.get_log()
+        if grep(log, re.compile("] error|] critical")):
+            self.fail("Errors in log file %s"%(log))
+
+class ReplicationTests(HaBrokerTest):
     """Correctness tests for  HA replication."""
 
     def test_replication(self):
@@ -256,6 +270,7 @@ class ReplicationTests(BrokerTest):
     def test_qpid_config_replication(self):
         """Set up replication via qpid-config"""
         brokers = HaCluster(self,2)
+        brokers[0].wait_status("active")
         brokers[0].config_declare("q","all")
         brokers[0].connect().session().sender("q").send("foo")
         brokers[1].assert_browse_backup("q", ["foo"])
@@ -739,11 +754,16 @@ acl deny all all
 
     def test_auto_delete_timeout(self):
         cluster = HaCluster(self, 2)
-        s = cluster[0].connect().session().receiver("q;{create:always,node:{x-declare:{auto-delete:True,arguments:{'qpid.auto_delete_timeout':1}}}}")
-        cluster[1].wait_queue("q")
+        # Test timeout
+        r1 = cluster[0].connect().session().receiver("q1;{create:always,node:{x-declare:{auto-delete:True,arguments:{'qpid.auto_delete_timeout':1}}}}")
+        # Test special case of timeout = 0
+        r0 = cluster[0].connect().session().receiver("q0;{create:always,node:{x-declare:{auto-delete:True,arguments:{'qpid.auto_delete_timeout':0}}}}")
+        cluster[1].wait_queue("q0")
+        cluster[1].wait_queue("q1")
         cluster[0].kill()
-        cluster[1].wait_queue("q")    # Not timed out yet
-        cluster[1].wait_no_queue("q") # Wait for timeout
+        cluster[1].wait_queue("q1")                       # Not timed out yet
+        cluster[1].wait_no_queue("q1", timeout=2)         # Wait for timeout
+        cluster[1].wait_no_queue("q0", timeout=2)
 
     def test_alt_exchange_dup(self):
         """QPID-4349: if a queue has an alterante exchange and is deleted the
@@ -774,6 +794,54 @@ acl deny all all
         cluster.start()
         send_ttl_messages()
 
+    def test_stale_response(self):
+        """Check for race condition where a stale response is processed after an
+        event for the same queue/exchange """
+        cluster = HaCluster(self, 2)
+        s = cluster[0].connect().session()
+        s.sender("keep;{create:always}") # Leave this queue in place.
+        for i in xrange(100):            # FIXME aconway 2012-10-23: ??? IS this an issue?
+            s.sender("deleteme%s;{create:always,delete:always}"%(i)).close()
+        # It is possible for the backup to attempt to subscribe after the queue
+        # is deleted. This is not an error, but is logged as an error on the primary.
+        # The backup does not log this as an error so we only check the backup log for errors.
+        self.assert_log_no_errors(cluster[1])
+
+    def test_missed_recreate(self):
+        """If a queue or exchange is destroyed and one with the same name re-created
+        while a backup is disconnected, the backup should also delete/recreate
+        the object when it re-connects"""
+        cluster = HaCluster(self, 3)
+        sn = cluster[0].connect().session()
+        # Create a queue with messages
+        s = sn.sender("qq;{create:always}")
+        msgs = [str(i) for i in xrange(3)]
+        for m in msgs: s.send(m)
+        cluster[1].assert_browse_backup("qq", msgs)
+        cluster[2].assert_browse_backup("qq", msgs)
+        # Set up an exchange with a binding.
+        sn.sender("xx;{create:always,node:{type:topic}}")
+        sn.sender("xxq;{create:always,node:{x-bindings:[{exchange:'xx',queue:'xxq',key:xxq}]}}")
+        cluster[1].wait_address("xx")
+        self.assertEqual(cluster[1].agent().getExchange("xx").values["bindingCount"], 1)
+        cluster[2].wait_address("xx")
+        self.assertEqual(cluster[2].agent().getExchange("xx").values["bindingCount"], 1)
+
+        # Simulate the race by re-creating the objects before promoting the new primary
+        cluster.kill(0, False)
+        sn = cluster[1].connect_admin().session()
+        sn.sender("qq;{delete:always}").close()
+        s = sn.sender("qq;{create:always}")
+        s.send("foo")
+        sn.sender("xx;{delete:always}").close()
+        sn.sender("xx;{create:always,node:{type:topic}}")
+        cluster[1].promote()
+        cluster[1].wait_status("active")
+        # Verify we are not still using the old objects on cluster[2]
+        cluster[2].assert_browse_backup("qq", ["foo"])
+        cluster[2].wait_address("xx")
+        self.assertEqual(cluster[2].agent().getExchange("xx").values["bindingCount"], 0)
+
 def fairshare(msgs, limit, levels):
     """
     Generator to return prioritised messages in expected order for a given fairshare limit
@@ -808,7 +876,7 @@ def priority_level(value, levels):
     offset = 5-math.ceil(levels/2.0)
     return min(max(value - offset, 0), levels-1)
 
-class LongTests(BrokerTest):
+class LongTests(HaBrokerTest):
     """Tests that can run for a long time if -DDURATION=<minutes> is set"""
 
     def duration(self):
@@ -891,7 +959,64 @@ class LongTests(BrokerTest):
             if unexpected_dead:
                 raise Exception("Brokers not running: %s"%unexpected_dead)
 
-class RecoveryTests(BrokerTest):
+    def test_qmf_order(self):
+        """QPID 4402:  HA QMF events can be out of order.
+        This test mimics the test described in the JIRA. Two threads repeatedly
+        declare the same auto-delete queue and close their connection.
+        """
+        broker = Broker(self)
+        class Receiver(Thread):
+            def __init__(self, qname):
+                Thread.__init__(self)
+                self.qname = qname
+                self.stopped = False
+
+            def run(self):
+                while not self.stopped:
+                    self.connection = broker.connect()
+                    try:
+                        self.connection.session().receiver(
+                            self.qname+";{create:always,node:{x-declare:{auto-delete:True}}}")
+                    except NotFound: pass # Can occur occasionally, not an error.
+                    try: self.connection.close()
+                    except: pass
+
+        class QmfObject(object):
+            """Track existance of an object and validate QMF events"""
+            def __init__(self, type_name, name_field, name):
+                self.type_name, self.name_field, self.name = type_name, name_field, name
+                self.exists = False
+
+            def qmf_event(self, event):
+                content = event.content[0]
+                event_type = content['_schema_id']['_class_name']
+                values = content['_values']
+                if event_type == self.type_name+"Declare" and values[self.name_field] == self.name:
+                    disp = values['disp']
+                    log.debug("Event %s: disp=%s exists=%s"%(
+                            event_type, values['disp'], self.exists))
+                    if self.exists: assert values['disp'] == 'existing'
+                    else: assert values['disp'] == 'created'
+                    self.exists = True
+                elif event_type == self.type_name+"Delete" and values[self.name_field] == self.name:
+                    log.debug("Event %s: exists=%s"%(event_type, self.exists))
+                    assert self.exists
+                    self.exists = False
+
+        # Verify order of QMF events.
+        helper = EventHelper()
+        r = broker.connect().session().receiver(helper.eventAddress())
+        threads = [Receiver("qq"), Receiver("qq")]
+        for t in threads: t.start()
+        queue = QmfObject("queue", "qName", "qq")
+        finish = time.time() + self.duration()
+        try:
+            while time.time() < finish:
+                queue.qmf_event(r.fetch())
+        finally:
+            for t in threads: t.stopped = True; t.join()
+
+class RecoveryTests(HaBrokerTest):
     """Tests for recovery after a failure."""
 
     def test_queue_hold(self):
@@ -909,6 +1034,7 @@ class RecoveryTests(BrokerTest):
             for b in cluster: b.wait_backup("q1")
             for i in xrange(100): s1.send(str(i))
             # Kill primary and 2 backups
+            cluster[3].wait_status("ready")
             for i in [0,1,2]: cluster.kill(i, False)
             cluster[3].promote()    # New primary, backups will be 1 and 2
             cluster[3].wait_status("recovering")

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/cpp-broker/Active-Passive-Cluster.xml Mon Nov 19 12:47:53 2012
@@ -594,9 +594,14 @@ NOTE: fencing is not shown, you must con
     <para>
       There are some built-in exchanges created automatically by the broker, these
       exchangs are never replicated. The built-in exchanges are the default (nameless)
-      exchange, the AMQP standard exchanges (amq.direct, amq.topic, amq.fanout and
-      amq.match) and the management exchanges (qpid.management, qmf.default.direct and
-      qmf.default.topic)
+      exchange, the AMQP standard exchanges (<literal>amq.direct, amq.topic, amq.fanout</literal> and
+      <literal>amq.match</literal>) and the management exchanges (<literal>qpid.management, qmf.default.direct</literal> and
+      <literal>qmf.default.topic</literal>)
+    </para>
+    <para>
+      Note that if you bind a replicated queue to one of these exchanges, the
+      binding wil <emphasis>not</emphasis> be replicated, so the queue will not
+      have the binding after a fail-over.
     </para>
   </section>
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml Mon Nov 19 12:47:53 2012
@@ -20,10 +20,10 @@
 
 -->
 
-<book>
+<book xmlns:xi="http://www.w3.org/2001/XInclude">
 <title>AMQP Messaging Broker (Java)</title>
 
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Broker-Introduction.xml"/>
+<xi:include  href="Java-Broker-Introduction.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Broker-Installation.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Broker-Getting-Started.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Broker-Concepts.xml"/>
@@ -35,5 +35,6 @@
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Broker-Security.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Broker-Runtime.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Broker-High-Availability.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Java-Broker-Miscellaneous.xml"/>
 
 </book>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Getting-Started.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Getting-Started.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Getting-Started.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Getting-Started.xml Mon Nov 19 12:47:53 2012
@@ -1,4 +1,8 @@
 <?xml version="1.0"?>
+<!DOCTYPE entities [
+<!ENTITY %  entities SYSTEM  "commonEntities.xml">
+%entities;
+]>
 <!--
 
  Licensed to the Apache Software Foundation (ASF) under one
@@ -22,4 +26,109 @@
 
 <chapter id="Java-Broker-Getting-Started">
   <title>Getting Started</title>
+  <para>This section describes how to start the Java Broker for the first time.</para>
+  <section role="h2" id="Java-Broker-Getting-Started-Starting">
+    <title>Starting/Stopping the Broker</title>
+    <para>To start the Broker, use the <command>qpid-server</command> script (UNIX) or <command>qpid-server.bat</command> (Windows)
+      provided within distribution.</para>
+  </section>
+  <section role="h2" id="Java-Broker-Getting-Started-Starting-Stopping-Windows">
+    <title>Starting/Stopping on Windows</title>
+    <para>Firstly change to the installation directory used during the <link linkend="Java-Broker-Installation-InstallationWindows">installation</link>
+      and ensure that the <link linkend="Java-Broker-Installation-InstallationWindows-SettingQPIDWORK">QPID_WORK environment variable is set</link>.</para>
+    <para>Now use the qpid-server.bat to start the server</para>
+    <programlisting><![CDATA[bin\qpid-server.bat]]></programlisting>
+    <para>Output similar to the following will be seen:</para>
+    <screen>[Broker] BRK-1006 : Using configuration : C:\qpid\qpid-broker-&qpidCurrentRelease;\etc\config.xml
+[Broker] BRK-1007 : Using logging configuration : C:\qpid\qpid-broker-&qpidCurrentRelease;\etc\log4j.xml
+[Broker] MNG-1001 : Startup
+[Broker] MNG-1002 : Starting : RMI Registry : Listening on port 8999
+[Broker] MNG-1002 : Starting : JMX RMIConnectorServer : Listening on port 9099
+[Broker] MNG-1004 : Ready
+[Broker] BRK-1001 : Startup : Version: &qpidCurrentRelease; Build: 1363863
+[Broker] BRK-1010 : Platform : JVM : Sun Microsystems Inc. version: 1.6.0_24-b07 OS : Windows 7 version: 6.1 arch: amd64
+[Broker] BRK-1011 : Maximum Memory : 1,069,416,448 bytes
+[Broker] BRK-1002 : Starting : Listening on TCP port 5672
+[Broker] BRK-1004 : Qpid Broker Ready</screen>
+    <para>The BRK-1004 message confirms that the Broker is ready for work.  The MNG-1002 and BRK-1004 confirm the ports to
+      which the Broker is listening (for JMX management and AMQP respectively).</para>
+    <para>To stop the Broker, use Control-C or use the Shutdown MBean made from the <xref
+        linkend="Java-Broker-Configuring-And-Managing-JMX"/></para>
+  </section>
+  <section role="h2" id="Java-Broker-Getting-Started-Starting-Stopping-Unix">
+    <title>Starting/Stopping on Unix</title>
+    <para>Firstly change to the installation directory used during the <link linkend="Java-Broker-Installation-InstallationUnix">installation</link>
+      and ensure that the <link linkend="Java-Broker-Installation-InstallationUnix-SettingQPIDWORK">QPID_WORK environment variable is set</link>.</para>
+    <para>Now use the <command>qpid-server</command> script to start the server:</para>
+    <programlisting><![CDATA[bin\qpid-server]]></programlisting>
+    <para>Output similar to the following will be seen:</para>
+    <screen>[Broker] BRK-1006 : Using configuration : /usr/local/qpid/qpid-broker-&qpidCurrentRelease;/etc/config.xml
+[Broker] BRK-1007 : Using logging configuration : /usr/local/qpid/qpid-broker-&qpidCurrentRelease;/etc/log4j.xml
+[Broker] MNG-1001 : Startup
+[Broker] MNG-1002 : Starting : RMI Registry : Listening on port 8999
+[Broker] MNG-1002 : Starting : JMX RMIConnectorServer : Listening on port 9099
+[Broker] MNG-1004 : Ready
+[Broker] BRK-1001 : Startup : Version: &qpidCurrentRelease; Build: 1363863
+[Broker] BRK-1010 : Platform : JVM : Apple Inc. version: 1.6.0_35-b10-428-11M3811 OS : Mac OS X version: 10.8.2 arch: x86_64
+[Broker] BRK-1011 : Maximum Memory : 1,069,416,448 bytes
+[Broker] BRK-1002 : Starting : Listening on TCP port 5672
+[Broker] BRK-1004 : Qpid Broker Ready</screen>
+    <para>The BRK-1004 message confirms that the Broker is ready for work.  The MNG-1002 and BRK-1004 confirm the ports to
+    which the Broker is listening (for JMX management and AMQP respectively).</para>
+    <para>To stop the Broker, use Control-C from the controlling shell, use the
+        <command>bin/qpid.stop</command> script, or use <command>kill -TERM &lt;pid&gt;</command> or
+      the Shutdown MBean from <xref linkend="Java-Broker-Configuring-And-Managing-JMX"/></para>
+  </section>
+  <section role="h2" id="Java-Broker-Getting-Started-LogFile">
+    <title>Log file</title>
+    <para>The Java Broker writes a log file to record both details of its normal operation and any exceptional
+      conditions.  By default the log file is written within the log subdirectory beneath the work directory
+      - <computeroutput>$QPID_WORK/log/qpid.log</computeroutput> (UNIX) and
+      <computeroutput>%QPID_WORK%\log\qpid.log</computeroutput> (Windows).</para>
+    <para>For details of how to control the logging, see <xref linkend="Java-Broker-Runtime-Log-Files"/></para>
+  </section>
+  <section role="h2" id="Java-Broker-Getting-Started-CommandLine">
+    <title>Using the command line</title>
+    <para>The Java Broker understands a number of command line options which may be used to override the configuration.</para>
+    <para>To see usage information for all command line options, use the option <option>--help</option></para>
+    <programlisting><![CDATA[bin/qpid-server --help]]></programlisting>
+    <screen><![CDATA[usage: Qpid [-b address>] [-c <file>] [--exclude-0-10 <port>] [--exclude-0-8 <port>] [--exclude-0-9 <port>] [--exclude-0-9-1
+       <port>] [--exclude-1-0 <port>] [-h] [--include-0-10 <port>] [--include-0-8 <port>] [--include-0-9 <port>] [--include-0-9-1
+       <port>] [--include-1-0 <port>] [--jmxconnectorport <port>] [-l <file>] [-m <port>] [-p <port>] [-s <port>] [-v] [-w <period>]
+ -b,--bind <address>            bind to the specified address. Overrides any value in the config file
+ -c,--config <file>             use given configuration file
+    --exclude-0-10 <port>       when listening on the specified port do not accept AMQP0-10 connections. The
+                                specified port must be one specified on the command line
+    --exclude-0-8 <port>        when listening on the specified port do not accept AMQP0-8 connections. The
+                                specified port must be one specified on the command line
+    --exclude-0-9 <port>        when listening on the specified port do not accept AMQP0-9 connections. The
+                                specified port must be one specified on the command line
+    --exclude-0-9-1 <port>      when listening on the specified port do not accept AMQP0-9-1 connections. The
+                                specified port must be one specified on the command line
+    --exclude-1-0 <port>        when listening on the specified port do not accept AMQP1-0 connections. The
+                                specified port must be one specified on the command line
+ -h,--help                      print this message
+    --include-0-10 <port>       accept AMQP0-10 connections on this port, overriding configuration to the contrary.
+                                The specified port must be one specified on the command line
+    --include-0-8 <port>        accept AMQP0-8 connections on this port, overriding configuration to the contrary.
+                                The specified port must be one specified on the command line
+    --include-0-9 <port>        accept AMQP0-9 connections on this port, overriding configuration to the contrary.
+                                The specified port must be one specified on the command line
+    --include-0-9-1 <port>      accept AMQP0-9-1 connections on this port, overriding configuration to the contrary.
+                                The specified port must be one specified on the command line
+    --include-1-0 <port>        accept AMQP1-0 connections on this port, overriding configuration to the contrary.
+                                The specified port must be one specified on the command line
+    --jmxconnectorport <port>   listen on the specified management (connector server) port. Overrides any
+                                value in the config file
+ -l,--logconfig <file>          use the specified log4j xml configuration file. By default looks for a file named
+                                etc/log4j.xml in the same directory as the configuration file
+ -m,--jmxregistryport <port>    listen on the specified management (registry server) port. Overrides any
+                                value in the config file
+ -p,--port <port>               listen on the specified port. Overrides any value in the config file
+ -s,--sslport <port>            SSL port. Overrides any value in the config file
+ -v,--version                   print the version information and exit
+ -w,--logwatch <period>         monitor the log file configuration file for changes. Units are seconds. Zero means
+                                do not check for changes.]]></screen>
+  </section>
+
 </chapter>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-High-Availability.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-High-Availability.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-High-Availability.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-High-Availability.xml Mon Nov 19 12:47:53 2012
@@ -1,10 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE urls [
-<!ENTITY oracleBdbProductOverviewUrl "http://www.oracle.com/technetwork/products/berkeleydb/overview/index-093405.html">
-<!ENTITY oracleBdbProductVersion "5.0.58">
-<!ENTITY oracleBdbRepGuideUrl "http://oracle.com/cd/E17277_02/html/ReplicationGuide/">
-<!ENTITY oracleBdbJavaDocUrl "http://docs.oracle.com/cd/E17277_02/html/java/">
-<!ENTITY oracleJdkDocUrl "http://oracle.com/javase/6/docs/api/">
+<!DOCTYPE entities [
+<!ENTITY %  entities SYSTEM  "commonEntities.xml">
+%entities;
 ]>
 <!--
 
@@ -297,6 +294,9 @@
     <title>Configuring a Virtual Host to be a node</title>
     <para>To configure a virtualhost as a cluster node, configure the virtualhost.xml in the following manner:</para>
     <para>
+
+    <example>
+      <title>Configuring a VirtualHost to use the BDBHAMessageStore</title>
       <programlisting language="xml"><![CDATA[
 <virtualhost>
   <name>myhost</name>
@@ -317,6 +317,7 @@
     ...
  </myvhost>
 </virtualhost>]]></programlisting>
+    </example>
     </para>
     <para>The <varname>groupName</varname> is the name of logical name of the cluster.  All nodes within the
       cluster must use the same <varname>groupName</varname> in order to be considered part of the cluster.</para>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Installation.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Installation.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Installation.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Installation.xml Mon Nov 19 12:47:53 2012
@@ -1,4 +1,8 @@
 <?xml version="1.0"?>
+<!DOCTYPE entities [
+<!ENTITY %  entities SYSTEM  "commonEntities.xml">
+%entities;
+]>
 <!--
 
  Licensed to the Apache Software Foundation (ASF) under one
@@ -22,4 +26,160 @@
 
 <chapter id="Java-Broker-Installation">
   <title>Installation</title>
+  <section role="h2" id="Java-Broker-Installation-Introduction">
+    <title>Introduction</title>
+    <para>This document describes how to install the Java Broker on both Windows and UNIX
+      platforms.</para>
+  </section>
+  <section role="h2" id="Java-Broker-Installation-Prerequistes">
+    <title>Prerequisites</title>
+    <section role="h3" id="Java-Broker-Installation-Prerequistes-Java">
+      <title>Java Platform</title>
+      <para>
+        The Java Broker is an 100% Java implementation and as such it can be used on any operating
+        system supporting Java 1.6 or higher. This includes Linux, Solaris, Mac OS X, and Windows XP/Vista/7/8.</para>
+      <para>
+        The broker has been tested with Java implementations from both Oracle and IBM.  Whatever
+        platform you chose, it is recommended that you ensure it is patched with any critical updates made
+        available from the vendor.
+      </para>
+      <para>
+        Verify that your JVM is installed properly by following <link linkend="Java-Broker-Miscellaneous-JVM-Verification">these instructions.</link>
+      </para>
+    </section>
+    <section role="h3" id="Java-Broker-Installation-Prerequistes-Disk">
+      <title>Disk</title>
+      <para>The Java Broker installation requires approximately 20MB of free disk space.</para>
+      <para>The Java Broker also requires a working directory.  The working directory is used for
+        the message store, that is, the area of the file-system used to record persistent messages whilst they
+        are passing through the Broker.  The working directory is also used for the default location of the log file.
+        The size of the working directory will depend on the how the Broker is used.</para>
+      <para>The performance of the file system hosting the work directory is key to the performance of Broker as
+        a whole.  For best performance, choose a device that has low latency and one that is uncontended by other
+        applications.</para>
+      <para>Be aware that there are additional considerations if you are considering hosting the working directory on NFS. See
+        <xref linkend="Java-Broker-Stores"/> for further details.</para>
+    </section>
+    <section role="h3" id="Java-Broker-Installation-Prerequistes-Memory">
+      <title>Memory</title>
+      <para>Qpid caches messages on the heap for performance reasons, so in general, the Broker will
+        benefit from as much heap as possible. However, on a 32bit JVM, the maximum addressable memory range
+        for a process is 4GB, after leaving space for the JVM's own use this will give a maximum heap size
+        of approximately ~3.7GB.</para>
+    </section>
+    <section role="h3" id="Java-Broker-Installation-Prerequistes-OperatingSystemAccount">
+      <title>Operating System Account</title>
+      <para>Installation or operation of Qpid does <emphasis>not</emphasis> require a privileged account (i.e. root
+      on UNIX platforms or Administrator on Windows).  However it is suggested that you use an dedicated account
+      (e.g. qpid) for the installation and operation of the Java Broker.</para>
+    </section>
+  </section>
+
+  <section role="h2" id="Java-Broker-Installation-Download">
+    <title>Download</title>
+    <section role="h3" id="Java-Broker-Installation-Download-Release">
+      <title>Broker Release</title>
+      <para>You can download the latest qpid-java-broker-&qpidCurrentRelease;.tar.gz package from the <ulink
+        url="&qpidDownloadUrl;">Download Page</ulink>.
+      </para>
+      <para> It is recommended that you confirm the integrity of the download by verifying the PGP signature
+        matches that available on the site. Instrutions are given on the download page.
+      </para>
+    </section>
+    <section role="h3" id="Java-Broker-Installation-Download-OptionalDependencies">
+      <title>Optional Dependencies</title>
+      <para>The broker has an optional message store implementations backed by Oracle BDB JE. If you wish to use these
+        stores you will need to provide the optional Oracle BDB JE dependency. For more details, see <xref linkend="Java-Broker-Stores-BDB-Store"></xref>
+      </para>
+    </section>
+  </section>
+
+  <section role="h2" id="Java-Broker-Installation-InstallationWindows">
+    <title>Installation on Windows</title>
+    <para>
+      Firstly, verify that your JVM is installed properly by following
+      <link linkend="Java-Broker-Miscellaneous-JVM-Verification-Windows">these instructions.</link>
+    </para>
+    <para>Now chose a directory for Qpid broker installation.  This directory will be used for the Qpid JARs and configuration files.
+      It need not be the same location as the store used for the persistent messages or the log file (you will chose this
+      location later).   For the remainder this example we will assumed that location c:\qpid has been chosen.</para>
+    <para>Now using WinZip<footnote><para>WinZip is a Registered Trademark of WinZip International LLC</para></footnote> (or similar)
+      extract the Qpid package qpid-java-broker-&qpidCurrentRelease;.tar.gz into the directory.</para>
+    <para>The extraction of the Qpid package will have created a directory qpid-broker-&qpidCurrentRelease; within c:\qpid</para>
+    <screen>Volume in drive C has no label
+
+ Directory of c:\qpid\qpid-broker-&qpidCurrentRelease;
+
+07/25/2012  11:22 PM                   .
+09/30/2012  10:51 AM                   ..
+09/30/2012  12:24 AM                   bin
+08/21/2012  11:17 PM                   etc
+07/25/2012  11:22 PM                   lib
+07/20/2012  08:10 PM            65,925 LICENSE
+07/20/2012  08:10 PM             3,858 NOTICE
+07/20/2012  08:10 PM             1,346 README.txt
+               3 File(s)         71,129 bytes
+               5 Dir(s)  743,228,796,928 bytes free</screen>
+    <section role="h3" id="Java-Broker-Installation-InstallationWindows-SettingQPIDWORK">
+      <title>Setting the working directory</title>
+      <para>Qpid requires a work directory.  This directory is used for the default location of the Qpid log
+        file and is used for the storage of persistent messages.  The work directory can be set on the
+        command-line (for the lifetime of the command interpreter), but you will normally want to set
+        the environment variable permanently via the Advanced System Settings in the Control Panel.</para>
+      <screen>set QPID_WORK=S:\qpidwork</screen>
+      <para>If the directory referred to by QPID_WORK does not exist, the Java Broker will attempt to create it
+         on start-up.</para>
+    </section>
+    <section role="h3" id="Java-Broker-Installation-InstallationWindows-OptionalDependencies">
+      <title>Optional Dependencies</title>
+      <para>The broker has an optional message store implementations backed by Oracle BDB JE. If you wish to use these
+        stores you will need to provide the optional Oracle BDB JE dependency. For more details, see <xref linkend="Java-Broker-Stores-BDB-Store"></xref>
+      </para>
+    </section>
+  </section>
+
+  <section role="h2" id="Java-Broker-Installation-InstallationUnix">
+    <title>Installation on UNIX platforms</title>
+    <para>
+      Firstly, verify that your JVM is installed properly by following
+      <link linkend="Java-Broker-Miscellaneous-JVM-Verification-Unix">these instructions.</link>
+    </para>
+    <para>Now chose a directory for Qpid broker installation.  This directory will be used for the Qpid JARs and configuration files.
+      It need not be the same location as the store used for the persistent messages or the log file (you will chose this
+      location later).   For the remainder this example we will assumed that location /usr/local/qpid has been chosen.</para>
+    <para>Extract the Qpid package qpid-java-broker-&qpidCurrentRelease;.tar.gz into the directory.</para>
+    <programlisting>mkdir /usr/local/qpid
+cd /usr/local/qpid
+tar xvzf qpid-java-broker-&qpidCurrentRelease;.tar.gz></programlisting>
+    <para>The extraction of the Qpid package will have created a directory qpid-broker-x.x</para>
+    <screen>ls -la qpid-broker-&qpidCurrentRelease;/
+total 152
+drwxr-xr-x   8 qpid  qpid    272 25 Jul 23:22 .
+drwxr-xr-x  45 qpid  qpid   1530 30 Sep 10:51 ..
+-rw-r--r--@  1 qpid  qpid  65925 20 Jul 20:10 LICENSE
+-rw-r--r--@  1 qpid  qpid   3858 20 Jul 20:10 NOTICE
+-rw-r--r--@  1 qpid  qpid   1346 20 Jul 20:10 README.txt
+drwxr-xr-x  10 qpid  qpid    340 30 Sep 00:24 bin
+drwxr-xr-x   9 qpid  qpid    306 21 Aug 23:17 etc
+drwxr-xr-x  34 qpid  qpid   1156 25 Jul 23:22 lib
+    </screen>
+    <section role="h3" id="Java-Broker-Installation-InstallationUnix-SettingQPIDWORK">
+      <title>Setting the working directory</title>
+      <para>Qpid requires a work directory.  This directory is used for the default location of the Qpid log
+        file and is used for the storage of persistent messages.  The work directory can be set on the
+        command-line (for the lifetime of the current shell), but you will normally want to set
+        the environment variable permanently the user's shell profile file (~/.bash_profile for Bash etc).</para>
+      <screen><![CDATA[export QPID_WORK=/var/qpidwork]]>
+      </screen>
+      <para>If the directory referred to by QPID_WORK does not exist, the Java Broker will attempt to create it
+         on start-up.
+      </para>
+    </section>
+    <section role="h3" id="Java-Broker-Installation-InstallationUnix-OptionalDependencies">
+      <title>Optional Dependencies</title>
+      <para>The broker has an optional message store implementations backed by Oracle BDB JE. If you wish to use these
+        stores you will need to provide the optional Oracle BDB JE dependency. For more details, see <xref linkend="Java-Broker-Stores-BDB-Store"></xref>
+      </para>
+    </section>
+  </section>
 </chapter>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Introduction.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Introduction.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Introduction.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Introduction.xml Mon Nov 19 12:47:53 2012
@@ -1,4 +1,8 @@
 <?xml version="1.0"?>
+<!DOCTYPE chapter[
+<!ENTITY %  entities SYSTEM  "commonEntities.xml">
+%entities;
+]>
 <!--
 
  Licensed to the Apache Software Foundation (ASF) under one
@@ -22,4 +26,64 @@
 
 <chapter id="Java-Broker-Introduction">
   <title>Introduction</title>
+  <para>The Java Broker is a powerful open-source message broker that implements all versions of the
+      <ulink url="http://www.amqp.org"> Advanced Message Queuing Protocol (AMQP)</ulink>. The Java
+    Broker is actually one of two message brokers provided by the <ulink
+      url="http://qpid.apache.org">Apache Qpid project</ulink>: the Java Broker and the C++
+    Broker.</para>
+  <para>This document relates to the Java Broker. The <ulink url="&qpidCppBook;">C++ Broker is
+    described separately</ulink>.</para>
+  <para><emphasis>Headline features</emphasis></para>
+  <itemizedlist mark="circle">
+    <listitem>
+      <para>100% Java implementation - runs on any platform supporting Java 1.6 or higher</para>
+    </listitem>
+    <listitem>
+      <para>Messaging clients support in Java, C++, Python.</para>
+    </listitem>
+    <listitem>
+      <para>JMS 1.1 compliance (Java client).</para>
+    </listitem>
+    <listitem>
+      <para>Persistent and non-persistent (transient) message support</para>
+    </listitem>
+    <listitem>
+      <para>Supports for all common messaging patterns (point-to-point, publish/subscribe, fan-out
+        etc).</para>
+    </listitem>
+    <listitem>
+      <para>Transaction support including XA<footnote>
+          <para>XA provided when using AMQP 0-10</para>
+        </footnote></para>
+    </listitem>
+    <listitem>
+      <para>Supports for all versions of the AMQP protocol</para>
+    </listitem>
+    <listitem>
+      <para>Automatic message translation, allowing clients using different AMQP versions to communicate with each other.</para>
+    </listitem>
+    <listitem>
+      <para>Pluggable authentication architecture with out-of-the-box support for Kerberos, LDAP,
+        External, and file-based authentication mechanisms.</para>
+    </listitem>
+    <listitem>
+      <para>Pluggable message store architecture with implementations based on <ulink
+          url="http://db.apache.org/derby/">Apache Derby</ulink>, <ulink
+          url="&oracleBdbProductOverviewUrl;">Oracle BDB JE</ulink><footnote>
+          <para>Oracle BDB JE must be downloaded separately.</para>
+        </footnote>, and Memory Store</para>
+    </listitem>
+    <listitem>
+      <para>Web based management interface and programmatic management interfaces  via REST and JMX
+        APIs.</para>
+    </listitem>
+    <listitem>
+      <para>SSL support</para>
+    </listitem>
+    <listitem>
+      <para>High availability (HA) support.<footnote>
+          <para>HA currently only available to users of the optional BDB JE HA based message store.</para>
+        </footnote></para>
+    </listitem>
+  </itemizedlist>
 </chapter>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Queues-OtherTypes.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Queues-OtherTypes.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Queues-OtherTypes.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Queues-OtherTypes.xml Mon Nov 19 12:47:53 2012
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE urls [
-<!ENTITY oracleJeeDocUrl "http://docs.oracle.com/javaee/6/api/">
+<!DOCTYPE entities [
+<!ENTITY %  entities SYSTEM  "commonEntities.xml">
+%entities;
 ]>
 <!--
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Security-Authentication-Providers.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Security-Authentication-Providers.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Security-Authentication-Providers.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Security-Authentication-Providers.xml Mon Nov 19 12:47:53 2012
@@ -26,55 +26,22 @@
   <para>
     In order to successfully establish a connection to the Java Broker, the connection must be
     authenticated. The Java Broker supports a number of different authentication schemes, each
-    with its own "authentication manager". Different managers may be used on different ports.
-    Each manager has its own configuration element, the presence of which within the
-    &lt;security&gt; section denotes the use of that authentication provider. Where only one
-    such manager is configured, that manager will be used on all ports (including JMX). Where
-    more than one authentication manager is configured the configuration must define which
-    manager is the "default", and (if required) the mapping of non-default authentication
-    managers to other ports.
-  </para>
-  <para>
-    The following configuration sets up three authentication managers, using a password file as
-    the default (e.g. for the JMX port), Kerberos on port 5672 and Anonymous on 5673.
+    with its own "authentication manager". Each of these are outlined below, along with details
+    of <link linkend="MultipleAuthProviders"> using more than one at a time</link>.
   </para>
 
-  <example>
-    <title>Configuring different authentication schemes on different ports</title>
-    <programlisting><![CDATA[
-<security>
-    <pd-auth-manager>
-	<principal-database>
-	    <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
-	    <attributes>
-		<attribute>
-		    <name>passwordFile</name>
-		    <value>${conf}/passwd</value>
-		</attribute>
-	    </attributes>
-	</principal-database>
-    </pd-auth-manager>
-    <kerberos-auth-manager><auth-name>sib</auth-name></kerberos-auth-manager>
-    <anonymous-auth-manager></anonymous-auth-manager>
-    <default-auth-manager>PrincipalDatabaseAuthenticationManager</default-auth-manager>
-    <port-mappings>
-	<port-mapping>
-	    <port>5672</port>
-	    <auth-manager>KerberosAuthenticationManager</auth-manager>
-	</port-mapping>
-	<port-mapping>
-	    <port>5673</port>
-	    <auth-manager>AnonymousAuthenticationManager</auth-manager>
-	</port-mapping>
-    </port-mappings>
-</security>]]>
-    </programlisting>
-  </example>
+  <section>
+    <title>Password File</title>
+    <para>
+      TODO
+    </para>
 
-  <section><title>Password File</title></section>
-  <section><title>LDAP</title>
+  </section>
+
+  <section>
+  <title>LDAP</title>
   <example>
-    <title>Configuring a LDAP authentication</title>
+    <title>Configuring LDAP authentication</title>
     <programlisting><![CDATA[
 <security>
     <simple-ldap-auth-manager>
@@ -82,8 +49,8 @@
       <search-context>dc=example\,dc=com</search-context>
       <search-filter>(uid={0})</search-filter>
     </simple-ldap-auth-manager>
-</security>]]>
-    </programlisting>
+    ...
+</security>]]></programlisting>
   </example>
 
   <para>
@@ -111,9 +78,10 @@
     By default com.sun.jndi.ldap.LdapCtxFactory is used to create the context, however this can be
     overridden by specifying &lt;ldap-context-factory&gt; in the configuration.
   </para>
-
   </section>
-  <section><title>Kerberos</title>
+
+  <section>
+  <title>Kerberos</title>
 
   <para>
     Kereberos Authentication is configured using the &lt;kerberos-auth-manager&gt; element within
@@ -128,30 +96,30 @@
   </para>
 
   <example>
-    <title>Configuring a Kerberos authentication</title>
+    <title>Configuring Kerberos authentication</title>
     <programlisting><![CDATA[
 <security>
-    <pd-auth-manager>
-	<principal-database>
-	    <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
-	    <attributes>
-		<attribute>
-		    <name>passwordFile</name>
-		    <value>${conf}/passwd</value>
-		</attribute>
-	    </attributes>
-	</principal-database>
-    </pd-auth-manager>
-    <kerberos-auth-manager></kerberos-auth-manager>
-    <default-auth-manager>PrincipalDatabaseAuthenticationManager</default-auth-manager>
-    <port-mappings>
-	<port-mapping>
-	    <port>5672</port>
-	    <auth-manager>KerberosAuthenticationManager</auth-manager>
-	</port-mapping>
-    </port-mappings>
-</security>]]>
-    </programlisting>
+  <pd-auth-manager>
+    <principal-database>
+      <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
+      <attributes>
+        <attribute>
+          <name>passwordFile</name>
+          <value>${conf}/passwd</value>
+        </attribute>
+      </attributes>
+    </principal-database>
+  </pd-auth-manager>
+  <kerberos-auth-manager/>
+  <default-auth-manager>PrincipalDatabaseAuthenticationManager</default-auth-manager>
+  <port-mappings>
+    <port-mapping>
+      <port>5672</port>
+      <auth-manager>KerberosAuthenticationManager</auth-manager>
+    </port-mapping>
+  </port-mappings>
+  ...
+</security>]]></programlisting>
   </example>
 
   <para>
@@ -177,8 +145,7 @@ com.sun.security.jgss.accept {
     kdc="kerberos.example.com"
     keyTab="/path/to/keytab-file"
     principal="<name>/<host>";
-};]]>
-  </programlisting>
+};]]></programlisting>
 
   <para>
     Where realm, kdc, keyTab and principal should obviously be set correctly for the environment
@@ -191,7 +158,137 @@ com.sun.security.jgss.accept {
     Jurisdiction Policy Files" appropriate for your JDK in order to get Kerberos support working.
   </para>
   </section>
-  <section><title>SSL Client Certificates</title></section>
-  <section><title>Anonymous</title></section>
+
+  <section id="ExternalAuthManager">
+    <title>External (SSL Client Certificates)</title>
+
+    <para>
+      When <link linkend="SSL-Truststore-ClientCertificate"> requiring SSL Client Certificates</link> be
+      presented the ExternalAuthenticationManager can be used, such that the user is authenticated based on
+      trust of their certificate alone, and the X500Principal from the SSL session is then used as the username
+      for the connection, instead of also requiring the user to present a valid username and password.
+    </para>
+
+    <para>
+      The ExternalAuthenticationManager may be enabled by adding an empty &lt;external-auth-manager&gt; element to
+      the &lt;security&gt; section, as shown below. When referencing it from the default-auth-manager or port-mapping
+      sections, its name is ExternalAuthenticationManager.
+    </para>
+
+    <para>
+      <emphasis role="bold">Note:</emphasis> The ExternalAuthenticationManager should typically only be used on the
+      AMQP ports, in conjunction with <link linkend="SSL-Truststore-ClientCertificate">SSL client certificate
+      authentication</link>. It is not intended for other uses such as the JMX management port and will treat any
+      non-sasl authentication processes on these ports as successfull with the given username. As such you should
+      <link linkend="MultipleAuthProviders">include another Authentication Manager for use on non-AMQP ports</link>,
+      as is done in the example below. Perhaps the only exception to this would be where the broker is embedded in a
+      container that is itself externally protecting the HTTP interface and then providing the remote users name.
+    </para>
+
+    <example>
+      <title>Configuring external authentication (SSL client auth)</title>
+      <programlisting><![CDATA[
+<security>
+  <pd-auth-manager>
+    <principal-database>
+      <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
+      <attributes>
+        <attribute>
+          <name>passwordFile</name>
+          <value>${conf}/passwd</value>
+        </attribute>
+      </attributes>
+    </principal-database>
+  </pd-auth-manager>
+  <external-auth-manager/>
+  <default-auth-manager>PrincipalDatabaseAuthenticationManager</default-auth-manager>
+  <port-mappings>
+    <port-mapping>
+      <port>5672</port>
+      <auth-manager>ExternalAuthenticationManager</auth-manager>
+    </port-mapping>
+  </port-mappings>
+  ...
+</security>]]></programlisting>
+    </example>
+
+  </section>
+
+  <section id="AnonymousAuthManager">
+    <title>Anonymous</title>
+
+    <para>
+      The AnonymousAuthenticationManager will allow users to connect with or without credentials and result
+      in their identification on the broker as the user ANONYMOUS. It may be enabled by adding an empty
+      anonymous-auth-manager element to the security configuration section, as shown below.
+    </para>
+
+    <example>
+      <title>Configuring anonymous authentication</title>
+
+      <programlisting><![CDATA[
+<security>
+  <anonymous-auth-manager/>
+  ...
+</security>]]></programlisting>
+    </example>
+
+    <para>
+      When referencing it from the default-auth-manager or port-mapping sections, its name is
+      AnonymousAuthenticationManager.
+    </para>
+  </section>
+
+  <section id="MultipleAuthProviders">
+    <title>Configuring multiple Authentication Providers</title>
+    <para>
+      Different managers may be used on different ports. Each manager has its own configuration element,
+      the presence of which within the &lt;security&gt; section denotes the use of that authentication
+      provider. Where only one such manager is configured, it will be used on all ports (including JMX
+      and HTTP). Where more than one authentication manager is configured the configuration must define
+      which is the "default", and (if required) the mapping of non-default authentication managers to
+      other ports.
+    </para>
+    <para>
+      The following configuration sets up three authentication managers, using a password file as the
+      default (e.g. for the JMX and HTTP ports), Kerberos on port 5672 (the regular AMQP port) and Anonymous
+      on port 5673 (e.g a second AMQP port the broker could have been configured with).
+    </para>
+
+    <example>
+      <title>Configuring multiple (per-port) authentication schemes</title>
+      <programlisting><![CDATA[
+<security>
+  <pd-auth-manager>
+    <principal-database>
+      <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
+      <attributes>
+        <attribute>
+          <name>passwordFile</name>
+          <value>${conf}/passwd</value>
+        </attribute>
+      </attributes>
+    </principal-database>
+  </pd-auth-manager>
+  <kerberos-auth-manager>
+    <auth-name>sib</auth-name>
+  </kerberos-auth-manager>
+  <anonymous-auth-manager/>
+  <default-auth-manager>PrincipalDatabaseAuthenticationManager</default-auth-manager>
+  <port-mappings>
+    <port-mapping>
+      <port>5672</port>
+        <auth-manager>KerberosAuthenticationManager</auth-manager>
+      </port-mapping>
+    <port-mapping>
+      <port>5673</port>
+        <auth-manager>AnonymousAuthenticationManager</auth-manager>
+    </port-mapping>
+  </port-mappings>
+  ...
+</security>]]></programlisting>
+    </example>
+  </section>
+
 </section>
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Security-SSL.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Security-SSL.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Security-SSL.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Security-SSL.xml Mon Nov 19 12:47:53 2012
@@ -21,6 +21,85 @@
 -->
 
 <section id="Java-Broker-Security-SSL">
-<title>SSL</title>
+    <title>SSL</title>
 
+    <para>
+        This section will show how to use SSL to enable secure
+        connections between an AMQP message client and the broker.
+    </para>
+    <section role="h2" id="SSL-Keystore">
+        <title>Keystore Configuration</title>
+        <para>
+            The broker configuration file (config.xml) needs to be updated to include the required SSL keystore
+            configuration, an example of which can be found below.
+        </para>
+
+        <example>
+        <title>Configuring an SSL Keystore</title>
+        <programlisting><![CDATA[
+<connector>
+  ...
+  <ssl>
+    <enabled>true</enabled>
+    <port>5671</port>
+    <sslOnly>false</sslOnly>
+    <keyStorePath>/path/to/keystore.ks</keyStorePath>
+    <keyStorePassword>keystorepass</keyStorePassword>
+    <certAlias>alias<certAlias>
+  </ssl>
+  ...
+<connector>]]></programlisting>
+        </example>
+
+        <para>
+            The certAlias element is an optional way of specifying which certificate the broker should use
+            if the keystore contains multiple entries.
+        </para>
+
+        <para>
+            The sslOnly element controls whether the broker will <emphasis role="bold">only</emphasis> bind
+            the configured SSL port(s) or will also bind the non-SSL port(s). Setting sslOnly to true will
+            disable the non-SSL ports.
+        </para>
+    </section>
+
+    <section role="h2" id="SSL-Truststore-ClientCertificate">
+        <title>Truststore / Client Certificate Authentication</title>
+        <para>
+            The SSL trustore and related Client Certificate Authentication behaviour can be configured with
+            additional configuration as shown in the example below, in which the broker requires client
+            certificate authentication.
+        </para>
+
+        <example>
+        <title>Configuring an SSL Truststore and client auth</title>
+        <programlisting><![CDATA[
+<connector>
+  ...
+  <ssl>
+    ...
+    <trustStorePath>/path/to/truststore.ks</trustStorePath>
+    <trustStorePassword>truststorepass</trustStorePassword>
+    <needClientAuth>true</needClientAuth>
+    <wantClientAuth>false</wantClientAuth>
+    ...
+  </ssl>
+  ...
+<connector>]]></programlisting>
+        </example>
+
+        <para>
+            The needClientAuth and wantClientAuth elements allow control of whether the client must present an
+            SSL certificate. Only one of these elements is needed but both may be used at the same time.
+            A socket's client authentication setting is one of three states: required (needClientAuth = true),
+            requested (wantClientAuth = true), or none desired (both false, the default). If both elements are
+            set to true, needClientAuth takes precedence.
+        </para>
+
+        <para>
+            When using Client Certificate Authentication it may be desirable to use the External Authentication
+            Manager, for details see <xref linkend="ExternalAuthManager"></xref>
+        </para>
+
+    </section>
 </section>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-BDB-Store.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-BDB-Store.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-BDB-Store.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-BDB-Store.xml Mon Nov 19 12:47:53 2012
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE entities [
+<!ENTITY %  entities SYSTEM  "commonEntities.xml">
+%entities;
+]>
 <!--
 
  Licensed to the Apache Software Foundation (ASF) under one
@@ -21,6 +25,72 @@
 -->
 
 <section id="Java-Broker-Stores-BDB-Store">
-<title>BDB Store</title>
+  <title>BDB Store</title>
+  <para>
+    The Java broker has an <emphasis>optional</emphasis> message store implementation backed by Oracle BDB JE.
+    This section will detail where to download the optional dependency from, how to add it to the broker installation,
+    and provide an example configuration for using the BDBMessageStore.
+  </para>
+
+  <section role="h3" id="Java-Broker-Stores-BDB-Store-BDBJE-Download">
+    <title>Oracle BDB JE download</title>
+    <para>
+      The BDB based message store is optional due to its dependency on Oracle BDB JE, which is distributed under the Sleepycat
+      licence. As a result of this, the dependency cant be distributed by the Apache Qpid project as part of the broker release package.
+    </para>
+    <para>
+       If you wish to use the BDBMessageStore, then you must download the Oracle BDB JE &oracleBdbProductVersion; release
+      <ulink url="&oracleJeDownloadUrl;">from the Oracle website.</ulink>
+    </para>
+    <para>
+      The download has a name in the form je-&oracleBdbProductVersion;.tar.gz. It is recommended that you
+      confirm the integrity of the download by verifying the MD5.
+    </para>
+  </section>
+
+  <section role="h3" id="Java-Broker-Stores-BDB-Store-BDBJE-Installation">
+    <title>Oracle BDB JE jar installation</title>
+    <para>
+      If you wish to use the BDBMessageStore, copy the je-&oracleBdbProductVersion;.jar from within the release
+      downloaded <link linkend="Java-Broker-Stores-BDB-Store-BDBJE-Download">above</link> into an 'opt' sub-directory
+      of the brokers 'lib' directory.
+    </para>
+
+    <programlisting>Unix:
+mkdir qpid-broker-&qpidCurrentRelease;/lib/opt
+cp je-&oracleBdbProductVersion;.jar qpid-broker-&qpidCurrentRelease;/lib/opt</programlisting>
+
+      <programlisting>Windows:
+mkdir qpid-broker-&qpidCurrentRelease;\lib\opt
+copy je-&oracleBdbProductVersion;.jar qpid-broker-&qpidCurrentRelease;\lib\opt</programlisting>
+  </section>
+
+
+
+  <section role="h3" id="Java-Broker-Stores-BDB-Store-Configuration">
+    <title>Configuration</title>
+    <para>
+      In order to use the BDBMessageStore, you must configure it for each VirtualHost desired by updating the store element
+      to specify the associated store class and provide a directory location for the data to be written, as shown below.
+    </para>
+
+    <example>
+      <title>Configuring a VirtualHost to use the BDBMessageStore</title>
+      <programlisting><![CDATA[
+<virtualhosts>
+  <virtualhost>
+    <name>vhostname</name>
+    <vhostname>
+      <store>
+        <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
+        <environment-path>${QPID_WORK}/bdbstore/vhostname</environment-path>
+      </store>
+      ...
+    </vhostname>
+  </virtualhost>
+</virtualhosts>
+]]></programlisting>
+    </example>
+  </section>
 
 </section>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-Derby-Store.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-Derby-Store.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-Derby-Store.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-Derby-Store.xml Mon Nov 19 12:47:53 2012
@@ -22,5 +22,35 @@
 
 <section id="Java-Broker-Stores-Derby-Store">
 <title>Derby Store</title>
+  <para>
+    The Java broker has a message store implementation backed by Apache Derby.
+    This section will detail configuration for using the DerbyMessageStore.
+  </para>
+
+  <section role="h3" id="Java-Broker-Stores-Derby-Store-Configuration">
+    <title>Configuration</title>
+    <para>
+      In order to use the DerbyMessageStore, you must configure it for each VirtualHost desired by updating the store element
+      to specify the associated store class and provide a directory location for the data to be written, as shown below.
+    </para>
+
+    <example>
+      <title>Configuring a VirtualHost to use the DerbyMessageStore</title>
+      <programlisting><![CDATA[
+<virtualhosts>
+  <virtualhost>
+    <name>vhostname</name>
+    <vhostname>
+      <store>
+        <class>org.apache.qpid.server.store.DerbyMessageStore</class>
+        <environment-path>${QPID_WORK}/derbystore/vhostname</environment-path>
+      </store>
+      ...
+    </vhostname>
+  </virtualhost>
+</virtualhosts>
+]]></programlisting>
+    </example>
+  </section>
 
 </section>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-HA-BDB-Store.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-HA-BDB-Store.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-HA-BDB-Store.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-HA-BDB-Store.xml Mon Nov 19 12:47:53 2012
@@ -21,6 +21,42 @@
 -->
 
 <section id="Java-Broker-Stores-HA-BDB-Store">
-<title>High Availability BDB Store</title>
+  <title>High Availability BDB Store</title>
+  <para>
+    The Java broker has an <emphasis>optional</emphasis> High Availability message store implementation backed by Oracle BDB JE HA.
+    This section references information on where to download the optional dependency from, how to add it to the broker
+    installation, and how to configure the BDBHAMessageStore.
+  </para>
+  <para>
+    For more detailed information about use of this store, see <xref linkend="Java-Broker-High-Availability"></xref>.
+  </para>
+
+  <section role="h3" id="Java-Broker-Stores-HA-BDB-Store-BDBJE-Download">
+    <title>Oracle BDB JE download</title>
+    <para>
+      For details, see <xref linkend="Java-Broker-Stores-BDB-Store-BDBJE-Download"></xref>.
+    </para>
+  </section>
+
+  <section role="h3" id="Java-Broker-Stores-HA-BDB-Store-BDBJE-Installation">
+    <title>Oracle BDB JE jar installation</title>
+    <para>
+      For details, see <xref linkend="Java-Broker-Stores-BDB-Store-BDBJE-Installation"></xref>.
+    </para>
+  </section>
+
+  <section role="h3" id="Java-Broker-Stores-HA-BDB-Store-Configuration">
+    <title>Configuration</title>
+    <para>
+      In order to use the BDBHAMessageStore, you must configure it for each VirtualHost desired by updating the store element
+      to specify the associated store class, provide a directory location for the data to be written, and configure the
+      replication group and policies used by BDB JA HA.
+    </para>
+    <para>
+      A general configuration example is shown <link linkend="Java-Broker-High-Availability-Configuration">here</link>, however it
+      is strongly recommended you examine the wider context of <xref linkend="Java-Broker-High-Availability"></xref> for a fuller
+      discussion of the various configuration options and how to use them.
+    </para>
+  </section>
 
 </section>

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-Memory-Store.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-Memory-Store.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-Memory-Store.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/doc/book/src/java-broker/Java-Broker-Stores-Memory-Store.xml Mon Nov 19 12:47:53 2012
@@ -21,6 +21,41 @@
 -->
 
 <section id="Java-Broker-Stores-Memory-Store">
-<title>Memory Store</title>
+  <title>Memory Store</title>
+  <para>
+    The Java broker has an in-memory message store implementation.
+    This section will detail configuration for using the MemoryMessageStore.
+  </para>
+  <para>
+    Note: when using this store, the broker will store both persistent and non-persistent messages
+    in memory, which is to say that neither will be available following a broker restart, and the
+    ability to store new messages will be entirely constrained by the JVM heap size.
+  </para>
+
+  <section role="h3" id="Java-Broker-Stores-Derby-Store-Configuration">
+    <title>Configuration</title>
+    <para>
+      In order to use the MemoryMessageStore, you must configure it for each VirtualHost desired by updating the store element
+      to specify the associated store class, as shown below.
+    </para>
+
+    <example>
+      <title>Configuring a VirtualHost to use the MemoryMessageStore</title>
+      <programlisting><![CDATA[
+<virtualhosts>
+  <virtualhost>
+    <name>vhostname</name>
+    <vhostname>
+      <store>
+        <class>org.apache.qpid.server.store.MemoryMessageStore</class
+      </store>
+      ...
+    </vhostname>
+  </virtualhost>
+</virtualhosts>
+]]></programlisting>
+    </example>
+  </section>
+
 
 </section>

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/amqp-1-0-client:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/amqp-1-0-client-jms:r1401294-1411033

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/build.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/build.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/build.xml Mon Nov 19 12:47:53 2012
@@ -24,6 +24,9 @@
   <property name="module.depends" value="amqp-1-0-common amqp-1-0-client"/>
   <property name="module.genpom.args" value="-Sgeronimo-jms_1.1_spec=provided"/>
 
+  <property name="example.src.dir" value="${project.root}/amqp-1-0-client-jms/example/src/main/java" />
+  <property name="example.jar.file" value="${build.lib}/qpid-amqp-1-0-client-jms-example-${project.version}.jar" />
+
 
   <target name="release-bin-copy-readme">
       <copy todir="${module.release}" overwrite="true" failonerror="true">

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ConnectionImpl.java Mon Nov 19 12:47:53 2012
@@ -282,7 +282,7 @@ public class ConnectionImpl implements C
                 {
                     task.onClose();
                 }
-                if(_state != State.UNCONNECTED ) {
+                if(_conn != null && _state != State.UNCONNECTED ) {
                     _conn.close();
                 }
                 _state = State.CLOSED;
@@ -331,6 +331,10 @@ public class ConnectionImpl implements C
                                                               final int i) throws JMSException
     {
         checkClosed();
+        if (_isQueueConnection)
+        {
+            throw new IllegalStateException("QueueConnection cannot be used to create Pub/Sub based resources.");
+        } 
         return null;  //TODO
     }
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java Mon Nov 19 12:47:53 2012
@@ -316,9 +316,9 @@ public class MessageConsumerImpl impleme
         _lastUnackedMessage = deliveryTag;
     }
 
-    void preReceiveAction(final org.apache.qpid.amqp_1_0.client.Message msg) throws IllegalStateException
+    void preReceiveAction(final org.apache.qpid.amqp_1_0.client.Message msg)
     {
-        final int acknowledgeMode = _session.getAcknowledgeMode();
+        int acknowledgeMode = _session.getAckModeEnum().ordinal();
 
         if(acknowledgeMode == Session.AUTO_ACKNOWLEDGE
            || acknowledgeMode == Session.DUPS_OK_ACKNOWLEDGE

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueBrowserImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueBrowserImpl.java?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueBrowserImpl.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/QueueBrowserImpl.java Mon Nov 19 12:47:53 2012
@@ -18,9 +18,7 @@
  */
 package org.apache.qpid.amqp_1_0.jms.impl;
 
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Map;
+import java.util.*;
 import javax.jms.InvalidSelectorException;
 import javax.jms.JMSException;
 import org.apache.qpid.amqp_1_0.client.AcknowledgeMode;
@@ -29,6 +27,7 @@ import org.apache.qpid.amqp_1_0.client.R
 import org.apache.qpid.amqp_1_0.jms.QueueBrowser;
 import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
 import org.apache.qpid.amqp_1_0.type.Symbol;
+import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
 import org.apache.qpid.amqp_1_0.type.messaging.Filter;
 import org.apache.qpid.amqp_1_0.type.messaging.JMSSelectorFilter;
 import org.apache.qpid.amqp_1_0.type.messaging.StdDistMode;
@@ -39,49 +38,27 @@ public class QueueBrowserImpl implements
     private static final String JMS_SELECTOR = "jms-selector";
     private QueueImpl _queue;
     private String _selector;
-    private Receiver _receiver;
-    private Message _nextElement;
-    private MessageEnumeration _enumeration;
+    private final SessionImpl _session;
+    private Map<Symbol, Filter> _filters;
+    private HashSet<MessageEnumeration> _enumerations = new HashSet<MessageEnumeration>();
+    private boolean _closed;
 
     QueueBrowserImpl(final QueueImpl queue, final String selector, SessionImpl session) throws JMSException
     {
         _queue = queue;
         _selector = selector;
+        _session = session;
 
 
-        Map<Symbol, Filter> filters;
         if(selector == null || selector.trim().equals(""))
         {
-            filters = null;
+            _filters = null;
         }
         else
         {
-            filters = Collections.singletonMap(Symbol.valueOf(JMS_SELECTOR),(Filter) new JMSSelectorFilter(_selector));
-        }
-
-
-        try
-        {
-            _receiver = session.getClientSession().createReceiver(queue.getAddress(),
-                                                                  StdDistMode.COPY,
-                                                                  AcknowledgeMode.AMO,null,
-                                                                  false,
-                                                                  filters, null);
-            _nextElement = _receiver.receive(0L);
-            _enumeration = new MessageEnumeration();
-        }
-        catch(AmqpErrorException e)
-        {
-            org.apache.qpid.amqp_1_0.type.transport.Error error = e.getError();
-            if(AmqpError.INVALID_FIELD.equals(error.getCondition()))
-            {
-                throw new InvalidSelectorException(e.getMessage());
-            }
-            else
-            {
-                throw new JMSException(e.getMessage(), error.getCondition().getValue().toString());
-            }
-
+            _filters = Collections.singletonMap(Symbol.valueOf(JMS_SELECTOR),(Filter) new JMSSelectorFilter(_selector));
+            // We do this just to have the server validate the filter..
+            new MessageEnumeration().close();
         }
     }
 
@@ -97,42 +74,108 @@ public class QueueBrowserImpl implements
 
     public Enumeration getEnumeration() throws JMSException
     {
-        if(_enumeration == null)
+        if(_closed)
         {
             throw new IllegalStateException("Browser has been closed");
         }
-        return _enumeration;
+        return new MessageEnumeration();
     }
 
     public void close() throws JMSException
     {
-        _receiver.close();
-        _enumeration = null;
+        _closed = true;
+        for(MessageEnumeration me : new ArrayList<MessageEnumeration>(_enumerations))
+        {
+            me.close();
+        }
     }
 
     private final class MessageEnumeration implements Enumeration<Message>
     {
+        private Receiver _receiver;
+        private Message _nextElement;
+        private boolean _needNext = true;
+
+        MessageEnumeration() throws JMSException
+        {
+            try
+            {
+                _receiver = _session.getClientSession().createReceiver(_queue.getAddress(),
+                        StdDistMode.COPY,
+                        AcknowledgeMode.AMO, null,
+                        false,
+                        _filters, null);
+                _receiver.setCredit(UnsignedInteger.valueOf(100), true);
+            }
+            catch(AmqpErrorException e)
+            {
+                org.apache.qpid.amqp_1_0.type.transport.Error error = e.getError();
+                if(AmqpError.INVALID_FIELD.equals(error.getCondition()))
+                {
+                    throw new InvalidSelectorException(e.getMessage());
+                }
+                else
+                {
+                    throw new JMSException(e.getMessage(), error.getCondition().getValue().toString());
+                }
+
+            }
+            _enumerations.add(this);
+
+        }
+
+        public void close()
+        {
+            _enumerations.remove(this);
+            _receiver.close();
+            _receiver = null;
+        }
 
         @Override
         public boolean hasMoreElements()
         {
+            if( _receiver == null )
+            {
+                return false;
+            }
+            if( _needNext )
+            {
+                _needNext = false;
+                _nextElement = _receiver.receive(0L);
+                if( _nextElement == null )
+                {
+                    // Drain to verify there really are no more messages.
+                    _receiver.drain();
+                    _receiver.drainWait();
+                    _nextElement = _receiver.receive(0L);
+                    if( _nextElement == null )
+                    {
+                        close();
+                    }
+                    else
+                    {
+                        // there are still more messages, open up the credit window again..
+                        _receiver.clearDrain();
+                    }
+                }
+            }
             return _nextElement != null;
         }
 
         @Override
         public Message nextElement()
         {
-
-            Message message = _nextElement;
-            if(message == null)
+            if( hasMoreElements() )
             {
-                message = _receiver.receive(0l);
+                Message message = _nextElement;
+                _nextElement = null;
+                _needNext = true;
+                return message;
             }
-            if(message != null)
+            else
             {
-                _nextElement = _receiver.receive(0l);
+                throw new NoSuchElementException();
             }
-            return message;
         }
     }
 }

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java Mon Nov 19 12:47:53 2012
@@ -804,6 +804,10 @@ public class SessionImpl implements Sess
 
                         if(message != null)
                         {
+                            if(_acknowledgeMode == AcknowledgeMode.CLIENT_ACKNOWLEDGE)
+                            {
+                                consumer.setLastUnackedMessage(msg.getDeliveryTag());
+                            }
                             _currentConsumer = consumer;
                             _currentMessage = msg;
                             try
@@ -816,11 +820,11 @@ public class SessionImpl implements Sess
                                 _currentMessage = null;
                             }
 
-                            if((_recoveredMessage == null) && (_acknowledgeMode == AcknowledgeMode.AUTO_ACKNOWLEDGE
-                               || _acknowledgeMode == AcknowledgeMode.DUPS_OK_ACKNOWLEDGE))
+                            if(_recoveredMessage == null)
                             {
-                                consumer.acknowledge(msg);
+                                consumer.preReceiveAction(msg);
                             }
+
                         }
 
                     }

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/build.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/build.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/build.xml Mon Nov 19 12:47:53 2012
@@ -23,6 +23,9 @@
   <property name="module.genpom" value="true"/>
   <property name="module.depends" value="amqp-1-0-common"/>
 
+  <property name="example.src.dir" value="${project.root}/amqp-1-0-client/example/src/main/java" />
+  <property name="example.jar.file" value="${build.lib}/qpid-amqp-1-0-client-example-${project.version}.jar" />
+
 
   <import file="../module.xml"/>
 

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java Mon Nov 19 12:47:53 2012
@@ -503,6 +503,37 @@ public class Receiver implements Deliver
         _endpoint.drain();
     }
 
+    /**
+     * Waits for the receiver to drain or a message to be available to be received.
+     * @return true if the receiver has been drained.
+     */
+    public boolean drainWait()
+    {
+        final Object lock = _endpoint.getLock();
+        synchronized(lock)
+        {
+            try
+            {
+                while( _prefetchQueue.peek()==null && !_endpoint.isDrained() && !_endpoint.isDetached() )
+                {
+                    lock.wait();
+                }
+            }
+            catch (InterruptedException e)
+            {
+            }
+        }
+        return _prefetchQueue.peek()==null && _endpoint.isDrained();
+    }
+
+    /**
+     * Clears the receiver drain so that message delivery can resume.
+     */
+    public void clearDrain()
+    {
+        _endpoint.clearDrain();
+    }
+
     public void setCreditWithTransaction(final UnsignedInteger credit, final Transaction txn)
     {
         _endpoint.setLinkCredit(credit);

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-common/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/amqp-1-0-common:r1401294-1411033

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ReceivingLinkEndpoint.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ReceivingLinkEndpoint.java?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ReceivingLinkEndpoint.java (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ReceivingLinkEndpoint.java Mon Nov 19 12:47:53 2012
@@ -159,7 +159,7 @@ public class ReceivingLinkEndpoint exten
             super.receiveFlow(flow);
             _remoteDrain = Boolean.TRUE.equals((Boolean)flow.getDrain());
             setAvailable(flow.getAvailable());
-            _remoteTransferCount = flow.getDeliveryCount();
+            setDeliveryCount(flow.getDeliveryCount());
             getLock().notifyAll();
         }
     }

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/bin/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker/bin:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/message/MessageMetaData_1_0.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/message/MessageMetaData_1_0.java:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0.java:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0_SASL.java
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ProtocolEngine_1_0_0_SASL.java:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/v1_0:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue:r1401294-1411033

Propchange: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost:r1401294-1411033

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/build.deps
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/build.deps?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/build.deps (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/build.deps Mon Nov 19 12:47:53 2012
@@ -68,7 +68,8 @@ commons-configuration.libs = ${commons-b
 common.libs=${slf4j-api}
 client.libs=${geronimo-jms}
 amqp-1-0-common.libs=
-amqp-1-0-client.libs=${commons-cli}
+amqp-1-0-client.libs=
+amqp-1-0-client-example.libs=${commons-cli}
 amqp-1-0-client-jms.libs=${geronimo-jms}
 tools.libs=${commons-configuration.libs} ${log4j}
 broker.libs=${commons-cli} ${commons-logging} ${log4j} ${slf4j-log4j} \

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/build.xml?rev=1411155&r1=1411154&r2=1411155&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/build.xml (original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/build.xml Mon Nov 19 12:47:53 2012
@@ -32,7 +32,7 @@
   </condition>
 
   <property name="modules.core"       value="common management/common amqp-1-0-common broker client amqp-1-0-client amqp-1-0-client-jms tools"/>
-  <property name="modules.examples"   value="client/example management/example"/>
+  <property name="modules.examples"   value="client/example management/example amqp-1-0-client/example amqp-1-0-client-jms/example"/>
   <property name="modules.tests"      value="systests perftests"/>
   <property name="modules.plugin"     value="${broker-plugins} ${client-plugins}"/>
   <property name="modules.jca"        value="jca"/>
@@ -77,6 +77,10 @@
     <iterate target="release-mvn"/>
   </target>
 
+  <target name="deploy-snapshot" description="deploy snapshot artifacts to nexus">
+    <iterate target="deploy-snapshot"/>
+  </target>
+
   <target name="compile" description="compile sources">
     <iterate target="compile"/>
   </target>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message