diff options
| author | Robert Gemmell <robbie@apache.org> | 2012-02-05 20:55:38 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2012-02-05 20:55:38 +0000 |
| commit | 9f999bb08dd75698d26d883cda9f28e9745365e6 (patch) | |
| tree | f9a85883bad8cb2629f3a2f99fe51074f0018639 /qpid/java/client | |
| parent | 6f4c0cf239c847a8b80c7cd6cda8bbae990c4d52 (diff) | |
| download | qpid-python-9f999bb08dd75698d26d883cda9f28e9745365e6.tar.gz | |
QPID-3814: ensure the 0-10 client sends its version number during ConnectionStart(Ok) process, align properties better across protocol versions, general tidy up of the property handling
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1240813 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client')
2 files changed, 16 insertions, 29 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java index a18a3fcbd4..56ee56d178 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java @@ -34,6 +34,7 @@ import org.apache.qpid.framing.ProtocolVersion; import org.apache.qpid.jms.BrokerDetails; import org.apache.qpid.jms.ChannelLimitReachedException; import org.apache.qpid.jms.Session; +import org.apache.qpid.properties.ConnectionStartProperties; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.transport.Connection; import org.apache.qpid.transport.ConnectionClose; @@ -428,7 +429,7 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec Map<String, Object> clientProps = new HashMap<String, Object>(); try { - clientProps.put("clientName", _conn.getClientID()); + clientProps.put(ConnectionStartProperties.CLIENT_ID_0_10, _conn.getClientID()); conSettings.setClientProperties(clientProps); } catch (JMSException e) diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java b/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java index 8fc51f7799..66c4821f60 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java @@ -29,14 +29,15 @@ import org.apache.qpid.client.security.AMQCallbackHandler; import org.apache.qpid.client.security.CallbackHandlerRegistry; import org.apache.qpid.client.state.AMQState; import org.apache.qpid.client.state.StateAwareMethodListener; -import org.apache.qpid.common.ClientProperties; import org.apache.qpid.common.QpidProperties; +import org.apache.qpid.configuration.ClientProperties; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.ConnectionStartBody; import org.apache.qpid.framing.ConnectionStartOkBody; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.framing.FieldTableFactory; import org.apache.qpid.framing.ProtocolVersion; +import org.apache.qpid.properties.ConnectionStartProperties; import javax.security.sasl.Sasl; import javax.security.sasl.SaslClient; @@ -148,14 +149,18 @@ public class ConnectionStartMethodHandler implements StateAwareMethodListener<Co session.getStateManager().changeState(AMQState.CONNECTION_NOT_TUNED); FieldTable clientProperties = FieldTableFactory.newFieldTable(); - clientProperties.setString(new AMQShortString(ClientProperties.instance.toString()), - session.getClientID()); - clientProperties.setString(new AMQShortString(ClientProperties.product.toString()), - QpidProperties.getProductName()); - clientProperties.setString(new AMQShortString(ClientProperties.version.toString()), - QpidProperties.getReleaseVersion()); - clientProperties.setString(new AMQShortString(ClientProperties.platform.toString()), getFullSystemInfo()); - + clientProperties.setString(ConnectionStartProperties.CLIENT_ID_0_8, + session.getClientID()); + clientProperties.setString(ConnectionStartProperties.PRODUCT, + QpidProperties.getProductName()); + clientProperties.setString(ConnectionStartProperties.VERSION_0_8, + QpidProperties.getReleaseVersion()); + clientProperties.setString(ConnectionStartProperties.PLATFORM, + ConnectionStartProperties.getPlatformInfo()); + clientProperties.setString(ConnectionStartProperties.PROCESS, + System.getProperty(ClientProperties.PROCESS_NAME, "Qpid Java Client")); + clientProperties.setInteger(ConnectionStartProperties.PID, + ConnectionStartProperties.getPID()); ConnectionStartOkBody connectionStartOkBody = session.getMethodRegistry().createConnectionStartOkBody(clientProperties,new AMQShortString(mechanism),saslResponse,new AMQShortString(locales)); // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0) @@ -178,25 +183,6 @@ public class ConnectionStartMethodHandler implements StateAwareMethodListener<Co } } - private String getFullSystemInfo() - { - StringBuilder fullSystemInfo = new StringBuilder(System.getProperty("java.runtime.name")); - fullSystemInfo.append(", "); - fullSystemInfo.append(System.getProperty("java.runtime.version")); - fullSystemInfo.append(", "); - fullSystemInfo.append(System.getProperty("java.vendor")); - fullSystemInfo.append(", "); - fullSystemInfo.append(System.getProperty("os.arch")); - fullSystemInfo.append(", "); - fullSystemInfo.append(System.getProperty("os.name")); - fullSystemInfo.append(", "); - fullSystemInfo.append(System.getProperty("os.version")); - fullSystemInfo.append(", "); - fullSystemInfo.append(System.getProperty("sun.os.patch.level")); - - return fullSystemInfo.toString(); - } - private String chooseMechanism(byte[] availableMechanisms) throws UnsupportedEncodingException { final String mechanisms = new String(availableMechanisms, "utf8"); |
