activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r733487 [1/10] - /activemq/activemq-cpp/trunk/src/main/activemq/commands/
Date Sun, 11 Jan 2009 16:36:05 GMT
Author: tabish
Date: Sun Jan 11 08:36:02 2009
New Revision: 733487

URL: http://svn.apache.org/viewvc?rev=733487&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-100

Newly generated commands used in the 3.0 version.

Added:
    activemq/activemq-cpp/trunk/src/main/activemq/commands/
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessage.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessage.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageBase.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQObjectMessage.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQQueue.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQQueue.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQStreamMessage.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQStreamMessage.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempDestination.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempDestination.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempQueue.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempQueue.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempTopic.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempTopic.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTopic.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTopic.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BaseCommand.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BaseDataStructure.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BooleanExpression.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerError.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/BrokerInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionControl.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionError.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConnectionInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerControl.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ConsumerInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ControlCommand.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ControlCommand.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DataArrayResponse.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DataArrayResponse.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DataResponse.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DataResponse.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DataStructure.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DestinationInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DestinationInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DiscoveryEvent.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/DiscoveryEvent.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ExceptionResponse.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ExceptionResponse.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/FlushCommand.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/FlushCommand.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/IntegerResponse.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/IntegerResponse.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/JournalQueueAck.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/JournalQueueAck.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/JournalTopicAck.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/JournalTopicAck.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/JournalTrace.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/JournalTrace.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/JournalTransaction.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/JournalTransaction.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/KeepAliveInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/KeepAliveInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/LastPartialCommand.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/LastPartialCommand.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/LocalTransactionId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/LocalTransactionId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageAck.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatch.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageDispatchNotification.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessageId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/MessagePull.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/NetworkBridgeFilter.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/PartialCommand.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/PartialCommand.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerAck.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ProducerInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/RemoveSubscriptionInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ReplayCommand.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ReplayCommand.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/Response.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/Response.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/SessionId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/SessionId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/SessionInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/SessionInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ShutdownInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ShutdownInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/SubscriptionInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/SubscriptionInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/TransactionId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/TransactionId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/TransactionInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/TransactionInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/WireFormatInfo.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/WireFormatInfo.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/XATransactionId.cpp   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/XATransactionId.h   (with props)
    activemq/activemq-cpp/trunk/src/main/activemq/commands/srcmakefile.mk

