You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by sh...@apache.org on 2011/10/21 03:20:13 UTC

svn commit: r1187150 [28/43] - in /qpid/branches/QPID-2519: ./ bin/ cpp/ cpp/bindings/ cpp/bindings/qmf/python/ cpp/bindings/qmf/ruby/ cpp/bindings/qmf/tests/ cpp/bindings/qmf2/ cpp/bindings/qmf2/examples/cpp/ cpp/bindings/qmf2/python/ cpp/bindings/qmf...

Modified: qpid/branches/QPID-2519/java/build.deps
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/build.deps?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/build.deps (original)
+++ qpid/branches/QPID-2519/java/build.deps Fri Oct 21 01:19:00 2011
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+backport-util-concurrent=lib/backport-util-concurrent-2.2.jar
+
 commons-beanutils-core=lib/commons-beanutils-core-1.8.0.jar
 commons-cli=lib/commons-cli-1.0.jar
 commons-codec=lib/commons-codec-1.3.jar
@@ -25,40 +27,88 @@ commons-configuration=lib/commons-config
 commons-digester=lib/commons-digester-1.8.1.jar
 commons-lang=lib/commons-lang-2.2.jar
 commons-logging=lib/commons-logging-1.0.4.jar
+commons-pool=lib/commons-pool-1.4.jar
 
 derby-db=lib/derby-10.6.1.0.jar
 
 geronimo-jms=lib/geronimo-jms_1.1_spec-1.0.jar
 
 junit=lib/junit-3.8.1.jar
+junit4=lib/junit-4.4.jar
+
+jline=lib/jline-0.9.94.jar
 
 log4j=lib/log4j-1.2.12.jar
 
+mina-core=lib/mina-core-1.0.1.jar
+mina-filter-ssl=lib/mina-filter-ssl-1.0.1.jar
+
 slf4j-api=lib/slf4j-api-1.6.1.jar
 slf4j-log4j=lib/slf4j-log4j12-1.6.1.jar
 
 xalan=lib/xalan-2.7.0.jar
 
+muse-core=lib/muse-core-2.2.0.jar
+muse-platform-mini=lib/muse-platform-mini-2.2.0.jar
+muse-util=lib/muse-util-2.2.0.jar
+muse-util-qname=lib/muse-util-qname-2.2.0.jar
+muse-util-xml=lib/muse-util-xml-2.2.0.jar
+muse-wsa-soap=lib/muse-wsa-soap-2.2.0.jar
+muse-wsdm-muws-adv-api=lib/muse-wsdm-muws-adv-api-2.2.0.jar
+muse-wsdm-muws-adv-impl=lib/muse-wsdm-muws-adv-impl-2.2.0.jar
+muse-wsdm-muws-api=lib/muse-wsdm-muws-api-2.2.0.jar
+muse-wsdm-muws-impl=lib/muse-wsdm-muws-impl-2.2.0.jar
+muse-wsdm-wef-api=lib/muse-wsdm-wef-api-2.2.0.jar
+muse-wsdm-wef-impl=lib/muse-wsdm-wef-impl-2.2.0.jar
+muse-wsn-api=lib/muse-wsn-api-2.2.0.jar
+muse-wsn-impl=lib/muse-wsn-impl-2.2.0.jar
+muse-wsrf-api=lib/muse-wsrf-api-2.2.0.jar
+muse-wsrf-impl=lib/muse-wsrf-impl-2.2.0.jar
+muse-wsrf-rmd=lib/muse-wsrf-rmd-2.2.0.jar
+muse-wsx-api=lib/muse-wsx-api-2.2.0.jar
+muse-wsx-impl=lib/muse-wsx-impl-2.2.0.jar
+wsdl4j=lib/wsdl4j-1.6.1.jar
+xercesImpl=lib/xercesImpl-2.8.1.jar
+xml-apis=lib/xml-apis-1.3.03.jar
+javassist=lib/javassist.jar
 jetty=lib/jetty-6.1.14.jar
 jetty-util=lib/jetty-util-6.1.14.jar
 jetty-servlet-tester=lib/jetty-servlet-tester-6.1.14.jar
+jetty-bootstrap=lib/start.jar
+jsp-api=lib/jsp-api-2.1.jar
+jsp-impl=lib/jsp-2.1.jar
+core-lib=lib/core-3.1.1.jar
 servlet-api=lib/servlet-api.jar
 
+muse.libs = ${muse-core} ${muse-platform-mini} ${muse-util} ${muse-util-qname} \
+${muse-util-xml} ${muse-wsa-soap} ${muse-wsdm-muws-adv-api} ${muse-wsdm-muws-adv-impl} \
+${muse-wsdm-muws-api} ${muse-wsdm-muws-impl} ${muse-wsdm-wef-api} ${muse-wsdm-wef-impl} \
+${muse-wsn-api} ${muse-wsn-impl} ${muse-wsrf-api} ${muse-wsrf-impl} ${muse-wsrf-rmd} \
+${muse-wsx-api} ${muse-wsx-impl} ${wsdl4j} ${xercesImpl} ${xml-apis} ${jetty} ${jetty-util} ${jetty-bootstrap}
+
+jsp.libs = ${jsp-api} ${jsp-impl} ${core-lib}
+
 osgi-core=lib/org.osgi.core-1.0.0.jar
 felix-framework=lib/org.apache.felix.framework-2.0.5.jar
 
+geronimo-servlet=lib/geronimo-servlet_2.5_spec-1.2.jar
 felix.libs=${osgi-core} ${felix-framework}
 
 commons-configuration.libs = ${commons-beanutils-core} ${commons-digester} \
   ${commons-codec} ${commons-lang} ${commons-collections} ${commons-configuration}
 
-common.libs=${slf4j-api}
+common.libs=${slf4j-api} ${backport-util-concurrent} ${mina-core} ${mina-filter-ssl} 
 client.libs=${geronimo-jms}
 tools.libs=${commons-configuration.libs} ${log4j}
 broker.libs=${commons-cli} ${commons-logging} ${log4j} ${slf4j-log4j} \
     ${xalan} ${felix.libs} ${derby-db} ${commons-configuration.libs}
 
-broker-plugins.libs=${felix.libs} ${log4j} ${commons-configuration.libs}
+broker-plugins.libs=${felix.libs} ${log4j} ${commons-configuration.libs} 
+management-client.libs=${jsp.libs} ${log4j} ${slf4j-log4j} ${slf4j-api} \
+  ${commons-pool} ${geronimo-servlet} ${muse.libs} ${javassist} ${xalan}
+
+management-agent.libs=${commons-logging}
+management-console.libs=${commons-logging}
 
 junit-toolkit.libs=${log4j} ${junit} ${slf4j-api}
 test.libs=${slf4j-log4j} ${junit-toolkit.libs}
@@ -100,28 +150,34 @@ ecl-equinox-launcher-solaris-gtk-sparc=l
 
 management-common.libs=
 
-management-eclipse-plugin.core-libs=${ibm-icu} ${ecl-core-jface} ${ecl-core-jface-databinding} \
-    ${ecl-core-commands} ${ecl-core-contenttype} ${ecl-core-databinding} ${ecl-core-expressions} \
-    ${ecl-core-jobs} ${ecl-core-runtime} ${ecl-equinox-app} ${ecl-equinox-common} ${ecl-equinox-launcher} \
-    ${ecl-equinox-prefs} ${ecl-equinox-registry} ${ecl-help} ${ecl-osgi} ${ecl-swt} ${ecl-ui} ${ecl-ui-forms} \
-    ${ecl-ui-workbench} ${apache-commons-codec}
-
-management-eclipse-plugin.swt-libs=${ecl-swt-win32-win32-x86} ${ecl-swt-linux-gtk-x86} ${ecl-swt-macosx-carbon} \
-    ${ecl-swt-linux-gtk-x86_64} ${ecl-swt-solaris-gtk-sparc}
-
-management-eclipse-plugin.libs=${management-eclipse-plugin.core-libs} ${management-eclipse-plugin.swt-libs}
-
 management-eclipse-plugin-win32-win32-x86.libs=${management-eclipse-plugin.core-libs} \
-    ${ecl-swt-win32-win32-x86} ${ecl-equinox-launcher-win32-win32-x86} ${ecl-core-runtime-compat-registry}
+    ${ecl-swt-win32-win32-x86} ${ecl-equinox-launcher-win32-win32-x86}
 management-eclipse-plugin-linux-gtk-x86.libs=${management-eclipse-plugin.core-libs} \
-    ${ecl-swt-linux-gtk-x86} ${ecl-equinox-launcher-linux-gtk-x86} ${ecl-core-runtime-compat-registry}
+    ${ecl-swt-linux-gtk-x86} ${ecl-equinox-launcher-linux-gtk-x86}
 management-eclipse-plugin-linux-gtk-x86_64.libs=${management-eclipse-plugin.core-libs} \
-    ${ecl-swt-linux-gtk-x86_64} ${ecl-equinox-launcher-linux-gtk-x86_64} ${ecl-core-runtime-compat-registry}
+    ${ecl-swt-linux-gtk-x86_64} ${ecl-equinox-launcher-linux-gtk-x86_64}
 management-eclipse-plugin-macosx.libs=${management-eclipse-plugin.core-libs} \
-    ${ecl-swt-macosx-carbon} ${ecl-equinox-launcher-macosx-carbon} ${ecl-core-runtime-compat-registry}
+    ${ecl-swt-macosx-carbon} ${ecl-equinox-launcher-macosx-carbon}
 management-eclipse-plugin-solaris-gtk-sparc.libs=${management-eclipse-plugin.core-libs} \
