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/20 20:43:26 UTC

svn commit: r1186990 [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/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java?rev=1186990&r1=1186989&r2=1186990&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java (original)
+++ qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/txn/MockServerMessage.java Thu Oct 20 18:42:46 2011
@@ -46,67 +46,56 @@ class MockServerMessage implements Serve
         this.persistent = persistent;
     }
 
-    @Override
     public boolean isPersistent()
     {
         return persistent;
     }
 
-    @Override
     public MessageReference newReference()
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public boolean isImmediate()
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public long getSize()
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public SessionConfig getSessionConfig()
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public String getRoutingKey()
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public AMQMessageHeader getMessageHeader()
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public long getExpiration()
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public int getContent(ByteBuffer buf, int offset)
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public long getArrivalTime()
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public Long getMessageNumber()
     {
         return 0L;

Modified: qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java?rev=1186990&r1=1186989&r2=1186990&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java (original)
+++ qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java Thu Oct 20 18:42:46 2011
@@ -61,7 +61,6 @@ class MockStoreTransaction implements Tr
         return _state;
     }
 
-    @Override
     public void enqueueMessage(TransactionLogResource queue, Long messageId) throws AMQStoreException
     {
         if (_throwExceptionOnQueueOp)
@@ -83,8 +82,6 @@ class MockStoreTransaction implements Tr
         return _numberOfEnqueuedMessages;
     }
 
-
-    @Override
     public void dequeueMessage(TransactionLogResource queue, Long messageId) throws AMQStoreException
     {
         if (_throwExceptionOnQueueOp)
@@ -95,19 +92,16 @@ class MockStoreTransaction implements Tr
         _numberOfDequeuedMessages++;
     }
 
-    @Override
     public void commitTran() throws AMQStoreException
     {
         _state = TransactionState.COMMITTED;
     }
 
-    @Override
     public StoreFuture commitTranAsync() throws AMQStoreException
     {
         throw new NotImplementedException();
     }
 
