activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r747057 - in /activemq/activemq-cpp/trunk: activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/ src/main/activemq/commands/ src/main/activemq/core/ src/test/
Date Mon, 23 Feb 2009 16:06:13 GMT
Author: tabish
Date: Mon Feb 23 16:06:11 2009
New Revision: 747057

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

Add readOnlyBody and readOnlyProperties to the base Message command and then use correct checks
in the CMS Message implementations, set the Message body and propeties to read only in the
ActiveMQConnection class explicitly on a dispatch to the consumer.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempDestination.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQAckHandler.h
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
    activemq/activemq-cpp/trunk/src/test/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java?rev=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp-openwire-generator/src/main/java/org/apache/activemq/openwire/tool/AmqCppClassesGenerator.java
Mon Feb 23 16:06:11 2009
@@ -194,7 +194,9 @@
 out.println("");
 
         if( className.equals( "Message" ) ) {
-out.println("    this->ackHandler = NULL;");
+            out.println("    this->ackHandler = NULL;");
+            out.println("    this->readOnlyBody = false;");
+            out.println("    this->readOnlyProperties = false;");
         }
 
         List properties = getProperties();
@@ -275,8 +277,9 @@
 
              if( className.equals( "Message" ) &&
                  property.getType().getSimpleName().equals( "MessageId" ) ) {
-out.println("    this->"+setter+"( Pointer<MessageId>( new MessageId( *( srcPtr->"+getter+"()
) ) ) );" );
-
+out.println("    if( this->getMessageId() != NULL ) {");
+out.println("        this->"+setter+"( Pointer<MessageId>( new MessageId( *( srcPtr->"+getter+"()
) ) ) );" );
+out.println("    }");
              } else {
 out.println("    this->"+setter+"( srcPtr->"+getter+"() );");
              }
