diff options
| author | Arnaud Simon <arnaudsimon@apache.org> | 2007-08-20 09:37:31 +0000 |
|---|---|---|
| committer | Arnaud Simon <arnaudsimon@apache.org> | 2007-08-20 09:37:31 +0000 |
| commit | fb7e64d5985ee88e60316bb3d76e408dde0764a1 (patch) | |
| tree | 9e53f13c8d5ffb38d07e329eb4ea0608d2f2cd98 /java/client | |
| parent | bfe5cca29e36eff2fcc6781cf7f933c9c0af0af4 (diff) | |
| download | qpid-python-fb7e64d5985ee88e60316bb3d76e408dde0764a1.tar.gz | |
Updated QpidURL scheme
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@567629 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client')
3 files changed, 19 insertions, 5 deletions
diff --git a/java/client/src/main/java/org/apache/qpidity/jms/ConnectionFactoryImpl.java b/java/client/src/main/java/org/apache/qpidity/jms/ConnectionFactoryImpl.java index 082d1c70e6..46142c80ca 100644 --- a/java/client/src/main/java/org/apache/qpidity/jms/ConnectionFactoryImpl.java +++ b/java/client/src/main/java/org/apache/qpidity/jms/ConnectionFactoryImpl.java @@ -5,6 +5,7 @@ import javax.naming.*; import javax.naming.spi.ObjectFactory; import org.apache.qpidity.QpidException; +import org.apache.qpidity.BrokerDetails; import org.apache.qpidity.url.QpidURLImpl; import org.apache.qpidity.url.QpidURL; import org.apache.qpidity.url.BindingURLImpl; @@ -13,6 +14,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Hashtable; +import java.net.MalformedURLException; /** * Implements all the JMS connection factories. @@ -67,9 +69,15 @@ public class ConnectionFactoryImpl implements ConnectionFactory, QueueConnection _qpidURL = url; } - public ConnectionFactoryImpl(String url) throws URLSyntaxException + public ConnectionFactoryImpl(String url) throws MalformedURLException { - // todo + _qpidURL = new QpidURLImpl(url); + BrokerDetails bd = _qpidURL.getAllBrokerDetails().get(0); + _host = bd.getHost(); + _port = bd.getPort(); + _defaultUsername = bd.getUserName(); + _defaultPassword = bd.getPassword(); + _virtualHost = bd.getVirtualHost(); } /** @@ -474,7 +482,7 @@ public class ConnectionFactoryImpl implements ConnectionFactory, QueueConnection return new TopicImpl(new BindingURLImpl((String) addr.getContent())); } } - + if (ref.getClassName().equals(DestinationImpl.class.getName())) { RefAddr addr = ref.get(DestinationImpl.class.getName()); diff --git a/java/client/src/main/java/org/apache/qpidity/naming/PropertiesFileInitialContextFactory.java b/java/client/src/main/java/org/apache/qpidity/naming/PropertiesFileInitialContextFactory.java index 7536a7ec4a..adfe86abf5 100644 --- a/java/client/src/main/java/org/apache/qpidity/naming/PropertiesFileInitialContextFactory.java +++ b/java/client/src/main/java/org/apache/qpidity/naming/PropertiesFileInitialContextFactory.java @@ -43,7 +43,12 @@ import java.util.concurrent.ConcurrentHashMap; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; +import java.net.MalformedURLException; +/** + * This is an implementation of InitialContextFactory that uses a default jndi.properties file. + * + */ public class PropertiesFileInitialContextFactory implements InitialContextFactory { protected final Logger _logger = LoggerFactory.getLogger(PropertiesFileInitialContextFactory.class); @@ -181,7 +186,7 @@ public class PropertiesFileInitialContextFactory implements InitialContextFactor { return new ConnectionFactoryImpl(url); } - catch (URLSyntaxException urlse) + catch (MalformedURLException urlse) { _logger.warn("Unable to createFactories:" + urlse); } diff --git a/java/client/src/main/java/org/apache/qpidity/naming/jndi.properties b/java/client/src/main/java/org/apache/qpidity/naming/jndi.properties index c379ab7cfd..e451cf53fa 100644 --- a/java/client/src/main/java/org/apache/qpidity/naming/jndi.properties +++ b/java/client/src/main/java/org/apache/qpidity/naming/jndi.properties @@ -23,7 +23,8 @@ java.naming.factory.initial = org.apache.qpidity.naming.PropertiesFileInitialCon # register some connection factories # connectionfactory.[jndiname] = [ConnectionURL] -connectionfactory.local = amqp://guest:guest@clientid/testpath?brokerlist='vm://:1' +# qpid:username=foo;password=password;client_id=id;virtualhost=path@tpc:localhost:1556 +connectionfactory.local = qpid:tcp:localhost' # register some queues in JNDI using the form # queue.[jndiName] = [physicalName] |