-    @Override
     public void abortTran() throws AMQStoreException
     {
         _state = TransactionState.ABORTED;
@@ -117,14 +111,11 @@ class MockStoreTransaction implements Tr
     {
         return new TransactionLog()
         {
-    
-            @Override
             public void configureTransactionLog(String name, TransactionLogRecoveryHandler recoveryHandler,
                     Configuration storeConfiguration, LogSubject logSubject) throws Exception
             {
             }
-    
-            @Override
+
             public Transaction newTransaction()
             {
                 storeTransaction.setState(TransactionState.STARTED);

Modified: qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java?rev=1186990&r1=1186989&r2=1186990&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java (original)
+++ qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java Thu Oct 20 18:42:46 2011
@@ -44,14 +44,13 @@ import org.apache.qpid.server.store.Mess
 import org.apache.qpid.server.store.TestableMemoryMessageStore;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.util.MockChannel;
 
 
 public class InternalBrokerBaseCase extends QpidTestCase
 {
     private IApplicationRegistry _registry;
     private MessageStore _messageStore;
-    private MockChannel _channel;
+    private AMQChannel _channel;
     private InternalTestProtocolSession _session;
     private VirtualHost _virtualHost;
     private AMQQueue _queue;
@@ -111,7 +110,7 @@ public class InternalBrokerBaseCase exte
         _session = new InternalTestProtocolSession(_virtualHost);
         CurrentActor.set(_session.getLogActor());
 
-        _channel = new MockChannel(_session, 1, _messageStore);
+        _channel = new AMQChannel(_session, 1, _messageStore);
 
         _session.addChannel(_channel);
     }
@@ -243,7 +242,7 @@ public class InternalBrokerBaseCase exte
             //Make Message Persistent
             properties.setDeliveryMode((byte) 2);
 
-            _headerBody.properties = properties;
+            _headerBody.setProperties(properties);
 
             channel.publishContentHeader(_headerBody);
         }
@@ -283,12 +282,12 @@ public class InternalBrokerBaseCase exte
         _messageStore = messageStore;
     }
 
-    public MockChannel getChannel()
+    public AMQChannel getChannel()
     {
         return _channel;
     }
 
-    public void setChannel(MockChannel channel)
+    public void setChannel(AMQChannel channel)
     {
         _channel = channel;
     }

Modified: qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/util/TestApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/util/TestApplicationRegistry.java?rev=1186990&r1=1186989&r2=1186990&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/util/TestApplicationRegistry.java (original)
+++ qpid/branches/QPID-2519/java/broker/src/test/java/org/apache/qpid/server/util/TestApplicationRegistry.java Thu Oct 20 18:42:46 2011
@@ -20,27 +20,72 @@
  */
 package org.apache.qpid.server.util;
 
+import java.util.Properties;
+
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.qpid.server.configuration.ServerConfiguration;
+import org.apache.qpid.server.logging.NullRootMessageLogger;
+import org.apache.qpid.server.logging.actors.BrokerActor;
+import org.apache.qpid.server.logging.actors.CurrentActor;
+import org.apache.qpid.server.logging.actors.GenericActor;
+import org.apache.qpid.server.configuration.plugins.ConfigurationPlugin;
 import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.auth.database.PropertiesPrincipalDatabaseManager;
-
-import java.util.Properties;
-
+import org.apache.qpid.server.security.auth.database.PropertiesPrincipalDatabase;
+import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
+import org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager;
 
 public class TestApplicationRegistry extends ApplicationRegistry
 {
+
     public TestApplicationRegistry(ServerConfiguration config) throws ConfigurationException
     {
         super(config);
     }
 
-    protected void createDatabaseManager(ServerConfiguration configuration) throws Exception
+    @Override
+    public void initialise() throws Exception
+    {
+        CurrentActor.setDefault(new BrokerActor(new NullRootMessageLogger()));
+        GenericActor.setDefaultMessageLogger(new NullRootMessageLogger());
+        super.initialise();
+    }
+
+    /**
+     * @see org.apache.qpid.server.registry.ApplicationRegistry#createAuthenticationManager()
+     */
+    @Override
+    protected AuthenticationManager createAuthenticationManager() throws ConfigurationException
     {
-        Properties users = new Properties();
+        final Properties users = new Properties();
         users.put("guest","guest");
         users.put("admin","admin");
-        _databaseManager = new PropertiesPrincipalDatabaseManager("testPasswordFile", users);
+
+        final PropertiesPrincipalDatabase ppd = new PropertiesPrincipalDatabase(users);
+
+        AuthenticationManager pdam =  new PrincipalDatabaseAuthenticationManager()
+        {
+
+            /**
+             * @see org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager#configure(org.apache.qpid.server.configuration.plugins.ConfigurationPlugin)
+             */
+            @Override
+            public void configure(ConfigurationPlugin config) throws ConfigurationException
+            {
+                // We don't pass configuration to this test instance.
+            }
+
+            @Override
+            public void initialise()
+            {
+                setPrincipalDatabase(ppd);
+
+                super.initialise();
+            }
+        };
+
+        pdam.initialise();
+
+        return pdam;
     }
 
 }

Modified: qpid/branches/QPID-2519/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java?rev=1186990&r1=1186989&r2=1186990&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java (original)
+++ qpid/branches/QPID-2519/java/broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java Thu Oct 20 18:42:46 2011
@@ -481,7 +481,7 @@ public class GenerateLogMessages
                     // Only check the text inside the braces '{}'
                     int typeIndexEnd = parametersString[index].indexOf("}", typeIndex);
                     String typeString = parametersString[index].substring(typeIndex, typeIndexEnd);
-                    if (typeString.contains("number"))
+                    if (typeString.contains("number") || typeString.contains("choice"))
                     {
                         type = "Number";
                     }

Modified: qpid/branches/QPID-2519/java/build.deps
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-2519/java/build.deps?rev=1186990&r1=1186989&r2=1186990&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/build.deps (original)
+++ qpid/branches/QPID-2519/java/build.deps Thu Oct 20 18:42:46 2011
@@ -17,8 +17,6 @@
 # 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
@@ -27,88 +25,40 @@ 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} ${backport-util-concurrent} ${mina-core} ${mina-filter-ssl} 
+common.libs=${slf4j-api}
 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} 