-    ${ecl-swt-solaris-gtk-sparc} ${ecl-equinox-launcher-solaris-gtk-sparc} ${ecl-core-runtime-compat-registry}
+    ${ecl-swt-solaris-gtk-sparc} ${ecl-equinox-launcher-solaris-gtk-sparc}
+
+management-eclipse-plugin.core-libs=${ibm-icu} ${ecl-core-jface} ${ecl-core-jface-databinding} \
+    ${ecl-core-commands} ${ecl-core-contenttype} ${ecl-core-databinding} ${ecl-core-expressions} \
+    ${ecl-core-jobs} ${ecl-core-runtime} ${ecl-core-runtime-compat-registry} ${ecl-equinox-app} \
+    ${ecl-equinox-common} ${ecl-equinox-launcher} ${ecl-equinox-prefs} ${ecl-equinox-registry} \
+    ${ecl-help} ${ecl-osgi} ${ecl-swt} ${ecl-ui} ${ecl-ui-forms} ${ecl-ui-workbench} ${apache-commons-codec}
     
+management-eclipse-plugin.platform-libs=${ecl-equinox-launcher-win32-win32-x86} \
+    ${ecl-equinox-launcher-linux-gtk-x86} ${ecl-equinox-launcher-macosx-carbon} \
+    ${ecl-swt-win32-win32-x86} ${ecl-swt-linux-gtk-x86} ${ecl-swt-macosx-carbon} \
+    ${ecl-swt-linux-gtk-x86_64} ${ecl-equinox-launcher-linux-gtk-x86_64} \
+    ${ecl-swt-solaris-gtk-sparc} ${ecl-equinox-launcher-solaris-gtk-sparc}
+
+management-eclipse-plugin.libs=${management-eclipse-plugin.core-libs} ${management-eclipse-plugin.platform-libs}
+    
+
+management-tools-qpid-cli.libs=${jline} ${commons-configuration.libs}
+
 common.test.libs=${test.libs}
 broker.test.libs=${test.libs}
 client.test.libs=${test.libs}
@@ -133,10 +189,9 @@ systests.libs=${test.libs}
 broker-plugins.test.libs=${test.libs} 
 broker-plugins-experimental-info.test.libs=${test.libs} ${servlet-api} ${jetty} ${jetty-util} ${jetty-servlet-tester}
 
-management-eclipse-plugin.test.libs=${test.libs}
+management-client.test.libs=${muse.libs} ${test.libs} ${log4j} ${javassist} ${geronimo-servlet} ${commons-pool}
+management-console.test.libs=${junit4} ${slf4j-log4j} ${log4j}
+management-agent.test.libs=${junit} 
+management-eclipse-plugin.test.libs=${systests.libs}
+management-tools-qpid-cli.test.libs=${junit4} ${slf4j-log4j} ${log4j}
 management-common.test.libs=${test.libs}
-
-# optional bdbstore module deps
-bdb-je=lib/bdbstore/je-4.0.103.jar
-bdbstore.libs=${bdb-je}
-bdbstore.test.libs=${test.libs}

Modified: qpid/branches/QPID-2519/java/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/build.xml?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/build.xml (original)
+++ qpid/branches/QPID-2519/java/build.xml Fri Oct 21 01:19:00 2011
@@ -22,20 +22,18 @@
 
   <import file="common.xml"/>
 
-  <property file="${project.root}/build.overrides"/>
 
   <findSubProjects name="broker-plugins" dir="broker-plugins"/>
-  <findSubProjects name="client-plugins" dir="client-plugins"/>
-  <findSubProjects name="management" dir="management" excludes="common,example"/>
+  <findSubProjects name="management" dir="management" excludes="common,example,tools/qpid-cli"/>
 
   <property name="modules.core"       value="junit-toolkit common management/common broker client tools"/>
   <property name="modules.examples"   value="client/example management/example"/>
   <property name="modules.tests"      value="systests perftests integrationtests testkit"/>
   <property name="modules.management" value="${management}"/>
-  <property name="modules.plugin"     value="${broker-plugins} ${client-plugins}"/>
-  <property name="modules.opt"        value=""/>
+  <property name="modules.plugin"     value="${broker-plugins}"/>
+  <property name="modules.management.tools" value="management/tools/qpid-cli"/>
   <property name="modules"            value="${modules.core} ${modules.examples}
-   ${modules.management} ${modules.tests} ${modules.plugin} ${modules.opt}"/>
+   ${modules.management} ${modules.management.tools} ${modules.tests} ${modules.plugin}"/>
 
   <property name="qpid.jar"           location="${build.lib}/qpid-all.jar"/>
   <basename property="qpid.jar.name"  file="${qpid.jar}"/>
@@ -80,7 +78,7 @@
     <iterate target="compile-tests"/>
   </target>
 
-  <target name="test" description="execute tests" depends="manifest">
+  <target name="test" description="execute tests">
 
     <delete file="${build.failed}"/>
 
@@ -95,10 +93,6 @@
     <fail if="failed" message="TEST SUITE FAILED"/>
 
   </target>
-  
-  <target name="report-module" description="generate junitreport for modules">
-    <iterate target="report-module"/>
-  </target>
 
   <target name="jar" description="create module jars">
     <iterate target="jar"/>
@@ -219,18 +213,7 @@
         <include name="**/*.ser"/>
       </fileset>
     </cobertura-merge>
-    <cobertura-report format="xml"
-                      destdir="${build.coveragereport}"
-		      datafile="${build.coveragereport}/cobertura.ser"
-		      >
-      <fileset dir="${project.root}/common/src/main/java" includes="**/*.java" />
-      <fileset dir="${project.root}/build/scratch/common/src" includes="**/*.java" />
-      <fileset dir="${project.root}/broker/src/main/java" includes="**/*.java" />
-      <fileset dir="${project.root}/build/scratch/broker/src" includes="**/*.java" />
-      <fileset dir="${project.root}/client/src/main/java" includes="**/*.java" />
-      <fileset dir="${project.root}/build/scratch/client/src" includes="**/*.java" />
-    </cobertura-report>
-	<cobertura-report format="html"
+    <cobertura-report format="html"
                       destdir="${build.coveragereport}"
 		      datafile="${build.coveragereport}/cobertura.ser"
 		      >
@@ -294,7 +277,4 @@
     </findbugs>
   </target>
 
-  <target name="eclipse" description="build eclipse project and classpath files">
-    <iterate target="eclipse"/>
-  </target>
 </project>

Modified: qpid/branches/QPID-2519/java/client/README.txt
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/README.txt?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/README.txt (original)
+++ qpid/branches/QPID-2519/java/client/README.txt Fri Oct 21 01:19:00 2011
@@ -24,7 +24,7 @@ run more easily.
 E.g, in order to run the Hello example, you would add the client+example library
 files to the java classpath and launch the example like follows:
 
-java -cp "lib/qpid-all.jar:example/lib/qpid-client-example-<version>.jar" \
+java -cp "lib/qpid-all.jar:example/lib/qpid-client-examples-<version>.jar" \
     org.apache.qpid.example.Hello
 
 NOTE: The client uses the SL4FJ API for its logging. You must supply a logging 

Modified: qpid/branches/QPID-2519/java/client/example/src/main/java/org/apache/qpid/example/pubsub/ConnectionSetup.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/example/src/main/java/org/apache/qpid/example/pubsub/ConnectionSetup.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/example/src/main/java/org/apache/qpid/example/pubsub/ConnectionSetup.java (original)
+++ qpid/branches/QPID-2519/java/client/example/src/main/java/org/apache/qpid/example/pubsub/ConnectionSetup.java Fri Oct 21 01:19:00 2011
@@ -33,6 +33,7 @@ import java.util.Properties;
  * It is equivalent to a PropertyFile of value:
  *
  * connectionfactory.local=amqp://guest:guest@clientid/test?brokerlist='localhost'
+ * connectionfactory.vm=amqp://guest:guest@clientid/test?brokerlist='vm://:1'
  *
  * queue.queue=example.MyQueue
  * topic.topic=example.hierarical.topic
@@ -49,7 +50,7 @@ public class ConnectionSetup
     final static String QUEUE_NAME = "example.MyQueue";
 
     public static final String TOPIC_JNDI_NAME = "topic";
-    final static String TOPIC_NAME = "usa.news";
+    final static String TOPIC_NAME = "example.hierarical.topic";
 
     private Context _ctx;
 
@@ -60,6 +61,7 @@ public class ConnectionSetup
         Properties properties = new Properties();
         properties.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
         properties.put("connectionfactory." + CONNECTION_JNDI_NAME, CONNECTION_NAME);
+        properties.put("connectionfactory." + "vm", "amqp://guest:guest@clientid/test?brokerlist='vm://:1'");
 
         properties.put("queue." + QUEUE_JNDI_NAME, QUEUE_NAME);
         properties.put("topic." + TOPIC_JNDI_NAME, TOPIC_NAME);

