Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 88937 invoked from network); 16 Nov 2010 23:00:00 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Nov 2010 23:00:00 -0000 Received: (qmail 66366 invoked by uid 500); 16 Nov 2010 23:00:31 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 66321 invoked by uid 500); 16 Nov 2010 23:00:31 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 66314 invoked by uid 99); 16 Nov 2010 23:00:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Nov 2010 23:00:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Nov 2010 23:00:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3DD3E23888D2; Tue, 16 Nov 2010 22:59:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1035852 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ Date: Tue, 16 Nov 2010 22:59:14 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101116225915.3DD3E23888D2@eris.apache.org> Author: tabish Date: Tue Nov 16 22:59:14 2010 New Revision: 1035852 URL: http://svn.apache.org/viewvc?rev=1035852&view=rev Log: Regenerated Commands with full implementation of XATransaction as an cms::Xid. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BrokerId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/LocalTransactionId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ProducerId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/TransactionId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.h Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BrokerId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BrokerId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BrokerId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/BrokerId.cpp Tue Nov 16 22:59:14 2010 @@ -152,7 +152,7 @@ int BrokerId::compareTo( const BrokerId& //////////////////////////////////////////////////////////////////////////////// bool BrokerId::equals( const BrokerId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConnectionId.cpp Tue Nov 16 22:59:14 2010 @@ -176,7 +176,7 @@ int ConnectionId::compareTo( const Conne //////////////////////////////////////////////////////////////////////////////// bool ConnectionId::equals( const ConnectionId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ConsumerId.cpp Tue Nov 16 22:59:14 2010 @@ -41,20 +41,20 @@ using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// ConsumerId::ConsumerId() - : BaseDataStructure(), parentId(), connectionId(""), sessionId(0), value(0) { + : BaseDataStructure(), connectionId(""), sessionId(0), value(0) { } //////////////////////////////////////////////////////////////////////////////// ConsumerId::ConsumerId( const ConsumerId& other ) - : BaseDataStructure(), parentId(), connectionId(""), sessionId(0), value(0) { + : BaseDataStructure(), connectionId(""), sessionId(0), value(0) { this->copyDataStructure( &other ); } //////////////////////////////////////////////////////////////////////////////// ConsumerId::ConsumerId( const SessionId& sessionId, long long consumerIdd ) - : BaseDataStructure(), parentId(), connectionId(""), sessionId(0), value(0) { + : BaseDataStructure(), connectionId(""), sessionId(0), value(0) { this->connectionId = sessionId.getConnectionId(); this->sessionId = sessionId.getValue(); @@ -208,7 +208,7 @@ int ConsumerId::compareTo( const Consume //////////////////////////////////////////////////////////////////////////////// bool ConsumerId::equals( const ConsumerId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/LocalTransactionId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/LocalTransactionId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/LocalTransactionId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/LocalTransactionId.cpp Tue Nov 16 22:59:14 2010 @@ -189,7 +189,7 @@ int LocalTransactionId::compareTo( const //////////////////////////////////////////////////////////////////////////////// bool LocalTransactionId::equals( const LocalTransactionId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.cpp Tue Nov 16 22:59:14 2010 @@ -44,11 +44,10 @@ using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// Message::Message() - : BaseCommand(), ackHandler(NULL), properties(), readOnlyProperties(false), readOnlyBody(false), connection(NULL), producerId(NULL), - destination(NULL), transactionId(NULL), originalDestination(NULL), messageId(NULL), originalTransactionId(NULL), + : BaseCommand(), producerId(NULL), destination(NULL), transactionId(NULL), originalDestination(NULL), messageId(NULL), originalTransactionId(NULL), groupID(""), groupSequence(0), correlationId(""), persistent(false), expiration(0), priority(0), replyTo(NULL), timestamp(0), type(""), content(), marshalledProperties(), dataStructure(NULL), targetConsumerId(NULL), compressed(false), redeliveryCounter(0), - brokerPath(), arrival(0), userID(""), recievedByDFBridge(false), droppable(false), cluster(), brokerInTime(0), brokerOutTime(0) { + brokerPath(), arrival(0), userID(""), recievedByDFBridge(false), droppable(false), cluster(), brokerInTime(0), brokerOutTime(0), ackHandler(NULL), properties(), readOnlyProperties(false), readOnlyBody(false), connection(NULL) { } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h Tue Nov 16 22:59:14 2010 @@ -57,28 +57,6 @@ namespace commands{ * */ class AMQCPP_API Message : public BaseCommand { - private: - - // Used to allow a client to call Message::acknowledge when in the Client - // Ack mode. - Pointer ackHandler; - - // Message properties, these are Marshaled and Unmarshaled from the Message - // Command's marshaledProperties vector. - activemq::util::PrimitiveMap properties; - - // Indicates if the Message Properties are Read Only - bool readOnlyProperties; - - // Indicates if the Message Body are Read Only - bool readOnlyBody; - - protected: - - core::ActiveMQConnection* connection; - - static const unsigned int DEFAULT_MESSAGE_SIZE = 1024; - protected: Pointer producerId; @@ -117,6 +95,28 @@ namespace commands{ private: + // Used to allow a client to call Message::acknowledge when in the Client + // Ack mode. + Pointer ackHandler; + + // Message properties, these are Marshaled and Unmarshaled from the Message + // Command's marshaledProperties vector. + activemq::util::PrimitiveMap properties; + + // Indicates if the Message Properties are Read Only + bool readOnlyProperties; + + // Indicates if the Message Body are Read Only + bool readOnlyBody; + + protected: + + core::ActiveMQConnection* connection; + + static const unsigned int DEFAULT_MESSAGE_SIZE = 1024; + + private: + Message( const Message& ); Message& operator= ( const Message& ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.cpp Tue Nov 16 22:59:14 2010 @@ -42,27 +42,27 @@ using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// MessageId::MessageId() - : BaseDataStructure(), key(""), producerId(NULL), producerSequenceId(0), brokerSequenceId(0) { + : BaseDataStructure(), producerId(NULL), producerSequenceId(0), brokerSequenceId(0), key("") { } //////////////////////////////////////////////////////////////////////////////// MessageId::MessageId( const MessageId& other ) - : BaseDataStructure(), key(""), producerId(NULL), producerSequenceId(0), brokerSequenceId(0) { + : BaseDataStructure(), producerId(NULL), producerSequenceId(0), brokerSequenceId(0), key("") { this->copyDataStructure( &other ); } //////////////////////////////////////////////////////////////////////////////// MessageId::MessageId( const std::string& messageKey ) - : BaseDataStructure(), key(""), producerId(NULL), producerSequenceId(0), brokerSequenceId(0) { + : BaseDataStructure(), producerId(NULL), producerSequenceId(0), brokerSequenceId(0), key("") { this->setValue( messageKey ); } //////////////////////////////////////////////////////////////////////////////// MessageId::MessageId( const Pointer& producerInfo, long long producerSequenceId ) - : BaseDataStructure(), key(""), producerId(NULL), producerSequenceId(0), brokerSequenceId(0) { + : BaseDataStructure(), producerId(NULL), producerSequenceId(0), brokerSequenceId(0), key("") { this->producerId = producerInfo->getProducerId(); this->producerSequenceId = producerSequenceId; @@ -70,7 +70,7 @@ MessageId::MessageId( const Pointer& producerId, long long producerSequenceId ) - : BaseDataStructure(), key(""), producerId(NULL), producerSequenceId(0), brokerSequenceId(0) { + : BaseDataStructure(), producerId(NULL), producerSequenceId(0), brokerSequenceId(0), key("") { this->producerId = producerId; this->producerSequenceId = producerSequenceId; @@ -78,7 +78,7 @@ MessageId::MessageId( const PointerproducerId.reset( new ProducerId( producerId ) ); this->producerSequenceId = producerSequenceId; @@ -236,7 +236,7 @@ int MessageId::compareTo( const MessageI //////////////////////////////////////////////////////////////////////////////// bool MessageId::equals( const MessageId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.h?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/MessageId.h Tue Nov 16 22:59:14 2010 @@ -47,10 +47,6 @@ namespace commands{ * */ class AMQCPP_API MessageId : public BaseDataStructure, public decaf::lang::Comparable { - private: - - mutable std::string key; - protected: Pointer producerId; @@ -63,6 +59,10 @@ namespace commands{ typedef decaf::lang::PointerComparator COMPARATOR; + private: + + mutable std::string key; + public: MessageId(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ProducerId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ProducerId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ProducerId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ProducerId.cpp Tue Nov 16 22:59:14 2010 @@ -42,20 +42,20 @@ using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// ProducerId::ProducerId() - : BaseDataStructure(), parentId(), connectionId(""), value(0), sessionId(0) { + : BaseDataStructure(), connectionId(""), value(0), sessionId(0) { } //////////////////////////////////////////////////////////////////////////////// ProducerId::ProducerId( const ProducerId& other ) - : BaseDataStructure(), parentId(), connectionId(""), value(0), sessionId(0) { + : BaseDataStructure(), connectionId(""), value(0), sessionId(0) { this->copyDataStructure( &other ); } //////////////////////////////////////////////////////////////////////////////// ProducerId::ProducerId( const SessionId& sessionId, long long consumerId ) - : BaseDataStructure(), parentId(), connectionId(""), value(0), sessionId(0) { + : BaseDataStructure(), connectionId(""), value(0), sessionId(0) { this->connectionId = sessionId.getConnectionId(); this->sessionId = sessionId.getValue(); @@ -64,7 +64,7 @@ ProducerId::ProducerId( const SessionId& //////////////////////////////////////////////////////////////////////////////// ProducerId::ProducerId( std::string producerKey ) - : BaseDataStructure(), parentId(), connectionId(""), value(0), sessionId(0) { + : BaseDataStructure(), connectionId(""), value(0), sessionId(0) { // Parse off the producerId std::size_t p = producerKey.rfind( ':' ); @@ -224,7 +224,7 @@ int ProducerId::compareTo( const Produce //////////////////////////////////////////////////////////////////////////////// bool ProducerId::equals( const ProducerId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.cpp Tue Nov 16 22:59:14 2010 @@ -44,20 +44,20 @@ using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// SessionId::SessionId() - : BaseDataStructure(), parentId(), connectionId(""), value(0) { + : BaseDataStructure(), connectionId(""), value(0), parentId() { } //////////////////////////////////////////////////////////////////////////////// SessionId::SessionId( const SessionId& other ) - : BaseDataStructure(), parentId(), connectionId(""), value(0) { + : BaseDataStructure(), connectionId(""), value(0), parentId() { this->copyDataStructure( &other ); } //////////////////////////////////////////////////////////////////////////////// SessionId::SessionId( const ConnectionId* connectionId, long long sessionId ) - : BaseDataStructure(), parentId(), connectionId(""), value(0) { + : BaseDataStructure(), connectionId(""), value(0), parentId() { this->connectionId = connectionId->getValue(); this->value = sessionId; @@ -65,7 +65,7 @@ SessionId::SessionId( const ConnectionId //////////////////////////////////////////////////////////////////////////////// SessionId::SessionId( const ProducerId* producerId ) - : BaseDataStructure(), parentId(), connectionId(""), value(0) { + : BaseDataStructure(), connectionId(""), value(0), parentId() { this->connectionId = producerId->getConnectionId(); this->value = producerId->getSessionId(); @@ -73,7 +73,7 @@ SessionId::SessionId( const ProducerId* //////////////////////////////////////////////////////////////////////////////// SessionId::SessionId( const ConsumerId* consumerId ) - : BaseDataStructure(), parentId(), connectionId(""), value(0) { + : BaseDataStructure(), connectionId(""), value(0), parentId() { this->connectionId = consumerId->getConnectionId(); this->value = consumerId->getSessionId(); @@ -204,7 +204,7 @@ int SessionId::compareTo( const SessionI //////////////////////////////////////////////////////////////////////////////// bool SessionId::equals( const SessionId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.h?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionId.h Tue Nov 16 22:59:14 2010 @@ -49,10 +49,6 @@ namespace commands{ * */ class AMQCPP_API SessionId : public BaseDataStructure, public decaf::lang::Comparable { - private: - - mutable Pointer parentId; - protected: std::string connectionId; @@ -64,6 +60,10 @@ namespace commands{ typedef decaf::lang::PointerComparator COMPARATOR; + private: + + mutable Pointer parentId; + public: SessionId(); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.cpp Tue Nov 16 22:59:14 2010 @@ -40,7 +40,7 @@ using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// SessionInfo::SessionInfo() - : BaseCommand(), ackMode((unsigned int)cms::Session::AUTO_ACKNOWLEDGE), sessionId(NULL) { + : BaseCommand(), sessionId(NULL), ackMode((unsigned int)cms::Session::AUTO_ACKNOWLEDGE) { } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.h?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/SessionInfo.h Tue Nov 16 22:59:14 2010 @@ -46,11 +46,6 @@ namespace commands{ * */ class AMQCPP_API SessionInfo : public BaseCommand { - private: - - // The ACK mode that the Session was created with - unsigned int ackMode; - protected: Pointer sessionId; @@ -61,6 +56,11 @@ namespace commands{ private: + // The ACK mode that the Session was created with + unsigned int ackMode; + + private: + SessionInfo( const SessionInfo& ); SessionInfo& operator= ( const SessionInfo& ); Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/TransactionId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/TransactionId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/TransactionId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/TransactionId.cpp Tue Nov 16 22:59:14 2010 @@ -133,7 +133,7 @@ int TransactionId::compareTo( const Tran //////////////////////////////////////////////////////////////////////////////// bool TransactionId::equals( const TransactionId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.cpp?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.cpp Tue Nov 16 22:59:14 2010 @@ -19,6 +19,7 @@ #include #include #include +#include #include using namespace std; @@ -40,18 +41,47 @@ using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// XATransactionId::XATransactionId() - : TransactionId(), formatId(0), globalTransactionId(), branchQualifier() { + : TransactionId(), cms::Xid(), formatId(0), globalTransactionId(), branchQualifier() { } //////////////////////////////////////////////////////////////////////////////// XATransactionId::XATransactionId( const XATransactionId& other ) - : TransactionId(), formatId(0), globalTransactionId(), branchQualifier() { + : TransactionId(), cms::Xid(), formatId(0), globalTransactionId(), branchQualifier() { this->copyDataStructure( &other ); } //////////////////////////////////////////////////////////////////////////////// +XATransactionId::XATransactionId( const cms::Xid* xid ) + : TransactionId(), cms::Xid(), formatId(0), globalTransactionId(), branchQualifier() { + + if( xid == NULL ) { + return; + } + + this->formatId = xid->getFormatId(); + this->branchQualifier.resize( cms::Xid::MAXBQUALSIZE ); + this->globalTransactionId.resize( cms::Xid::MAXGTRIDSIZE ); + + int result = xid->getBranchQualifier( &this->branchQualifier[0], cms::Xid::MAXBQUALSIZE ); + + if( result == -1 ) { + throw cms::XAException("Invalid Xid Branch Qualifier is larger than MAXBQUALSIZE" ); + } else { + this->branchQualifier.resize( result ); + } + + result = xid->getGlobalTransactionId( &this->globalTransactionId[0], cms::Xid::MAXGTRIDSIZE ); + + if( result == -1 ) { + throw cms::XAException("Invalid Xid Global Transaction Id is larger than MAXGTRIDSIZE" ); + } else { + this->globalTransactionId.resize( result ); + } +} + +//////////////////////////////////////////////////////////////////////////////// XATransactionId::~XATransactionId() { } @@ -230,7 +260,7 @@ int XATransactionId::compareTo( const XA //////////////////////////////////////////////////////////////////////////////// bool XATransactionId::equals( const XATransactionId& value ) const { - return this->equals( &value ); + return this->equals( (const DataStructure*)&value ); } //////////////////////////////////////////////////////////////////////////////// @@ -249,3 +279,89 @@ XATransactionId& XATransactionId::operat return *this; } +//////////////////////////////////////////////////////////////////////////////// +cms::Xid* XATransactionId::clone() const { + + XATransactionId* theClone = new XATransactionId(); + + theClone->formatId = this->formatId; + theClone->globalTransactionId = this->globalTransactionId; + theClone->branchQualifier = this->branchQualifier; + + return theClone; +} + +//////////////////////////////////////////////////////////////////////////////// +bool XATransactionId::equals( const cms::Xid* other ) const { + + if( (void*)this == other ) { + return true; + } + + if( other == NULL ) { + return false; + } + + if( this->formatId != other->getFormatId() ) { + return false; + } + + std::vector otherBQual( Xid::MAXBQUALSIZE ); + + other->getBranchQualifier( &otherBQual[0], Xid::MAXBQUALSIZE ); + + if( this->branchQualifier != otherBQual ) { + return false; + } + + std::vector otherGTXID( Xid::MAXBQUALSIZE ); + + other->getGlobalTransactionId( &otherGTXID[0], Xid::MAXGTRIDSIZE ); + + if( this->globalTransactionId != otherGTXID ) { + return false; + } + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +int XATransactionId::getBranchQualifier( unsigned char* buffer, int size ) const { + + if( size < 0 ) { + throw cms::XAException("Invalid negative size value passed to getBranchQualifier()"); + } + + if( size < (int)this->branchQualifier.size() ) { + return -1; + } + + if( this->branchQualifier.size() == 0 ) { + return 0; + } + + std::copy( this->branchQualifier.begin(), this->branchQualifier.end(), buffer ); + + return (int)this->branchQualifier.size(); +} + +//////////////////////////////////////////////////////////////////////////////// +int XATransactionId::getGlobalTransactionId( unsigned char* buffer, int size ) const { + + if( size < 0 ) { + throw cms::XAException("Invalid negative size value passed to getGlobalTransactionId()"); + } + + if( size < (int)this->globalTransactionId.size() ) { + return -1; + } + + if( this->globalTransactionId.size() == 0 ) { + return 0; + } + + std::copy( this->globalTransactionId.begin(), this->globalTransactionId.end(), buffer ); + + return (int)this->globalTransactionId.size(); +} + Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.h?rev=1035852&r1=1035851&r2=1035852&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/XATransactionId.h Tue Nov 16 22:59:14 2010 @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -44,7 +45,7 @@ namespace commands{ * in the activemq-cpp-openwire-generator module * */ - class AMQCPP_API XATransactionId : public TransactionId, public decaf::lang::Comparable { + class AMQCPP_API XATransactionId : public TransactionId, public cms::Xid, public decaf::lang::Comparable { protected: int formatId; @@ -63,6 +64,8 @@ namespace commands{ XATransactionId( const XATransactionId& other ); + XATransactionId( const cms::Xid* xid ); + virtual ~XATransactionId(); virtual unsigned char getDataStructureType() const; @@ -79,6 +82,16 @@ namespace commands{ return true; } + public: // Xid interface implementation. + + virtual Xid* clone() const; + + virtual bool equals( const Xid* other ) const; + + virtual int getBranchQualifier( unsigned char* buffer, int size ) const; + + virtual int getGlobalTransactionId( unsigned char* buffer, int size ) const; + virtual int getFormatId() const; virtual void setFormatId( int formatId );