-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}
+broker-plugins.libs=${felix.libs} ${log4j} ${commons-configuration.libs}
 
 junit-toolkit.libs=${log4j} ${junit} ${slf4j-api}
 test.libs=${slf4j-log4j} ${junit-toolkit.libs}
@@ -150,34 +100,28 @@ 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-swt-win32-win32-x86} ${ecl-equinox-launcher-win32-win32-x86} ${ecl-core-runtime-compat-registry}
 management-eclipse-plugin-linux-gtk-x86.libs=${management-eclipse-plugin.core-libs} \
-    ${ecl-swt-linux-gtk-x86} ${ecl-equinox-launcher-linux-gtk-x86}
+    ${ecl-swt-linux-gtk-x86} ${ecl-equinox-launcher-linux-gtk-x86} ${ecl-core-runtime-compat-registry}
 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-swt-linux-gtk-x86_64} ${ecl-equinox-launcher-linux-gtk-x86_64} ${ecl-core-runtime-compat-registry}
 management-eclipse-plugin-macosx.libs=${management-eclipse-plugin.core-libs} \
-    ${ecl-swt-macosx-carbon} ${ecl-equinox-launcher-macosx-carbon}
+    ${ecl-swt-macosx-carbon} ${ecl-equinox-launcher-macosx-carbon} ${ecl-core-runtime-compat-registry}
 management-eclipse-plugin-solaris-gtk-sparc.libs=${management-eclipse-plugin.core-libs} \
-    ${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}
+    ${ecl-swt-solaris-gtk-sparc} ${ecl-equinox-launcher-solaris-gtk-sparc} ${ecl-core-runtime-compat-registry}
     
-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}
@@ -189,9 +133,10 @@ 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-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-eclipse-plugin.test.libs=${test.libs}
 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=1186990&r1=1186989&r2=1186990&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/build.xml (original)
+++ qpid/branches/QPID-2519/java/build.xml Thu Oct 20 18:42:46 2011
@@ -22,18 +22,20 @@
 
   <import file="common.xml"/>
 
+  <property file="${project.root}/build.overrides"/>
 
   <findSubProjects name="broker-plugins" dir="broker-plugins"/>
-  <findSubProjects name="management" dir="management" excludes="common,example,tools/qpid-cli"/>
+  <findSubProjects name="client-plugins" dir="client-plugins"/>
+  <findSubProjects name="management" dir="management" excludes="common,example"/>
 
   <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}"/>
-  <property name="modules.management.tools" value="management/tools/qpid-cli"/>
+  <property name="modules.plugin"     value="${broker-plugins} ${client-plugins}"/>
+  <property name="modules.opt"        value=""/>
   <property name="modules"            value="${modules.core} ${modules.examples}
-   ${modules.management} ${modules.management.tools} ${modules.tests} ${modules.plugin}"/>
+   ${modules.management} ${modules.tests} ${modules.plugin} ${modules.opt}"/>
 
   <property name="qpid.jar"           location="${build.lib}/qpid-all.jar"/>
   <basename property="qpid.jar.name"  file="${qpid.jar}"/>
@@ -78,7 +80,7 @@
     <iterate target="compile-tests"/>
   </target>
 
-  <target name="test" description="execute tests">
+  <target name="test" description="execute tests" depends="manifest">
 
     <delete file="${build.failed}"/>
 
