activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r733509 [33/33] - in /activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire: ./ marshal/ marshal/v1/ marshal/v2/ marshal/v3/ utils/
Date Sun, 11 Jan 2009 20:22:43 GMT
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/XATransactionIdMarshaller.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/XATransactionIdMarshaller.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/XATransactionIdMarshaller.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/XATransactionIdMarshaller.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,127 @@
+/*
+ * 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_WIREFORMAT_OPENWIRE_MARSAHAL_V3_XATRANSACTIONIDMARSHALLER_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V3_XATRANSACTIONIDMARSHALLER_H_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <activemq/wireformat/openwire/marshal/v3/TransactionIdMarshaller.h>
+
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <decaf/io/IOException.h>
+#include <activemq/util/Config.h>
+#include <activemq/commands/DataStructure.h>
+#include <activemq/wireformat/openwire/OpenWireFormat.h>
+#include <activemq/wireformat/openwire/utils/BooleanStream.h>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace marshal{
+namespace v3{
+
+    /**
+     * Marshalling code for Open Wire Format for XATransactionIdMarshaller
+     *
+     *  NOTE!: This file is autogenerated - do not modify!
+     *         if you need to make a change, please see the Java Classes
+     *         in the activemq-openwire-generator module
+     */
+    class AMQCPP_API XATransactionIdMarshaller : public TransactionIdMarshaller {
+    public:
+
+        XATransactionIdMarshaller() {}
+        virtual ~XATransactionIdMarshaller() {}
+
+        /**
+         * Creates a new instance of this marshalable type.
+         * @return new DataStructure object pointer caller owns it.
+         */
+        virtual commands::DataStructure* createObject() const;
+
+        /**
+         * Get the Data Structure Type that identifies this Marshaller
+         * @return byte holding the data structure type value
+         */
+        virtual unsigned char getDataStructureType() const;
+
+        /**
+         * Un-marshal an object instance from the data input stream
+         * @param wireFormat - describs the wire format of the broker
+         * @param o - Object to be un-marshaled
+         * @param dataIn - BinaryReader that provides that data
+         * @param bs - BooleanStream
+         */
+        virtual void tightUnmarshal( OpenWireFormat* wireFormat,
+                                     commands::DataStructure* dataStructure,
+                                     decaf::io::DataInputStream* dataIn,
+                                     utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+        /**
+         * Write the booleans that this object uses to a BooleanStream
+         * @param wireFormat - describis the wire format of the broker
+         * @param o - Object to be marshaled
+         * @param bs - BooleanStream
+         * @returns int
+         */
+        virtual int tightMarshal1( OpenWireFormat* wireFormat,
+                                   commands::DataStructure* dataStructure,
+                                   utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+        /**
+         * Write a object instance to data output stream
+         * @param wireFormat - describs the wire format of the broker
+         * @param o - Object to be marshaled
+         * @param dataOut - BinaryReader that provides that data sink
+         * @param bs - BooleanStream
+         */
+        virtual void tightMarshal2( OpenWireFormat* wireFormat,
+                                    commands::DataStructure* dataStructure,
+                                    decaf::io::DataOutputStream* dataOut,
+                                    utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+        /**
+         * Un-marshal an object instance from the data input stream
+         * @param wireFormat - describs the wire format of the broker
+         * @param o - Object to be marshaled
+         * @param dataIn - BinaryReader that provides that data source
+         */
+        virtual void looseUnmarshal( OpenWireFormat* wireFormat,
+                                     commands::DataStructure* dataStructure,
+                                     decaf::io::DataInputStream* dataIn ) throw( decaf::io::IOException );
+
+        /**
+         * Write a object instance to data output stream
+         * @param wireFormat - describs the wire format of the broker
+         * @param o - Object to be marshaled
+         * @param dataOut - BinaryWriter that provides that data sink
+         */
+        virtual void looseMarshal( OpenWireFormat* wireFormat,
+                                   commands::DataStructure* dataStructure,
+                                   decaf::io::DataOutputStream* dataOut ) throw( decaf::io::IOException );
+
+    };
+
+}}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V3_XATRANSACTIONIDMARSHALLER_H_*/
+

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/XATransactionIdMarshaller.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/srcmakefile.mk
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/srcmakefile.mk?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/srcmakefile.mk (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v3/srcmakefile.mk Sun Jan 11 12:22:34 2009
@@ -0,0 +1,144 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+cc_sources += \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQBlobMessageMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQBytesMessageMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQDestinationMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQMapMessageMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQMessageMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQObjectMessageMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQQueueMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQStreamMessageMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTempDestinationMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTempQueueMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTempTopicMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTextMessageMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTopicMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/BaseCommandMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/BrokerIdMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/BrokerInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ConnectionControlMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ConnectionErrorMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ConnectionIdMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ConnectionInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ConsumerControlMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ConsumerIdMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ConsumerInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ControlCommandMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/DataArrayResponseMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/DataResponseMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/DestinationInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/DiscoveryEventMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ExceptionResponseMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/FlushCommandMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/IntegerResponseMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/JournalQueueAckMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/JournalTopicAckMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/JournalTraceMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/JournalTransactionMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/KeepAliveInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/LastPartialCommandMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/LocalTransactionIdMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/MarshallerFactory.cpp \
+    activemq/wireformat/openwire/marshal/v3/MessageAckMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/MessageDispatchMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/MessageDispatchNotificationMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/MessageIdMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/MessageMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/MessagePullMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/NetworkBridgeFilterMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/PartialCommandMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ProducerAckMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ProducerIdMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ProducerInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/RemoveInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/RemoveSubscriptionInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ReplayCommandMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ResponseMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/SessionIdMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/SessionInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/ShutdownInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/SubscriptionInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/TransactionIdMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/TransactionInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/WireFormatInfoMarshaller.cpp \
+    activemq/wireformat/openwire/marshal/v3/XATransactionIdMarshaller.cpp
+
+h_sources += \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQBlobMessageMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQBytesMessageMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQDestinationMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQMapMessageMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQMessageMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQObjectMessageMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQQueueMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQStreamMessageMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTempDestinationMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTempQueueMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTempTopicMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTextMessageMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ActiveMQTopicMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/BaseCommandMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/BrokerIdMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/BrokerInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ConnectionControlMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ConnectionErrorMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ConnectionIdMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ConnectionInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ConsumerControlMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ConsumerIdMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ConsumerInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ControlCommandMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/DataArrayResponseMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/DataResponseMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/DestinationInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/DiscoveryEventMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ExceptionResponseMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/FlushCommandMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/IntegerResponseMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/JournalQueueAckMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/JournalTopicAckMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/JournalTraceMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/JournalTransactionMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/KeepAliveInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/LastPartialCommandMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/LocalTransactionIdMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/MarshallerFactory.h \
+    activemq/wireformat/openwire/marshal/v3/MessageAckMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/MessageDispatchMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/MessageDispatchNotificationMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/MessageIdMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/MessageMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/MessagePullMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/NetworkBridgeFilterMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/PartialCommandMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ProducerAckMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ProducerIdMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ProducerInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/RemoveInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/RemoveSubscriptionInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ReplayCommandMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ResponseMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/SessionIdMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/SessionInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/ShutdownInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/SubscriptionInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/TransactionIdMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/TransactionInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/WireFormatInfoMarshaller.h \
+    activemq/wireformat/openwire/marshal/v3/XATransactionIdMarshaller.h

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.cpp?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.cpp Sun Jan 11 12:22:34 2009
@@ -0,0 +1,185 @@
+/**
+ * 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/wireformat/openwire/utils/BooleanStream.h>
+
+#include <activemq/exceptions/ActiveMQException.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::utils;
+using namespace decaf::io;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+///////////////////////////////////////////////////////////////////////////////
+BooleanStream::BooleanStream() {
+
+    this->arrayLimit = 0;
+    this->arrayPos = 0;
+    this->bytePos = 0;
+
+    // Reserve 1K
+    this->data.resize( 1000, 0 );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+bool BooleanStream::readBoolean() throw ( IOException ) {
+
+    try {
+
+        unsigned char b = data[arrayPos];
+        bool rc = ( ( b >> bytePos ) & 0x01 ) != 0;
+        bytePos++;
+        if( bytePos >= 8 ) {
+            bytePos = 0;
+            arrayPos++;
+        }
+        return rc;
+    }
+    AMQ_CATCH_RETHROW( IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+    AMQ_CATCHALL_THROW( IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void BooleanStream::writeBoolean( bool value ) throw ( IOException ) {
+
+    try{
+
+        if( bytePos == 0 ) {
+            arrayLimit++;
+
+            if( (size_t)arrayLimit >= data.size() ) {
+                // re-grow the array if necessary
+                data.resize( data.size() * 2 );
+            }
+        }
+
+        if( value ) {
+            data[arrayPos] |= ( 0x01 << bytePos );
+        }
+
+        bytePos++;
+
+        // Wrap around when we hit the next byte
+        if( bytePos >= 8 ) {
+            bytePos=0;
+            arrayPos++;
+        }
+    }
+    AMQ_CATCH_RETHROW( IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+    AMQ_CATCHALL_THROW( IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void BooleanStream::marshal( DataOutputStream* dataOut ) throw ( IOException ) {
+
+    try {
+
+        if( arrayLimit < 64 ) {
+            dataOut->writeByte( (unsigned char)arrayLimit );
+        } else if( arrayLimit < 256 ) { // max value of unsigned char
+            dataOut->writeByte( 0xC0 );
+            dataOut->writeByte( (unsigned char)arrayLimit );
+        } else {
+            dataOut->writeByte( 0x80 );
+            dataOut->writeShort( arrayLimit );
+        }
+
+        // Dump the payload
+        dataOut->write( &data[0], 0, arrayLimit );
+        clear();
+    }
+    AMQ_CATCH_RETHROW( IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+    AMQ_CATCHALL_THROW( IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void BooleanStream::marshal( std::vector< unsigned char >& dataOut ) {
+
+    try{
+
+        if( arrayLimit < 64 ) {
+            dataOut.push_back( ( unsigned char ) arrayLimit );
+        } else if( arrayLimit < 256 ) { // max value of unsigned byte
+            dataOut.push_back( ( unsigned char ) 0xC0 );
+            dataOut.push_back( ( unsigned char ) arrayLimit );
+        } else {
+            dataOut.push_back( ( unsigned char ) 0x80 );
+            dataOut.push_back( arrayLimit >> 8 );   // High Byte
+            dataOut.push_back( arrayLimit & 0xFF ); // Low Byte
+        }
+
+        // Insert all data from data into the passed buffer
+        std::back_insert_iterator< std::vector<unsigned char> > iter( dataOut );
+        std::copy( &data[0], &data[arrayLimit-1], iter );
+    }
+    AMQ_CATCH_RETHROW( IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+    AMQ_CATCHALL_THROW( IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void BooleanStream::unmarshal( DataInputStream* dataIn ) throw ( IOException ) {
+
+    try{
+
+        arrayLimit = (short)( dataIn->readByte() & 0xFF );
+
+        if ( arrayLimit == 0xC0 ) {
+            arrayLimit = (short)( dataIn->readByte() & 0xFF );
+        } else if( arrayLimit == 0x80 ) {
+            arrayLimit = dataIn->readShort();
+        }
+
+        // Make sure we can accomodate all the data.
+        data.resize( arrayLimit );
+
+        // Make sure we get all the data we are expecting
+        dataIn->readFully( &data[0], 0, arrayLimit );
+
+        clear();
+    }
+    AMQ_CATCH_RETHROW( IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException )
+    AMQ_CATCHALL_THROW( IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void BooleanStream::clear() {
+    // Reset the positions
+    arrayPos = 0;
+    bytePos = 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+int BooleanStream::marshalledSize() {
+
+    if( arrayLimit < 64 ) {
+        return 1 + arrayLimit;
+    } else if( arrayLimit < 256 ) {
+        return 2 + arrayLimit;
+    } else {
+        return 3 + arrayLimit;
+    }
+}

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,114 @@
+/**
+ * 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_WIREFORMAT_OPENWIRE_UTILS_BOOLEANSTREAM_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_UTILS_BOOLEANSTREAM_H_
+
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <activemq/util/Config.h>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace utils{
+
+    /**
+     * Manages the writing and reading of boolean data streams
+     * to and from a data source such as a DataInputStream or
+     * DataOutputStream.  The booleans are stored as single bits in the
+     * stream, with the stream size pre-pended to the stream when the
+     * data is marshalled.
+     *
+     * The serialized form of the size field can be between 1 and 3 bytes.
+     * If the number of used bytes < 64, size=1 byte
+     * If the number of used bytes >=64 and < 256 (size of an unsigned byte), size=2 bytes
+     * If the number of used bytes >=256, size=3 bytes
+     *
+     * The high-order 2 bits (128 and 64) of the first byte of the size field are
+     * used to encode the information about the number of bytes in the size field.  The
+     * only time the first byte will contain a value >=64 is if there are more bytes in
+     * the size field.  If the first byte < 64, the value of the byte is simply the size
+     * value.  If the first byte = 0xC0, the following unsigned byte is the size field.
+     * If the first byte = 0x80, the following short (two bytes) are the size field.
+     */
+    class AMQCPP_API BooleanStream {
+    public:
+
+        BooleanStream();
+        virtual ~BooleanStream() {}
+
+        /**
+         * Read a boolean data element from the internal data buffer
+         * @returns boolean from the stream
+         */
+        bool readBoolean() throw ( decaf::io::IOException );
+
+        /**
+         * Writes a Boolean value to the internal data buffer
+         * @param value - boolean data to write.
+         */
+        void writeBoolean( bool value ) throw ( decaf::io::IOException );
+
+        /**
+         * Marshal the data to a DataOutputStream
+         * @param dataOut - Stream to write the data to.
+         */
+        void marshal( decaf::io::DataOutputStream* dataOut ) throw ( decaf::io::IOException );
+
+        /**
+         * Marshal the data to a STL vector of unsigned chars
+         * @param dataOut - reference to a vector to write the data to.
+         */
+        void marshal( std::vector< unsigned char >& dataOut );
+
+        /**
+         * Unmarshal a Boolean data stream from the Input Stream
+         * @param dataIn - Input Stream to read data from.
+         */
+        void unmarshal( decaf::io::DataInputStream* dataIn ) throw ( decaf::io::IOException );
+
+        /**
+         * Clears to old position markers, data starts at the beginning
+         */
+        void clear();
+
+        /**
+         * Calc the size that data is marshalled to
+         * @returns int size of marshalled data.
+         */
+        int marshalledSize();
+
+    private:
+
+        // Internal Buffer of data
+        std::vector<unsigned char> data;
+
+        // Limit on buffer size
+        short arrayLimit;
+
+        // Byte we are on from the buffer
+        short arrayPos;
+
+        // Bit we are on in the byte we are on from the buffer
+        unsigned char bytePos;
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_UTILS_BOOLEANSTREAM_H_*/

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/BooleanStream.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.cpp?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.cpp Sun Jan 11 12:22:34 2009
@@ -0,0 +1,87 @@
+/*
+ * 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 "HexTable.h"
+
+#include <decaf/lang/Integer.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::utils;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+HexTable::HexTable(){
+
+    const char values[] =
+        { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',
+          'c', 'd', 'e', 'f' };
+    const int count = 16;
+
+    for( int i = 0; i < count; ++i ) {
+        for( int j = 0; j < count; ++j ) {
+            string entry( 1, values[i] );
+            entry += values[j];
+            table.push_back( entry );
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string& HexTable::operator[]( std::size_t index )
+    throw ( IndexOutOfBoundsException ) {
+
+    try{
+
+        if( size() < index ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__,
+                ( string( "HexTable::operator[] - Index passed is out of Bounds" ) +
+                  Integer::toString( (int)index ) ).c_str() );
+        }
+
+        return table[index];
+    }
+    AMQ_CATCH_RETHROW( IndexOutOfBoundsException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    AMQ_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string& HexTable::operator[]( std::size_t index ) const
+    throw ( IndexOutOfBoundsException ) {
+
+    try{
+
+        if( size() < index ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__,
+                ( string( "HexTable::operator[] - Index passed is out of Bounds" ) +
+                  Integer::toString( (int)index ) ).c_str() );
+        }
+
+        return table[index];
+    }
+    AMQ_CATCH_RETHROW( IndexOutOfBoundsException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    AMQ_CATCHALL_THROW( IndexOutOfBoundsException )
+}

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,72 @@
+/*
+ * 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_WIREFORMAT_OPENWIRE_MARSHAL_HEXTABLE_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_HEXTABLE_H_
+
+#include <vector>
+#include <string>
+
+#include <activemq/util/Config.h>
+#include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace utils{
+
+    /**
+     * The HexTable class maps hexidecimal strings to the value of an index
+     * into the table, i.e. the class will return "FF" for the index 255 in
+     * the table.
+     */
+    class AMQCPP_API HexTable {
+    public:
+
+        HexTable();
+        virtual ~HexTable() {}
+
+        /**
+         * Index operator for this Table, will throw an exeption if the
+         * index requested is out of bounds for this table.
+         * @param int - index to fetch
+         * @returns string contianing the hex value if the index
+         * @throws IndexOutOfBoundsException
+         */
+        virtual const std::string& operator[]( std::size_t index )
+            throw ( decaf::lang::exceptions::IndexOutOfBoundsException );
+        virtual const std::string& operator[]( std::size_t index ) const
+            throw ( decaf::lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Returns the max size of this Table.
+         * @returns int size value
+         */
+        virtual std::size_t size() const{
+            return table.size();
+        }
+
+    private:
+
+        // Vector of Strings mapping hex to the value of the index.
+        std::vector<std::string> table;
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_HEXTABLE_H_*/

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/HexTable.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.cpp?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.cpp Sun Jan 11 12:22:34 2009
@@ -0,0 +1,374 @@
+/*
+ * 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 "MessagePropertyInterceptor.h"
+
+#include <decaf/lang/Integer.h>
+#include <activemq/exceptions/ActiveMQException.h>
+#include <cms/DeliveryMode.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::exceptions;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::utils;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+MessagePropertyInterceptor::MessagePropertyInterceptor(
+    commands::Message* message, PrimitiveMap* properties )
+        throw( decaf::lang::exceptions::NullPointerException ) {
+
+    if( message == NULL ) {
+        throw NullPointerException(
+            __FILE__, __LINE__, "Message passed was NULL" );
+    }
+
+    if( properties == NULL ) {
+        throw NullPointerException(
+            __FILE__, __LINE__, "PrimitiveMap passed was NULL" );
+    }
+
+    this->message = message;
+    this->properties = properties;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+MessagePropertyInterceptor::~MessagePropertyInterceptor() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool MessagePropertyInterceptor::getBooleanProperty( const std::string& name ) const
+	throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        return this->properties->getBool( name );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char MessagePropertyInterceptor::getByteProperty( const std::string& name ) const
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        return this->properties->getByte( name );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+double MessagePropertyInterceptor::getDoubleProperty( const std::string& name ) const
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        return this->properties->getDouble( name );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+float MessagePropertyInterceptor::getFloatProperty( const std::string& name ) const
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        return this->properties->getFloat( name );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int MessagePropertyInterceptor::getIntProperty( const std::string& name ) const
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXGroupID" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        } else if( name == "JMSXDeliveryCount" ) {
+            return this->message->getRedeliveryCounter();
+        } else if( name == "JMSXGroupSeq" ) {
+            return this->message->getGroupSequence();
+        }
+
+        return this->properties->getInt( name );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long MessagePropertyInterceptor::getLongProperty( const std::string& name ) const
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXGroupID" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        } else if( name == "JMSXDeliveryCount" ) {
+            return (long long)this->message->getRedeliveryCounter();
+        } else if( name == "JMSXGroupSeq" ) {
+            return (long long)this->message->getGroupSequence();
+        }
+
+        return this->properties->getLong( name );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+short MessagePropertyInterceptor::getShortProperty( const std::string& name ) const
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        return this->properties->getShort( name );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string MessagePropertyInterceptor::getStringProperty( const std::string& name ) const
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXGroupID" ) {
+            return this->message->getGroupID();
+        } else if( name == "JMSXDeliveryCount" ) {
+            return Integer::toString( this->message->getRedeliveryCounter() );
+        } else if( name == "JMSXGroupSeq" ) {
+            return Integer::toString( this->message->getGroupSequence() );
+        }
+
+        return this->properties->getString( name );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MessagePropertyInterceptor::setBooleanProperty( const std::string& name, bool value )
+	throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        this->properties->setBool( name, value );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MessagePropertyInterceptor::setByteProperty( const std::string& name, unsigned char value )
+	throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        this->properties->setByte( name, value );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MessagePropertyInterceptor::setDoubleProperty( const std::string& name, double value )
+	throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        this->properties->setDouble( name, value );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MessagePropertyInterceptor::setFloatProperty( const std::string& name, float value )
+	throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXDeliveryCount" || name == "JMSXGroupID" || name == "JMSXGroupSeq" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        }
+
+        this->properties->setFloat( name, value );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MessagePropertyInterceptor::setIntProperty( const std::string& name, int value )
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXGroupID" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        } else if( name == "JMSXDeliveryCount" ) {
+            this->message->setRedeliveryCounter( value );
+        } else if( name == "JMSXGroupSeq" ) {
+            this->message->setGroupSequence( value );
+        }
+
+        this->properties->setInt( name, value );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MessagePropertyInterceptor::setLongProperty( const std::string& name, long long value )
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+        this->properties->setLong( name, value );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MessagePropertyInterceptor::setShortProperty( const std::string& name, short value )
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXGroupID" ) {
+            throw ActiveMQException(
+                __FILE__, __LINE__,
+                "Cannot Convert Reserved Property to this Type." );
+        } else if( name == "JMSXDeliveryCount" ) {
+            this->message->setRedeliveryCounter( (int)value );
+        } else if( name == "JMSXGroupSeq" ) {
+            this->message->setGroupSequence( (int)value );
+        }
+
+        this->properties->setShort( name, value );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void MessagePropertyInterceptor::setStringProperty( const std::string& name,
+                                                    const std::string& value )
+    throw( activemq::exceptions::ActiveMQException ) {
+
+    try{
+
+        if( name == "JMSXGroupID" ) {
+            this->message->setGroupID( value );
+        } else if( name == "JMSXDeliveryCount" ) {
+            this->message->setRedeliveryCounter( Integer::parseInt( value ) );
+        } else if( name == "JMSXGroupSeq" ) {
+            this->message->setGroupSequence( Integer::parseInt( value ) );
+        }
+
+        this->properties->setString( name, value );
+    }
+    AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
+    AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,224 @@
+/*
+ * 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_WIREFORMAT_OPENWIRE_UTILS_MESSAGEPROPERTYINTERCEPTOR_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_UTILS_MESSAGEPROPERTYINTERCEPTOR_H_
+
+#include <activemq/util/Config.h>
+#include <activemq/commands/Message.h>
+#include <activemq/util/PrimitiveMap.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+#include <decaf/lang/exceptions/NullPointerException.h>
+
+namespace activemq {
+namespace wireformat {
+namespace openwire {
+namespace utils {
+
+    /**
+     * Used the base ActiveMQMessage class to intercept calls to get and set properties
+     * in order to capture the calls that use the reserved JMS properties and get and
+     * set them in the OpenWire Message properties.
+     *
+     * Currently the only properties that are intercepted and handled are:
+     *
+     * Name                | Conversion Supported
+     * ------------------------------------------------------
+     * JMSXDeliveryCount   | Int, Long, String
+     * JMSXGroupID         | String
+     * JMSXGroupSeq        | Int, Long, String
+     *
+     */
+    class AMQCPP_API MessagePropertyInterceptor {
+    private:
+
+        commands::Message* message;
+        util::PrimitiveMap* properties;
+
+    public:
+
+        /**
+         * Constructor, accepts the Message that will be used to store JMS reserved
+         * property values, and the PrimitiveMap to get and set the rest to.
+         *
+         * @param message - The Message to store reserved property data in
+         * @param properties - The PrimitiveMap to store the rest of the properties in.
+         *
+         * @throws NullPointerException if either param is NULL
+         */
+        MessagePropertyInterceptor( commands::Message* message, util::PrimitiveMap* properties )
+            throw( decaf::lang::exceptions::NullPointerException );
+
+        virtual ~MessagePropertyInterceptor();
+
+        /**
+         * Gets a boolean property.
+         * @param name The name of the property to retrieve.
+         * @return The value for the named property.
+         * @throws CMSException if the property does not exist.
+         */
+        virtual bool getBooleanProperty( const std::string& name ) const
+            throw( exceptions::ActiveMQException );
+
+        /**
+         * Gets a byte property.
+         * @param name The name of the property to retrieve.
+         * @return The value for the named property.
+         * @throws CMSException if the property does not exist.
+         */
+        virtual unsigned char getByteProperty( const std::string& name ) const
+            throw( exceptions::ActiveMQException );
+
+        /**
+         * Gets a double property.
+         * @param name The name of the property to retrieve.
+         * @return The value for the named property.
+         * @throws CMSException if the property does not exist.
+         */
+        virtual double getDoubleProperty( const std::string& name ) const
+            throw( exceptions::ActiveMQException );
+
+        /**
+         * Gets a float property.
+         * @param name The name of the property to retrieve.
+         * @return The value for the named property.
+         * @throws CMSException if the property does not exist.
+         */
+        virtual float getFloatProperty( const std::string& name ) const
+            throw( exceptions::ActiveMQException );
+
+        /**
+         * Gets a int property.
+         * @param name The name of the property to retrieve.
+         * @return The value for the named property.
+         * @throws CMSException if the property does not exist.
+         */
+        virtual int getIntProperty( const std::string& name ) const
+            throw( exceptions::ActiveMQException );
+
+        /**
+         * Gets a long property.
+         * @param name The name of the property to retrieve.
+         * @return The value for the named property.
+         * @throws CMSException if the property does not exist.
+         */
+        virtual long long getLongProperty( const std::string& name ) const
+            throw( exceptions::ActiveMQException );
+
+        /**
+         * Gets a short property.
+         * @param name The name of the property to retrieve.
+         * @return The value for the named property.
+         * @throws CMSException if the property does not exist.
+         */
+        virtual short getShortProperty( const std::string& name ) const
+            throw( exceptions::ActiveMQException );
+
+        /**
+         * Gets a string property.
+         * @param name The name of the property to retrieve.
+         * @return The value for the named property.
+         * @throws CMSException if the property does not exist.
+         */
+        virtual std::string getStringProperty( const std::string& name ) const
+            throw( exceptions::ActiveMQException );
+
+        /**
+         * Sets a boolean property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setBooleanProperty( const std::string& name,
+                                         bool value )
+                                            throw( exceptions::ActiveMQException );
+        /**
+         * Sets a byte property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setByteProperty( const std::string& name,
+                                      unsigned char value )
+                                        throw( exceptions::ActiveMQException );
+
+        /**
+         * Sets a double property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setDoubleProperty( const std::string& name,
+                                        double value )
+                                            throw( exceptions::ActiveMQException );
+
+        /**
+         * Sets a float property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setFloatProperty( const std::string& name,
+                                       float value )
+                                        throw( exceptions::ActiveMQException );
+
+        /**
+         * Sets a int property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setIntProperty( const std::string& name,
+                                     int value )
+                                        throw( exceptions::ActiveMQException );
+
+        /**
+         * Sets a long property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setLongProperty( const std::string& name,
+                                      long long value )
+                                        throw( exceptions::ActiveMQException );
+
+        /**
+         * Sets a short property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setShortProperty( const std::string& name,
+                                       short value )
+                                        throw( exceptions::ActiveMQException );
+
+        /**
+         * Sets a string property.
+         * @param name The name of the property to retrieve.
+         * @param value The value for the named property.
+         * @throws CMSException
+         */
+        virtual void setStringProperty( const std::string& name,
+                                        const std::string& value )
+                                            throw( exceptions::ActiveMQException );
+
+    };
+
+}}}}
+
+#endif /* _ACTIVEMQ_WIREFORMAT_OPENWIRE_UTILS_MESSAGEPROPERTYINTERCEPTOR_H_ */

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/MessagePropertyInterceptor.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.cpp?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.cpp Sun Jan 11 12:22:34 2009
@@ -0,0 +1,156 @@
+/*
+ * 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 "OpenwireStringSupport.h"
+
+#include <decaf/lang/Integer.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::utils;
+using namespace decaf::io;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+std::string OpenwireStringSupport::readString( decaf::io::DataInputStream& dataIn )
+    throw ( decaf::io::IOException ) {
+
+    try {
+
+        short utflen = dataIn.readShort();
+
+        if( utflen > -1 )
+        {
+            // Let the stream get us all that data.
+            std::vector<unsigned char> value;
+            value.resize( utflen );
+            dataIn.readFully( value );
+
+            int c = 0;
+            int count = 0;
+
+            while( count < utflen )
+            {
+                c = value[count] & 0xff;
+                switch( c >> 4 )
+                {
+                    case 0:
+                    case 1:
+                    case 2:
+                    case 3:
+                    case 4:
+                    case 5:
+                    case 6:
+                    case 7:
+                        /* 0xxxxxxx */
+                        count++;
+                        break;
+                    case 12:
+                    case 13:
+                    case 14:
+                    default :
+                    {
+                        /* 10xx xxxx, 1111 xxxx */
+                        throw IOException(
+                            __FILE__,
+                            __LINE__,
+                            "OpenwireStringSupport::readString - Encoding not supported" );
+                    }
+                }
+            }
+
+            // C++ strings need a NULL terminator
+            value.push_back( '\0' );
+
+            // Let the Compiler give us a string.
+            return reinterpret_cast<const char*>( &value[0] );
+        }
+
+        return "";
+    }
+    AMQ_CATCH_RETHROW( decaf::io::IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::IOException )
+    AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenwireStringSupport::writeString( decaf::io::DataOutputStream& dataOut,
+                                         const std::string* str )
+                                            throw ( decaf::io::IOException ) {
+
+    try {
+
+        if( str != NULL ) {
+
+            if( str->size() > 65536 ) {
+
+                throw IOException(
+                    __FILE__,
+                    __LINE__,
+                    ( std::string( "OpenwireStringSupport::writeString - Cannot marshall " ) +
+                    "string longer than: 65536 characters, supplied string was: " +
+                    Integer::toString( (int)str->size() ) + " characters long." ).c_str() );
+            }
+
+            unsigned short utflen = 0;
+            int c, count = 0;
+
+            std::string::const_iterator iter = str->begin();
+
+            for(; iter != str->end(); ++iter ) {
+                c = *iter;
+                if( (c >= 0x0001) && (c <= 0x007F) ) {
+                    utflen++;
+                } else if( c > 0x07FF ) {
+                    utflen += 3;
+                } else {
+                    utflen += 2;
+                }
+            }
+
+            dataOut.writeUnsignedShort( utflen );
+            std::vector<unsigned char> byteArr;
+            byteArr.resize( utflen );
+
+            for( iter = str->begin(); iter != str->end(); ++iter ) {
+
+                c = *iter;
+                if( (c >= 0x0001) && (c <= 0x007F) ) {
+                    byteArr[count++] = (unsigned char)c;
+                } else if ( c > 0x07FF ) {
+                    byteArr[count++] = (unsigned char)( 0xE0 | ( (c >> 12) & 0x0F) );
+                    byteArr[count++] = (unsigned char)( 0x80 | ( (c >> 6) & 0x3F) );
+                    byteArr[count++] = (unsigned char)( 0x80 | ( (c >> 0) & 0x3F) );
+                } else {
+                    byteArr[count++] = (unsigned char)( 0xC0 | ( (c >> 6) & 0x1F) );
+                    byteArr[count++] = (unsigned char)( 0x80 | ( (c >> 0) & 0x3F) );
+                }
+            }
+
+            dataOut.write( byteArr );
+
+        } else {
+            dataOut.writeShort( (short)-1 );
+        }
+    }
+    AMQ_CATCH_RETHROW( decaf::io::IOException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::IOException )
+    AMQ_CATCHALL_THROW( decaf::io::IOException )
+}

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,68 @@
+/*
+ * 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_WIREFORMAT_OPENWIRE_UTILS_OPENWIRESTRINGSUPPORT_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_UTILS_OPENWIRESTRINGSUPPORT_H_
+
+#include <string>
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <activemq/util/Config.h>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace utils{
+
+    class AMQCPP_API OpenwireStringSupport {
+    protected:
+
+        OpenwireStringSupport() {}
+        virtual ~OpenwireStringSupport() {}
+
+    public:
+
+        /**
+         * Static method used for reading a string that uses the Openwire format
+         * from a DataInputStream, this can throw an IOException for the same
+         * reason as a DataInputStream.readUTF might, as well as if the string
+         * that is received doesn't conform to the supported charactor encoding.
+         * @param dataIn - DataInputStream to read from
+         * @returns A string that has been read
+         * @throws IOException on Errror.
+         */
+        static std::string readString( decaf::io::DataInputStream& dataIn )
+            throw ( decaf::io::IOException );
+
+        /**
+         * Static method used for writing a string that uses the Openwire format
+         * from a DataOutputStream, this can throw an IOException for the same
+         * reason as a DataOutputStream.writeUTF might.
+         * @param dataOut - DataOutputStream to write to
+         * @param str - A pointer to a string that should be written, NULL needs
+         *              to be an option here as its written as -1.
+         * @throws IOException on Errror.
+         */
+        static void writeString( decaf::io::DataOutputStream& dataOut,
+                                 const std::string* str )
+            throw ( decaf::io::IOException );
+
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_UTILS_OPENWIRESTRINGSUPPORT_H_*/

Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/utils/OpenwireStringSupport.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message