qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject [02/18] qpid-site git commit: Add 6.0.4 release input templates
Date Fri, 01 Jul 2016 11:13:24 GMT
http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/Drain.java.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/Drain.java.html.in b/input/releases/qpid-java-6.0.4/qpid-jms/examples/Drain.java.html.in
new file mode 100644
index 0000000..0806ab3
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/Drain.java.html.in
@@ -0,0 +1,88 @@
+
+<h1>Drain.java</h1>
+<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Message</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MessageConsumer</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQAnyDestination</span><span class="o">;</span>
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Drain</span> <span class="kd">extends</span> <span class="n">OptionParser</span>
+<span class="o">{</span>
+       
+    <span class="kd">static</span> <span class="kd">final</span> <span class="n">Option</span> <span class="n">FOREVER</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Option</span><span class="o">(</span><span class="s">&quot;f&quot;</span><span class="o">,</span>
+            <span class="s">&quot;forever&quot;</span><span class="o">,</span>
+            <span class="s">&quot;ignore timeout and wait forever&quot;</span><span class="o">,</span>
+            <span class="kc">null</span><span class="o">,</span>
+            <span class="kc">null</span><span class="o">,</span>
+            <span class="n">Boolean</span><span class="o">.</span><span class="na">class</span><span class="o">);</span>
+
+    <span class="kd">static</span> <span class="kd">final</span> <span class="n">Option</span> <span class="n">COUNT</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Option</span> <span class="o">(</span><span class="s">&quot;c&quot;</span><span class="o">,</span>
+            <span class="s">&quot;count&quot;</span><span class="o">,</span>
+            <span class="s">&quot;read c messages, then exit&quot;</span><span class="o">,</span>
+            <span class="s">&quot;COUNT&quot;</span><span class="o">,</span>
+            <span class="s">&quot;0&quot;</span><span class="o">,</span>
+            <span class="n">Integer</span><span class="o">.</span><span class="na">class</span><span class="o">);</span>
+                                                
+
+    <span class="kd">static</span> 
+    <span class="o">{</span>        
+        <span class="n">addOption</span><span class="o">(</span><span class="n">BROKER</span><span class="o">);</span>
+        <span class="n">addOption</span><span class="o">(</span><span class="n">HELP</span><span class="o">);</span>
+        <span class="n">addOption</span><span class="o">(</span><span class="n">TIMEOUT</span><span class="o">);</span>
+        <span class="n">addOption</span><span class="o">(</span><span class="n">FOREVER</span><span class="o">);</span>
+        <span class="n">addOption</span><span class="o">(</span><span class="n">COUNT</span><span class="o">);</span>
+        <span class="n">addOption</span><span class="o">(</span><span class="n">CON_OPTIONS</span><span class="o">);</span>
+        <span class="n">addOption</span><span class="o">(</span><span class="n">BROKER_OPTIONS</span><span class="o">);</span>
+    <span class="o">}</span>
+    
+    <span class="kd">public</span> <span class="nf">Drain</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">,</span> <span class="n">String</span> <span class="n">usage</span><span class="o">,</span> <span class="n">String</span> <span class="n">desc</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>   
+        <span class="kd">super</span><span class="o">(</span><span class="n">args</span><span class="o">,</span> <span class="n">usage</span><span class="o">,</span> <span class="n">desc</span><span class="o">);</span>        
+        
+        <span class="n">Connection</span> <span class="n">con</span> <span class="o">=</span> <span class="n">createConnection</span><span class="o">();</span>
+        <span class="n">con</span><span class="o">.</span><span class="na">start</span><span class="o">();</span>
+        <span class="n">Session</span> <span class="n">ssn</span> <span class="o">=</span> <span class="n">con</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span><span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span>     
+        <span class="n">Destination</span> <span class="n">dest</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AMQAnyDestination</span><span class="o">(</span><span class="n">getAddress</span><span class="o">());</span>
+        <span class="n">MessageConsumer</span> <span class="n">consumer</span> <span class="o">=</span> <span class="n">ssn</span><span class="o">.</span><span class="na">createConsumer</span><span class="o">(</span><span class="n">dest</span><span class="o">);</span>
+        <span class="n">Message</span> <span class="n">msg</span><span class="o">;</span>
+        
+        <span class="kt">long</span> <span class="n">timeout</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="o">;</span>        
+        <span class="kt">int</span> <span class="n">count</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span>
+        <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span>
+        
+        <span class="k">if</span> <span class="o">(</span><span class="n">containsOp</span><span class="o">(</span><span class="n">TIMEOUT</span><span class="o">))</span> <span class="o">{</span> <span class="n">timeout</span> <span class="o">=</span> <span class="n">Integer</span><span class="o">.</span><span class="na">parseInt</span><span class="o">(</span><span class="n">getOp</span><span class="o">(</span><span class="n">TIMEOUT</span><span class="o">))*</span><span class="mi">1000</span><span class="o">;</span> <span class="o">}</span>
+        <span class="k">if</span> <span class="o">(</span><span class="n">containsOp</span><span class="o">(</span><span class="n">FOREVER</span><span class="o">))</span> <span class="o">{</span> <span class="n">timeout</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="o">}</span>
+        <span class="k">if</span> <span class="o">(</span><span class="n">containsOp</span><span class="o">(</span><span class="n">COUNT</span><span class="o">))</span> <span class="o">{</span> <span class="n">count</span> <span class="o">=</span> <span class="n">Integer</span><span class="o">.</span><span class="na">parseInt</span><span class="o">(</span><span class="n">getOp</span><span class="o">(</span><span class="n">COUNT</span><span class="o">));</span> <span class="o">}</span>
+        
+        <span class="k">while</span> <span class="o">((</span><span class="n">msg</span> <span class="o">=</span> <span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">(</span><span class="n">timeout</span><span class="o">))</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span>
+        <span class="o">{</span>
+            <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;\n------------- Msg -------------&quot;</span><span class="o">);</span>
+            <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">msg</span><span class="o">);</span>
+            <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;-------------------------------\n&quot;</span><span class="o">);</span>
+
+            <span class="k">if</span> <span class="o">(</span><span class="n">count</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="o">)</span> <span class="o">{</span>
+                <span class="k">if</span> <span class="o">(++</span><span class="n">i</span> <span class="o">==</span> <span class="n">count</span><span class="o">)</span> <span class="o">{</span>
+                    <span class="k">break</span><span class="o">;</span>                    
+                <span class="o">}</span>               
+            <span class="o">}</span>            
+        <span class="o">}</span>
+        <span class="n">consumer</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+        <span class="n">ssn</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+        <span class="n">con</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+    <span class="o">}</span>
+   
+    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>
+        <span class="n">String</span> <span class="n">u</span> <span class="o">=</span> <span class="s">&quot;Usage: drain [OPTIONS] &#39;ADDRESS&#39;&quot;</span><span class="o">;</span>
+        <span class="n">String</span> <span class="n">d</span> <span class="o">=</span> <span class="s">&quot;Drains messages from the specified address.&quot;</span><span class="o">;</span> 
+            
+        <span class="k">new</span> <span class="n">Drain</span><span class="o">(</span><span class="n">args</span><span class="o">,</span><span class="n">u</span><span class="o">,</span><span class="n">d</span><span class="o">);</span>        
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+<p><a href="Drain.java">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/Hello.java
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/Hello.java b/input/releases/qpid-java-6.0.4/qpid-jms/examples/Hello.java
new file mode 100644
index 0000000..109a72b
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/Hello.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.example;
+
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+
+public class Hello 
+{
+
+    public Hello() 
+    {
+    }
+
+    public static void main(String[] args)
+    {
+        Hello hello = new Hello();
+        hello.runTest();
+    }
+
+    private void runTest() 
+    {
+        try (InputStream resourceAsStream = this.getClass().getResourceAsStream("hello.properties"))
+        {
+            Properties properties = new Properties();
+            properties.load(resourceAsStream);
+            Context context = new InitialContext(properties);
+
+            ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("qpidConnectionfactory");
+            Connection connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = (Destination) context.lookup("topicExchange");
+
+            MessageProducer messageProducer = session.createProducer(destination);
+            MessageConsumer messageConsumer = session.createConsumer(destination);
+
+            TextMessage message = session.createTextMessage("Hello world!");
+            messageProducer.send(message);
+
+            message = (TextMessage)messageConsumer.receive();
+            System.out.println(message.getText());
+
+            connection.close();
+            context.close();
+        }
+        catch (Exception exp) 
+        {
+            exp.printStackTrace();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/Hello.java.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/Hello.java.html.in b/input/releases/qpid-java-6.0.4/qpid-jms/examples/Hello.java.html.in
new file mode 100644
index 0000000..0c73231
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/Hello.java.html.in
@@ -0,0 +1,67 @@
+
+<h1>Hello.java</h1>
+<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">java.io.InputStream</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.Properties</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.ConnectionFactory</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MessageConsumer</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MessageProducer</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.TextMessage</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.naming.Context</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.naming.InitialContext</span><span class="o">;</span>
+
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Hello</span> 
+<span class="o">{</span>
+
+    <span class="kd">public</span> <span class="nf">Hello</span><span class="o">()</span> 
+    <span class="o">{</span>
+    <span class="o">}</span>
+
+    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span>
+    <span class="o">{</span>
+        <span class="n">Hello</span> <span class="n">hello</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Hello</span><span class="o">();</span>
+        <span class="n">hello</span><span class="o">.</span><span class="na">runTest</span><span class="o">();</span>
+    <span class="o">}</span>
+
+    <span class="kd">private</span> <span class="kt">void</span> <span class="nf">runTest</span><span class="o">()</span> 
+    <span class="o">{</span>
+        <span class="k">try</span> <span class="o">(</span><span class="n">InputStream</span> <span class="n">resourceAsStream</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="na">getClass</span><span class="o">().</span><span class="na">getResourceAsStream</span><span class="o">(</span><span class="s">&quot;hello.properties&quot;</span><span class="o">))</span>
+        <span class="o">{</span>
+            <span class="n">Properties</span> <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Properties</span><span class="o">();</span>
+            <span class="n">properties</span><span class="o">.</span><span class="na">load</span><span class="o">(</span><span class="n">resourceAsStream</span><span class="o">);</span>
+            <span class="n">Context</span> <span class="n">context</span> <span class="o">=</span> <span class="k">new</span> <span class="n">InitialContext</span><span class="o">(</span><span class="n">properties</span><span class="o">);</span>
+
+            <span class="n">ConnectionFactory</span> <span class="n">connectionFactory</span> <span class="o">=</span> <span class="o">(</span><span class="n">ConnectionFactory</span><span class="o">)</span> <span class="n">context</span><span class="o">.</span><span class="na">lookup</span><span class="o">(</span><span class="s">&quot;qpidConnectionfactory&quot;</span><span class="o">);</span>
+            <span class="n">Connection</span> <span class="n">connection</span> <span class="o">=</span> <span class="n">connectionFactory</span><span class="o">.</span><span class="na">createConnection</span><span class="o">();</span>
+            <span class="n">connection</span><span class="o">.</span><span class="na">start</span><span class="o">();</span>
+
+            <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span> <span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span>
+            <span class="n">Destination</span> <span class="n">destination</span> <span class="o">=</span> <span class="o">(</span><span class="n">Destination</span><span class="o">)</span> <span class="n">context</span><span class="o">.</span><span class="na">lookup</span><span class="o">(</span><span class="s">&quot;topicExchange&quot;</span><span class="o">);</span>
+
+            <span class="n">MessageProducer</span> <span class="n">messageProducer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createProducer</span><span class="o">(</span><span class="n">destination</span><span class="o">);</span>
+            <span class="n">MessageConsumer</span> <span class="n">messageConsumer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createConsumer</span><span class="o">(</span><span class="n">destination</span><span class="o">);</span>
+
+            <span class="n">TextMessage</span> <span class="n">message</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createTextMessage</span><span class="o">(</span><span class="s">&quot;Hello world!&quot;</span><span class="o">);</span>
+            <span class="n">messageProducer</span><span class="o">.</span><span class="na">send</span><span class="o">(</span><span class="n">message</span><span class="o">);</span>
+
+            <span class="n">message</span> <span class="o">=</span> <span class="o">(</span><span class="n">TextMessage</span><span class="o">)</span><span class="n">messageConsumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span>
+            <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">message</span><span class="o">.</span><span class="na">getText</span><span class="o">());</span>
+
+            <span class="n">connection</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+            <span class="n">context</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+        <span class="o">}</span>
+        <span class="k">catch</span> <span class="o">(</span><span class="n">Exception</span> <span class="n">exp</span><span class="o">)</span> 
+        <span class="o">{</span>
+            <span class="n">exp</span><span class="o">.</span><span class="na">printStackTrace</span><span class="o">();</span>
+        <span class="o">}</span>
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+<p><a href="Hello.java">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListReceiver.java
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListReceiver.java b/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListReceiver.java
new file mode 100644
index 0000000..b12cfab
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListReceiver.java
@@ -0,0 +1,101 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.example;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.MapMessage;
+import javax.jms.StreamMessage;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.MessageEOFException;
+
+import org.apache.qpid.client.AMQAnyDestination;
+import org.apache.qpid.client.AMQConnection;
+
+import org.apache.qpid.jms.ListMessage;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+public class ListReceiver {
+
+    public static void main(String[] args) throws Exception
+    {
+	if (args.length != 1) {
+		System.out.println("Usage: java org.apache.qpid.example.ListReceiver <-l | -m | -s>");
+		System.out.println("where:");
+		System.out.println("\t-l\tAccept ListMessage and print it");
+		System.out.println("\t-m\tAccept ListMessage as a MapMessage");
+		System.out.println("\t-s\tAccept ListMessage as a StreamMessage");
+		return;
+	}
+
+        Connection connection =
+            new AMQConnection("amqp://guest:guest@test/?brokerlist='tcp://localhost:5672'");
+
+        connection.start();
+
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Destination queue = new AMQAnyDestination("ADDR:message_queue; {create: always}");
+        MessageConsumer consumer = session.createConsumer(queue);
+
+	if (args[0].equals("-l")) {
+		System.out.println("Receiving as ListMessage");
+        	ListMessage m = (ListMessage)consumer.receive();
+	        System.out.println(m);
+		System.out.println("==========================================");
+		System.out.println("Printing list contents:");
+		Iterator i = m.iterator();
+		while(i.hasNext())
+			System.out.println(i.next());
+	}
+	else if (args[0].equals("-m")) {
+		System.out.println("Receiving as MapMessage");
+        	MapMessage m = (MapMessage)consumer.receive();
+	        System.out.println(m);
+		System.out.println("==========================================");
+		System.out.println("Printing map contents:");
+		Enumeration keys = m.getMapNames();
+		while(keys.hasMoreElements()) {
+			String key = (String)keys.nextElement();
+			System.out.println(key + " => " + m.getObject(key));
+		}
+	}
+	else if (args[0].equals("-s")) {
+		System.out.println("Receiving as StreamMessage");
+        	StreamMessage m = (StreamMessage)consumer.receive();
+	        System.out.println(m);
+		System.out.println("==========================================");
+		System.out.println("Printing stream contents:");
+		try {
+			while(true)
+				System.out.println(m.readObject());
+		}
+		catch (MessageEOFException e) {
+			// DONE
+		}
+	}
+
+        connection.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListReceiver.java.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListReceiver.java.html.in b/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListReceiver.java.html.in
new file mode 100644
index 0000000..4c0b4f7
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListReceiver.java.html.in
@@ -0,0 +1,85 @@
+
+<h1>ListReceiver.java</h1>
+<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MapMessage</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.StreamMessage</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MessageConsumer</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MessageEOFException</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQAnyDestination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQConnection</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.qpid.jms.ListMessage</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">java.util.Enumeration</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.Iterator</span><span class="o">;</span>
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">ListReceiver</span> <span class="o">{</span>
+
+    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>
+	<span class="k">if</span> <span class="o">(</span><span class="n">args</span><span class="o">.</span><span class="na">length</span> <span class="o">!=</span> <span class="mi">1</span><span class="o">)</span> <span class="o">{</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Usage: java org.apache.qpid.example.ListReceiver &lt;-l | -m | -s&gt;&quot;</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;where:&quot;</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;\t-l\tAccept ListMessage and print it&quot;</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;\t-m\tAccept ListMessage as a MapMessage&quot;</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;\t-s\tAccept ListMessage as a StreamMessage&quot;</span><span class="o">);</span>
+		<span class="k">return</span><span class="o">;</span>
+	<span class="o">}</span>
+
+        <span class="n">Connection</span> <span class="n">connection</span> <span class="o">=</span>
+            <span class="k">new</span> <span class="n">AMQConnection</span><span class="o">(</span><span class="s">&quot;amqp://guest:guest@test/?brokerlist=&#39;tcp://localhost:5672&#39;&quot;</span><span class="o">);</span>
+
+        <span class="n">connection</span><span class="o">.</span><span class="na">start</span><span class="o">();</span>
+
+        <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span> <span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span>
+        <span class="n">Destination</span> <span class="n">queue</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AMQAnyDestination</span><span class="o">(</span><span class="s">&quot;ADDR:message_queue; {create: always}&quot;</span><span class="o">);</span>
+        <span class="n">MessageConsumer</span> <span class="n">consumer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createConsumer</span><span class="o">(</span><span class="n">queue</span><span class="o">);</span>
+
+	<span class="k">if</span> <span class="o">(</span><span class="n">args</span><span class="o">[</span><span class="mi">0</span><span class="o">].</span><span class="na">equals</span><span class="o">(</span><span class="s">&quot;-l&quot;</span><span class="o">))</span> <span class="o">{</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Receiving as ListMessage&quot;</span><span class="o">);</span>
+        	<span class="n">ListMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="o">(</span><span class="n">ListMessage</span><span class="o">)</span><span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span>
+	        <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;==========================================&quot;</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Printing list contents:&quot;</span><span class="o">);</span>
+		<span class="n">Iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="na">iterator</span><span class="o">();</span>
+		<span class="k">while</span><span class="o">(</span><span class="n">i</span><span class="o">.</span><span class="na">hasNext</span><span class="o">())</span>
+			<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">i</span><span class="o">.</span><span class="na">next</span><span class="o">());</span>
+	<span class="o">}</span>
+	<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">args</span><span class="o">[</span><span class="mi">0</span><span class="o">].</span><span class="na">equals</span><span class="o">(</span><span class="s">&quot;-m&quot;</span><span class="o">))</span> <span class="o">{</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Receiving as MapMessage&quot;</span><span class="o">);</span>
+        	<span class="n">MapMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="o">(</span><span class="n">MapMessage</span><span class="o">)</span><span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span>
+	        <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;==========================================&quot;</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Printing map contents:&quot;</span><span class="o">);</span>
+		<span class="n">Enumeration</span> <span class="n">keys</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="na">getMapNames</span><span class="o">();</span>
+		<span class="k">while</span><span class="o">(</span><span class="n">keys</span><span class="o">.</span><span class="na">hasMoreElements</span><span class="o">())</span> <span class="o">{</span>
+			<span class="n">String</span> <span class="n">key</span> <span class="o">=</span> <span class="o">(</span><span class="n">String</span><span class="o">)</span><span class="n">keys</span><span class="o">.</span><span class="na">nextElement</span><span class="o">();</span>
+			<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">key</span> <span class="o">+</span> <span class="s">&quot; =&gt; &quot;</span> <span class="o">+</span> <span class="n">m</span><span class="o">.</span><span class="na">getObject</span><span class="o">(</span><span class="n">key</span><span class="o">));</span>
+		<span class="o">}</span>
+	<span class="o">}</span>
+	<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">args</span><span class="o">[</span><span class="mi">0</span><span class="o">].</span><span class="na">equals</span><span class="o">(</span><span class="s">&quot;-s&quot;</span><span class="o">))</span> <span class="o">{</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Receiving as StreamMessage&quot;</span><span class="o">);</span>
+        	<span class="n">StreamMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="o">(</span><span class="n">StreamMessage</span><span class="o">)</span><span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span>
+	        <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;==========================================&quot;</span><span class="o">);</span>
+		<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Printing stream contents:&quot;</span><span class="o">);</span>
+		<span class="k">try</span> <span class="o">{</span>
+			<span class="k">while</span><span class="o">(</span><span class="kc">true</span><span class="o">)</span>
+				<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">.</span><span class="na">readObject</span><span class="o">());</span>
+		<span class="o">}</span>
+		<span class="k">catch</span> <span class="o">(</span><span class="n">MessageEOFException</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span>
+			<span class="c1">// DONE</span>
+		<span class="o">}</span>
+	<span class="o">}</span>
+
+        <span class="n">connection</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+<p><a href="ListReceiver.java">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListSender.java
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListSender.java b/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListSender.java
new file mode 100644
index 0000000..fe2c1ec
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListSender.java
@@ -0,0 +1,86 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.example;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import org.apache.qpid.client.AMQAnyDestination;
+import org.apache.qpid.client.AMQConnection;
+
+import org.apache.qpid.jms.ListMessage;
+
+
+public class ListSender {
+
+    public static void main(String[] args) throws Exception
+    {
+        Connection connection =
+            new AMQConnection("amqp://guest:guest@test/?brokerlist='tcp://localhost:5672'");
+
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Destination queue = new AMQAnyDestination("ADDR:message_queue; {create: always}");
+        MessageProducer producer = session.createProducer(queue);
+
+        ListMessage m = ((org.apache.qpid.jms.Session)session).createListMessage();
+        m.setIntProperty("Id", 987654321);
+        m.setStringProperty("name", "Widget");
+        m.setDoubleProperty("price", 0.99);
+
+        List<String> colors = new ArrayList<String>();
+        colors.add("red");
+        colors.add("green");
+        colors.add("white");
+        m.add(colors);
+
+        Map<String,Double> dimensions = new HashMap<String,Double>();
+        dimensions.put("length",10.2);
+        dimensions.put("width",5.1);
+        dimensions.put("depth",2.0);
+        m.add(dimensions);
+
+        List<List<Integer>> parts = new ArrayList<List<Integer>>();
+        parts.add(Arrays.asList(new Integer[] {1,2,5}));
+        parts.add(Arrays.asList(new Integer[] {8,2,5}));
+        m.add(parts);
+
+        Map<String,Object> specs = new HashMap<String,Object>();
+        specs.put("colours", colors);
+        specs.put("dimensions", dimensions);
+        specs.put("parts", parts);
+        m.add(specs);
+
+        producer.send((Message)m);
+	System.out.println("Sent: " + m);
+        connection.close();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListSender.java.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListSender.java.html.in b/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListSender.java.html.in
new file mode 100644
index 0000000..9e4f3be
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/ListSender.java.html.in
@@ -0,0 +1,70 @@
+
+<h1>ListSender.java</h1>
+<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">java.util.ArrayList</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.Arrays</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.HashMap</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.Map</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Message</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MessageProducer</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQAnyDestination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQConnection</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.qpid.jms.ListMessage</span><span class="o">;</span>
+
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">ListSender</span> <span class="o">{</span>
+
+    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>
+        <span class="n">Connection</span> <span class="n">connection</span> <span class="o">=</span>
+            <span class="k">new</span> <span class="n">AMQConnection</span><span class="o">(</span><span class="s">&quot;amqp://guest:guest@test/?brokerlist=&#39;tcp://localhost:5672&#39;&quot;</span><span class="o">);</span>
+
+        <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span> <span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span>
+        <span class="n">Destination</span> <span class="n">queue</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AMQAnyDestination</span><span class="o">(</span><span class="s">&quot;ADDR:message_queue; {create: always}&quot;</span><span class="o">);</span>
+        <span class="n">MessageProducer</span> <span class="n">producer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createProducer</span><span class="o">(</span><span class="n">queue</span><span class="o">);</span>
+
+        <span class="n">ListMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="o">((</span><span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">qpid</span><span class="o">.</span><span class="na">jms</span><span class="o">.</span><span class="na">Session</span><span class="o">)</span><span class="n">session</span><span class="o">).</span><span class="na">createListMessage</span><span class="o">();</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setIntProperty</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">,</span> <span class="mi">987654321</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setStringProperty</span><span class="o">(</span><span class="s">&quot;name&quot;</span><span class="o">,</span> <span class="s">&quot;Widget&quot;</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setDoubleProperty</span><span class="o">(</span><span class="s">&quot;price&quot;</span><span class="o">,</span> <span class="mf">0.99</span><span class="o">);</span>
+
+        <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">colors</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;();</span>
+        <span class="n">colors</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">&quot;red&quot;</span><span class="o">);</span>
+        <span class="n">colors</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">&quot;green&quot;</span><span class="o">);</span>
+        <span class="n">colors</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">&quot;white&quot;</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">colors</span><span class="o">);</span>
+
+        <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">dimensions</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Double</span><span class="o">&gt;();</span>
+        <span class="n">dimensions</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;length&quot;</span><span class="o">,</span><span class="mf">10.2</span><span class="o">);</span>
+        <span class="n">dimensions</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;width&quot;</span><span class="o">,</span><span class="mf">5.1</span><span class="o">);</span>
+        <span class="n">dimensions</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;depth&quot;</span><span class="o">,</span><span class="mf">2.0</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">dimensions</span><span class="o">);</span>
+
+        <span class="n">List</span><span class="o">&lt;</span><span class="n">List</span><span class="o">&lt;</span><span class="n">Integer</span><span class="o">&gt;&gt;</span> <span class="n">parts</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">List</span><span class="o">&lt;</span><span class="n">Integer</span><span class="o">&gt;&gt;();</span>
+        <span class="n">parts</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">Arrays</span><span class="o">.</span><span class="na">asList</span><span class="o">(</span><span class="k">new</span> <span class="n">Integer</span><span class="o">[]</span> <span class="o">{</span><span class="mi">1</span><span class="o">,</span><span class="mi">2</span><span class="o">,</span><span class="mi">5</span><span class="o">}));</span>
+        <span class="n">parts</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">Arrays</span><span class="o">.</span><span class="na">asList</span><span class="o">(</span><span class="k">new</span> <span class="n">Integer</span><span class="o">[]</span> <span class="o">{</span><span class="mi">8</span><span class="o">,</span><span class="mi">2</span><span class="o">,</span><span class="mi">5</span><span class="o">}));</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">parts</span><span class="o">);</span>
+
+        <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Object</span><span class="o">&gt;</span> <span class="n">specs</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Object</span><span class="o">&gt;();</span>
+        <span class="n">specs</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;colours&quot;</span><span class="o">,</span> <span class="n">colors</span><span class="o">);</span>
+        <span class="n">specs</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;dimensions&quot;</span><span class="o">,</span> <span class="n">dimensions</span><span class="o">);</span>
+        <span class="n">specs</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;parts&quot;</span><span class="o">,</span> <span class="n">parts</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">specs</span><span class="o">);</span>
+
+        <span class="n">producer</span><span class="o">.</span><span class="na">send</span><span class="o">((</span><span class="n">Message</span><span class="o">)</span><span class="n">m</span><span class="o">);</span>
+	<span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Sent: &quot;</span> <span class="o">+</span> <span class="n">m</span><span class="o">);</span>
+        <span class="n">connection</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+    <span class="o">}</span>
+
+<span class="o">}</span>
+</pre></div>
+
+<p><a href="ListSender.java">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapReceiver.java
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapReceiver.java b/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapReceiver.java
new file mode 100644
index 0000000..89db04f
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapReceiver.java
@@ -0,0 +1,52 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.example;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.MapMessage;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+
+import org.apache.qpid.client.AMQAnyDestination;
+import org.apache.qpid.client.AMQConnection;
+
+
+public class MapReceiver {
+
+    public static void main(String[] args) throws Exception 
+    {
+        Connection connection = 
+            new AMQConnection("amqp://guest:guest@test/?brokerlist='tcp://localhost:5672'");
+
+        connection.start();
+        
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Destination queue = new AMQAnyDestination("ADDR:message_queue; {create: always}");
+        MessageConsumer consumer = session.createConsumer(queue);
+
+        MapMessage m = (MapMessage)consumer.receive();
+        System.out.println(m);     
+        connection.close();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapReceiver.java.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapReceiver.java.html.in b/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapReceiver.java.html.in
new file mode 100644
index 0000000..49379b1
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapReceiver.java.html.in
@@ -0,0 +1,36 @@
+
+<h1>MapReceiver.java</h1>
+<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MapMessage</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MessageConsumer</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQAnyDestination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQConnection</span><span class="o">;</span>
+
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MapReceiver</span> <span class="o">{</span>
+
+    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> 
+    <span class="o">{</span>
+        <span class="n">Connection</span> <span class="n">connection</span> <span class="o">=</span> 
+            <span class="k">new</span> <span class="n">AMQConnection</span><span class="o">(</span><span class="s">&quot;amqp://guest:guest@test/?brokerlist=&#39;tcp://localhost:5672&#39;&quot;</span><span class="o">);</span>
+
+        <span class="n">connection</span><span class="o">.</span><span class="na">start</span><span class="o">();</span>
+        
+        <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span> <span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span>
+        <span class="n">Destination</span> <span class="n">queue</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AMQAnyDestination</span><span class="o">(</span><span class="s">&quot;ADDR:message_queue; {create: always}&quot;</span><span class="o">);</span>
+        <span class="n">MessageConsumer</span> <span class="n">consumer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createConsumer</span><span class="o">(</span><span class="n">queue</span><span class="o">);</span>
+
+        <span class="n">MapMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="o">(</span><span class="n">MapMessage</span><span class="o">)</span><span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span>
+        <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">);</span>     
+        <span class="n">connection</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+    <span class="o">}</span>
+
+<span class="o">}</span>
+</pre></div>
+
+<p><a href="MapReceiver.java">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapSender.java
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapSender.java b/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapSender.java
new file mode 100644
index 0000000..0ce9383
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapSender.java
@@ -0,0 +1,83 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.example;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.MapMessage;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import org.apache.qpid.client.AMQAnyDestination;
+import org.apache.qpid.client.AMQConnection;
+
+
+public class MapSender {
+
+    public static void main(String[] args) throws Exception 
+    {
+        Connection connection = 
+            new AMQConnection("amqp://guest:guest@test/?brokerlist='tcp://localhost:5672'");
+        
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Destination queue = new AMQAnyDestination("ADDR:message_queue; {create: always}");
+        MessageProducer producer = session.createProducer(queue);
+
+        MapMessage m = session.createMapMessage();
+        m.setIntProperty("Id", 987654321);
+        m.setStringProperty("name", "Widget");
+        m.setDoubleProperty("price", 0.99);
+        
+        List<String> colors = new ArrayList<String>();
+        colors.add("red");
+        colors.add("green");
+        colors.add("white");        
+        m.setObject("colours", colors);
+        
+        Map<String,Double> dimensions = new HashMap<String,Double>();
+        dimensions.put("length",10.2);
+        dimensions.put("width",5.1);
+        dimensions.put("depth",2.0);
+        m.setObject("dimensions",dimensions);
+        
+        List<List<Integer>> parts = new ArrayList<List<Integer>>();
+        parts.add(Arrays.asList(new Integer[] {1,2,5}));
+        parts.add(Arrays.asList(new Integer[] {8,2,5}));
+        m.setObject("parts", parts);
+        
+        Map<String,Object> specs = new HashMap<String,Object>();
+        specs.put("colours", colors);
+        specs.put("dimensions", dimensions);
+        specs.put("parts", parts);
+        m.setObject("specs",specs);
+        
+        producer.send(m);
+        connection.close();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapSender.java.html.in
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapSender.java.html.in b/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapSender.java.html.in
new file mode 100644
index 0000000..30e34d2
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/MapSender.java.html.in
@@ -0,0 +1,67 @@
+
+<h1>MapSender.java</h1>
+<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">java.util.ArrayList</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.Arrays</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.HashMap</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.Map</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MapMessage</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.MessageProducer</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQAnyDestination</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQConnection</span><span class="o">;</span>
+
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MapSender</span> <span class="o">{</span>
+
+    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> 
+    <span class="o">{</span>
+        <span class="n">Connection</span> <span class="n">connection</span> <span class="o">=</span> 
+            <span class="k">new</span> <span class="n">AMQConnection</span><span class="o">(</span><span class="s">&quot;amqp://guest:guest@test/?brokerlist=&#39;tcp://localhost:5672&#39;&quot;</span><span class="o">);</span>
+        
+        <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span> <span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span>
+        <span class="n">Destination</span> <span class="n">queue</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AMQAnyDestination</span><span class="o">(</span><span class="s">&quot;ADDR:message_queue; {create: always}&quot;</span><span class="o">);</span>
+        <span class="n">MessageProducer</span> <span class="n">producer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createProducer</span><span class="o">(</span><span class="n">queue</span><span class="o">);</span>
+
+        <span class="n">MapMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createMapMessage</span><span class="o">();</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setIntProperty</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">,</span> <span class="mi">987654321</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setStringProperty</span><span class="o">(</span><span class="s">&quot;name&quot;</span><span class="o">,</span> <span class="s">&quot;Widget&quot;</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setDoubleProperty</span><span class="o">(</span><span class="s">&quot;price&quot;</span><span class="o">,</span> <span class="mf">0.99</span><span class="o">);</span>
+        
+        <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">colors</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;();</span>
+        <span class="n">colors</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">&quot;red&quot;</span><span class="o">);</span>
+        <span class="n">colors</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">&quot;green&quot;</span><span class="o">);</span>
+        <span class="n">colors</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="s">&quot;white&quot;</span><span class="o">);</span>        
+        <span class="n">m</span><span class="o">.</span><span class="na">setObject</span><span class="o">(</span><span class="s">&quot;colours&quot;</span><span class="o">,</span> <span class="n">colors</span><span class="o">);</span>
+        
+        <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Double</span><span class="o">&gt;</span> <span class="n">dimensions</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Double</span><span class="o">&gt;();</span>
+        <span class="n">dimensions</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;length&quot;</span><span class="o">,</span><span class="mf">10.2</span><span class="o">);</span>
+        <span class="n">dimensions</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;width&quot;</span><span class="o">,</span><span class="mf">5.1</span><span class="o">);</span>
+        <span class="n">dimensions</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;depth&quot;</span><span class="o">,</span><span class="mf">2.0</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setObject</span><span class="o">(</span><span class="s">&quot;dimensions&quot;</span><span class="o">,</span><span class="n">dimensions</span><span class="o">);</span>
+        
+        <span class="n">List</span><span class="o">&lt;</span><span class="n">List</span><span class="o">&lt;</span><span class="n">Integer</span><span class="o">&gt;&gt;</span> <span class="n">parts</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">List</span><span class="o">&lt;</span><span class="n">Integer</span><span class="o">&gt;&gt;();</span>
+        <span class="n">parts</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">Arrays</span><span class="o">.</span><span class="na">asList</span><span class="o">(</span><span class="k">new</span> <span class="n">Integer</span><span class="o">[]</span> <span class="o">{</span><span class="mi">1</span><span class="o">,</span><span class="mi">2</span><span class="o">,</span><span class="mi">5</span><span class="o">}));</span>
+        <span class="n">parts</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">Arrays</span><span class="o">.</span><span class="na">asList</span><span class="o">(</span><span class="k">new</span> <span class="n">Integer</span><span class="o">[]</span> <span class="o">{</span><span class="mi">8</span><span class="o">,</span><span class="mi">2</span><span class="o">,</span><span class="mi">5</span><span class="o">}));</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setObject</span><span class="o">(</span><span class="s">&quot;parts&quot;</span><span class="o">,</span> <span class="n">parts</span><span class="o">);</span>
+        
+        <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Object</span><span class="o">&gt;</span> <span class="n">specs</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Object</span><span class="o">&gt;();</span>
+        <span class="n">specs</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;colours&quot;</span><span class="o">,</span> <span class="n">colors</span><span class="o">);</span>
+        <span class="n">specs</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;dimensions&quot;</span><span class="o">,</span> <span class="n">dimensions</span><span class="o">);</span>
+        <span class="n">specs</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;parts&quot;</span><span class="o">,</span> <span class="n">parts</span><span class="o">);</span>
+        <span class="n">m</span><span class="o">.</span><span class="na">setObject</span><span class="o">(</span><span class="s">&quot;specs&quot;</span><span class="o">,</span><span class="n">specs</span><span class="o">);</span>
+        
+        <span class="n">producer</span><span class="o">.</span><span class="na">send</span><span class="o">(</span><span class="n">m</span><span class="o">);</span>
+        <span class="n">connection</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
+    <span class="o">}</span>
+
+<span class="o">}</span>
+</pre></div>
+
+<p><a href="MapSender.java">Download this file</a></p>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/373f29ba/input/releases/qpid-java-6.0.4/qpid-jms/examples/OptionParser.java
----------------------------------------------------------------------
diff --git a/input/releases/qpid-java-6.0.4/qpid-jms/examples/OptionParser.java b/input/releases/qpid-java-6.0.4/qpid-jms/examples/OptionParser.java
new file mode 100644
index 0000000..9360be4
--- /dev/null
+++ b/input/releases/qpid-java-6.0.4/qpid-jms/examples/OptionParser.java
@@ -0,0 +1,351 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.example;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jms.Connection;
+
+import org.apache.qpid.client.AMQConnection;
+
+public class OptionParser
+{    
+    static final Option BROKER = new Option("b",
+            "broker",
+            "connect to specified broker",
+            "USER:PASS@HOST:PORT",
+            "guest:guest@localhost:5672",
+            String.class);        
+        
+    static final Option HELP = new Option("h",
+            "help",
+            "show this help message and exit",
+            null,
+            null,
+            Boolean.class);
+    
+    static final Option TIMEOUT = new Option("t",
+            "timeout",
+            "timeout in seconds to wait before exiting",
+            "TIMEOUT",
+            "0",
+            Integer.class);
+    
+    static final Option CON_OPTIONS = new Option(null,
+            "con-option",
+            "JMS Connection URL options. Ex sync_ack=true sync_publish=all ",
+            "NAME=VALUE",
+            null,
+            String.class);
+    
+    
+    static final Option BROKER_OPTIONS = new Option(null,
+            "broker-option",
+            "JMS Broker URL options. Ex ssl=true sasl_mechs=GSSAPI ",
+            "NAME=VALUE",
+            null,
+            String.class);
+    
+    
+    private Map<String,Object> optMap = new HashMap<String,Object>();
+    private static final List<Option> optDefs = new ArrayList<Option>();
+
+    private static final String CLIENTID = "test";
+    
+    private String usage;
+    private String desc;
+    private String address;
+    
+    public OptionParser(String[] args, String usage, String desc)
+    {   
+        this.usage = usage;
+        this.desc  = desc;
+        
+        if (args.length == 0 || 
+           (args.length == 1 && (args[0].equals("-h") || args[0].equals("--help"))))
+        {
+            printHelp();
+        }
+        
+        address = args[args.length -1];
+        String[] ops = new String[args.length -1];
+        System.arraycopy(args, 0, ops, 0, ops.length);        
+        parseOpts(ops);
+        
+        System.out.println(optMap);
+        
+        if (isHelp())
+        {
+            printHelp();
+        }
+    }
+    
+    public boolean isHelp()
+    {
+        return optMap.containsKey("h") || optMap.containsKey("help");
+    }
+    
+    public void printHelp()
+    {
+        System.out.println(String.format("%s\n",usage));
+        System.out.println(String.format("%s\n",desc));
+        System.out.println(String.format("%s\n","Options:"));
+        
+        for (Option op : optDefs)
+        {  
+           String valueLabel = op.getValueLabel() != null ? "=" + op.getValueLabel() : ""; 
+           String shortForm = op.getShortForm() != null ? "-" + op.getShortForm() + valueLabel : "";
+           String longForm = op.getLongForm() != null ? "--" + op.getLongForm() + valueLabel : "";
+           String desc = op.getDesc();
+           String defaultValue = op.getDefaultValue() != null ? 
+                   " (default " + op.getDefaultValue() + ")" : "";
+           
+           if (!shortForm.equals(""))
+           {
+               longForm = shortForm + ", " + longForm;
+           }
+           System.out.println(
+                   String.format("%-54s%s%s", longForm,desc,defaultValue));
+        }
+        
+        System.exit(0);
+    }
+    
+    private void parseOpts(String[] args)
+    {   
+        String prevOpt = null;
+        for(String op: args)
+        {
+            // covers both -h and --help formats
+            if (op.startsWith("-"))
+            {
+                String key = op.substring(op.startsWith("--")? 2:1 ,
+                                         (op.indexOf('=') > 0) ? 
+                                            op.indexOf('='):
+                                            op.length());
+                
+                boolean match = false;
+                for (Option option: optDefs)
+                {
+                    
+                    if ((op.startsWith("-") && option.getShortForm() != null && option.getShortForm().equals(key)) ||
+                        (op.startsWith("--") && option.getLongForm() != null && option.getLongForm().equals(key)) )
+                    {
+                        match = true;
+                        break;
+                    }
+                }
+                
+                if (!match) 
+                { 
+                    System.out.println(op + " is not a valid option"); 
+                    System.exit(0);
+                }                    
+                
+                if (op.indexOf('=') > 0)
+                {
+                    String val = extractValue(op.substring(op.indexOf('=')+1));
+                    if (optMap.containsKey(key))
+                    {
+                        optMap.put(key, optMap.get(key) + "," + val);
+                    }
+                    else
+                    {
+                        optMap.put(key, val);
+                    }
+                }
+                else
+                {
+                    if (! optMap.containsKey(key)){ optMap.put(key, ""); }
+                    prevOpt = key;
+                }
+            }
+            else if (prevOpt != null) // this is to catch broker localhost:5672 instead broker=localhost:5672
+            {
+                String val = extractValue(op);
+                if (optMap.containsKey(prevOpt) && !optMap.get(prevOpt).toString().equals(""))
+                {
+                    optMap.put(prevOpt, optMap.get(prevOpt) + "," + val);
+                }
+                else
+                {
+                    optMap.put(prevOpt, val);
+                }
+                prevOpt = null;
+            }
+            else
+            {
+                System.out.println(optMap);
+                throw new IllegalArgumentException(op + " is not a valid option");
+            }
+        }
+    }
+    
+    private String extractValue(String op)
+    {
+        if (op.startsWith("'"))
+        {
+            if (!op.endsWith("'")) 
+            {
+                throw new IllegalArgumentException(" The option " + op + " needs to be inside quotes");
+            }
+            
+            return op.substring(1,op.length() -1);
+        }
+        else
+        {
+            return op;
+        }
+    }
+    
+    protected boolean containsOp(Option op)
+    {
+        return optMap.containsKey(op.getShortForm()) || optMap.containsKey(op.getLongForm());
+    }
+    
+    protected String getOp(Option op)
+    {
+        if (optMap.containsKey(op.getShortForm()))
+        {
+            return (String)optMap.get(op.getShortForm());
+        }
+        else if (optMap.containsKey(op.getLongForm()))
+        {
+            return (String)optMap.get(op.getLongForm());
+        }
+        else
+        {
+            return op.getDefaultValue();
+        }           
+    }    
+
+    protected Connection createConnection() throws Exception
+    {
+        StringBuffer buf;
+        buf = new StringBuffer();       
+        buf.append("amqp://");
+        String userPass = "guest:guest";
+        String broker = "localhost:5672";
+        if(containsOp(BROKER))
+        {
+            try
+            {
+                String b = getOp(BROKER);
+                userPass = b.substring(0,b.indexOf('@'));
+                broker = b.substring(b.indexOf('@')+1);
+            }    
+            catch (StringIndexOutOfBoundsException e)
+            {
+                Exception ex = new Exception("Error parsing broker string " + getOp(BROKER));
+                ex.initCause(e);
+                throw ex;
+            }   
+            
+        }
+        
+        if(containsOp(BROKER_OPTIONS))
+        {
+            String bOps = getOp(BROKER_OPTIONS);
+            bOps = bOps.replaceAll(",", "'&");
+            bOps = bOps.replaceAll("=", "='");
+            broker = broker + "?" + bOps + "'";
+        }
+        buf.append(userPass);
+        buf.append("@");
+        buf.append(CLIENTID);
+        buf.append("/?brokerlist='tcp://");
+        buf.append(broker).append("'");
+        if(containsOp(CON_OPTIONS))
+        {
+            String bOps = getOp(CON_OPTIONS);
+            bOps = bOps.replaceAll(",", "'&");
+            bOps = bOps.replaceAll("=", "='");
+            buf.append("&").append(bOps).append("'");
+        }
+        
+        Connection con = new AMQConnection(buf.toString());
+        return con;
+    }
+
+    public static void addOption(Option opt)
+    {
+        optDefs.add(opt);
+    }
+
+    protected String getAddress()
+    {
+        return address;
+    }
+
+    static class Option
+    {
+        private final String shortForm;
+        private final String longForm;
+        private final String desc;
+        private final String valueLabel;
+        private final String defaultValue;
+        private final Class type;
+        
+        public Option(String shortForm, String longForm, String desc,
+                      String valueLabel, String defaultValue, Class type)
+        {
+            this.shortForm = shortForm;
+            this.longForm = longForm;
+            this.defaultValue = defaultValue;
+            this.type = type;
+            this.desc = desc;
+            this.valueLabel = valueLabel;
+        }
+
+        public String getShortForm()
+        {
+            return shortForm;
+        }
+        
+        public String getLongForm()
+        {
+            return longForm;
+        }
+        
+        public String getDefaultValue()
+        {
+            return defaultValue;
+        }
+        
+        public Class getType()
+        {
+            return type;
+        }    
+        
+        public String getDesc()
+        {
+            return desc;
+        }
+        
+        public String getValueLabel()
+        {
+            return valueLabel;
+        }
+    }
+}


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


Mime
View raw message