@@ -93,6 +95,10 @@
     <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"/>
@@ -213,7 +219,18 @@
         <include name="**/*.ser"/>
       </fileset>
     </cobertura-merge>
-    <cobertura-report format="html"
+    <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"
                       destdir="${build.coveragereport}"
 		      datafile="${build.coveragereport}/cobertura.ser"
 		      >
@@ -277,4 +294,7 @@
     </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=1186990&r1=1186989&r2=1186990&view=diff
==============================================================================
--- qpid/branches/QPID-2519/java/client/README.txt (original)
+++ qpid/branches/QPID-2519/java/client/README.txt Thu Oct 20 18:42:46 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-examples-<version>.jar" \
+java -cp "lib/qpid-all.jar:example/lib/qpid-client-example-<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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -33,7 +33,6 @@ 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
@@ -50,7 +49,7 @@ public class ConnectionSetup
     final static String QUEUE_NAME = "example.MyQueue";
 
     public static final String TOPIC_JNDI_NAME = "topic";
-    final static String TOPIC_NAME = "example.hierarical.topic";
+    final static String TOPIC_NAME = "usa.news";
 
     private Context _ctx;
 
@@ -61,7 +60,6 @@ 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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -71,7 +71,7 @@ public class Publisher extends Client
     public static void main(String[] args)
     {
 
-        String destination = args.length > 2 ? args[1] : null;
+        String destination = args.length > 2 ? args[1] : "usa.news";
 
         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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-ver: 0.9.0
+ver: 0.13.0
 
 Bundle-SymbolicName: qpid-client
 Bundle-Version: ${ver}

Propchange: qpid/branches/QPID-2519/java/client/src/main/java/client.log4j
            ('svn:mergeinfo' removed)

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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -72,6 +72,17 @@ public class AMQAnyDestination extends A
 
     public String getTopicName() throws JMSException
     {
-        return super.getRoutingKey().toString();
+        if (getRoutingKey() != null)
+        {
+            return getRoutingKey().asString();
+        }
+        else if (getSubject() != null)
+        {
+            return getSubject();
+        }
+        else
+        {
+            return null;
+        }
     }
 }

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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -26,7 +26,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.qpid.jms.BrokerDetails;
-import org.apache.qpid.jms.ConnectionURL;
+import org.apache.qpid.transport.ConnectionSettings;
 import org.apache.qpid.url.URLHelper;
 import org.apache.qpid.url.URLSyntaxException;
 
@@ -38,8 +38,6 @@ public class AMQBrokerDetails implements
 
     private Map<String, String> _options = new HashMap<String, String>();
 
-    private SSLConfiguration _sslConfiguration;
-
     public AMQBrokerDetails(){}
     
     public AMQBrokerDetails(String url) throws URLSyntaxException
@@ -56,9 +54,7 @@ public class AMQBrokerDetails implements
             if (transport != null)
             {
                 //todo this list of valid transports should be enumerated somewhere
-                if ((!(transport.equalsIgnoreCase(BrokerDetails.VM) ||
-                       transport.equalsIgnoreCase(BrokerDetails.TCP) ||
-                       transport.equalsIgnoreCase(BrokerDetails.SOCKET))))
+                if (!(transport.equalsIgnoreCase(BrokerDetails.TCP)))
                 {
                     if (transport.equalsIgnoreCase("localhost"))
                     {
@@ -105,6 +101,21 @@ 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);
@@ -167,10 +178,7 @@ public class AMQBrokerDetails implements
             }
             else
             {
-                if (!_transport.equalsIgnoreCase(SOCKET))
-                {
-                    setPort(port);
-                }
+                setPort(port);
             }
 
             String queryString = connection.getQuery();
@@ -190,11 +198,10 @@ public class AMQBrokerDetails implements
         }
     }
 