@@ -301,6 +304,8 @@
         if( className.equals( "Message" ) ) {
 out.println("    stream << \" Value of ackHandler = \" << ackHandler <<
std::endl;");
 out.println("    stream << \" Value of properties = \" << this->properties.toString()
<< std::endl;");
+out.println("    stream << \" Value of readOnlyBody = \" << this->readOnlyBody
<< std::endl;");
+out.println("    stream << \" Value of readOnlyProperties = \" << this->readOnlyBody
<< std::endl;");
         }
 
 for( Iterator iter = properties.iterator(); iter.hasNext(); ) {

Modified: 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=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.cpp Mon Feb
23 16:06:11 2009
@@ -83,7 +83,7 @@
 void ActiveMQBytesMessage::reset() throw ( cms::CMSException ) {
 
     try{
-        readOnly = true;
+        this->setReadOnlyBody( true );
         inputStream.setBuffer( getContent() );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -95,7 +95,7 @@
 bool ActiveMQBytesMessage::readBoolean() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readBoolean();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -107,7 +107,7 @@
 void ActiveMQBytesMessage::writeBoolean( bool value ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeBoolean( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -119,7 +119,7 @@
 unsigned char ActiveMQBytesMessage::readByte() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readByte();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -131,7 +131,7 @@
 void ActiveMQBytesMessage::writeByte( unsigned char value ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeByte( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -144,7 +144,7 @@
     throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.read( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -156,7 +156,7 @@
 void ActiveMQBytesMessage::writeBytes( const std::vector<unsigned char>& value
) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.write( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -169,7 +169,7 @@
     throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.read( buffer, 0, length );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -183,7 +183,7 @@
                                        std::size_t length ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.write( value, offset, length );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -195,7 +195,7 @@
 char ActiveMQBytesMessage::readChar() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readChar();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -207,7 +207,7 @@
 void ActiveMQBytesMessage::writeChar( char value ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeChar( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -219,7 +219,7 @@
 float ActiveMQBytesMessage::readFloat() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readFloat();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -231,7 +231,7 @@
 void ActiveMQBytesMessage::writeFloat( float value ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeFloat( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -243,7 +243,7 @@
 double ActiveMQBytesMessage::readDouble() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readDouble();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -255,7 +255,7 @@
 void ActiveMQBytesMessage::writeDouble( double value ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeDouble( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -267,7 +267,7 @@
 short ActiveMQBytesMessage::readShort() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readShort();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -279,7 +279,7 @@
 void ActiveMQBytesMessage::writeShort( short value ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeShort( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -291,7 +291,7 @@
 unsigned short ActiveMQBytesMessage::readUnsignedShort() const throw ( cms::CMSException
) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readUnsignedShort();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -303,7 +303,7 @@
 void ActiveMQBytesMessage::writeUnsignedShort( unsigned short value ) throw ( cms::CMSException
) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeUnsignedShort( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -315,7 +315,7 @@
 int ActiveMQBytesMessage::readInt() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readInt();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -327,7 +327,7 @@
 void ActiveMQBytesMessage::writeInt( int value ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeInt( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -339,7 +339,7 @@
 long long ActiveMQBytesMessage::readLong() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readLong();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -351,7 +351,7 @@
 void ActiveMQBytesMessage::writeLong( long long value ) throw ( cms::CMSException ) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeLong( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -363,7 +363,7 @@
 std::string ActiveMQBytesMessage::readString() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readString();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -375,7 +375,7 @@
 void ActiveMQBytesMessage::writeString( const std::string& value ) throw ( cms::CMSException
) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeChars( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -387,7 +387,7 @@
 std::string ActiveMQBytesMessage::readUTF() const throw ( cms::CMSException ) {
 
     try{
-        checkReadOnly();
+        checkWriteOnlyBody();
         return dataInputStream.readUTF();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -399,7 +399,7 @@
 void ActiveMQBytesMessage::writeUTF( const std::string& value ) throw ( cms::CMSException
) {
 
     try{
-        checkWriteOnly();
+        checkReadOnlyBody();
         dataOutputStream.writeUTF( value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )

Modified: 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=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQBytesMessage.h Mon Feb
23 16:06:11 2009
@@ -42,13 +42,6 @@
     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.
          */
@@ -147,9 +140,6 @@
             // Invoke base class's version.
             ActiveMQMessageTemplate<cms::BytesMessage>::clearBody();
 
-            // Set the stream in write only mode.
-            readOnly = false;
-
             outputStream.setBuffer( getContent() );
         }
 
@@ -416,27 +406,16 @@
     protected:
 
         /**
-         * Throws an exception if not in write-only mode.
+         * Throws an exception if in write-only mode.
          * @throws CMSException.
          */
-        void checkWriteOnly() const throw ( cms::CMSException ){
-            if( readOnly ){
+        void checkWriteOnlyBody() const throw ( cms::CMSException ){
+            if( !this->isReadOnlyBody() ){
                 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" );
-            }
-        }
-
     };
 
 }}

Modified: 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=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp Mon Feb
23 16:06:11 2009
@@ -160,6 +160,7 @@
     throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setBool( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -185,6 +186,7 @@
                                       throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setByte( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -210,6 +212,7 @@
                                        throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setByteArray( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -234,6 +237,7 @@
     throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setChar( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -259,6 +263,7 @@
                                         throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setDouble( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -283,6 +288,7 @@
     throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setFloat( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -307,6 +313,7 @@
     throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setInt( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -331,6 +338,7 @@
     throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setLong( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -355,6 +363,7 @@
     throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setShort( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -380,6 +389,7 @@
                                         throw( cms::CMSException ) {
 
     try{
+        checkReadOnlyBody();
         getMap().setString( name, value );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h?rev=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h Mon Feb
23 16:06:11 2009
@@ -65,6 +65,7 @@
          */
         virtual void clearBody() {
             this->setContent( std::vector<unsigned char>() );
+            this->setReadOnlyBody( false );
         }
 
         /**
@@ -72,7 +73,8 @@
          * header values.
          */
         virtual void clearProperties() {
-            getMessageProperties().clear();
+            this->getMessageProperties().clear();
+            this->setReadOnlyProperties( false );
         }
 
         /**
@@ -240,6 +242,7 @@
                                             throw( cms::CMSException ) {
 
             try{
+                checkReadOnlyProperties();
                 this->propertiesInterceptor->setBooleanProperty( name, value );
             }
             AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
@@ -258,6 +261,7 @@
                                         throw( cms::CMSException ) {
 
             try{
+                checkReadOnlyProperties();
                 this->propertiesInterceptor->setByteProperty( name, value );
             }
             AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
@@ -276,6 +280,7 @@
                                             throw( cms::CMSException ) {
 
             try{
+                checkReadOnlyProperties();
                 this->propertiesInterceptor->setDoubleProperty( name, value );
             }
             AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
@@ -294,6 +299,7 @@
                                         throw( cms::CMSException ) {
 
             try{
+                checkReadOnlyProperties();
                 this->propertiesInterceptor->setFloatProperty( name, value );
             }
             AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
@@ -312,6 +318,7 @@
                                         throw( cms::CMSException ) {
 
             try{
+                checkReadOnlyProperties();
                 this->propertiesInterceptor->setIntProperty( name, value );
             }
             AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
@@ -330,6 +337,7 @@
                                         throw( cms::CMSException ) {
 
             try{
+                checkReadOnlyProperties();
                 this->propertiesInterceptor->setLongProperty( name, value );
             }
             AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
@@ -348,6 +356,7 @@
                                         throw( cms::CMSException ) {
 
             try{
+                checkReadOnlyProperties();
                 this->propertiesInterceptor->setShortProperty( name, value );
             }
             AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
@@ -366,6 +375,7 @@
                                             throw( cms::CMSException ) {
 
             try{
+                checkReadOnlyProperties();
                 this->propertiesInterceptor->setStringProperty( name, value );
             }
             AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
@@ -544,6 +554,22 @@
             this->setType( type );
         }
 
+    protected:
+
+        void checkReadOnlyBody() {
+            if( this->isReadOnlyBody() ) {
+                throw exceptions::ActiveMQException(
+                    __FILE__, __LINE__, "Message Body is Read-Only." );
+            }
+        }
+
+        void checkReadOnlyProperties() {
+            if( this->isReadOnlyProperties() ) {
+                throw exceptions::ActiveMQException(
+                    __FILE__, __LINE__, "Message Properties are Read-Only." );
+            }
+        }
+
     };
 
 }}

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempDestination.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempDestination.cpp?rev=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempDestination.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTempDestination.cpp Mon
Feb 23 16:06:11 2009
@@ -26,12 +26,12 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQTempDestination::ActiveMQTempDestination() :
-    ActiveMQDestination() {
+    ActiveMQDestination(), connection( NULL ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQTempDestination::ActiveMQTempDestination( const std::string& name ) :
-    ActiveMQDestination( name ) {
+    ActiveMQDestination( name ), connection( NULL ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp?rev=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQTextMessage.cpp Mon Feb
23 16:06:11 2009
@@ -67,6 +67,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQTextMessage::setText( const std::string& msg ) throw( cms::CMSException
) {
     try{
+        checkReadOnlyBody();
         std::vector<unsigned char>& content = getContent();
         content.clear();
         decaf::io::ByteArrayOutputStream bos( content );

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.cpp?rev=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/Message.cpp Mon Feb 23 16:06:11
2009
@@ -42,6 +42,8 @@
 Message::Message() {
 
     this->ackHandler = NULL;
+    this->readOnlyBody = false;
+    this->readOnlyProperties = false;
     this->groupID = "";
     this->groupSequence = 0;
     this->correlationId = "";
@@ -100,7 +102,9 @@
     this->setDestination( srcPtr->getDestination() );
     this->setTransactionId( srcPtr->getTransactionId() );
     this->setOriginalDestination( srcPtr->getOriginalDestination() );
-    this->setMessageId( Pointer<MessageId>( new MessageId( *( srcPtr->getMessageId()
) ) ) );
+    if( this->getMessageId() != NULL ) {
+        this->setMessageId( Pointer<MessageId>( new MessageId( *( srcPtr->getMessageId()
) ) ) );
+    }
     this->setOriginalTransactionId( srcPtr->getOriginalTransactionId() );
     this->setGroupID( srcPtr->getGroupID() );
     this->setGroupSequence( srcPtr->getGroupSequence() );
@@ -141,6 +145,8 @@
     stream << " Value of Message::ID_MESSAGE = 0" << std::endl;
     stream << " Value of ackHandler = " << ackHandler << std::endl;
     stream << " Value of properties = " << this->properties.toString() <<
std::endl;
+    stream << " Value of readOnlyBody = " << this->readOnlyBody << std::endl;
+    stream << " Value of readOnlyProperties = " << this->readOnlyBody <<
std::endl;
     stream << " Value of ProducerId is Below:" << std::endl;
     if( this->getProducerId() != NULL ) {
         stream << this->getProducerId()->toString() << std::endl;

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQAckHandler.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQAckHandler.h?rev=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQAckHandler.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQAckHandler.h Mon Feb 23 16:06:11
2009
@@ -27,6 +27,8 @@
     /**
      * Interface class that is used to give CMS Messages an interface to
      * Ack themselves with.
+     *
+     * @since 2.0
      */
     class AMQCPP_API ActiveMQAckHandler {
     public:
@@ -39,7 +41,7 @@
          * @throw CMSException
          */
         virtual void acknowledgeMessage( const commands::Message* message )
-                throw ( cms::CMSException ) = 0;
+            throw ( cms::CMSException ) = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp?rev=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp Mon Feb 23 16:06:11
2009
@@ -462,8 +462,12 @@
                 // just closed.
                 if( dispatcher != NULL ) {
 
+                    Pointer<commands::Message> message = dispatch->getMessage();
+                    message->setReadOnlyBody( true );
+                    message->setReadOnlyProperties( true );
+
                     // Dispatch the message.
-                    DispatchData data( dispatch->getConsumerId(), dispatch->getMessage()
);
+                    DispatchData data( dispatch->getConsumerId(), message );
                     dispatcher->dispatch( data );
                 }
             }

Modified: activemq/activemq-cpp/trunk/src/test/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/testRegistry.cpp?rev=747057&r1=747056&r2=747057&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/testRegistry.cpp Mon Feb 23 16:06:11 2009
@@ -18,26 +18,26 @@
 // All CPP Unit tests are registered in here so we can disable them and
 // enable them easily in one place.
 
-//#include <activemq/commands/BrokerInfoTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::BrokerInfoTest );
+#include <activemq/commands/BrokerInfoTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::BrokerInfoTest );
 #include <activemq/commands/BrokerIdTest.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::BrokerIdTest );
-//#include <activemq/commands/ActiveMQTopicTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQTopicTest );
-//#include <activemq/commands/ActiveMQTextMessageTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQTextMessageTest );
-//#include <activemq/commands/ActiveMQTempTopicTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQTempTopicTest );
-//#include <activemq/commands/ActiveMQTempQueueTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQTempQueueTest );
-//#include <activemq/commands/ActiveMQQueueTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQQueueTest );
-//#include <activemq/commands/ActiveMQMessageTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQMessageTest );
-//#include <activemq/commands/ActiveMQMapMessageTest.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQMapMessageTest );
-//#include <activemq/commands/ActiveMQDestinationTest2.h>
-//CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQDestinationTest );
+#include <activemq/commands/ActiveMQTopicTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQTopicTest );
+#include <activemq/commands/ActiveMQTextMessageTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQTextMessageTest );
+#include <activemq/commands/ActiveMQTempTopicTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQTempTopicTest );
+#include <activemq/commands/ActiveMQTempQueueTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQTempQueueTest );
+#include <activemq/commands/ActiveMQQueueTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQQueueTest );
+#include <activemq/commands/ActiveMQMessageTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQMessageTest );
+#include <activemq/commands/ActiveMQMapMessageTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQMapMessageTest );
+#include <activemq/commands/ActiveMQDestinationTest2.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQDestinationTest );
 #include <activemq/commands/ActiveMQBytesMessageTest.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQBytesMessageTest );
 //



Mime
View raw message