Added: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.cpp?rev=733487&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.cpp Sun Jan 11 08:36:02 2009
@@ -0,0 +1,35 @@
+/*
+ * 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 "ActiveMQBlobMessage.h"
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::commands;
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string ActiveMQBlobMessage::BINARY_MIME_TYPE = "application/octet-stream";
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQBlobMessage::ActiveMQBlobMessage() :
+    mimeType( ActiveMQBlobMessage::BINARY_MIME_TYPE ), deletedByBroker( false ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQBlobMessage::getDataStructureType() const {
+    return ActiveMQBlobMessage::ID_ACTIVEMQBLOBMESSAGE;
+}

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.h?rev=733487&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.h Sun Jan 11 08:36:02 2009
@@ -0,0 +1,182 @@
+/*
+ * 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.
+ */
+
+#ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQBLOBMESSAGE_H_
+#define _ACTIVEMQ_COMMANDS_ACTIVEMQBLOBMESSAGE_H_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <activemq/util/Config.h>
+#include <activemq/commands/ActiveMQMessageBase.h>
+#include <cms/Message.h>
+#include <string>
+
+namespace activemq {
+namespace commands {
+
+    class AMQCPP_API ActiveMQBlobMessage :
+        public ActiveMQMessageBase< cms::Message > {
+
+    private:
+
+        std::string remoteBlobUrl;
+        std::string mimeType;
+        std::string name;
+        bool deletedByBroker;
+
+    public:
+
+        static const unsigned char ID_ACTIVEMQBLOBMESSAGE = 29;
+        static const std::string BINARY_MIME_TYPE;
+
+    public:
+
+        ActiveMQBlobMessage();
+        virtual ~ActiveMQBlobMessage() {}
+
+        virtual unsigned char getDataStructureType() const;
+
+        /**
+         * Clone this object and return a new instance that the
+         * caller now owns, this will be an exact copy of this one
+         * @returns new copy of this object.
+         */
+        virtual ActiveMQBlobMessage* cloneDataStructure() const {
+            ActiveMQBlobMessage* message = new ActiveMQBlobMessage();
+            message->copyDataStructure( this );
+            return message;
+        }
+
+        /**
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
+         */
+        virtual void copyDataStructure( const DataStructure* src ) {
+            ActiveMQMessageBase<cms::Message>::copyDataStructure( src );
+        }
+
+        /**
+         * Returns a string containing the information for this DataStructure
+         * such as its type and value of its elements.
+         * @return formatted string useful for debugging.
+         */
+        virtual std::string toString() const{
+            std::ostringstream stream;
+
+            stream << "Begin Class = ActiveMQBlobMessage" << std::endl;
+            stream << ActiveMQMessageBase<cms::Message>::toString();
+            stream << "End Class = ActiveMQBlobMessage" << std::endl;
+
+            return stream.str();
+        }
+
+        /**
+         * Compares the DataStructure passed in to this one, and returns if
+         * they are equivalent.  Equivalent here means that they are of the
+         * same type, and that each element of the objects are the same.
+         * @returns true if DataStructure's are Equal.
+         */
+        virtual bool equals( const DataStructure* value ) const {
+            return ActiveMQMessageBase<cms::Message>::equals( value );
+        }
+
+    public:  // cms::Message
+
+        /**
+         * Clone this message exactly, returns a new instance that the
+         * caller is required to delete.
+         * @return new copy of this message
+         */
+        virtual cms::Message* clone() const {
+            return dynamic_cast<cms::Message*>( this->cloneDataStructure() );
+        }
+
+    public: // BlobMessage
+
+        /**
+         * Get the Remote URL of the Blob.
+         * @returns string from of the Remote Blob URL.
+         */
+        std::string getRemoteBlobUrl() const {
+            return this->remoteBlobUrl;
+        }
+
+        /**
+         * Set the Remote URL of the Blob
+         * @param remoteURL - String form of the Remote URL.
+         */
+        void setRemoteBlobUrl( const std::string& remoteURL ) {
+            this->remoteBlobUrl = remoteURL;
+        }
+
+        /**
+         * Get the Mime Type of the Blob.
+         * @returns string holding the MIME Type.
+         */
+        std::string getMimeType() const {
+            return this->mimeType;
+        }
+
+        /**
+         * Set the Mime Type of the Blob
+         * @param mimeType - String holding the MIME Type.
+         */
+        void setMimeType( const std::string& mimeType ) {
+            this->mimeType = mimeType;
+        }
+
+        /**
+         * Gets the Name of the Blob.
+         * @returns string name of the Blob.
+         */
+        std::string getName() const {
+            return this->name;
+        }
+
+        /**
+         * Sets the Name of the Blob.
+         * @param name - Name of the Blob.
+         */
+        void setName( const std::string& name ) {
+            this->name = name;
+        }
+
+        /**
+         * Gets if this Blob is deleted by the Broker.
+         * @return true if the Blob is deleted by the Broker.
+         */
+        bool isDeletedByBroker() const {
+            return this->deletedByBroker;
+        }
+
+        /**
+         * Sets the Deleted By Broker flag.
+         * @param value - set the Delete by broker flag to value.
+         */
+        void setDeletedByBroker( bool value ) {
+            this->deletedByBroker = value;
+        }
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQBLOBMESSAGE_H_*/

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBlobMessage.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp?rev=733487&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp Sun Jan 11 08:36:02 2009
@@ -0,0 +1,408 @@
+/*
+ * 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 <activemq/commands/ActiveMQBytesMessage.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::commands;
+using namespace activemq::exceptions;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQBytesMessage::ActiveMQBytesMessage() :
+    ActiveMQMessageBase< cms::BytesMessage >(),
+    dataInputStream( &inputStream ),
+    dataOutputStream( &outputStream ) {
+
+    clearBody();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQBytesMessage::getDataStructureType() const {
+    return ActiveMQBytesMessage::ID_ACTIVEMQBYTESMESSAGE;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::setBodyBytes( const unsigned char* buffer,
+                                         std::size_t numBytes )
+    throw( cms::CMSException ) {
+
+    try{
+
+        clearBody();
+        std::vector<unsigned char>& content = getContent();
+        content.insert( content.end(), buffer, buffer + numBytes );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const unsigned char* ActiveMQBytesMessage::getBodyBytes(void) const {
+
+    try{
+
+        if( getContent().size() > 0 ) {
+            return reinterpret_cast<const unsigned char*>( &( getContent()[0] ) );
+        } else {
+            return NULL;
+        }
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t ActiveMQBytesMessage::getBodyLength(void) const {
+
+    try{
+        return getContent().size();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::reset() throw ( cms::CMSException ) {
+
+    try{
+        readOnly = true;
+        inputStream.setBuffer( getContent() );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool ActiveMQBytesMessage::readBoolean() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readBoolean();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeBoolean( bool value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeBoolean( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQBytesMessage::readByte() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readByte();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeByte( unsigned char value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeByte( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t ActiveMQBytesMessage::readBytes( std::vector<unsigned char>& value ) const
+    throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.read( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeBytes( const std::vector<unsigned char>& value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.write( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t ActiveMQBytesMessage::readBytes( unsigned char*& buffer, std::size_t length ) const
+    throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.read( buffer, 0, length );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeBytes( const unsigned char* value,
+                         std::size_t offset,
+                         std::size_t length ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.write( value, offset, length );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+char ActiveMQBytesMessage::readChar() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readChar();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeChar( char value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeChar( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+float ActiveMQBytesMessage::readFloat() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readFloat();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeFloat( float value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeFloat( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+double ActiveMQBytesMessage::readDouble() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readDouble();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeDouble( double value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeDouble( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+short ActiveMQBytesMessage::readShort() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readShort();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeShort( short value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeShort( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned short ActiveMQBytesMessage::readUnsignedShort() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readUnsignedShort();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeUnsignedShort( unsigned short value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeUnsignedShort( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQBytesMessage::readInt() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readInt();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeInt( int value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeInt( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long ActiveMQBytesMessage::readLong() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readLong();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeLong( long long value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeLong( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQBytesMessage::readString() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readString();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeString( const std::string& value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeChars( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQBytesMessage::readUTF() const throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnly();
+        return dataInputStream.readUTF();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeUTF( const std::string& value ) throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnly();
+        dataOutputStream.writeUTF( value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h?rev=733487&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h Sun Jan 11 08:36:02 2009
@@ -0,0 +1,447 @@
+/*
+ * 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.
+ */
+
+#ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQBYTESMESSAGE_H_
+#define _ACTIVEMQ_COMMANDS_ACTIVEMQBYTESMESSAGE_H_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <activemq/util/Config.h>
+#include <activemq/commands/ActiveMQMessageBase.h>
+#include <decaf/io/ByteArrayInputStream.h>
+#include <decaf/io/ByteArrayOutputStream.h>
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <cms/BytesMessage.h>
+#include <vector>
+#include <string>
+
+namespace activemq{
+namespace commands{
+
+    class AMQCPP_API ActiveMQBytesMessage :
+        public ActiveMQMessageBase< cms::BytesMessage > {
+
+    public:
+
+        const static unsigned char ID_ACTIVEMQBYTESMESSAGE = 24;
+
+    public:
+
+        ActiveMQBytesMessage();
+        virtual ~ActiveMQBytesMessage() {}
+
+        virtual unsigned char getDataStructureType() const;
+
+        /**
+         * Clone this object and return a new instance that the
+         * caller now owns, this will be an exact copy of this one
+         * @returns new copy of this object.
+         */
+        virtual ActiveMQBytesMessage* cloneDataStructure() const {
+            ActiveMQBytesMessage* message = new ActiveMQBytesMessage();
+            message->copyDataStructure( this );
+            return message;
+        }
+
+        /**
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
+         */
+        virtual void copyDataStructure( const DataStructure* src ) {
+            ActiveMQMessageBase<cms::BytesMessage>::copyDataStructure( src );
+            this->reset();
+        }
+
+        /**
+         * Returns a string containing the information for this DataStructure
+         * such as its type and value of its elements.
+         * @return formatted string useful for debugging.
+         */
+        virtual std::string toString() const{
+            std::ostringstream stream;
+
+            stream << "Begin Class = ActiveMQBytesMessage" << std::endl;
+            stream << ActiveMQMessageBase<cms::BytesMessage>::toString();
+            stream << "End Class = ActiveMQBytesMessage" << std::endl;
+
+            return stream.str();
+        }
+
+        /**
+         * Compares the DataStructure passed in to this one, and returns if
+         * they are equivalent.  Equivalent here means that they are of the
+         * same type, and that each element of the objects are the same.
+         * @returns true if DataStructure's are Equal.
+         */
+        virtual bool equals( const DataStructure* value ) const {
+            return ActiveMQMessageBase<cms::BytesMessage>::equals( value );
+        }
+
+    public:   // CMS Message
+
+        /**
+         * Clone this message exactly, returns a new instance that the
+         * caller is required to delete.
+         * @return new copy of this message
+         */
+        virtual cms::BytesMessage* clone() const {
+            return dynamic_cast<cms::BytesMessage*>( this->cloneDataStructure() );
+        }
+
+        /**
+         * Clears out the body of the message.  This does not clear the
+         * headers or properties.
+         */
+        virtual void clearBody(){
+
+            // Invoke base class's version.
+            ActiveMQMessageBase<cms::BytesMessage>::clearBody();
+
+            // Set the stream in write only mode.
+            readOnly = false;
+
+            outputStream.setBuffer( getContent() );
+        }
+
+    public:   // CMS BytesMessage
+
+        /**
+         * sets the bytes given to the message body.
+         * @param Byte Buffer to copy
+         * @param Number of bytes in Buffer to copy
+         * @throws CMSException
+         */
+        virtual void setBodyBytes(
+            const unsigned char* buffer,
+            std::size_t numBytes )
+                throw( cms::CMSException );
+
+        /**
+         * Gets the bytes that are contained in this message, user should
+         * copy this data into a user allocated buffer.  Call
+         * <code>getBodyLength</code> to determine the number of bytes
+         * to expect.
+         * @return const pointer to a byte buffer
+         */
+        virtual const unsigned char* getBodyBytes() const;
+
+        /**
+         * Returns the number of bytes contained in the body of this message.
+         * @return number of bytes.
+         */
+        virtual std::size_t getBodyLength() const;
+
+        /**
+         * Puts the message body in read-only mode and repositions the stream
+         * of bytes to the beginning.
+         * @throws CMSException
+         */
+        virtual void reset() throw ( cms::CMSException );
+
+        /**
+         * Reads a Boolean from the Bytes message stream
+         * @returns boolean value from stream
+         * @throws CMSException
+         */
+        virtual bool readBoolean() const throw ( cms::CMSException );
+
+        /**
+         * Writes a boolean to the bytes message stream as a 1-byte value.
+         * The value true is written as the value (byte)1; the value false
+         * is written as the value (byte)0.
+         * @param value - boolean to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeBoolean( bool value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a Byte from the Bytes message stream
+         * @returns unsigned char value from stream
+         * @throws CMSException
+         */
+        virtual unsigned char readByte() const throw ( cms::CMSException );
+
+        /**
+         * Writes a byte to the bytes message stream as a 1-byte value
+         * @param value - byte to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeByte( unsigned char value ) throw ( cms::CMSException );
+
+
+        /**
+         * Reads a byte array from the bytes message stream.
+         *
+         * If the length of vector value is less than the number of bytes
+         * remaining to be read from the stream, the vector should be filled. A
+         * subsequent call reads the next increment, and so on.
+         *
+         * If the number of bytes remaining in the stream is less than the
+         * length of vector value, the bytes should be read into the vector. The
+         * return value of the total number of bytes read will be less than the
+         * length of the vector, indicating that there are no more bytes left to
+         * be read from the stream. The next read of the stream returns -1.
+         *
+         * @param value - buffer to place data in
+         * @returns the total number of bytes read into the buffer, or -1 if
+         *          there is no more data because the end of the stream has
+         *          been reached
+         * @throws CMSException if an error occurs.
+         */
+        virtual std::size_t readBytes( std::vector<unsigned char>& value ) const
+            throw ( cms::CMSException );
+
+        /**
+         * Writes a byte array to the bytes message stream using the vector
+         * size as the number of bytes to write.
+         * @param value - bytes to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeBytes(
+            const std::vector<unsigned char>& value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a portion of the bytes message stream.
+         *
+         * If the length of array value is less than the number of bytes
+         * remaining to be read from the stream, the array should be filled. A
+         * subsequent call reads the next increment, and so on.
+         *
+         * If the number of bytes remaining in the stream is less than the
+         * length of array value, the bytes should be read into the array. The
+         * return value of the total number of bytes read will be less than the
+         * length of the array, indicating that there are no more bytes left to
+         * be read from the stream. The next read of the stream returns -1.
+         *
+         * If length is negative, or length is greater than the length of the
+         * array value, then an IndexOutOfBoundsException is thrown. No bytes
+         * will be read from the stream for this exception case.
+         *
+         * @param value - the buffer into which the data is read
+         * @param length - the number of bytes to read; must be less than or
+         *                 equal to value.length
+         * @returns the total number of bytes read into the buffer, or -1 if
+         *          there is no more data because the end of the stream has
+         *          been reached
+         * @throws CMSException
+         */
+        virtual std::size_t readBytes( unsigned char*& buffer, std::size_t length ) const
+            throw ( cms::CMSException );
+
+        /**
+         * Writes a portion of a byte array to the bytes message stream.
+         * size as the number of bytes to write.
+         * @param value - bytes to write to the stream
+         * @param offset - the initial offset within the byte array
+         * @param length - the number of bytes to use
+         * @throws CMSException
+         */
+        virtual void writeBytes( const unsigned char* value,
+                                 std::size_t offset,
+                                 std::size_t length ) throw ( cms::CMSException );
+
+        /**
+         * Reads a Char from the Bytes message stream
+         * @returns char value from stream
+         * @throws CMSException
+         */
+        virtual char readChar() const throw ( cms::CMSException );
+
+        /**
+         * Writes a char to the bytes message stream as a 1-byte value
+         * @param value - char to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeChar( char value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 32 bit float from the Bytes message stream
+         * @returns double value from stream
+         * @throws CMSException
+         */
+        virtual float readFloat() const throw ( cms::CMSException );
+
+        /**
+         * Writes a float to the bytes message stream as a 4 byte value
+         * @param value - float to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeFloat( float value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 64 bit double from the Bytes message stream
+         * @returns double value from stream
+         * @throws CMSException
+         */
+        virtual double readDouble() const throw ( cms::CMSException );
+
+        /**
+         * Writes a double to the bytes message stream as a 8 byte value
+         * @param value - double to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeDouble( double value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 16 bit signed short from the Bytes message stream
+         * @returns short value from stream
+         * @throws CMSException
+         */
+        virtual short readShort() const throw ( cms::CMSException );
+
+        /**
+         * Writes a signed short to the bytes message stream as a 2 byte value
+         * @param value - signed short to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeShort( short value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 16 bit unsigned short from the Bytes message stream
+         * @returns unsigned short value from stream
+         * @throws CMSException
+         */
+        virtual unsigned short readUnsignedShort() const throw ( cms::CMSException );
+
+        /**
+         * Writes a unsigned short to the bytes message stream as a 2 byte value
+         * @param value - unsigned short to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeUnsignedShort( unsigned short value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 32 bit signed intger from the Bytes message stream
+         * @returns int value from stream
+         * @throws CMSException
+         */
+        virtual int readInt() const throw ( cms::CMSException );
+
+        /**
+         * Writes a signed int to the bytes message stream as a 4 byte value
+         * @param value - signed int to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeInt( int value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 64 bit long from the Bytes message stream
+         * @returns long long value from stream
+         * @throws CMSException
+         */
+        virtual long long readLong() const throw ( cms::CMSException );
+
+        /**
+         * Writes a long long to the bytes message stream as a 8 byte value
+         * @param value - signed long long to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeLong( long long value ) throw ( cms::CMSException );
+
+        /**
+         * Reads an ASCII String from the Bytes message stream
+         * @returns String from stream
+         * @throws CMSException
+         */
+        virtual std::string readString() const throw ( cms::CMSException );
+
+        /**
+         * Writes an ASCII String to the Bytes message stream
+         * @param value - String to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeString( const std::string& value ) throw ( cms::CMSException );
+
+        /**
+         * Reads an UTF String from the BytesMessage stream
+         * @returns String from stream
+         * @throws CMSException
+         */
+        virtual std::string readUTF() const throw ( cms::CMSException );
+
+        /**
+         * Writes an UTF String to the BytesMessage stream
+         * @param value - String to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeUTF( const std::string& value ) throw ( cms::CMSException );
+
+    protected:
+
+        /**
+         * Throws an exception if not in write-only mode.
+         * @throws CMSException.
+         */
+        void checkWriteOnly() const throw ( cms::CMSException ){
+            if( readOnly ){
+                throw exceptions::ActiveMQException( __FILE__, __LINE__,
+                    "message is in read-only mode and cannot be written to" );
+            }
+        }
+
+        /**
+         * Throws an exception if not in read-only mode.
+         * @throws CMSException
+         */
+        void checkReadOnly() const throw ( cms::CMSException ){
+            if( !readOnly ){
+                throw exceptions::ActiveMQException( __FILE__, __LINE__,
+                    "message is in write-only mode and cannot be read from" );
+            }
+        }
+
+    private:
+
+        /**
+         * Flag that indicates what state the stream is in.  If true, the
+         * message may only be read from.  If false, the message may only be
+         * written to.
+         */
+        bool readOnly;
+
+        /**
+         * InputStream that wraps around the command's content when in
+         * read-only mode.
+         */
+        mutable decaf::io::ByteArrayInputStream inputStream;
+
+        /**
+         * OutputStream that wraps around the command's content when in
+         * write-only mode.
+         */
+        decaf::io::ByteArrayOutputStream outputStream;
+
+        /**
+         * DataInputStream wrapper around the input stream.
+         */
+        mutable decaf::io::DataInputStream dataInputStream;
+
+        /**
+         * DataOutputStream wrapper around the output stream.
+         */
+        decaf::io::DataOutputStream dataOutputStream;
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQBYTESMESSAGE_H_*/

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.cpp?rev=733487&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.cpp Sun Jan 11 08:36:02 2009
@@ -0,0 +1,145 @@
+/*
+ * 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 <activemq/commands/ActiveMQDestination.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <activemq/util/URISupport.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::commands;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string ActiveMQDestination::ADVISORY_PREFIX = "ActiveMQ.Advisory.";
+const std::string ActiveMQDestination::CONSUMER_ADVISORY_PREFIX =
+    ActiveMQDestination::ADVISORY_PREFIX + "Consumers.";
+const std::string ActiveMQDestination::PRODUCER_ADVISORY_PREFIX =
+    ActiveMQDestination::ADVISORY_PREFIX + "Producers.";
+const std::string ActiveMQDestination::CONNECTION_ADVISORY_PREFIX =
+    ActiveMQDestination::ADVISORY_PREFIX + "Connections.";
+const std::string ActiveMQDestination::DEFAULT_ORDERED_TARGET = "coordinator";
+const std::string ActiveMQDestination::TEMP_PREFIX = "{TD{";
+const std::string ActiveMQDestination::TEMP_POSTFIX = "}TD}";
+const std::string ActiveMQDestination::COMPOSITE_SEPARATOR = ",";
+const std::string ActiveMQDestination::DestinationFilter::ANY_CHILD = ">";
+const std::string ActiveMQDestination::DestinationFilter::ANY_DESCENDENT = "*";
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination::ActiveMQDestination() {
+
+    this->physicalName = "";
+    this->orderedTarget = DEFAULT_ORDERED_TARGET;
+    this->exclusive = false;
+    this->ordered = false;
+    this->advisory = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQDestination::ActiveMQDestination( const std::string& physicalName ) {
+
+    this->setPhysicalName( physicalName );
+    this->orderedTarget = DEFAULT_ORDERED_TARGET;
+    this->exclusive = false;
+    this->ordered = false;
+    this->advisory = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQDestination::setPhysicalName( const std::string& physicalName ) {
+
+    this->physicalName = physicalName;
+
+    size_t pos = physicalName.find_first_of('?');
+    if( pos != string::npos ) {
+
+        std::string optstring = physicalName.substr( pos + 1 );
+        this->physicalName = physicalName.substr( 0, pos );
+        URISupport::parseQuery( optstring, &options.getProperties() );
+    }
+
+    this->advisory = physicalName.find_first_of( ADVISORY_PREFIX ) == 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQDestination::copyDataStructure( const DataStructure* src ) {
+
+    // Copy the data of the base class or classes
+    BaseDataStructure::copyDataStructure( src );
+
+    const ActiveMQDestination* srcPtr =
+        dynamic_cast<const ActiveMQDestination*>( src );
+
+    if( srcPtr == NULL || src == NULL ) {
+
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "BrokerId::copyDataStructure - src is NULL or invalid" );
+    }
+
+    this->setPhysicalName( srcPtr->getPhysicalName() );
+    this->setAdvisory( srcPtr->isAdvisory() );
+    this->setOrdered( srcPtr->isOrdered() );
+    this->setExclusive( srcPtr->isExclusive() );
+    this->setOrderedTarget( srcPtr->getOrderedTarget() );
+    this->options.copy( &srcPtr->getOptions() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQDestination::toString() const {
+    std::ostringstream stream;
+
+    stream << "Begin Class = ActiveMQDestination" << std::endl;
+
+    stream << " Value of exclusive = "
+           << std::boolalpha << exclusive << std::endl;
+    stream << " Value of ordered = "
+           << std::boolalpha << ordered << std::endl;
+    stream << " Value of advisory = "
+           << std::boolalpha << advisory << std::endl;
+    stream << " Value of orderedTarget = " << orderedTarget << std::endl;
+    stream << " Value of physicalName = " << physicalName << std::endl;
+    stream << " Value of options = " << this->options.toString() << std::endl;
+    stream << BaseDataStructure::toString();
+    stream << "End Class = ActiveMQDestination" << std::endl;
+
+    return stream.str();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQDestination::getDataStructureType() const {
+    return ActiveMQDestination::ID_ACTIVEMQDESTINATION;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQDestination::getClientId(
+    const ActiveMQDestination* destination ) {
+
+    std::string answer = "";
+    if( destination != NULL && destination->isTemporary() ) {
+        std::string name = destination->getPhysicalName();
+        size_t start = name.find( TEMP_PREFIX );
+        if( start != std::string::npos ) {
+            start += TEMP_PREFIX.length();
+            size_t stop = name.rfind( TEMP_POSTFIX );
+            if( stop > start && stop < name.length() ) {
+                answer = name.substr( start, stop-start );
+            }
+        }
+    }
+    return answer;
+}

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.h?rev=733487&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.h Sun Jan 11 08:36:02 2009
@@ -0,0 +1,321 @@
+/*
+ * 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.
+ */
+
+#ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQDESTINATION_H_
+#define _ACTIVEMQ_COMMANDS_ACTIVEMQDESTINATION_H_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <activemq/util/Config.h>
+#include <activemq/commands/BaseDataStructure.h>
+#include <activemq/util/ActiveMQProperties.h>
+#include <cms/Destination.h>
+
+#include <vector>
+#include <string>
+#include <map>
+
+namespace activemq{
+namespace commands{
+
+    class AMQCPP_API ActiveMQDestination : public BaseDataStructure {
+    protected:
+
+        enum DESTINATION_TYPE_IDS {
+            ACTIVEMQ_TOPIC = 1,
+            ACTIVEMQ_TEMPORARY_TOPIC = 2,
+            ACTIVEMQ_QUEUE = 3,
+            ACTIVEMQ_TEMPORARY_QUEUE = 4
+        };
+
+        struct DestinationFilter{
+            static const std::string ANY_CHILD;
+            static const std::string ANY_DESCENDENT;
+        };
+
+        /**
+         * prefix for Advisory message destinations
+         */
+        static const std::string ADVISORY_PREFIX;
+
+        /**
+         * prefix for consumer advisory destinations
+         */
+        static const std::string CONSUMER_ADVISORY_PREFIX;
+
+        /**
+         * prefix for producer advisory destinations
+         */
+        static const std::string PRODUCER_ADVISORY_PREFIX;
+
+        /**
+         * prefix for connection advisory destinations
+         */
+        static const std::string CONNECTION_ADVISORY_PREFIX;
+
+        /**
+         * The default target for ordered destinations
+         */
+        static const std::string DEFAULT_ORDERED_TARGET;
+
+        static const std::string TEMP_PREFIX;
+        static const std::string TEMP_POSTFIX;
+        static const std::string COMPOSITE_SEPARATOR;
+
+        // Cached transient data
+        bool exclusive;
+        bool ordered;
+        bool advisory;
+        std::string orderedTarget;
+
+        std::string physicalName;
+        util::ActiveMQProperties options;
+
+    public:
+
+        const static unsigned char ID_ACTIVEMQDESTINATION = 0;
+
+    public:
+
+        ActiveMQDestination();
+        ActiveMQDestination( const std::string& physicalName );
+        virtual ~ActiveMQDestination() {}
+
+        /**
+         * Clone this object and return a new instance that the
+         * caller now owns, this will be an exact copy of this one
+         * @returns new copy of this object.
+         */
+        virtual ActiveMQDestination* cloneDataStructure() const {
+            return NULL;
+        }
+
+        /**
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
+         */
+        virtual void copyDataStructure( const DataStructure* src );
+
+        virtual unsigned char getDataStructureType() const;
+
+        /**
+         * Returns a string containing the information for this DataStructure
+         * such as its type and value of its elements.
+         * @return formatted string useful for debugging.
+         */
+        virtual std::string toString() const;
+
+        /**
+         * Fetch this destination's physical name
+         * @returns const string containing the name
+         */
+        virtual const std::string& getPhysicalName() const {
+            return this->physicalName;
+        }
+        virtual std::string& getPhysicalName() {
+            return this->physicalName;
+        }
+
+        /**
+         * Set this destination's physical name
+         * @returns const string containing the name
+         */
+        virtual void setPhysicalName( const std::string& physicalName );
+
+        /**
+         * @return Returns the advisory.
+         */
+        virtual bool isAdvisory() const {
+            return advisory;
+        }
+
+        /**
+         * @param advisory The advisory to set.
+         */
+        virtual void setAdvisory( bool advisory ){
+            this->advisory = advisory;
+        }
+
+        /**
+         * @return true if this is a destination for Consumer advisories
+         */
+        virtual bool isConsumerAdvisory() const {
+            return isAdvisory() &&
+                   physicalName.find(CONSUMER_ADVISORY_PREFIX) == 0;
+        }
+
+        /**
+         * @return true if this is a destination for Producer advisories
+         */
+        virtual bool isProducerAdvisory() const {
+            return isAdvisory() &&
+                   physicalName.find(PRODUCER_ADVISORY_PREFIX) == 0;
+        }
+
+        /**
+         * @return true if this is a destination for Connection advisories
+         */
+        virtual bool isConnectionAdvisory() const {
+            return isAdvisory() &&
+                   physicalName.find(CONNECTION_ADVISORY_PREFIX) == 0;
+        }
+
+        /**
+         * @return Returns the exclusive.
+         */
+        virtual bool isExclusive() const {
+            return exclusive;
+        }
+
+        /**
+         * @param exclusive The exclusive to set.
+         */
+        virtual void setExclusive( bool exclusive ) {
+            this->exclusive = exclusive;
+        }
+
+        /**
+         * @return Returns the ordered.
+         */
+        virtual bool isOrdered() const {
+            return ordered;
+        }
+
+        /**
+         * @param ordered The ordered to set.
+         */
+        virtual void setOrdered( bool ordered ) {
+            this->ordered = ordered;
+        }
+
+        /**
+         * @return Returns the orderedTarget.
+         */
+        virtual std::string getOrderedTarget() const {
+            return orderedTarget;
+        }
+
+        /**
+         * @param orderedTarget The orderedTarget to set.
+         */
+        virtual void setOrderedTarget( const std::string& orderedTarget) {
+            this->orderedTarget = orderedTarget;
+        }
+
+    public:  // Statics
+
+        /**
+         * Create a temporary name from the clientId
+         *
+         * @param clientId
+         * @return
+         */
+        static std::string createTemporaryName(
+            const std::string& clientId ) {
+
+            return TEMP_PREFIX + clientId + TEMP_POSTFIX;
+        }
+
+        /**
+         * From a temporary destination find the clientId of the Connection that created it
+         *
+         * @param destination
+         * @return the clientId or null if not a temporary destination
+         */
+        static std::string getClientId( const ActiveMQDestination* destination );
+
+    public:
+
+        /**
+         * Returns the Type of Destination that this object represents
+         * @returns int type qualifier.
+         */
+        virtual cms::Destination::DestinationType getDestinationType() const = 0;
+
+        /**
+         * Returns true if a temporary Destination
+         * @return true/false
+         */
+        virtual bool isTemporary() const {
+            return getDestinationType() == cms::Destination::TEMPORARY_TOPIC ||
+                   getDestinationType() == cms::Destination::TEMPORARY_QUEUE;
+        }
+
+        /**
+         * Returns true if a Topic Destination
+         * @return true/false
+         */
+        virtual bool isTopic() const {
+            return getDestinationType() == cms::Destination::TOPIC ||
+                   getDestinationType() == cms::Destination::TEMPORARY_TOPIC;
+        }
+
+        /**
+         * Returns true if a Queue Destination
+         * @return true/false
+         */
+        virtual bool isQueue() const {
+            return !isTopic();
+        }
+
+        /**
+         * Returns true if this destination represents a collection of
+         * destinations; allowing a set of destinations to be published to or
+         * subscribed from in one CMS operation.
+         * <p/>
+         * If this destination is a composite then you can call
+         * {@link #getChildDestinations()}
+         * to return the list of child destinations.
+         * @return true if this destination represents a collection of child
+         *         destinations.
+         */
+        virtual bool isComposite() const {
+            return physicalName.find_first_of( COMPOSITE_SEPARATOR ) > 0;
+        }
+
+        /**
+         * @return true if the destination matches multiple possible destinations
+         */
+        virtual bool isWildcard() const {
+            return physicalName.find_first_of( DestinationFilter::ANY_CHILD ) != std::string::npos ||
+                   physicalName.find_first_of( DestinationFilter::ANY_DESCENDENT ) != std::string::npos;
+        }
+
+        /**
+         * @returns a reference (const) to the options properties for this Dest.
+         */
+        const activemq::util::ActiveMQProperties& getOptions() const {
+            return options;
+        }
+
+        /**
+         * @returns the cms::Destination interface pointer that the
+         *          objects that derive from this class implement.
+         */
+        virtual const cms::Destination* getCMSDestination() const {
+            return NULL;
+        }
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQDESTINATION_H_*/

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQDestination.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp?rev=733487&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp Sun Jan 11 08:36:02 2009
@@ -0,0 +1,388 @@
+/*
+ * 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 <activemq/commands/ActiveMQMapMessage.h>
+#include <activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::exceptions;
+using namespace activemq::commands;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::marshal;
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQMapMessage::ActiveMQMapMessage() :
+    ActiveMQMessageBase<cms::MapMessage>() {
+    this->map = NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ActiveMQMapMessage::~ActiveMQMapMessage() {
+    delete map;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQMapMessage::getDataStructureType() const {
+    return ActiveMQMapMessage::ID_ACTIVEMQMAPMESSAGE;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::beforeMarshal( WireFormat* wireFormat )
+    throw ( decaf::io::IOException ) {
+
+    try{
+
+        // Let the base class do its thing.
+        ActiveMQMessageBase<cms::MapMessage>::beforeMarshal( wireFormat );
+
+        if( map != NULL && !map->isEmpty() ) {
+            // Marshal as Content.
+            PrimitiveMapMarshaller::marshal( map, getContent() );
+        } else {
+            clearBody();
+        }
+    }
+    AMQ_CATCH_RETHROW( io::IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )
+    AMQ_CATCHALL_THROW( io::IOException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+PrimitiveMap& ActiveMQMapMessage::getMap() throw ( NullPointerException ) {
+
+    try{
+
+        this->checkMapIsUnmarshalled();
+        return *map;
+    }
+    AMQ_CATCH_RETHROW( NullPointerException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
+    AMQ_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const PrimitiveMap& ActiveMQMapMessage::getMap() const
+    throw ( decaf::lang::exceptions::NullPointerException ) {
+
+    try{
+
+        this->checkMapIsUnmarshalled();
+        return *map;
+    }
+    AMQ_CATCH_RETHROW( NullPointerException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
+    AMQ_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::checkMapIsUnmarshalled() const
+    throw ( decaf::lang::exceptions::NullPointerException ) {
+
+    try {
+
+        if( map == NULL ) {
+
+            if( getContent().size() == 0 ){
+                map = new PrimitiveMap;
+            } else {
+                map = PrimitiveMapMarshaller::unmarshal( getContent() );
+            }
+
+            if( map == NULL ) {
+                throw NullPointerException(
+                    __FILE__,
+                    __LINE__,
+                    "ActiveMQMapMessage::getMap() - All attempts to create a "
+                    "map have fialed." );
+            }
+        }
+    }
+    AMQ_CATCH_RETHROW( NullPointerException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
+    AMQ_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> ActiveMQMapMessage::getMapNames(void) const {
+
+    try{
+        return getMap().getKeys();
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool ActiveMQMapMessage::itemExists( const std::string& name ) const {
+
+    try{
+        return getMap().containsKey( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool ActiveMQMapMessage::getBoolean( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getBool( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setBoolean( const std::string& name, bool value )
+    throw( cms::CMSException ) {
+
+    try{
+        getMap().setBool( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQMapMessage::getByte( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getByte( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setByte( const std::string& name,
+                                  unsigned char value )
+                                      throw( cms::CMSException ) {
+
+    try{
+        getMap().setByte( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<unsigned char> ActiveMQMapMessage::getBytes( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getByteArray( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setBytes( const std::string& name,
+                                   const std::vector<unsigned char>& value )
+                                       throw( cms::CMSException ) {
+
+    try{
+        getMap().setByteArray( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+char ActiveMQMapMessage::getChar( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getChar( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setChar( const std::string& name, char value )
+    throw( cms::CMSException ) {
+
+    try{
+        getMap().setChar( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+double ActiveMQMapMessage::getDouble( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getDouble( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setDouble( const std::string& name,
+                                    double value )
+                                        throw( cms::CMSException ) {
+
+    try{
+        getMap().setDouble( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+float ActiveMQMapMessage::getFloat( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getFloat( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setFloat( const std::string& name, float value )
+    throw( cms::CMSException ) {
+
+    try{
+        getMap().setFloat( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQMapMessage::getInt( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getInt( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setInt( const std::string& name, int value )
+    throw( cms::CMSException ) {
+
+    try{
+        getMap().setInt( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long ActiveMQMapMessage::getLong( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getLong( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setLong( const std::string& name, long long value )
+    throw( cms::CMSException ) {
+
+    try{
+        getMap().setLong( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+short ActiveMQMapMessage::getShort( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getShort( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setShort( const std::string& name, short value )
+    throw( cms::CMSException ) {
+
+    try{
+        getMap().setShort( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQMapMessage::getString( const std::string& name ) const
+    throw( cms::CMSException ) {
+
+    try{
+        return getMap().getString( name );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::setString( const std::string& name,
+                                    const std::string& value )
+                                        throw( cms::CMSException ) {
+
+    try{
+        getMap().setString( name, value );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message