Modified: qpid/branches/QPID-2519/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Publisher.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Publisher.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Publisher.java (original)
+++ qpid/branches/QPID-2519/java/client/example/src/main/java/org/apache/qpid/example/pubsub/Publisher.java Fri Oct 21 01:19:00 2011
@@ -71,7 +71,7 @@ public class Publisher extends Client
     public static void main(String[] args)
     {
 
-        String destination = args.length > 2 ? args[1] : "usa.news";
+        String destination = args.length > 2 ? args[1] : null;
 
         int msgCount = args.length > 2 ? Integer.parseInt(args[2]) : 100;
 

Modified: qpid/branches/QPID-2519/java/client/src/main/java/client.bnd
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/client.bnd?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/client.bnd (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/client.bnd Fri Oct 21 01:19:00 2011
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-ver: 0.13.0
+ver: 0.9.0
 
 Bundle-SymbolicName: qpid-client
 Bundle-Version: ${ver}

Propchange: qpid/branches/QPID-2519/java/client/src/main/java/client.log4j
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Oct 21 01:19:00 2011
@@ -0,0 +1,7 @@
+/qpid/branches/0.5.x-dev/client/src/main/java/client.log4j:886720-886722
+/qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/client.log4j:886720-886722,887145,892761,894875,916304,916325,930288,931179
+/qpid/branches/java-broker-0-10/qpid/java/client/src/main/java/client.log4j:795950-829653
+/qpid/branches/java-network-refactor/qpid/java/client/src/main/java/client.log4j:805429-821809
+/qpid/branches/qpid-2935/qpid/java/client/src/main/java/client.log4j:1061302-1072333
+/qpid/trunk/qpid/client/src/main/java/client.log4j:796646-796653
+/qpid/trunk/qpid/java/client/src/main/java/client.log4j:1072051-1185907

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQAnyDestination.java Fri Oct 21 01:19:00 2011
@@ -72,17 +72,6 @@ public class AMQAnyDestination extends A
 
     public String getTopicName() throws JMSException
     {
-        if (getRoutingKey() != null)
-        {
-            return getRoutingKey().asString();
-        }
-        else if (getSubject() != null)
-        {
-            return getSubject();
-        }
-        else
-        {
-            return null;
-        }
+        return super.getRoutingKey().toString();
     }
 }

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQBrokerDetails.java Fri Oct 21 01:19:00 2011
@@ -26,7 +26,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.qpid.jms.BrokerDetails;
-import org.apache.qpid.transport.ConnectionSettings;
+import org.apache.qpid.jms.ConnectionURL;
 import org.apache.qpid.url.URLHelper;
 import org.apache.qpid.url.URLSyntaxException;
 
@@ -38,6 +38,8 @@ public class AMQBrokerDetails implements
 
     private Map<String, String> _options = new HashMap<String, String>();
 
+    private SSLConfiguration _sslConfiguration;
+
     public AMQBrokerDetails(){}
     
     public AMQBrokerDetails(String url) throws URLSyntaxException
@@ -54,7 +56,9 @@ public class AMQBrokerDetails implements
             if (transport != null)
             {
                 //todo this list of valid transports should be enumerated somewhere
-                if (!(transport.equalsIgnoreCase(BrokerDetails.TCP)))
+                if ((!(transport.equalsIgnoreCase(BrokerDetails.VM) ||
+                       transport.equalsIgnoreCase(BrokerDetails.TCP) ||
+                       transport.equalsIgnoreCase(BrokerDetails.SOCKET))))
                 {
                     if (transport.equalsIgnoreCase("localhost"))
                     {
@@ -101,21 +105,6 @@ public class AMQBrokerDetails implements
             if (host == null)
             {
                 host = "";
-                
-                String auth = connection.getAuthority();
-                if (auth != null)
-                {
-                    // contains both host & port myhost:5672                
-                    if (auth.contains(":"))
-                    {
-                        host = auth.substring(0,auth.indexOf(":"));
-                    }
-                    else
-                    {
-                        host = auth;
-                    }
-                }
-
             }
 
             setHost(host);
@@ -178,7 +167,10 @@ public class AMQBrokerDetails implements
             }
             else
             {
-                setPort(port);
+                if (!_transport.equalsIgnoreCase(SOCKET))
+                {
+                    setPort(port);
+                }
             }
 
             String queryString = connection.getQuery();
@@ -198,10 +190,11 @@ public class AMQBrokerDetails implements
         }
     }
 
-    public AMQBrokerDetails(String host, int port)
+    public AMQBrokerDetails(String host, int port, SSLConfiguration sslConfiguration)
     {
         _host = host;
         _port = port;
+        _sslConfiguration = sslConfiguration;
     }
 
     public String getHost()
@@ -277,15 +270,33 @@ public class AMQBrokerDetails implements
         setProperty(OPTIONS_CONNECT_TIMEOUT, Long.toString(timeout));
     }
 
+    public SSLConfiguration getSSLConfiguration()
+    {
+        return _sslConfiguration;
+    }
+
+    public void setSSLConfiguration(SSLConfiguration sslConfig)
+    {
+        _sslConfiguration = sslConfig;
+    }
+
     public String toString()
     {
         StringBuffer sb = new StringBuffer();
 
         sb.append(_transport);
         sb.append("://");
-        sb.append(_host);
-        sb.append(':');
-        sb.append(_port);
+
+        if (!(_transport.equalsIgnoreCase(VM)))
+        {
+            sb.append(_host);
+        }
+
+        if (!(_transport.equalsIgnoreCase(SOCKET)))
+        {
+            sb.append(':');
+            sb.append(_port);
+        }
 
         sb.append(printOptionsURL());
 
@@ -303,8 +314,9 @@ public class AMQBrokerDetails implements
 
         return _host.equalsIgnoreCase(bd.getHost()) &&
                (_port == bd.getPort()) &&
-               _transport.equalsIgnoreCase(bd.getTransport());
-        //TODO do we need to compare all the options as well?
+               _transport.equalsIgnoreCase(bd.getTransport()) &&
+               compareSSLConfigurations(bd.getSSLConfiguration());
+        //todo do we need to compare all the options as well?
     }
 
     @Override
@@ -345,6 +357,24 @@ public class AMQBrokerDetails implements
         return optionsURL.toString();
     }
 
+    // Do we need to do a more in-depth comparison?
+    private boolean compareSSLConfigurations(SSLConfiguration other)
+    {
+        boolean retval = false;
+        if (_sslConfiguration == null &&
+                other == null)
+        {
+            retval = true;
+        }
+        else if (_sslConfiguration != null &&
+                other != null)
+        {
+            retval = true;
+        }
+
+        return retval;
+    }
+
     public static String checkTransport(String broker)
     {
         if ((!broker.contains("://")))
@@ -366,82 +396,4 @@ public class AMQBrokerDetails implements
     {
         _options = props;
     }
-
-    public ConnectionSettings buildConnectionSettings()
-    {
-        ConnectionSettings conSettings = new ConnectionSettings();
-
-        conSettings.setHost(getHost());
-        conSettings.setPort(getPort());
-
-        // ------------ sasl options ---------------
-        if (getProperty(BrokerDetails.OPTIONS_SASL_MECHS) != null)
-        {
-            conSettings.setSaslMechs(
-                    getProperty(BrokerDetails.OPTIONS_SASL_MECHS));
-        }
-
-        // Sun SASL Kerberos client uses the
-        // protocol + servername as the service key.
-
-        if (getProperty(BrokerDetails.OPTIONS_SASL_PROTOCOL_NAME) != null)
-        {
-            conSettings.setSaslProtocol(
-                    getProperty(BrokerDetails.OPTIONS_SASL_PROTOCOL_NAME));
-        }
-
-
-        if (getProperty(BrokerDetails.OPTIONS_SASL_SERVER_NAME) != null)
-        {
-            conSettings.setSaslServerName(
-                    getProperty(BrokerDetails.OPTIONS_SASL_SERVER_NAME));
-        }
-
-        conSettings.setUseSASLEncryption(
-                getBooleanProperty(BrokerDetails.OPTIONS_SASL_ENCRYPTION));
-
-        // ------------- ssl options ---------------------
-        conSettings.setUseSSL(getBooleanProperty(BrokerDetails.OPTIONS_SSL));
-
-        if (getProperty(BrokerDetails.OPTIONS_TRUST_STORE) != null)
-        {
-            conSettings.setTrustStorePath(
-                    getProperty(BrokerDetails.OPTIONS_TRUST_STORE));
-        }
-
-        if (getProperty(BrokerDetails.OPTIONS_TRUST_STORE_PASSWORD) != null)
-        {
-            conSettings.setTrustStorePassword(
-                    getProperty(BrokerDetails.OPTIONS_TRUST_STORE_PASSWORD));
-        }
-
-        if (getProperty(BrokerDetails.OPTIONS_KEY_STORE) != null)
-        {
-            conSettings.setKeyStorePath(
-                    getProperty(BrokerDetails.OPTIONS_KEY_STORE));
-        }
-
-        if (getProperty(BrokerDetails.OPTIONS_KEY_STORE_PASSWORD) != null)
-        {
-            conSettings.setKeyStorePassword(
-                    getProperty(BrokerDetails.OPTIONS_KEY_STORE_PASSWORD));
-        }
-
-        if (getProperty(BrokerDetails.OPTIONS_SSL_CERT_ALIAS) != null)
-        {
-            conSettings.setCertAlias(
-                    getProperty(BrokerDetails.OPTIONS_SSL_CERT_ALIAS));
-        }
-        // ----------------------------
-
-        conSettings.setVerifyHostname(getBooleanProperty(BrokerDetails.OPTIONS_SSL_VERIFY_HOSTNAME));
-
-        if (getProperty(BrokerDetails.OPTIONS_TCP_NO_DELAY) != null)
-        {
-            conSettings.setTcpNodelay(
-                    getBooleanProperty(BrokerDetails.OPTIONS_TCP_NO_DELAY));
-        }
-
-        return conSettings;
-    }
 }

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java Fri Oct 21 01:19:00 2011
@@ -111,7 +111,7 @@ public class AMQConnection extends Close
     /** Maps from session id (Integer) to AMQSession instance */
     private final ChannelToSessionMap _sessions = new ChannelToSessionMap();
 
