qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lqu...@apache.org
Subject [22/51] [abbrv] [partial] qpid-site git commit: Update site for release 6.1.3 and 6.0.7 of Qpid for Java
Date Thu, 01 Jun 2017 10:25:11 GMT
http://git-wip-us.apache.org/repos/asf/qpid-site/blob/663bd8c2/content/releases/qpid-java-6.0.7/qpid-jms/examples/ListSender.java.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-java-6.0.7/qpid-jms/examples/ListSender.java.html b/content/releases/qpid-java-6.0.7/qpid-jms/examples/ListSender.java.html
new file mode 100644
index 0000000..a628f3f
--- /dev/null
+++ b/content/releases/qpid-java-6.0.7/qpid-jms/examples/ListSender.java.html
@@ -0,0 +1,214 @@
+<!DOCTYPE html>
+<!--
+ -
+ - 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.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>ListSender.java - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-java-6.0.7/index.html">Qpid for Java 6.0.7</a></li><li><a href="/releases/qpid-java-6.0.7/qpid-jms/examples/index.html">Qpid JMS Examples (AMQP 0-10)</a></li><li>ListSender.java</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>ListSender.java</h1>
+<div class="highlight"><pre><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>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/663bd8c2/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapReceiver.java
----------------------------------------------------------------------
diff --git a/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapReceiver.java b/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapReceiver.java
new file mode 100755
index 0000000..89db04f
--- /dev/null
+++ b/content/releases/qpid-java-6.0.7/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/663bd8c2/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapReceiver.java.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapReceiver.java.html b/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapReceiver.java.html
new file mode 100644
index 0000000..6718c9a
--- /dev/null
+++ b/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapReceiver.java.html
@@ -0,0 +1,180 @@
+<!DOCTYPE html>
+<!--
+ -
+ - 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.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>MapReceiver.java - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-java-6.0.7/index.html">Qpid for Java 6.0.7</a></li><li><a href="/releases/qpid-java-6.0.7/qpid-jms/examples/index.html">Qpid JMS Examples (AMQP 0-10)</a></li><li>MapReceiver.java</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>MapReceiver.java</h1>
+<div class="highlight"><pre><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>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/663bd8c2/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapSender.java
----------------------------------------------------------------------
diff --git a/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapSender.java b/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapSender.java
new file mode 100755
index 0000000..0ce9383
--- /dev/null
+++ b/content/releases/qpid-java-6.0.7/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/663bd8c2/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapSender.java.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapSender.java.html b/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapSender.java.html
new file mode 100644
index 0000000..78d76ce
--- /dev/null
+++ b/content/releases/qpid-java-6.0.7/qpid-jms/examples/MapSender.java.html
@@ -0,0 +1,211 @@
+<!DOCTYPE html>
+<!--
+ -
+ - 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.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>MapSender.java - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-java-6.0.7/index.html">Qpid for Java 6.0.7</a></li><li><a href="/releases/qpid-java-6.0.7/qpid-jms/examples/index.html">Qpid JMS Examples (AMQP 0-10)</a></li><li>MapSender.java</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>MapSender.java</h1>
+<div class="highlight"><pre><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>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/663bd8c2/content/releases/qpid-java-6.0.7/qpid-jms/examples/OptionParser.java
----------------------------------------------------------------------
diff --git a/content/releases/qpid-java-6.0.7/qpid-jms/examples/OptionParser.java b/content/releases/qpid-java-6.0.7/qpid-jms/examples/OptionParser.java
new file mode 100755
index 0000000..9360be4
--- /dev/null
+++ b/content/releases/qpid-java-6.0.7/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