-    public AMQBrokerDetails(String host, int port, SSLConfiguration sslConfiguration)
+    public AMQBrokerDetails(String host, int port)
     {
         _host = host;
         _port = port;
-        _sslConfiguration = sslConfiguration;
     }
 
     public String getHost()
@@ -270,33 +277,15 @@ 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("://");
-
-        if (!(_transport.equalsIgnoreCase(VM)))
-        {
-            sb.append(_host);
-        }
-
-        if (!(_transport.equalsIgnoreCase(SOCKET)))
-        {
-            sb.append(':');
-            sb.append(_port);
-        }
+        sb.append(_host);
+        sb.append(':');
+        sb.append(_port);
 
         sb.append(printOptionsURL());
 
@@ -314,9 +303,8 @@ public class AMQBrokerDetails implements
 
         return _host.equalsIgnoreCase(bd.getHost()) &&
                (_port == bd.getPort()) &&
-               _transport.equalsIgnoreCase(bd.getTransport()) &&
-               compareSSLConfigurations(bd.getSSLConfiguration());
-        //todo do we need to compare all the options as well?
+               _transport.equalsIgnoreCase(bd.getTransport());
+        //TODO do we need to compare all the options as well?
     }
 
     @Override
@@ -357,24 +345,6 @@ 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("://")))
@@ -396,4 +366,82 @@ 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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 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 String _clientName;
+    private final 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 ConnectionURL _connectionURL;
+    private final ConnectionURL _connectionURL;
 
     /**
      * Whether this connection is started, i.e. whether messages are flowing to consumers. It has no meaning for message
@@ -147,9 +147,6 @@ 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;
@@ -173,8 +170,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;
 
@@ -194,69 +191,33 @@ public class AMQConnection extends Close
         this(new AMQConnectionURL(
                 ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@"
                 + ((clientName == null) ? "" : clientName) + "/" + virtualHost + "?brokerlist='"
-                + 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);
+                + AMQBrokerDetails.checkTransport(broker) + "'"));
     }
 
     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(
-                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);
+                   ConnectionURL.AMQ_PROTOCOL + "://" + username + ":" + password + "@"
+                   + ((clientName == null) ? "" : clientName) + virtualHost + "?brokerlist='tcp://" + host + ":" + port + "'"));
     }
 
     public AMQConnection(String connection) throws AMQException, URLSyntaxException
     {
-        this(new AMQConnectionURL(connection), null);
-    }
-
-    public AMQConnection(String connection, SSLConfiguration sslConfig) throws AMQException, URLSyntaxException
-    {
-        this(new AMQConnectionURL(connection), sslConfig);
+        this(new AMQConnectionURL(connection));
     }
 
     /**
      * @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, SSLConfiguration sslConfig) throws AMQException
+    public AMQConnection(ConnectionURL connectionURL) throws AMQException
     {
+        if (connectionURL == null)
+        {
+            throw new IllegalArgumentException("Connection must be specified");
+        }
+
         // set this connection maxPrefetch
         if (connectionURL.getOption(ConnectionURL.OPTIONS_MAXPREFETCH) != null)
         {
@@ -264,7 +225,7 @@ public class AMQConnection extends Close
         }
         else
         {
-            // use the defaul value set for all connections
+            // use the default value set for all connections
             _maxPrefetch = Integer.parseInt(System.getProperties().getProperty(ClientProperties.MAX_PREFETCH_PROP_NAME,
                     ClientProperties.MAX_PREFETCH_DEFAULT));
         }
@@ -278,7 +239,7 @@ public class AMQConnection extends Close
         }
         else
         {
-            // use the defaul value set for all connections
+            // use the default value set for all connections
             _syncPersistence = Boolean.getBoolean(ClientProperties.SYNC_PERSISTENT_PROP_NAME);
             if (_syncPersistence)
             {
@@ -293,7 +254,7 @@ public class AMQConnection extends Close
         }
         else
         {
-            // use the defaul value set for all connections
+            // use the default value set for all connections
             _syncAck = Boolean.getBoolean(ClientProperties.SYNC_ACK_PROP_NAME);
         }
 
@@ -306,7 +267,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(
@@ -317,16 +278,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 (brokerDetails.getTransport().equals(BrokerDetails.VM) || "0-8".equals(amqpVersion)) 
+        if ("0-8".equals(amqpVersion))
         {
             _delegate = new AMQConnectionDelegate_8_0(this);
-        } 
+        }
         else if ("0-9".equals(amqpVersion))
         {
             _delegate = new AMQConnectionDelegate_0_9(this);
@@ -345,12 +306,6 @@ 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();
@@ -418,6 +373,7 @@ public class AMQConnection extends Close
                 brokerDetails = _failoverPolicy.getNextBrokerDetails();
             }
         }
+        verifyClientID();
 
         if (_logger.isDebugEnabled())
         {
@@ -504,7 +460,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());
 
         }
@@ -535,14 +491,6 @@ 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("/"))
@@ -555,7 +503,7 @@ public class AMQConnection extends Close
 
     public boolean attemptReconnection(String host, int port)
     {
-        BrokerDetails bd = new AMQBrokerDetails(host, port, _sslConfiguration);
+        BrokerDetails bd = new AMQBrokerDetails(host, port);
 
         _failoverPolicy.setBroker(bd);
 
@@ -696,20 +644,6 @@ 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;
@@ -1096,7 +1030,7 @@ public class AMQConnection extends Close
     {
         _username = id;
     }
-    
+
     public String getPassword()
     {
         return _password;
@@ -1249,7 +1183,7 @@ public class AMQConnection extends Close
 
             if (code != null)
             {
-                je = new JMSException(Integer.toString(code.getCode()), "Exception thrown against " + toString() + ": " + cause);
+                je = new JMSException("Exception thrown against " + toString() + ": " + cause, Integer.toString(code.getCode()));
             }
             else
             {
@@ -1272,7 +1206,7 @@ public class AMQConnection extends Close
             {
                 je.setLinkedException((Exception) cause);
             }
-            
+
             je.initCause(cause);
         }
 
@@ -1305,7 +1239,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)
             {
@@ -1315,7 +1249,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)
             {
@@ -1372,6 +1306,20 @@ 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();
@@ -1383,11 +1331,6 @@ public class AMQConnection extends Close
                              AMQConnectionFactory.class.getName(), null); // factory location
     }
 
-    public SSLConfiguration getSSLConfiguration()
-    {
-        return _sslConfiguration;
-    }
-
     public AMQShortString getDefaultTopicExchangeName()
     {
         return _defaultTopicExchangeName;
@@ -1442,7 +1385,18 @@ 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);
@@ -1485,9 +1439,27 @@ 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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -57,10 +57,12 @@ 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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 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,6 +35,7 @@ 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;
@@ -43,10 +44,13 @@ 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;
@@ -59,6 +63,10 @@ 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;
@@ -69,6 +77,12 @@ 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)
     {
@@ -80,7 +94,14 @@ 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();
@@ -95,7 +116,7 @@ public class AMQConnectionDelegate_0_10 
         try
         {
             session = new AMQSession_0_10(_qpidConnection, _conn, channelId, transacted, acknowledgeMode, prefetchHigh,
-                                          prefetchLow);
+                    prefetchLow,name);
             _conn.registerSession(channelId, session);
             if (_conn._started)
             {
@@ -173,8 +194,8 @@ public class AMQConnectionDelegate_0_10 
                         + _conn.getPassword());
             }
 
-            ConnectionSettings conSettings = new ConnectionSettings();
-            retriveConnectionSettings(conSettings,brokerDetail);
+            ConnectionSettings conSettings = retriveConnectionSettings(brokerDetail);
+            _qpidConnection.setConnectionDelegate(new ClientConnectionDelegate(conSettings, _conn.getConnectionURL()));
             _qpidConnection.connect(conSettings);
 
             _conn._connected = true;
@@ -211,6 +232,8 @@ 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)
@@ -254,10 +277,10 @@ public class AMQConnectionDelegate_0_10 
         }
 
         ConnectionClose close = exc.getClose();
-        if (close == null)
+        if (close == null || close.getReplyCode() == ConnectionCloseCode.CONNECTION_FORCED)
         {
             _conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1));
-            
+
             try
             {
                 if (_conn.firePreFailover(false) && _conn.attemptReconnection())
@@ -326,78 +349,20 @@ public class AMQConnectionDelegate_0_10 
     {
         return ProtocolVersion.v0_10;
     }
-    
-    private void retriveConnectionSettings(ConnectionSettings conSettings, BrokerDetails brokerDetail)
+
+    public String getUUID()
+    {
+        return (String)_qpidConnection.getServerProperties().get(UUID_NAME);
+    }
+
+    private ConnectionSettings retriveConnectionSettings(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
@@ -409,16 +374,12 @@ 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)
@@ -433,7 +394,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>");
@@ -441,12 +402,37 @@ 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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -23,6 +23,8 @@ 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;
@@ -31,15 +33,17 @@ 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;
@@ -49,6 +53,13 @@ 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;
 
@@ -60,8 +71,30 @@ public class AMQConnectionDelegate_8_0 i
 
     public void closeConnection(long timeout) throws JMSException, AMQException
     {
-        _conn.getProtocolHandler().closeConnection(timeout);
+        final AMQStateManager stateManager = _conn.getProtocolHandler().getStateManager();
+        final AMQState currentState = stateManager.getCurrentState();
 
+        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)
@@ -89,15 +122,34 @@ public class AMQConnectionDelegate_8_0 i
 
         StateWaiter waiter = _conn._protocolHandler.createWaiter(openOrClosedStates);
 
-        // TODO: use system property thingy for this
-        if (System.getProperty("UseTransportIo", "false").equals("false"))
-        {
-            TransportConnection.getInstance(brokerDetail).connect(_conn._protocolHandler, brokerDetail);
-        }
-        else
+        ConnectionSettings settings = brokerDetail.buildConnectionSettings();
+        settings.setProtocol(brokerDetail.getTransport());
+
+        SSLContext sslContext = null;
+        if (settings.isUseSSL())
         {
-            _conn.getProtocolHandler().createIoTransportSession(brokerDetail);
+            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);
+            }
         }
+
+        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
@@ -322,4 +374,9 @@ 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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -44,210 +44,34 @@ public class AMQConnectionFactory implem
                                              ObjectFactory, Referenceable, XATopicConnectionFactory,
                                              XAQueueConnectionFactory, XAConnectionFactory
 {
-    private String _host;
-    private int _port;
-    private String _defaultUsername;
-    private String _defaultPassword;
-    private String _virtualPath;
+    private final ConnectionURL _connectionDetails;
 
-    private ConnectionURL _connectionDetails;
-    private SSLConfiguration _sslConfig;
-
-    public AMQConnectionFactory()
-    {
-    }
-
-    /**
-     * 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)
+    public AMQConnectionFactory(final String url) throws URLSyntaxException
     {
-        _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)
+        if (url == null)
         {
-            return _connectionDetails.getPassword();
+            throw new IllegalArgumentException("url cannot be null");
         }
-        else
-        {
-            return _defaultPassword;
-        }
-    }
-
-    /**
-     * @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;
-        }
+        _connectionDetails = new AMQConnectionURL(url);
     }
 
-    /**
-     * @param username The _defaultUsername to set.
-     */
-    public final void setDefaultUsername(String username)
+    public AMQConnectionFactory(ConnectionURL url)
     {
-        if (_connectionDetails != null)
+        if (url == null)
         {
-            _connectionDetails.setUsername(username);
+            throw new IllegalArgumentException("url cannot be null");
         }
-        _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;
-    }
 