-    private final String _clientName;
+    private String _clientName;
 
     /** The user name to use for authentication */
     private String _username;
@@ -126,7 +126,7 @@ public class AMQConnection extends Close
 
     private ConnectionListener _connectionListener;
 
-    private final ConnectionURL _connectionURL;
+    private ConnectionURL _connectionURL;
 
     /**
      * Whether this connection is started, i.e. whether messages are flowing to consumers. It has no meaning for message
@@ -147,6 +147,9 @@ public class AMQConnection extends Close
      */
     private QpidConnectionMetaData _connectionMetaData;
 
+    /** Configuration info for SSL */
+    private SSLConfiguration _sslConfiguration;
+
     private AMQShortString _defaultTopicExchangeName = ExchangeDefaults.TOPIC_EXCHANGE_NAME;
     private AMQShortString _defaultQueueExchangeName = ExchangeDefaults.DIRECT_EXCHANGE_NAME;
     private AMQShortString _temporaryTopicExchangeName = ExchangeDefaults.TOPIC_EXCHANGE_NAME;
@@ -170,8 +173,8 @@ public class AMQConnection extends Close
     //Indicates the sync publish options (persistent|all)
     //By default it's async publish
     private String _syncPublish = "";
-
-    // Indicates whether to use the old map message format or the
+    
+    // Indicates whether to use the old map message format or the 
     // new amqp-0-10 encoded format.
     private boolean _useLegacyMapMessageFormat;
 
@@ -191,33 +194,69 @@ public class AMQConnection extends Close
         this(new AMQConnectionURL(
                 ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@"
                 + ((clientName == null) ? "" : clientName) + "/" + virtualHost + "?brokerlist='"
-                + AMQBrokerDetails.checkTransport(broker) + "'"));
+                + AMQBrokerDetails.checkTransport(broker) + "'"), null);
+    }
+
+    /**
+     * @param broker      brokerdetails
+     * @param username    username
+     * @param password    password
+     * @param clientName  clientid
+     * @param virtualHost virtualhost
+     *
+     * @throws AMQException
+     * @throws URLSyntaxException
+     */
+    public AMQConnection(String broker, String username, String password, String clientName, String virtualHost,
+                         SSLConfiguration sslConfig) throws AMQException, URLSyntaxException
+    {
+        this(new AMQConnectionURL(
+                ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@"
+                + ((clientName == null) ? "" : clientName) + "/" + virtualHost + "?brokerlist='"
+                + AMQBrokerDetails.checkTransport(broker) + "'"), sslConfig);
     }
 
     public AMQConnection(String host, int port, String username, String password, String clientName, String virtualHost)
             throws AMQException, URLSyntaxException
     {
+        this(host, port, false, username, password, clientName, virtualHost, null);
+    }
+
+    public AMQConnection(String host, int port, String username, String password, String clientName, String virtualHost,
+                         SSLConfiguration sslConfig) throws AMQException, URLSyntaxException
+    {
+        this(host, port, false, username, password, clientName, virtualHost, sslConfig);
+    }
+
+    public AMQConnection(String host, int port, boolean useSSL, String username, String password, String clientName,
+                         String virtualHost, SSLConfiguration sslConfig) throws AMQException, URLSyntaxException
+    {
         this(new AMQConnectionURL(
-                   ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@"
-                   + ((clientName == null) ? "" : clientName) + virtualHost + "?brokerlist='tcp://" + host + ":" + port + "'"));
+                useSSL
+                ? (ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@"
+                   + ((clientName == null) ? "" : clientName) + virtualHost + "?brokerlist='tcp://" + host + ":" + port
+                   + "'" + "," + BrokerDetails.OPTIONS_SSL + "='true'")
+                : (ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@"
+                   + ((clientName == null) ? "" : clientName) + virtualHost + "?brokerlist='tcp://" + host + ":" + port
+                   + "'" + "," + BrokerDetails.OPTIONS_SSL + "='false'")), sslConfig);
     }
 
     public AMQConnection(String connection) throws AMQException, URLSyntaxException
     {
-        this(new AMQConnectionURL(connection));
+        this(new AMQConnectionURL(connection), null);
+    }
+
+    public AMQConnection(String connection, SSLConfiguration sslConfig) throws AMQException, URLSyntaxException
+    {
+        this(new AMQConnectionURL(connection), sslConfig);
     }
 
     /**
      * @todo Some horrible stuff going on here with setting exceptions to be non-null to detect if an exception
      * was thrown during the connection! Intention not clear. Use a flag anyway, not exceptions... Will fix soon.
      */
-    public AMQConnection(ConnectionURL connectionURL) throws AMQException
+    public AMQConnection(ConnectionURL connectionURL, SSLConfiguration sslConfig) throws AMQException
     {
-        if (connectionURL == null)
-        {
-            throw new IllegalArgumentException("Connection must be specified");
-        }
-
         // set this connection maxPrefetch
         if (connectionURL.getOption(ConnectionURL.OPTIONS_MAXPREFETCH) != null)
         {
@@ -225,7 +264,7 @@ public class AMQConnection extends Close
         }
         else
         {
-            // use the default value set for all connections
+            // use the defaul value set for all connections
             _maxPrefetch = Integer.parseInt(System.getProperties().getProperty(ClientProperties.MAX_PREFETCH_PROP_NAME,
                     ClientProperties.MAX_PREFETCH_DEFAULT));
         }
@@ -239,7 +278,7 @@ public class AMQConnection extends Close
         }
         else
         {
-            // use the default value set for all connections
+            // use the defaul value set for all connections
             _syncPersistence = Boolean.getBoolean(ClientProperties.SYNC_PERSISTENT_PROP_NAME);
             if (_syncPersistence)
             {
@@ -254,7 +293,7 @@ public class AMQConnection extends Close
         }
         else
         {
-            // use the default value set for all connections
+            // use the defaul value set for all connections
             _syncAck = Boolean.getBoolean(ClientProperties.SYNC_ACK_PROP_NAME);
         }
 
@@ -267,7 +306,7 @@ public class AMQConnection extends Close
             // use the default value set for all connections
             _syncPublish = System.getProperty((ClientProperties.SYNC_PUBLISH_PROP_NAME),_syncPublish);
         }
-
+        
         if (connectionURL.getOption(ConnectionURL.OPTIONS_USE_LEGACY_MAP_MESSAGE_FORMAT) != null)
         {
             _useLegacyMapMessageFormat =  Boolean.parseBoolean(
@@ -278,16 +317,16 @@ public class AMQConnection extends Close
             // use the default value set for all connections
             _useLegacyMapMessageFormat = Boolean.getBoolean(ClientProperties.USE_LEGACY_MAP_MESSAGE_FORMAT);
         }
-
+        
         String amqpVersion = System.getProperty((ClientProperties.AMQP_VERSION), "0-10");
         _logger.debug("AMQP version " + amqpVersion);
-
+        
         _failoverPolicy = new FailoverPolicy(connectionURL, this);
         BrokerDetails brokerDetails = _failoverPolicy.getCurrentBrokerDetails();
-        if ("0-8".equals(amqpVersion))
+        if (brokerDetails.getTransport().equals(BrokerDetails.VM) || "0-8".equals(amqpVersion)) 
         {
             _delegate = new AMQConnectionDelegate_8_0(this);
-        }
+        } 
         else if ("0-9".equals(amqpVersion))
         {
             _delegate = new AMQConnectionDelegate_0_9(this);
@@ -306,6 +345,12 @@ public class AMQConnection extends Close
             _logger.info("Connection:" + connectionURL);
         }
 
+        _sslConfiguration = sslConfig;
+        if (connectionURL == null)
+        {
+            throw new IllegalArgumentException("Connection must be specified");
+        }
+
         _connectionURL = connectionURL;
 
         _clientName = connectionURL.getClientName();
@@ -373,7 +418,6 @@ public class AMQConnection extends Close
                 brokerDetails = _failoverPolicy.getNextBrokerDetails();
             }
         }
-        verifyClientID();
 
         if (_logger.isDebugEnabled())
         {
@@ -460,7 +504,7 @@ public class AMQConnection extends Close
             Class partypes[] = new Class[1];
             partypes[0] = AMQConnection.class;
             _delegate = (AMQConnectionDelegate) c.getConstructor(partypes).newInstance(this);
-            //Update our session to use this new protocol version
+            //Update our session to use this new protocol version 
             _protocolHandler.getProtocolSession().setProtocolVersion(_delegate.getProtocolVersion());
 
         }
@@ -491,6 +535,14 @@ public class AMQConnection extends Close
         }
     }
 
+    protected AMQConnection(String username, String password, String clientName, String virtualHost)
+    {
+        _clientName = clientName;
+        _username = username;
+        _password = password;
+        setVirtualHost(virtualHost);
+    }
+
     private void setVirtualHost(String virtualHost)
     {
         if (virtualHost != null && virtualHost.startsWith("/"))
@@ -503,7 +555,7 @@ public class AMQConnection extends Close
 
     public boolean attemptReconnection(String host, int port)
     {
-        BrokerDetails bd = new AMQBrokerDetails(host, port);
+        BrokerDetails bd = new AMQBrokerDetails(host, port, _sslConfiguration);
 
         _failoverPolicy.setBroker(bd);
 
@@ -644,6 +696,20 @@ public class AMQConnection extends Close
         }
     }
 
