Author: rgreig
Date: Thu Jan 25 09:03:28 2007
New Revision: 499851
URL: http://svn.apache.org/viewvc?view=rev&rev=499851
Log:
QPID-318 : Patch supplied by Rob Godfrey - remove hard-coding of protocol values
Modified:
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java
incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java
Modified:
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
(original)
+++
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQPFastProtocolHandler.java
Thu Jan 25 09:03:28 2007
@@ -162,7 +162,8 @@
// TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions
change.
protocolSession.write(ConnectionCloseBody.createAMQFrame(0,
- (byte)8, (byte)0, // AMQP version (major, minor)
+ session.getProtocolMajorVersion(),
+ session.getProtocolMinorVersion(), // AMQP version (major,
minor)
0, // classId
0, // methodId
200, // replyCode
Modified:
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
(original)
+++
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
Thu Jan 25 09:03:28 2007
@@ -206,7 +206,8 @@
// TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions change.
final AMQFrame response = ConnectionCloseBody.createAMQFrame(0,
- (byte)8, (byte)0, // AMQP version (major, minor)
+ _session.getProtocolMajorVersion(),
+ _session.getProtocolMinorVersion(), // AMQP version (major,
minor)
0, // classId
0, // methodId
AMQConstant.REPLY_SUCCESS.getCode(), // replyCode
Modified:
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
(original)
+++
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
Thu Jan 25 09:03:28 2007
@@ -399,7 +399,8 @@
// TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions
change.
protocolSession.writeFrame(BasicCancelOkBody.createAMQFrame(channel.getChannelId(),
- (byte)8, (byte)0, // AMQP version (major, minor)
+ protocolSession.getProtocolMajorVersion(),
+ protocolSession.getProtocolMinorVersion(),
consumerTag // consumerTag
));
_closed = true;
@@ -417,22 +418,4 @@
}
- private ByteBuffer createEncodedDeliverFrame(long deliveryTag,
AMQShortString routingKey, AMQShortString exchange)
- {
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
- // Be aware of possible changes to parameter order as versions change.
- AMQFrame deliverFrame =
BasicDeliverBody.createAMQFrame(channel.getChannelId(),
- (byte)8, (byte)0, // AMQP version (major, minor)
- consumerTag, // consumerTag
- deliveryTag, // deliveryTag
- exchange, // exchange
- false, // redelivered
- routingKey // routingKey
- );
- ByteBuffer buf = ByteBuffer.allocate((int) deliverFrame.getSize()); //
XXX: Could cast be a problem?
- deliverFrame.writePayload(buf);
- buf.flip();
- return buf;
- }
}
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
Thu Jan 25 09:03:28 2007
@@ -134,11 +134,10 @@
{
// Declare the exchange
// Note that the durable and internal arguments are ignored since
passive is set to false
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
- // Be aware of possible changes to parameter order as versions change.
+ // TODO: Be aware of possible changes to parameter order as versions
change.
AMQFrame declare = ExchangeDeclareBody.createAMQFrame(_channelId,
- (byte)8, (byte)0, // AMQP version (major, minor)
+ _protocolHandler.getProtocolMajorVersion(),
+ _protocolHandler.getProtocolMinorVersion(),
null, // arguments
false, // autoDelete
false, // durable
@@ -528,7 +527,8 @@
// TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions change.
AMQFrame publishFrame = BasicPublishBody.createAMQFrame(_channelId,
- (byte)8, (byte)0, // AMQP version (major, minor)
+ _protocolHandler.getProtocolMajorVersion(),
+ _protocolHandler.getProtocolMinorVersion(),
destination.getExchangeName(), // exchange
immediate, // immediate
mandatory, // mandatory
@@ -575,9 +575,13 @@
// weight argument of zero indicates no child content headers, just
bodies
// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
// TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
- AMQFrame contentHeaderFrame =
ContentHeaderBody.createAMQFrame(_channelId, BasicConsumeBody.getClazz((byte)8,
(byte)0), 0,
-
contentHeaderProperties,
- size);
+ AMQFrame contentHeaderFrame =
+ ContentHeaderBody.createAMQFrame(_channelId,
+
BasicConsumeBody.getClazz(_protocolHandler.getProtocolMajorVersion(),
+
_protocolHandler.getProtocolMinorVersion()),
+ 0,
+ contentHeaderProperties,
+ size);
if (_logger.isDebugEnabled())
{
_logger.debug("Sending content header frame to " + destination);
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
Thu Jan 25 09:03:28 2007
@@ -59,10 +59,9 @@
_logger.debug("Channel close reply code: " + errorCode + ",
reason: " + reason);
}
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
- // Be aware of possible changes to parameter order as versions change.
- AMQFrame frame = ChannelCloseOkBody.createAMQFrame(evt.getChannelId(),
(byte)8, (byte)0);
+
+ // TODO: Be aware of possible changes to parameter order as versions
change.
+ AMQFrame frame = ChannelCloseOkBody.createAMQFrame(evt.getChannelId(),
method.getMajor(), method.getMinor());
protocolSession.writeFrame(frame);
if (errorCode != AMQConstant.REPLY_SUCCESS.getCode())
{
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
Thu Jan 25 09:03:28 2007
@@ -61,10 +61,8 @@
AMQShortString reason = method.replyText;
// TODO: check whether channel id of zero is appropriate
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions change.
-
protocolSession.writeFrame(ConnectionCloseOkBody.createAMQFrame((short)0,
(byte)8, (byte)0));
+
protocolSession.writeFrame(ConnectionCloseOkBody.createAMQFrame((short)0,
method.getMajor(), method.getMinor()));
if (errorCode != 200)
{
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java
Thu Jan 25 09:03:28 2007
@@ -59,7 +59,7 @@
// TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions
change.
AMQFrame responseFrame =
ConnectionSecureOkBody.createAMQFrame(evt.getChannelId(),
- (byte)8, (byte)0, // AMQP version (major, minor)
+ body.getMajor(), body.getMinor(),
response); // response
protocolSession.writeFrame(responseFrame);
}
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java
Thu Jan 25 09:03:28 2007
@@ -62,34 +62,30 @@
protocolSession.setConnectionTuneParameters(params);
stateManager.changeState(AMQState.CONNECTION_NOT_OPENED);
- protocolSession.writeFrame(createTuneOkFrame(evt.getChannelId(),
params));
+ protocolSession.writeFrame(createTuneOkFrame(evt.getChannelId(),
params,frame.getMajor(), frame.getMinor()));
String host = protocolSession.getAMQConnection().getVirtualHost();
AMQShortString virtualHost = new AMQShortString("/" + host);
-
protocolSession.writeFrame(createConnectionOpenFrame(evt.getChannelId(),
virtualHost, null, true));
+
protocolSession.writeFrame(createConnectionOpenFrame(evt.getChannelId(),
virtualHost, null, true,frame.getMajor(), frame.getMinor()));
}
- protected AMQFrame createConnectionOpenFrame(int channel, AMQShortString
path, AMQShortString capabilities, boolean insist)
+ protected AMQFrame createConnectionOpenFrame(int channel, AMQShortString
path, AMQShortString capabilities, boolean insist, byte major, byte minor)
{
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions change.
return ConnectionOpenBody.createAMQFrame(channel,
- (byte)8, (byte)0, // AMQP version (major, minor)
+ major, minor, // AMQP version (major, minor)
capabilities, // capabilities
insist, // insist
path); // virtualHost
}
- protected AMQFrame createTuneOkFrame(int channel, ConnectionTuneParameters
params)
+ protected AMQFrame createTuneOkFrame(int channel, ConnectionTuneParameters
params, byte major, byte minor)
{
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from
ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions change.
return ConnectionTuneOkBody.createAMQFrame(channel,
- (byte)8, (byte)0, // AMQP version (major, minor)
+ major, minor,
params.getChannelMax(), // channelMax
params.getFrameMax(), // frameMax
params.getHeartbeat()); // heartbeat
Modified:
incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java?view=diff&rev=499851&r1=499850&r2=499851
==============================================================================
---
incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java
(original)
+++
incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java
Thu Jan 25 09:03:28 2007
@@ -122,9 +122,9 @@
class ConnectionTuneHandler extends ConnectionTuneMethodHandler
{
- protected AMQFrame createConnectionOpenFrame(int channel,
AMQShortString path, AMQShortString capabilities, boolean insist)
+ protected AMQFrame createConnectionOpenFrame(int channel,
AMQShortString path, AMQShortString capabilities, boolean insist, byte major,
byte minor)
{
- return super.createConnectionOpenFrame(channel, path, new
AMQShortString(ClusterCapability.add(capabilities, _identity)), insist);
+ return super.createConnectionOpenFrame(channel, path, new
AMQShortString(ClusterCapability.add(capabilities, _identity)), insist, major,
minor);
}
}
}