-    /**
-     * @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;
+        _connectionDetails = url;
     }
 
     /**
-     * @return he _virtualPath.
+     * @return the virtualPath of the connection details.
      */
     public final String getVirtualPath()
     {
-        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;
+        return _connectionDetails.getVirtualHost();
     }
 
     public static String getUniqueClientID()
@@ -267,19 +91,11 @@ public class AMQConnectionFactory implem
     {
         try
         {
-            if (_connectionDetails != null)
-            {
-                if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals(""))
-                {
-                    _connectionDetails.setClientName(getUniqueClientID());
-                }
-                return new AMQConnection(_connectionDetails, _sslConfig);
-            }
-            else
+            if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals(""))
             {
-                return new AMQConnection(_host, _port, _defaultUsername, _defaultPassword, getUniqueClientID(),
-                                         _virtualPath);
+                _connectionDetails.setClientName(getUniqueClientID());
             }
+            return new AMQConnection(_connectionDetails);
         }
         catch (Exception e)
         {
@@ -288,8 +104,6 @@ public class AMQConnectionFactory implem
             jmse.initCause(e);
             throw jmse;
         }
-
-
     }
 
     public Connection createConnection(String userName, String password) throws JMSException
@@ -299,34 +113,35 @@ public class AMQConnectionFactory implem
     
     public Connection createConnection(String userName, String password, String id) throws JMSException
     {
-        try
+        if (_connectionDetails != null)
         {
-            if (_connectionDetails != null)
+            try
             {
-                _connectionDetails.setUsername(userName);
-                _connectionDetails.setPassword(password);
+                ConnectionURL connectionDetails = new AMQConnectionURL(_connectionDetails.toString());
+                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, _sslConfig);
+                return new AMQConnection(connectionDetails);
             }
-            else
+            catch (Exception e)
             {
-                return new AMQConnection(_host, _port, userName, password, (id != null ? id : getUniqueClientID()), _virtualPath);
+                JMSException jmse = new JMSException("Error creating connection: " + e.getMessage());
+                jmse.setLinkedException(e);
+                jmse.initCause(e);
+                throw jmse;
             }
         }