+    private void reopenChannel(int channelId, int prefetchHigh, int prefetchLow, boolean transacted)
+            throws AMQException, FailoverException
+    {
+        try
+        {
+            createChannelOverWire(channelId, prefetchHigh, prefetchLow, transacted);
+        }
+        catch (AMQException e)
+        {
+            deregisterSession(channelId);
+            throw new AMQException(null, "Error reopening channel " + channelId + " after failover: " + e, e);
+        }
+    }
+
     public void setFailoverPolicy(FailoverPolicy policy)
     {
         _failoverPolicy = policy;
@@ -1030,7 +1096,7 @@ public class AMQConnection extends Close
     {
         _username = id;
     }
-
+    
     public String getPassword()
     {
         return _password;
@@ -1183,7 +1249,7 @@ public class AMQConnection extends Close
 
             if (code != null)
             {
-                je = new JMSException("Exception thrown against " + toString() + ": " + cause, Integer.toString(code.getCode()));
+                je = new JMSException(Integer.toString(code.getCode()), "Exception thrown against " + toString() + ": " + cause);
             }
             else
             {
@@ -1206,7 +1272,7 @@ public class AMQConnection extends Close
             {
                 je.setLinkedException((Exception) cause);
             }
-
+            
             je.initCause(cause);
         }
 
@@ -1239,7 +1305,7 @@ public class AMQConnection extends Close
             {
                 _logger.info("Not a hard-error connection not closing: " + cause);
             }
-
+            
             // deliver the exception if there is a listener
             if (_exceptionListener != null)
             {
@@ -1249,7 +1315,7 @@ public class AMQConnection extends Close
             {
                 _logger.error("Throwable Received but no listener set: " + cause);
             }
-
+    
             // if we are closing the connection, close sessions first
             if (closer)
             {
@@ -1306,20 +1372,6 @@ public class AMQConnection extends Close
         return buf.toString();
     }
 
-    /**
-     * Returns connection url.
-     * @return connection url
-     */
-    public ConnectionURL getConnectionURL()
-    {
-        return _connectionURL;
-    }
-
-    /**
-     * Returns stringified connection url.   This url is suitable only for display
-     * as {@link AMQConnectionURL#toString()} converts any password to asterisks.
-     * @return connection url
-     */
     public String toURL()
     {
         return _connectionURL.toString();
@@ -1331,6 +1383,11 @@ public class AMQConnection extends Close
                              AMQConnectionFactory.class.getName(), null); // factory location
     }
 
+    public SSLConfiguration getSSLConfiguration()
+    {
+        return _sslConfiguration;
+    }
+
     public AMQShortString getDefaultTopicExchangeName()
     {
         return _defaultTopicExchangeName;
@@ -1385,18 +1442,7 @@ public class AMQConnection extends Close
     {
         return _delegate.getProtocolVersion();
     }
-    
-    public String getBrokerUUID()
-    {
-        if(getProtocolVersion().equals(ProtocolVersion.v0_10))
-        {
-            return ((AMQConnectionDelegate_0_10)_delegate).getUUID();
-        }
-        else
-        {
-            return null;
-        }
-    }
+
     public boolean isFailingOver()
     {
         return (_protocolHandler.getFailoverLatch() != null);
@@ -1439,27 +1485,9 @@ public class AMQConnection extends Close
     {
         return _sessions.getNextChannelId();
     }
-
+    
     public boolean isUseLegacyMapMessageFormat()
     {
         return _useLegacyMapMessageFormat;
     }
-
-    private void verifyClientID() throws AMQException
-    {
-        if (Boolean.getBoolean(ClientProperties.QPID_VERIFY_CLIENT_ID))
-        {
-            try
-            {
-                if (!_delegate.verifyClientID())
-                {
-                    throw new AMQException(AMQConstant.ALREADY_EXISTS,"ClientID must be unique");
-                }
-            }
-            catch(JMSException e)
-            {
-                    throw new AMQException(e.getMessage(),e);
-            }
-        }
-    }
 }

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate.java Fri Oct 21 01:19:00 2011
@@ -57,12 +57,10 @@ public interface AMQConnectionDelegate
     void closeConnection(long timeout) throws JMSException, AMQException;
 
     <T, E extends Exception> T executeRetrySupport(FailoverProtectedOperation<T,E> operation) throws E;
-
+    
     int getMaxChannelID();
 
     int getMinChannelID();
 
     ProtocolVersion getProtocolVersion();
-
-    boolean verifyClientID() throws JMSException, AMQException;
 }

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java Fri Oct 21 01:19:00 2011
@@ -1,6 +1,6 @@
 package org.apache.qpid.client;
 /*
- *
+ * 
  * 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
@@ -8,16 +8,16 @@ package org.apache.qpid.client;
  * 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.
- *
+ * 
  */
 
 
@@ -35,7 +35,6 @@ import javax.jms.XASession;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.failover.FailoverException;
 import org.apache.qpid.client.failover.FailoverProtectedOperation;
-import org.apache.qpid.client.transport.ClientConnectionDelegate;
 import org.apache.qpid.configuration.ClientProperties;
 import org.apache.qpid.framing.ProtocolVersion;
 import org.apache.qpid.jms.BrokerDetails;
@@ -44,13 +43,10 @@ import org.apache.qpid.jms.Session;
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.transport.Connection;
 import org.apache.qpid.transport.ConnectionClose;
-import org.apache.qpid.transport.ConnectionCloseCode;
 import org.apache.qpid.transport.ConnectionException;
 import org.apache.qpid.transport.ConnectionListener;
 import org.apache.qpid.transport.ConnectionSettings;
 import org.apache.qpid.transport.ProtocolVersionException;
-import org.apache.qpid.transport.SessionDetachCode;
-import org.apache.qpid.transport.SessionException;
 import org.apache.qpid.transport.TransportException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,10 +59,6 @@ public class AMQConnectionDelegate_0_10 
     private static final Logger _logger = LoggerFactory.getLogger(AMQConnectionDelegate_0_10.class);
 
     /**
-     * The name of the UUID property
-     */
-    private static final String UUID_NAME = "qpid.federation_tag";
-    /**
      * The AMQ Connection.
      */
     private AMQConnection _conn;
@@ -77,12 +69,6 @@ public class AMQConnectionDelegate_0_10 
     org.apache.qpid.transport.Connection _qpidConnection;
     private ConnectionException exception = null;
 
-    static
-    {
-        // Register any configured SASL client factories.
-        org.apache.qpid.client.security.DynamicSaslRegistrar.registerSaslProviders();
-    }
-
     //--- constructor
     public AMQConnectionDelegate_0_10(AMQConnection conn)
     {
@@ -94,14 +80,7 @@ public class AMQConnectionDelegate_0_10 
     /**
      * create a Session and start it if required.
      */
-
     public Session createSession(boolean transacted, int acknowledgeMode, int prefetchHigh, int prefetchLow)
-    throws JMSException
-    {
-        return createSession(transacted,acknowledgeMode,prefetchHigh,prefetchLow,null);
-    }
-
-    public Session createSession(boolean transacted, int acknowledgeMode, int prefetchHigh, int prefetchLow, String name)
             throws JMSException
     {
         _conn.checkNotClosed();
@@ -116,7 +95,7 @@ public class AMQConnectionDelegate_0_10 
         try
         {
             session = new AMQSession_0_10(_qpidConnection, _conn, channelId, transacted, acknowledgeMode, prefetchHigh,
-                    prefetchLow,name);
+                                          prefetchLow);
             _conn.registerSession(channelId, session);
             if (_conn._started)
             {
@@ -194,8 +173,8 @@ public class AMQConnectionDelegate_0_10 
                         + _conn.getPassword());
             }
 
-            ConnectionSettings conSettings = retriveConnectionSettings(brokerDetail);
-            _qpidConnection.setConnectionDelegate(new ClientConnectionDelegate(conSettings, _conn.getConnectionURL()));
+            ConnectionSettings conSettings = new ConnectionSettings();
+            retriveConnectionSettings(conSettings,brokerDetail);
             _qpidConnection.connect(conSettings);
 
             _conn._connected = true;
@@ -232,8 +211,6 @@ public class AMQConnectionDelegate_0_10 
 
     public void resubscribeSessions() throws JMSException, AMQException, FailoverException
     {
-        _logger.info("Resuming connection");
-        getQpidConnection().resume();
         List<AMQSession> sessions = new ArrayList<AMQSession>(_conn.getSessions().values());
         _logger.info(String.format("Resubscribing sessions = %s sessions.size=%d", sessions, sessions.size()));
         for (AMQSession s : sessions)
@@ -277,10 +254,10 @@ public class AMQConnectionDelegate_0_10 
         }
 
         ConnectionClose close = exc.getClose();
-        if (close == null || close.getReplyCode() == ConnectionCloseCode.CONNECTION_FORCED)
+        if (close == null)
         {
             _conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1));
-
+            
             try
             {
                 if (_conn.firePreFailover(false) && _conn.attemptReconnection())
@@ -349,20 +326,78 @@ public class AMQConnectionDelegate_0_10 
     {
         return ProtocolVersion.v0_10;
     }
-
-    public String getUUID()
-    {
-        return (String)_qpidConnection.getServerProperties().get(UUID_NAME);
-    }
-
-    private ConnectionSettings retriveConnectionSettings(BrokerDetails brokerDetail)
+    
+    private void retriveConnectionSettings(ConnectionSettings conSettings, BrokerDetails brokerDetail)
     {
-        ConnectionSettings conSettings = brokerDetail.buildConnectionSettings();
 
+        conSettings.setHost(brokerDetail.getHost());
+        conSettings.setPort(brokerDetail.getPort());
         conSettings.setVhost(_conn.getVirtualHost());
         conSettings.setUsername(_conn.getUsername());
         conSettings.setPassword(_conn.getPassword());
+        
+        // ------------ sasl options ---------------
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_SASL_MECHS) != null)
+        {
+            conSettings.setSaslMechs(
+                    brokerDetail.getProperty(BrokerDetails.OPTIONS_SASL_MECHS));
+        }
+
+        // Sun SASL Kerberos client uses the
+        // protocol + servername as the service key.
+        
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_SASL_PROTOCOL_NAME) != null)
+        {
+            conSettings.setSaslProtocol(
+                    brokerDetail.getProperty(BrokerDetails.OPTIONS_SASL_PROTOCOL_NAME));
+        }
+        
+        
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_SASL_SERVER_NAME) != null)
+        {
+            conSettings.setSaslServerName(
+                    brokerDetail.getProperty(BrokerDetails.OPTIONS_SASL_SERVER_NAME));
+        }
+                        
+        conSettings.setUseSASLEncryption(
+                brokerDetail.getBooleanProperty(BrokerDetails.OPTIONS_SASL_ENCRYPTION));
+
+        // ------------- ssl options ---------------------
+        conSettings.setUseSSL(brokerDetail.getBooleanProperty(BrokerDetails.OPTIONS_SSL));
+        
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_TRUST_STORE) != null)
+        {
+            conSettings.setTrustStorePath(
+                    brokerDetail.getProperty(BrokerDetails.OPTIONS_TRUST_STORE));
+        }
+
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_TRUST_STORE_PASSWORD) != null)
+        {
+            conSettings.setTrustStorePassword(
+                    brokerDetail.getProperty(BrokerDetails.OPTIONS_TRUST_STORE_PASSWORD));
+        }
+        
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_KEY_STORE) != null)
+        {
+            conSettings.setKeyStorePath(
+                    brokerDetail.getProperty(BrokerDetails.OPTIONS_KEY_STORE));
+        }
+        
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_KEY_STORE_PASSWORD) != null)
+        {
+            conSettings.setKeyStorePassword(
+                    brokerDetail.getProperty(BrokerDetails.OPTIONS_KEY_STORE_PASSWORD));
+        }
 
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_SSL_CERT_ALIAS) != null)
+        {
+            conSettings.setCertAlias(
+                    brokerDetail.getProperty(BrokerDetails.OPTIONS_SSL_CERT_ALIAS));
+        }
+        // ----------------------------
+        
+        conSettings.setVerifyHostname(brokerDetail.getBooleanProperty(BrokerDetails.OPTIONS_SSL_VERIFY_HOSTNAME));
+        
         // Pass client name from connection URL
         Map<String, Object> clientProps = new HashMap<String, Object>();
         try
