diff options
| author | Alan Conway <aconway@apache.org> | 2007-11-09 23:30:59 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-11-09 23:30:59 +0000 |
| commit | e95499012b4663fdaa41a5b875be75492c1c8fb0 (patch) | |
| tree | d0996eaa0bd4283431932fe085e6a8972d7598f1 /cpp/src/qpid | |
| parent | b78af32f2bb9c725bacec590dbdeecaec9b2906c (diff) | |
| download | qpid-python-e95499012b4663fdaa41a5b875be75492c1c8fb0.tar.gz | |
Get rid of BasicHeaderProperties, dead code from 0-8 protocol.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@593692 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/broker/Message.cpp | 7 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Message.h | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/MessageAdapter.cpp | 27 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/MessageAdapter.h | 11 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/AMQHeaderBody.cpp | 7 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/AMQHeaderBody.h | 17 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/BasicHeaderProperties.cpp | 136 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/BasicHeaderProperties.h | 123 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/FrameSet.cpp | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/amqp_framing.h | 1 |
10 files changed, 5 insertions, 326 deletions
diff --git a/cpp/src/qpid/broker/Message.cpp b/cpp/src/qpid/broker/Message.cpp index 4e075e73a3..0065ed397c 100644 --- a/cpp/src/qpid/broker/Message.cpp +++ b/cpp/src/qpid/broker/Message.cpp @@ -34,7 +34,6 @@ using namespace qpid::framing; using std::string; TransferAdapter Message::TRANSFER; -PublishAdapter Message::PUBLISH; Message::Message(const SequenceNumber& id) : frames(id), persistenceId(0), redelivered(false), loaded(false), publisher(0), adapter(0) {} @@ -190,12 +189,12 @@ void Message::sendHeader(framing::FrameHandler& out, uint16_t /*maxFrameSize*/) frames.map_if(f, TypeFilter(HEADER_BODY)); } +// FIXME aconway 2007-11-09: Obsolete, remove. Was used to cover over +// 0-8/0-9 message differences. MessageAdapter& Message::getAdapter() const { if (!adapter) { - if (frames.isA<BasicPublishBody>()) { - adapter = &PUBLISH; - } else if(frames.isA<MessageTransferBody>()) { + if(frames.isA<MessageTransferBody>()) { adapter = &TRANSFER; } else { const AMQMethodBody* method = frames.getMethod(); diff --git a/cpp/src/qpid/broker/Message.h b/cpp/src/qpid/broker/Message.h index f706a65e52..913cc759bc 100644 --- a/cpp/src/qpid/broker/Message.h +++ b/cpp/src/qpid/broker/Message.h @@ -130,7 +130,6 @@ public: mutable MessageAdapter* adapter; static TransferAdapter TRANSFER; - static PublishAdapter PUBLISH; MessageAdapter& getAdapter() const; }; diff --git a/cpp/src/qpid/broker/MessageAdapter.cpp b/cpp/src/qpid/broker/MessageAdapter.cpp index 764bf02cf4..2c29aa5444 100644 --- a/cpp/src/qpid/broker/MessageAdapter.cpp +++ b/cpp/src/qpid/broker/MessageAdapter.cpp @@ -28,33 +28,6 @@ namespace { namespace qpid { namespace broker{ - std::string PublishAdapter::getRoutingKey(const framing::FrameSet& f) - { - return f.as<framing::BasicPublishBody>()->getRoutingKey(); - } - - std::string PublishAdapter::getExchange(const framing::FrameSet& f) - { - return f.as<framing::BasicPublishBody>()->getExchange(); - } - - bool PublishAdapter::isImmediate(const framing::FrameSet& f) - { - return f.as<framing::BasicPublishBody>()->getImmediate(); - } - - const framing::FieldTable* PublishAdapter::getApplicationHeaders(const framing::FrameSet& f) - { - const framing::BasicHeaderProperties* p = f.getHeaders()->get<framing::BasicHeaderProperties>(); - return p ? &(p->getHeaders()) : 0; - } - - bool PublishAdapter::isPersistent(const framing::FrameSet& f) - { - const framing::BasicHeaderProperties* p = f.getHeaders()->get<framing::BasicHeaderProperties>(); - return p && p->getDeliveryMode() == 2; - } - std::string TransferAdapter::getRoutingKey(const framing::FrameSet& f) { const framing::DeliveryProperties* p = f.getHeaders()->get<framing::DeliveryProperties>(); diff --git a/cpp/src/qpid/broker/MessageAdapter.h b/cpp/src/qpid/broker/MessageAdapter.h index e8337ec649..ef316edacb 100644 --- a/cpp/src/qpid/broker/MessageAdapter.h +++ b/cpp/src/qpid/broker/MessageAdapter.h @@ -24,7 +24,6 @@ #include <string> #include "qpid/framing/BasicPublishBody.h" -#include "qpid/framing/BasicHeaderProperties.h" #include "qpid/framing/FieldTable.h" #include "qpid/framing/FrameSet.h" #include "qpid/framing/DeliveryProperties.h" @@ -34,6 +33,7 @@ namespace qpid { namespace broker { +// FIXME aconway 2007-11-09: No longer needed, we only have one type of message. struct MessageAdapter { virtual ~MessageAdapter() {} @@ -45,15 +45,6 @@ struct MessageAdapter virtual bool isPersistent(const framing::FrameSet& f) = 0; }; -struct PublishAdapter : MessageAdapter -{ - std::string getRoutingKey(const framing::FrameSet& f); - std::string getExchange(const framing::FrameSet& f); - bool isImmediate(const framing::FrameSet& f); - const framing::FieldTable* getApplicationHeaders(const framing::FrameSet& f); - bool isPersistent(const framing::FrameSet& f); -}; - struct TransferAdapter : MessageAdapter { std::string getRoutingKey(const framing::FrameSet& f); diff --git a/cpp/src/qpid/framing/AMQHeaderBody.cpp b/cpp/src/qpid/framing/AMQHeaderBody.cpp index 93568f5f46..8e02f6827f 100644 --- a/cpp/src/qpid/framing/AMQHeaderBody.cpp +++ b/cpp/src/qpid/framing/AMQHeaderBody.cpp @@ -44,9 +44,6 @@ void qpid::framing::AMQHeaderBody::decode(Buffer& buffer, uint32_t size){ uint16_t type = buffer.getShort(); //The following switch could be generated as the number of options increases: switch(type) { - case BasicHeaderProperties::TYPE: - decode(BasicHeaderProperties(), buffer, len - 2); - break; case MessageProperties::TYPE: decode(MessageProperties(), buffer, len - 2); break; @@ -66,10 +63,6 @@ uint64_t qpid::framing::AMQHeaderBody::getContentLength() const if (mProps) { return mProps->getContentLength(); } - const BasicHeaderProperties* bProps = get<BasicHeaderProperties>(); - if (bProps) { - return bProps->getContentLength(); - } return 0; } diff --git a/cpp/src/qpid/framing/AMQHeaderBody.h b/cpp/src/qpid/framing/AMQHeaderBody.h index 9fd99bd2d9..460bd2d69e 100644 --- a/cpp/src/qpid/framing/AMQHeaderBody.h +++ b/cpp/src/qpid/framing/AMQHeaderBody.h @@ -21,7 +21,6 @@ #include "amqp_types.h" #include "AMQBody.h" #include "Buffer.h" -#include "BasicHeaderProperties.h" #include "qpid/framing/DeliveryProperties.h" #include "qpid/framing/MessageProperties.h" #include <iostream> @@ -37,15 +36,10 @@ namespace framing { class AMQHeaderBody : public AMQBody { - typedef std::vector< boost::variant<BasicHeaderProperties, DeliveryProperties, MessageProperties> > PropertyList; + typedef std::vector< boost::variant<DeliveryProperties, MessageProperties> > PropertyList; PropertyList properties; - void decode(BasicHeaderProperties s, Buffer& b, uint32_t size) { - s.decode(b, size); - properties.push_back(s); - } - template <class T> void decode(T t, Buffer& b, uint32_t size) { t.decodeStructBody(b, size); properties.push_back(t); @@ -60,11 +54,6 @@ class AMQHeaderBody : public AMQBody t.encode(buffer); } - void operator()(const BasicHeaderProperties& s) const { - buffer.putLong(s.size() + 2/*typecode*/); - buffer.putShort(BasicHeaderProperties::TYPE); - s.encode(buffer); - } }; class CalculateSize : public boost::static_visitor<> { @@ -76,10 +65,6 @@ class AMQHeaderBody : public AMQBody size += t.size(); } - void operator()(const BasicHeaderProperties& s) { - size += s.size() + 2/*typecode*/ + 4/*size field*/; - } - uint32_t totalSize() { return size; } diff --git a/cpp/src/qpid/framing/BasicHeaderProperties.cpp b/cpp/src/qpid/framing/BasicHeaderProperties.cpp deleted file mode 100644 index 9d572787ae..0000000000 --- a/cpp/src/qpid/framing/BasicHeaderProperties.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * - * 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 - * regarding copyright ownership. The ASF licenses this file - * 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. - * - */ -#include "BasicHeaderProperties.h" - -//TODO: This could be easily generated from the spec - -qpid::framing::BasicHeaderProperties::BasicHeaderProperties() : deliveryMode(DeliveryMode(0)), - priority(0), - timestamp(0), - contentLength(0){} -qpid::framing::BasicHeaderProperties::~BasicHeaderProperties(){} - -uint32_t qpid::framing::BasicHeaderProperties::size() const{ - uint32_t bytes = 2;//flags - if(contentType.length() > 0) bytes += contentType.length() + 1; - if(contentEncoding.length() > 0) bytes += contentEncoding.length() + 1; - if(headers.count() > 0) bytes += headers.size(); - if(deliveryMode != 0) bytes += 1; - if(priority != 0) bytes += 1; - if(correlationId.length() > 0) bytes += correlationId.length() + 1; - if(replyTo.length() > 0) bytes += replyTo.length() + 1; - if(expiration.length() > 0) bytes += expiration.length() + 1; - if(messageId.length() > 0) bytes += messageId.length() + 1; - if(timestamp != 0) bytes += 8; - if(type.length() > 0) bytes += type.length() + 1; - if(userId.length() > 0) bytes += userId.length() + 1; - if(appId.length() > 0) bytes += appId.length() + 1; - if(clusterId.length() > 0) bytes += clusterId.length() + 1; - if(contentLength != 0) bytes += 8; - - return bytes; -} - -void qpid::framing::BasicHeaderProperties::encode(qpid::framing::Buffer& buffer) const{ - uint16_t flags = getFlags(); - buffer.putShort(flags); - - if(contentType.length() > 0) buffer.putShortString(contentType); - if(contentEncoding.length() > 0) buffer.putShortString(contentEncoding); - if(headers.count() > 0) buffer.put(headers); - if(deliveryMode != 0) buffer.putOctet(deliveryMode); - if(priority != 0) buffer.putOctet(priority); - if(correlationId.length() > 0) buffer.putShortString(correlationId); - if(replyTo.length() > 0) buffer.putShortString(replyTo); - if(expiration.length() > 0) buffer.putShortString(expiration); - if(messageId.length() > 0) buffer.putShortString(messageId); - if(timestamp != 0) buffer.putLongLong(timestamp);; - if(type.length() > 0) buffer.putShortString(type); - if(userId.length() > 0) buffer.putShortString(userId); - if(appId.length() > 0) buffer.putShortString(appId); - if(clusterId.length() > 0) buffer.putShortString(clusterId); - if(contentLength != 0) buffer.putLongLong(contentLength); -} - -void qpid::framing::BasicHeaderProperties::decode(qpid::framing::Buffer& buffer, uint32_t /*size*/){ - uint16_t flags = buffer.getShort(); - if(flags & (1 << 15)) buffer.getShortString(contentType); - if(flags & (1 << 14)) buffer.getShortString(contentEncoding); - if(flags & (1 << 13)) buffer.get(headers); - if(flags & (1 << 12)) deliveryMode = DeliveryMode(buffer.getOctet()); - if(flags & (1 << 11)) priority = buffer.getOctet(); - if(flags & (1 << 10)) buffer.getShortString(correlationId); - if(flags & (1 << 9)) buffer.getShortString(replyTo); - if(flags & (1 << 8)) buffer.getShortString(expiration); - if(flags & (1 << 7)) buffer.getShortString(messageId); - if(flags & (1 << 6)) timestamp = buffer.getLongLong(); - if(flags & (1 << 5)) buffer.getShortString(type); - if(flags & (1 << 4)) buffer.getShortString(userId); - if(flags & (1 << 3)) buffer.getShortString(appId); - if(flags & (1 << 2)) buffer.getShortString(clusterId); - if(flags & (1 << 1)) contentLength = buffer.getLongLong(); -} - -uint16_t qpid::framing::BasicHeaderProperties::getFlags() const{ - uint16_t flags(0); - if(contentType.length() > 0) flags |= (1 << 15); - if(contentEncoding.length() > 0) flags |= (1 << 14); - if(headers.count() > 0) flags |= (1 << 13); - if(deliveryMode != 0) flags |= (1 << 12); - if(priority != 0) flags |= (1 << 11); - if(correlationId.length() > 0) flags |= (1 << 10); - if(replyTo.length() > 0) flags |= (1 << 9); - if(expiration.length() > 0) flags |= (1 << 8); - if(messageId.length() > 0) flags |= (1 << 7); - if(timestamp != 0) flags |= (1 << 6); - if(type.length() > 0) flags |= (1 << 5); - if(userId.length() > 0) flags |= (1 << 4); - if(appId.length() > 0) flags |= (1 << 3); - if(clusterId.length() > 0) flags |= (1 << 2); - if(contentLength != 0) flags |= (1 << 1); - return flags; -} - -namespace qpid{ -namespace framing{ - - std::ostream& operator<<(std::ostream& out, const BasicHeaderProperties& props) - { - if(props.contentType.length() > 0) out << "contentType=" << props.contentType << ";"; - if(props.contentEncoding.length() > 0) out << "contentEncoding=" << props.contentEncoding << ";"; - if(props.headers.count() > 0) out << "headers=" << props.headers << ";"; - if(props.deliveryMode != 0) out << "deliveryMode=" << props.deliveryMode << ";"; - if(props.priority != 0) out << "priority=" << props.priority << ";"; - if(props.correlationId.length() > 0) out << "correlationId=" << props.correlationId << ";"; - if(props.replyTo.length() > 0) out << "replyTo=" << props.replyTo << ";"; - if(props.expiration.length() > 0) out << "expiration=" << props.expiration << ";"; - if(props.messageId.length() > 0) out << "messageId=" << props.messageId << ";"; - if(props.timestamp != 0) out << "timestamp=" << props.timestamp << ";"; - if(props.type.length() > 0) out << "type=" << props.type << ";"; - if(props.userId.length() > 0) out << "userId=" << props.userId << ";"; - if(props.appId.length() > 0) out << "appId=" << props.appId << ";"; - if(props.clusterId.length() > 0) out << "clusterId=" << props.clusterId << ";"; - if(props.contentLength != 0) out << "contentLength=" << props.contentLength << ";"; - - return out; - } - -}} diff --git a/cpp/src/qpid/framing/BasicHeaderProperties.h b/cpp/src/qpid/framing/BasicHeaderProperties.h deleted file mode 100644 index d6c71437fb..0000000000 --- a/cpp/src/qpid/framing/BasicHeaderProperties.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * 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 - * regarding copyright ownership. The ASF licenses this file - * 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. - * - */ -#include "amqp_types.h" -#include "Buffer.h" -#include "FieldTable.h" -#include "HeaderProperties.h" - -#ifndef _BasicHeaderProperties_ -#define _BasicHeaderProperties_ - -namespace qpid { -namespace framing { - -enum DeliveryMode { TRANSIENT = 1, PERSISTENT = 2}; - -class BasicHeaderProperties : public HeaderProperties -{ - string contentType; - string contentEncoding; - FieldTable headers; - DeliveryMode deliveryMode; - uint8_t priority; - string correlationId; - string replyTo; - string expiration; - string messageId; - uint64_t timestamp; - string type; - string userId; - string appId; - string clusterId; - uint64_t contentLength; - - uint16_t getFlags() const; - - public: - static const uint16_t TYPE = BASIC; - - BasicHeaderProperties(); - virtual ~BasicHeaderProperties(); - virtual uint32_t size() const; - virtual void encode(Buffer& buffer) const; - virtual void decode(Buffer& buffer, uint32_t size = 0); - - virtual uint8_t classId() const { return BASIC; } - - string getContentType() const { return contentType; } - string getContentEncoding() const { return contentEncoding; } - FieldTable& getHeaders() { return headers; } - const FieldTable& getHeaders() const { return headers; } - DeliveryMode getDeliveryMode() const { return deliveryMode; } - uint8_t getPriority() const { return priority; } - string getCorrelationId() const {return correlationId; } - string getReplyTo() const { return replyTo; } - string getExpiration() const { return expiration; } - string getMessageId() const {return messageId; } - uint64_t getTimestamp() const { return timestamp; } - string getType() const { return type; } - string getUserId() const { return userId; } - string getAppId() const { return appId; } - string getClusterId() const { return clusterId; } - uint64_t getContentLength() const { return contentLength; } - - void setContentType(const string& _type){ contentType = _type; } - void setContentEncoding(const string& encoding){ contentEncoding = encoding; } - void setHeaders(const FieldTable& _headers){ headers = _headers; } - void setDeliveryMode(DeliveryMode mode){ deliveryMode = mode; } - void setPriority(uint8_t _priority){ priority = _priority; } - void setCorrelationId(const string& _correlationId){ correlationId = _correlationId; } - void setReplyTo(const string& _replyTo){ replyTo = _replyTo;} - void setExpiration(const string& _expiration){ expiration = _expiration; } - void setMessageId(const string& _messageId){ messageId = _messageId; } - void setTimestamp(uint64_t _timestamp){ timestamp = _timestamp; } - void setType(const string& _type){ type = _type; } - void setUserId(const string& _userId){ userId = _userId; } - void setAppId(const string& _appId){appId = _appId; } - void setClusterId(const string& _clusterId){ clusterId = _clusterId; } - void setContentLength(uint64_t _contentLength){ contentLength = _contentLength; } - - friend std::ostream& operator<<(std::ostream&, const BasicHeaderProperties&); - - /** \internal - * Template to copy between types like BasicHeaderProperties. - */ - template <class T, class U> - static void copy(T& to, const U& from) { - to.setContentType(from.getContentType()); - to.setContentEncoding(from.getContentEncoding()); - to.setHeaders(from.getHeaders()); - to.setDeliveryMode(from.getDeliveryMode()); - to.setPriority(from.getPriority()); - to.setCorrelationId(from.getCorrelationId()); - to.setReplyTo(from.getReplyTo()); - to.setExpiration(from.getExpiration()); - to.setMessageId(from.getMessageId()); - to.setTimestamp(from.getTimestamp()); - to.setType(from.getType()); - to.setUserId(from.getUserId()); - to.setAppId(from.getAppId()); - to.setClusterId(from.getClusterId()); - to.setContentLength(from.getContentLength()); - } -}; -}} -#endif diff --git a/cpp/src/qpid/framing/FrameSet.cpp b/cpp/src/qpid/framing/FrameSet.cpp index 6db02419c2..b361076ee7 100644 --- a/cpp/src/qpid/framing/FrameSet.cpp +++ b/cpp/src/qpid/framing/FrameSet.cpp @@ -22,7 +22,6 @@ #include "FrameSet.h" #include "qpid/framing/all_method_bodies.h" #include "qpid/framing/frame_functors.h" -#include "qpid/framing/BasicHeaderProperties.h" #include "qpid/framing/MessageProperties.h" #include "qpid/framing/TypeFilter.h" diff --git a/cpp/src/qpid/framing/amqp_framing.h b/cpp/src/qpid/framing/amqp_framing.h index 69b5942ba0..9ce148a37b 100644 --- a/cpp/src/qpid/framing/amqp_framing.h +++ b/cpp/src/qpid/framing/amqp_framing.h @@ -30,5 +30,4 @@ #include "OutputHandler.h" #include "InitiationHandler.h" #include "ProtocolInitiation.h" -#include "BasicHeaderProperties.h" #include "ProtocolVersion.h" |