-        catch (Exception e)
+        else
         {
-            JMSException jmse = new JMSException("Error creating connection: " + e.getMessage());
-            jmse.setLinkedException(e);
-            jmse.initCause(e);
-            throw jmse;
+            throw new JMSException("The connection factory wasn't created with a proper URL, the connection details are empty");
         }
     }
 
@@ -361,12 +176,6 @@ 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.
      *
@@ -457,7 +266,7 @@ public class AMQConnectionFactory implem
     {
         try
         {
-            return new XAConnectionImpl(_connectionDetails, _sslConfig);
+            return new XAConnectionImpl(_connectionDetails);
         }
         catch (Exception e)
         {
@@ -484,19 +293,30 @@ public class AMQConnectionFactory implem
     {
         if (_connectionDetails != null)
         {
-            _connectionDetails.setUsername(username);
-            _connectionDetails.setPassword(password);
-
-            if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals(""))
+            try
             {
-                _connectionDetails.setClientName(getUniqueClientID());
+                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)
+            {
+                JMSException jmse = new JMSException("Error creating XA Connection: " + e.getMessage());
+                jmse.setLinkedException(e);
+                jmse.initCause(e);
+                throw jmse;
             }
         }
         else
         {
-            throw new JMSException("A URL must be specified to access XA connections");
-        }
-        return createXAConnection();
+            throw new JMSException("The connection factory wasn't created with a proper URL, the connection details are empty");
+        }        
     }
 
 

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=1186990&r1=1186989&r2=1186990&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 Thu Oct 20 18:42:46 2011
@@ -27,18 +27,14 @@ 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;
@@ -295,17 +291,4 @@ 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);
-
-    }
 }



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