@@ -374,12 +409,16 @@ public class AMQConnectionDelegate_0_10 
         {
             // Ignore
         }
-
+        
+        if (brokerDetail.getProperty(BrokerDetails.OPTIONS_TCP_NO_DELAY) != null)
+        {
+            conSettings.setTcpNodelay(
+                    brokerDetail.getBooleanProperty(BrokerDetails.OPTIONS_TCP_NO_DELAY));
+        }
+        
         conSettings.setHeartbeatInterval(getHeartbeatInterval(brokerDetail));
-
-        return conSettings;
     }
-
+    
     // The idle_timeout prop is in milisecs while
     // the new heartbeat prop is in secs
     private int getHeartbeatInterval(BrokerDetails brokerDetail)
@@ -394,7 +433,7 @@ public class AMQConnectionDelegate_0_10 
         {
             heartbeat = Integer.parseInt(brokerDetail.getProperty(BrokerDetails.OPTIONS_HEARTBEAT));
         }
-        else if (Integer.getInteger(ClientProperties.IDLE_TIMEOUT_PROP_NAME) != null)
+        else if (Integer.getInteger(ClientProperties.IDLE_TIMEOUT_PROP_NAME) != null) 
         {
             heartbeat = Integer.getInteger(ClientProperties.IDLE_TIMEOUT_PROP_NAME)/1000;
             _logger.warn("JVM arg -Didle_timeout=<mili_secs> is deprecated, please use -Dqpid.heartbeat=<secs>");
@@ -402,37 +441,12 @@ public class AMQConnectionDelegate_0_10 
         else
         {
             heartbeat = Integer.getInteger(ClientProperties.HEARTBEAT,ClientProperties.HEARTBEAT_DEFAULT);
-        }
+        } 
         return heartbeat;
     }
-
+    
     protected org.apache.qpid.transport.Connection getQpidConnection()
     {
         return _qpidConnection;
     }
-
-    public boolean verifyClientID() throws JMSException, AMQException
-    {
-        int prefetch = (int)_conn.getMaxPrefetch();
-        AMQSession_0_10 ssn = (AMQSession_0_10)createSession(false, 1,prefetch,prefetch,_conn.getClientID());
-        org.apache.qpid.transport.Session ssn_0_10 = ssn.getQpidSession();
-        try
-        {
-            ssn_0_10.awaitOpen();
-        }
-        catch(SessionException se)
-        {
-            //if due to non unique client id for user return false, otherwise wrap and re-throw.
-            if (ssn_0_10.getDetachCode() != null &&
-                ssn_0_10.getDetachCode() == SessionDetachCode.SESSION_BUSY)
-            {
-                return false;
-            }
-            else
-            {
-                throw new AMQException(AMQConstant.INTERNAL_ERROR, "Unexpected SessionException thrown while awaiting session opening", se);
-            }
-        }
-        return true;
-    }
 }

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java Fri Oct 21 01:19:00 2011
@@ -23,8 +23,6 @@ package org.apache.qpid.client;
 import java.io.IOException;
 import java.net.ConnectException;
 import java.nio.channels.UnresolvedAddressException;
-import java.security.GeneralSecurityException;
-import java.security.Security;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.EnumSet;
@@ -33,17 +31,15 @@ import java.util.Set;
 
 import javax.jms.JMSException;
 import javax.jms.XASession;
-import javax.net.ssl.SSLContext;
 
 import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQTimeoutException;
 import org.apache.qpid.client.failover.FailoverException;
 import org.apache.qpid.client.failover.FailoverProtectedOperation;
 import org.apache.qpid.client.failover.FailoverRetrySupport;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
 import org.apache.qpid.client.state.AMQState;
-import org.apache.qpid.client.state.AMQStateManager;
 import org.apache.qpid.client.state.StateWaiter;
+import org.apache.qpid.client.transport.TransportConnection;
 import org.apache.qpid.framing.BasicQosBody;
 import org.apache.qpid.framing.BasicQosOkBody;
 import org.apache.qpid.framing.ChannelOpenBody;
@@ -53,13 +49,6 @@ import org.apache.qpid.framing.TxSelectB
 import org.apache.qpid.framing.TxSelectOkBody;
 import org.apache.qpid.jms.BrokerDetails;
 import org.apache.qpid.jms.ChannelLimitReachedException;
-import org.apache.qpid.ssl.SSLContextFactory;
-import org.apache.qpid.transport.ConnectionSettings;
-import org.apache.qpid.transport.network.NetworkConnection;
-import org.apache.qpid.transport.network.OutgoingNetworkTransport;
-import org.apache.qpid.transport.network.Transport;
-import org.apache.qpid.transport.network.security.SecurityLayer;
-import org.apache.qpid.transport.network.security.SecurityLayerFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -71,30 +60,8 @@ public class AMQConnectionDelegate_8_0 i
 
     public void closeConnection(long timeout) throws JMSException, AMQException
     {
-        final AMQStateManager stateManager = _conn.getProtocolHandler().getStateManager();
-        final AMQState currentState = stateManager.getCurrentState();
+        _conn.getProtocolHandler().closeConnection(timeout);
 
-        if (currentState.equals(AMQState.CONNECTION_CLOSED))
-        {
-            _logger.debug("Connection already closed.");
-        }
-        else if (currentState.equals(AMQState.CONNECTION_CLOSING))
-        {
-            _logger.debug("Connection already closing, awaiting closed state.");
-            final StateWaiter closeWaiter = new StateWaiter(stateManager, currentState, EnumSet.of(AMQState.CONNECTION_CLOSED));
-            try
-            {
-                closeWaiter.await(timeout);
-            }
-            catch (AMQTimeoutException te)
-            {
-                throw new AMQTimeoutException("Close did not complete in timely fashion", te);
-            }
-        }
-        else
-        {
-            _conn.getProtocolHandler().closeConnection(timeout);
-        }
     }
 
     public AMQConnectionDelegate_8_0(AMQConnection conn)
@@ -122,34 +89,15 @@ public class AMQConnectionDelegate_8_0 i
 
         StateWaiter waiter = _conn._protocolHandler.createWaiter(openOrClosedStates);
 
-        ConnectionSettings settings = brokerDetail.buildConnectionSettings();
-        settings.setProtocol(brokerDetail.getTransport());
-
-        SSLContext sslContext = null;
-        if (settings.isUseSSL())
+        // TODO: use system property thingy for this
+        if (System.getProperty("UseTransportIo", "false").equals("false"))
         {
-            try
-            {
-                sslContext = SSLContextFactory.buildClientContext(
-                                settings.getTrustStorePath(),
-                                settings.getTrustStorePassword(),
-                                settings.getTrustStoreCertType(),
-                                settings.getKeyStorePath(),
-                                settings.getKeyStorePassword(),
-                                settings.getKeyStoreCertType(),
-                                settings.getCertAlias());
-            }
-            catch (GeneralSecurityException e)
-            {
-                throw new AMQException("Unable to create SSLContext: " + e.getMessage(), e);
-            }
+            TransportConnection.getInstance(brokerDetail).connect(_conn._protocolHandler, brokerDetail);
+        }
+        else
+        {
+            _conn.getProtocolHandler().createIoTransportSession(brokerDetail);
         }
-
-        SecurityLayer securityLayer = SecurityLayerFactory.newInstance(settings);
-
-        OutgoingNetworkTransport transport = Transport.getOutgoingTransportInstance(getProtocolVersion());
-        NetworkConnection network = transport.connect(settings, securityLayer.receiver(_conn._protocolHandler), sslContext);
-        _conn._protocolHandler.setNetworkConnection(network, securityLayer.sender(network.getSender()));
         _conn._protocolHandler.getProtocolSession().init();
         // this blocks until the connection has been set up or when an error
         // has prevented the connection being set up
@@ -374,9 +322,4 @@ public class AMQConnectionDelegate_8_0 i
     {
         return ProtocolVersion.v8_0;
     }
-
-    public boolean verifyClientID() throws JMSException
-    {
-        return true;
-    }
 }

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java Fri Oct 21 01:19:00 2011
@@ -44,34 +44,210 @@ public class AMQConnectionFactory implem
                                              ObjectFactory, Referenceable, XATopicConnectionFactory,
                                              XAQueueConnectionFactory, XAConnectionFactory
 {
-    private final ConnectionURL _connectionDetails;
+    private String _host;
+    private int _port;
+    private String _defaultUsername;
+    private String _defaultPassword;
+    private String _virtualPath;
 
-    public AMQConnectionFactory(final String url) throws URLSyntaxException
+    private ConnectionURL _connectionDetails;
+    private SSLConfiguration _sslConfig;
+
+    public AMQConnectionFactory()
     {
-        if (url == null)
-        {
-            throw new IllegalArgumentException("url cannot be null");
-        }
+    }
 
+    /**
+     * This is the Only constructor used!
+     * It is used form the context and from the JNDI objects.
+     */
+    public AMQConnectionFactory(String url) throws URLSyntaxException
+    {
         _connectionDetails = new AMQConnectionURL(url);
     }
 
+    /**
+     * This constructor is never used!
+     */
     public AMQConnectionFactory(ConnectionURL url)
     {
-        if (url == null)
+        _connectionDetails = url;
+    }
+
+    /**
+     * This constructor is never used!
+     */
+    public AMQConnectionFactory(String broker, String username, String password, String clientName, String virtualHost)
+            throws URLSyntaxException
+    {
+        this(new AMQConnectionURL(
+                ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@" + clientName + "/" + virtualHost + "?brokerlist='" + broker + "'"));
+    }
+
+    /**
+     * This constructor is never used!
+     */
+    public AMQConnectionFactory(String host, int port, String virtualPath)
+    {
+        this(host, port, "guest", "guest", virtualPath);
+    }
+
+    /**
+     * This constructor is never used!
+     */
+    public AMQConnectionFactory(String host, int port, String defaultUsername, String defaultPassword,
+                                String virtualPath)
+    {
+        _host = host;
+        _port = port;
+        _defaultUsername = defaultUsername;
+        _defaultPassword = defaultPassword;
+        _virtualPath = virtualPath;
+
+//todo when setting Host/Port has been resolved then we can use this otherwise those methods won't work with the following line.
+//        _connectionDetails = new AMQConnectionURL(
+//                ConnectionURL.AMQ_PROTOCOL + "://" +
+//                        _defaultUsername + ":" + _defaultPassword + "@" +
+//                        virtualPath + "?brokerlist='tcp://" + host + ":" + port + "'");
+    }
+
+    /**
+     * @return The _defaultPassword.
+     */
+    public final String getDefaultPassword(String password)
+    {
+        if (_connectionDetails != null)
         {
-            throw new IllegalArgumentException("url cannot be null");
+            return _connectionDetails.getPassword();
         }
+        else
+        {
+            return _defaultPassword;
+        }
+    }
 
-        _connectionDetails = url;
+    /**
+     * @param password The _defaultPassword to set.
+     */
+    public final void setDefaultPassword(String password)
+    {
+        if (_connectionDetails != null)
+        {
+            _connectionDetails.setPassword(password);
+        }
+        _defaultPassword = password;
+    }
+
+    /**
+     * Getter for SSLConfiguration
+     *
+     * @return SSLConfiguration if set, otherwise null
+     */
+    public final SSLConfiguration getSSLConfiguration()
+    {
+        return _sslConfig;
+    }
+
+    /**
+     * Setter for SSLConfiguration
+     *
+     * @param sslConfig config to store
+     */
+    public final void setSSLConfiguration(SSLConfiguration sslConfig)
+    {
+        _sslConfig = sslConfig;
+    }
+
+    /**
+     * @return The _defaultPassword.
+     */
+    public final String getDefaultUsername(String password)
+    {
+        if (_connectionDetails != null)
+        {
+            return _connectionDetails.getUsername();
+        }
+        else
+        {
+            return _defaultUsername;
+        }
+    }
+
+    /**
+     * @param username The _defaultUsername to set.
+     */
+    public final void setDefaultUsername(String username)
+    {
+        if (_connectionDetails != null)
+        {
+            _connectionDetails.setUsername(username);
+        }
+        _defaultUsername = username;
+    }
+
+    /**
+     * @return The _host .
+     */
+    public final String getHost()
+    {
+        //todo this doesn't make sense in a multi broker URL as we have no current as that is done by AMQConnection
+        return _host;
     }
 
     /**
-     * @return the virtualPath of the connection details.
+     * @param host The _host to set.
+     */
+    public final void setHost(String host)
+    {
+        //todo if _connectionDetails is set then run _connectionDetails.addBrokerDetails()
+        // Should perhaps have this method changed to setBroker(host,port)
+        _host = host;
+    }
+
+    /**
+     * @return _port The _port to set.
+     */
+    public final int getPort()
+    {
+        //todo see getHost
+        return _port;
+    }
+
+    /**
+     * @param port The port to set.
+     */
+    public final void setPort(int port)
+    {
+        //todo see setHost
+        _port = port;
+    }
+
+    /**
+     * @return he _virtualPath.
      */
     public final String getVirtualPath()
     {
-        return _connectionDetails.getVirtualHost();
+        if (_connectionDetails != null)
+        {
+            return _connectionDetails.getVirtualHost();
+        }
+        else
+        {
+            return _virtualPath;
+        }
+    }
+
+    /**
+     * @param path The _virtualPath to set.
+     */
+    public final void setVirtualPath(String path)
+    {
+        if (_connectionDetails != null)
+        {
+            _connectionDetails.setVirtualHost(path);
+        }
+
+        _virtualPath = path;
     }
 
     public static String getUniqueClientID()
@@ -91,11 +267,19 @@ public class AMQConnectionFactory implem
     {
         try
         {
-            if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals(""))
+            if (_connectionDetails != null)
             {
-                _connectionDetails.setClientName(getUniqueClientID());
+                if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals(""))
+                {
+                    _connectionDetails.setClientName(getUniqueClientID());
+                }
+                return new AMQConnection(_connectionDetails, _sslConfig);
+            }
+            else
+            {
+                return new AMQConnection(_host, _port, _defaultUsername, _defaultPassword, getUniqueClientID(),
+                                         _virtualPath);
             }
-            return new AMQConnection(_connectionDetails);
         }
         catch (Exception e)
         {
@@ -104,6 +288,8 @@ public class AMQConnectionFactory implem
             jmse.initCause(e);
             throw jmse;
         }
+
+
     }
 
     public Connection createConnection(String userName, String password) throws JMSException
@@ -113,35 +299,34 @@ public class AMQConnectionFactory implem
     
     public Connection createConnection(String userName, String password, String id) throws JMSException
     {
-        if (_connectionDetails != null)
+        try
         {
-            try
+            if (_connectionDetails != null)
             {
-                ConnectionURL connectionDetails = new AMQConnectionURL(_connectionDetails.toString());
-                connectionDetails.setUsername(userName);
-                connectionDetails.setPassword(password);
+                _connectionDetails.setUsername(userName);
+                _connectionDetails.setPassword(password);
                 
                 if (id != null && !id.equals(""))
                 {
-                    connectionDetails.setClientName(id);
+                    _connectionDetails.setClientName(id);
                 } 
-                else if (connectionDetails.getClientName() == null || connectionDetails.getClientName().equals(""))
+                else if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals(""))
                 {
-                    connectionDetails.setClientName(getUniqueClientID());
+                    _connectionDetails.setClientName(getUniqueClientID());
                 }
-                return new AMQConnection(connectionDetails);
+                return new AMQConnection(_connectionDetails, _sslConfig);
             }
-            catch (Exception e)
+            else
             {
-                JMSException jmse = new JMSException("Error creating connection: " + e.getMessage());
-                jmse.setLinkedException(e);
-                jmse.initCause(e);
-                throw jmse;
+                return new AMQConnection(_host, _port, userName, password, (id != null ? id : getUniqueClientID()), _virtualPath);
             }
         }
-        else
+        catch (Exception e)
         {
-            throw new JMSException("The connection factory wasn't created with a proper URL, the connection details are empty");
+            JMSException jmse = new JMSException("Error creating connection: " + e.getMessage());
+            jmse.setLinkedException(e);
+            jmse.initCause(e);
+            throw jmse;
         }
     }
 
@@ -176,6 +361,12 @@ public class AMQConnectionFactory implem
         return _connectionDetails.toString();
     }
 
+
+    public final void setConnectionURLString(String url) throws URLSyntaxException
+    {
+        _connectionDetails = new AMQConnectionURL(url);
+    }
+
     /**
      * JNDI interface to create objects from References.
      *
@@ -266,7 +457,7 @@ public class AMQConnectionFactory implem
     {
         try
         {
-            return new XAConnectionImpl(_connectionDetails);
+            return new XAConnectionImpl(_connectionDetails, _sslConfig);
         }
         catch (Exception e)
         {
@@ -293,30 +484,19 @@ public class AMQConnectionFactory implem
     {
         if (_connectionDetails != null)
         {
-            try
-            {
-                ConnectionURL connectionDetails = new AMQConnectionURL(_connectionDetails.toString());
-                connectionDetails.setUsername(username);
-                connectionDetails.setPassword(password);
-    
-                if (connectionDetails.getClientName() == null || connectionDetails.getClientName().equals(""))
-                {
-                    connectionDetails.setClientName(getUniqueClientID());
-                }
-                return new XAConnectionImpl(connectionDetails);
-            }
-            catch (Exception e)
+            _connectionDetails.setUsername(username);
+            _connectionDetails.setPassword(password);
+
+            if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals(""))
             {
-                JMSException jmse = new JMSException("Error creating XA Connection: " + e.getMessage());
-                jmse.setLinkedException(e);
-                jmse.initCause(e);
-                throw jmse;
+                _connectionDetails.setClientName(getUniqueClientID());
             }
         }
         else
         {
-            throw new JMSException("The connection factory wasn't created with a proper URL, the connection details are empty");
-        }        
+            throw new JMSException("A URL must be specified to access XA connections");
+        }
+        return createXAConnection();
     }
 
 

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java Fri Oct 21 01:19:00 2011
@@ -27,14 +27,18 @@ import java.util.Map;
 
 import org.apache.qpid.client.url.URLParser;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.framing.ProtocolVersion;
 import org.apache.qpid.jms.BrokerDetails;
 import org.apache.qpid.jms.ConnectionURL;
 import org.apache.qpid.url.URLHelper;
 import org.apache.qpid.url.URLSyntaxException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AMQConnectionURL implements ConnectionURL
 {
- 
+    private static final Logger _logger = LoggerFactory.getLogger(AMQConnectionURL.class);
+
     private String _url;
     private String _failoverMethod;
     private Map<String, String> _failoverOptions;
@@ -291,4 +295,17 @@ public class AMQConnectionURL implements
 
         return sb.toString();
     }
+
+    public static void main(String[] args) throws URLSyntaxException
+    {
+        String url2 =
+            "amqp://ritchiem:bob@temp/testHost?brokerlist='tcp://localhost:5672;tcp://fancyserver:3000/',failover='roundrobin'";
+        // "amqp://user:pass@clientid/virtualhost?brokerlist='tcp://host:1?option1=\'value\',option2=\'value\';vm://:3?option1=\'value\'',failover='method?option1=\'value\',option2='value''";
+
+        ConnectionURL connectionurl2 = new AMQConnectionURL(url2);
+
+        System.out.println(url2);
+        System.out.println(connectionurl2);
+
+    }
 }

Modified: qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java?rev=1187150&r1=1187149&r2=1187150&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java (original)
+++ qpid/branches/QPID-2519/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java Fri Oct 21 01:19:00 2011
@@ -21,6 +21,8 @@
 package org.apache.qpid.client;
 
 import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import javax.jms.Destination;
@@ -32,6 +34,8 @@ import javax.naming.StringRefAddr;
 import org.apache.qpid.client.messaging.address.AddressHelper;
 import org.apache.qpid.client.messaging.address.Link;
 import org.apache.qpid.client.messaging.address.Node;
+import org.apache.qpid.client.messaging.address.QpidExchangeOptions;
+import org.apache.qpid.client.messaging.address.QpidQueueOptions;
 import org.apache.qpid.configuration.ClientProperties;
 import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.framing.AMQShortString;
@@ -74,6 +78,11 @@ public abstract class AMQDestination imp
 
     private boolean _exchangeExistsChecked;
 
+    private byte[] _byteEncoding;
+    private static final int IS_DURABLE_MASK = 0x1;
+    private static final int IS_EXCLUSIVE_MASK = 0x2;
+    private static final int IS_AUTODELETE_MASK = 0x4;
+
     public static final int QUEUE_TYPE = 1;
     public static final int TOPIC_TYPE = 2;
     public static final int UNKNOWN_TYPE = 3;
@@ -314,11 +323,7 @@ public abstract class AMQDestination imp
     {
         if(_urlAsShortString == null)
         {
-            if (_url == null)
-            {
-                toURL();
-            }
-            _urlAsShortString = new AMQShortString(_url);
+            toURL();
         }
         return _urlAsShortString;
     }
@@ -365,6 +370,7 @@ public abstract class AMQDestination imp
         // calculated URL now out of date
         _url = null;
         _urlAsShortString = null;
+        _byteEncoding = null;
     }
 
     public AMQShortString getRoutingKey()
@@ -502,10 +508,59 @@ public abstract class AMQDestination imp
             sb.deleteCharAt(sb.length() - 1);
             url = sb.toString();
             _url = url;
+            _urlAsShortString = new AMQShortString(url);
         }
         return url;
     }
 
+    public byte[] toByteEncoding()
+    {
+        byte[] encoding = _byteEncoding;
+        if(encoding == null)
+        {
+            int size = _exchangeClass.length() + 1 +
+                       _exchangeName.length() + 1 +
+                       0 +  // in place of the destination name
+                       (_queueName == null ? 0 : _queueName.length()) + 1 +
+                       1;
+            encoding = new byte[size];
+            int pos = 0;
+
+            pos = _exchangeClass.writeToByteArray(encoding, pos);
+            pos = _exchangeName.writeToByteArray(encoding, pos);
+
+            encoding[pos++] = (byte)0;
+
+            if(_queueName == null)
+            {
+                encoding[pos++] = (byte)0;
+            }
+            else
+            {
+                pos = _queueName.writeToByteArray(encoding,pos);
+            }
+            byte options = 0;
+            if(_isDurable)
+            {
+                options |= IS_DURABLE_MASK;
+            }
+            if(_isExclusive)
+            {
+                options |= IS_EXCLUSIVE_MASK;
+            }
+            if(_isAutoDelete)
+            {
+                options |= IS_AUTODELETE_MASK;
+            }
+            encoding[pos] = options;
+
+
+            _byteEncoding = encoding;
+
+        }
+        return encoding;
+    }
+
     public boolean equals(Object o)
     {
         if (this == o)
@@ -559,6 +614,53 @@ public abstract class AMQDestination imp
                 null);          // factory location
     }
 
+
+    public static Destination createDestination(byte[] byteEncodedDestination)
+    {
+        AMQShortString exchangeClass;
+        AMQShortString exchangeName;
+        AMQShortString routingKey;
+        AMQShortString queueName;
+        boolean isDurable;
+        boolean isExclusive;
+        boolean isAutoDelete;
+
+        int pos = 0;
+        exchangeClass = AMQShortString.readFromByteArray(byteEncodedDestination, pos);
+        pos+= exchangeClass.length() + 1;
+        exchangeName =  AMQShortString.readFromByteArray(byteEncodedDestination, pos);
+        pos+= exchangeName.length() + 1;
+        routingKey =  AMQShortString.readFromByteArray(byteEncodedDestination, pos);
+        pos+= (routingKey == null ? 0 : routingKey.length()) + 1;
+        queueName =  AMQShortString.readFromByteArray(byteEncodedDestination, pos);
+        pos+= (queueName == null ? 0 : queueName.length()) + 1;
+        int options = byteEncodedDestination[pos];
+        isDurable = (options & IS_DURABLE_MASK) != 0;
+        isExclusive = (options & IS_EXCLUSIVE_MASK) != 0;
+        isAutoDelete = (options & IS_AUTODELETE_MASK) != 0;
+
+        if (exchangeClass.equals(ExchangeDefaults.DIRECT_EXCHANGE_CLASS))
+        {
+            return new AMQQueue(exchangeName,routingKey,queueName,isExclusive,isAutoDelete,isDurable);
+        }
+        else if (exchangeClass.equals(ExchangeDefaults.TOPIC_EXCHANGE_CLASS))
+        {
+            return new AMQTopic(exchangeName,routingKey,isAutoDelete,queueName,isDurable);
+        }
+        else if (exchangeClass.equals(ExchangeDefaults.HEADERS_EXCHANGE_CLASS))
+        {
+            return new AMQHeadersExchange(routingKey);
+        }
+        else
+        {
+            return new AMQAnyDestination(exchangeName,exchangeClass,
+                                         routingKey,isExclusive, 
+                                         isAutoDelete,queueName, 
+                                         isDurable, new AMQShortString[0]);
+        }
+
+    }
+
     public static Destination createDestination(BindingURL binding)
     {
         AMQShortString type = binding.getExchangeClass();
@@ -793,7 +895,7 @@ public abstract class AMQDestination imp
         return _browseOnly;
     }
     
-    private void setBrowseOnly(boolean b)
+    public void setBrowseOnly(boolean b)
     {
         _browseOnly = b;
     }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org