Author: tabish Date: Mon Nov 20 13:09:29 2006 New Revision: 477334 URL: http://svn.apache.org/viewvc?view=rev&rev=477334 Log: Changes to support new Openwire Functionality
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessage.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQObjectMessage.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.cpp?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.cpp Mon Nov 20 13:09:29 2006 @@ -15,6 +15,7 @@ * limitations under the License. */ #include <activemq/connector/openwire/commands/ActiveMQBytesMessage.h> +#include <activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h> using namespace std; using namespace activemq; @@ -38,3 +39,17 @@ return ActiveMQBytesMessage::ID_ACTIVEMQBYTESMESSAGE; } +//////////////////////////////////////////////////////////////////////////////// +void ActiveMQBytesMessage::acknowledge(void) const throw( cms::CMSException ) { + + try{ + this->getAckHandler()->acknowledgeMessage( this ); + } + AMQ_CATCH_RETHROW( exceptions::ActiveMQException ) + AMQ_CATCHALL_THROW( exceptions::ActiveMQException ) +} + +//////////////////////////////////////////////////////////////////////////////// +std::string ActiveMQBytesMessage::getCMSMessageId(void) const { + return marshal::BaseDataStreamMarshaller::toString( this->getMessageId() ); +} Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.h?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQBytesMessage.h Mon Nov 20 13:09:29 2006 @@ -84,7 +84,7 @@ * of this consumed message. */ virtual void acknowledge(void) const throw( cms::CMSException ); - + /** * Retrieves a reference to the properties object owned * by this message @@ -97,13 +97,17 @@ * Get the Correlation Id for this message * @return string representation of the correlation Id */ - virtual std::string getCMSCorrelationId(void) const; + virtual std::string getCMSCorrelationId(void) const { + return this->getCorrelationId(); + } /** * Sets the Correlation Id used by this message * @param correlationId - String representing the correlation id. */ - virtual void setCMSCorrelationId( const std::string& correlationId ); + virtual void setCMSCorrelationId( const std::string& correlationId ) { + this->setCorrelationId( correlationId ); + } /** * Gets the DeliveryMode for this message @@ -133,13 +137,17 @@ * Gets the Expiration Time for this Message * @return time value */ - virtual long getCMSExpiration(void) const; + virtual long long getCMSExpiration(void) const { + return this->getExpiration(); + } /** * Sets the Expiration Time for this message * @param expireTime - time value */ - virtual void setCMSExpiration( long expireTime ); + virtual void setCMSExpiration( long long expireTime ) { + this->setExpiration( expireTime ); + } /** * Gets the CMS Message Id for this Message @@ -151,31 +159,37 @@ * Sets the CMS Message Id for this message * @param id - time value */ - virtual void setCMSMessageId( const std::string& id ); + virtual void setCMSMessageId( const std::string& id ) {} /** * Gets the Priority Value for this Message * @return priority value */ - virtual int getCMSPriority(void) const; + virtual int getCMSPriority(void) const { + return this->getPriority(); + } /** * Sets the Priority Value for this message * @param priority - priority value for this message */ - virtual void setCMSPriority( int priority ); + virtual void setCMSPriority( int priority ) { + this->setPriority( priority ); + } /** * Gets the Redelivered Flag for this Message * @return redelivered value */ - virtual bool getCMSRedelivered(void) const; + virtual bool getCMSRedelivered(void) const { + return this->getRedeliveryCounter() != 0; + } /** * Sets the Redelivered Flag for this message * @param redelivered - boolean redelivered value */ - virtual void setCMSRedelivered( bool redelivered ); + virtual void setCMSRedelivered( bool redelivered ) {} /** * Gets the CMS Reply To Address for this Message @@ -193,25 +207,33 @@ * Gets the Time Stamp for this Message * @return time stamp value */ - virtual long getCMSTimeStamp(void) const; + virtual long long getCMSTimeStamp(void) const { + return this->getTimestamp(); + } /** * Sets the Time Stamp for this message * @param timeStamp - integer time stamp value */ - virtual void setCMSTimeStamp( long timeStamp ); + virtual void setCMSTimeStamp( long long timeStamp ) { + this->setTimestamp( timeStamp ); + } /** * Gets the CMS Message Type for this Message * @return type value */ - virtual std::string getCMSMessageType(void) const; + virtual std::string getCMSMessageType(void) const { + return this->getType(); + } /** * Sets the CMS Message Type for this message * @param type - message type value string */ - virtual void setCMSMessageType( const std::string& type ); + virtual void setCMSMessageType( const std::string& type ) { + this->setType( type ); + } public: // CMS BytesMessage Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp Mon Nov 20 13:09:29 2006 @@ -38,3 +38,12 @@ return ActiveMQMapMessage::ID_ACTIVEMQMAPMESSAGE; } +//////////////////////////////////////////////////////////////////////////////// +void ActiveMQMapMessage::acknowledge(void) const throw( cms::CMSException ) { + + try{ + this->getAckHandler()->acknowledgeMessage( this ); + } + AMQ_CATCH_RETHROW( exceptions::ActiveMQException ) + AMQ_CATCHALL_THROW( exceptions::ActiveMQException ) +} Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h Mon Nov 20 13:09:29 2006 @@ -133,13 +133,13 @@ * Gets the Expiration Time for this Message * @return time value */ - virtual long getCMSExpiration(void) const; + virtual long long getCMSExpiration(void) const; /** * Sets the Expiration Time for this message * @param expireTime - time value */ - virtual void setCMSExpiration( long expireTime ); + virtual void setCMSExpiration( long long expireTime ); /** * Gets the CMS Message Id for this Message @@ -193,13 +193,13 @@ * Gets the Time Stamp for this Message * @return time stamp value */ - virtual long getCMSTimeStamp(void) const; + virtual long long getCMSTimeStamp(void) const; /** * Sets the Time Stamp for this message * @param timeStamp - integer time stamp value */ - virtual void setCMSTimeStamp( long timeStamp ); + virtual void setCMSTimeStamp( long long timeStamp ); /** * Gets the CMS Message Type for this Message Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessage.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessage.h?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessage.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessage.h Mon Nov 20 13:09:29 2006 @@ -21,6 +21,7 @@ #include <activemq/connector/openwire/commands/Message.h> #include <activemq/core/ActiveMQMessage.h> #include <activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h> +#include <activemq/core/ActiveMQAckHandler.h> namespace activemq{ namespace connector{ @@ -80,6 +81,15 @@ } /** + * Gets the Acknowledgement Handler that this Message will use + * when the Acknowledge method is called. + * @returns handler ActiveMQAckHandler to call or NULL if not set + */ + virtual core::ActiveMQAckHandler* getAckHandler() const { + return this->ackHandler; + } + + /** * Gets the number of times this message has been redelivered. * @return redelivery count */ @@ -97,9 +107,9 @@ } private: - - int redeliveryCount; + core::ActiveMQAckHandler* ackHandler; + int redeliveryCount; }; Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQObjectMessage.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQObjectMessage.cpp?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQObjectMessage.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQObjectMessage.cpp Mon Nov 20 13:09:29 2006 @@ -37,4 +37,3 @@ { return ActiveMQObjectMessage::ID_ACTIVEMQOBJECTMESSAGE; } - Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.cpp?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.cpp Mon Nov 20 13:09:29 2006 @@ -38,3 +38,12 @@ return ActiveMQTextMessage::ID_ACTIVEMQTEXTMESSAGE; } +//////////////////////////////////////////////////////////////////////////////// +void ActiveMQTextMessage::acknowledge(void) const throw( cms::CMSException ) { + + try{ + this->getAckHandler()->acknowledgeMessage( this ); + } + AMQ_CATCH_RETHROW( exceptions::ActiveMQException ) + AMQ_CATCHALL_THROW( exceptions::ActiveMQException ) +} Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.h?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTextMessage.h Mon Nov 20 13:09:29 2006 @@ -133,13 +133,13 @@ * Gets the Expiration Time for this Message * @return time value */ - virtual long getCMSExpiration(void) const; + virtual long long getCMSExpiration(void) const; /** * Sets the Expiration Time for this message * @param expireTime - time value */ - virtual void setCMSExpiration( long expireTime ); + virtual void setCMSExpiration( long long expireTime ); /** * Gets the CMS Message Id for this Message @@ -193,13 +193,13 @@ * Gets the Time Stamp for this Message * @return time stamp value */ - virtual long getCMSTimeStamp(void) const; + virtual long long getCMSTimeStamp(void) const; /** * Sets the Time Stamp for this message * @param timeStamp - integer time stamp value */ - virtual void setCMSTimeStamp( long timeStamp ); + virtual void setCMSTimeStamp( long long timeStamp ); /** * Gets the CMS Message Type for this Message Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp Mon Nov 20 13:09:29 2006 @@ -758,7 +758,7 @@ } //////////////////////////////////////////////////////////////////////////////// -std::string BaseDataStreamMarshaller::toString( commands::MessageId* id ) +std::string BaseDataStreamMarshaller::toString( const commands::MessageId* id ) { if( id == NULL ) return ""; @@ -767,7 +767,7 @@ } //////////////////////////////////////////////////////////////////////////////// -std::string BaseDataStreamMarshaller::toString( commands::ProducerId* id ) +std::string BaseDataStreamMarshaller::toString( const commands::ProducerId* id ) { return id->getConnectionId() + ":" + Long::toString( id->getSessionId() ) + ":" + @@ -775,10 +775,12 @@ } //////////////////////////////////////////////////////////////////////////////// -std::string BaseDataStreamMarshaller::toString( commands::TransactionId* txnId ) +std::string BaseDataStreamMarshaller::toString( const commands::TransactionId* txnId ) { - LocalTransactionId* ltxnId = dynamic_cast<LocalTransactionId*>( txnId ); - XATransactionId* xaTxnId = dynamic_cast<XATransactionId*>( txnId ); + const LocalTransactionId* ltxnId = + dynamic_cast<const LocalTransactionId*>( txnId ); + const XATransactionId* xaTxnId = + dynamic_cast<const XATransactionId*>( txnId ); if( ltxnId != NULL ) { Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h Mon Nov 20 13:09:29 2006 @@ -115,21 +115,21 @@ * @param id - MessageId pointer * @returns string representing the id */ - static std::string toString( commands::MessageId* id ); + static std::string toString( const commands::MessageId* id ); /** * Converts the object to a String * @param id - ProducerId pointer * @returns string representing the id */ - static std::string toString( commands::ProducerId* id ); + static std::string toString( const commands::ProducerId* id ); /** * Converts the given transaction ID into a String * @param txnId - TransactionId poitner * @returns string representation of the id */ - static std::string toString( commands::TransactionId* txnId ); + static std::string toString( const commands::TransactionId* txnId ); /** * given an array of bytes, convert that array to a Hexidecimal Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/commands/StompMessage.h Mon Nov 20 13:09:29 2006 @@ -170,7 +170,7 @@ * Gets the Expiration Time for this Message * @return time value */ - virtual long getCMSExpiration(void) const { + virtual long long getCMSExpiration(void) const { return util::Long::parseLong( getPropertyValue( CommandConstants::toString( CommandConstants::HEADER_EXPIRES ), "0" ) ); @@ -180,7 +180,7 @@ * Sets the Expiration Time for this message * @param expireTime time value */ - virtual void setCMSExpiration( long expireTime ) { + virtual void setCMSExpiration( long long expireTime ) { setPropertyValue( CommandConstants::toString( CommandConstants::HEADER_EXPIRES) , @@ -276,7 +276,7 @@ * Gets the Time Stamp for this Message * @return time stamp value */ - virtual long getCMSTimeStamp(void) const { + virtual long long getCMSTimeStamp(void) const { return util::Long::parseLong( getPropertyValue( CommandConstants::toString( CommandConstants::HEADER_TIMESTAMP ), "0" ) ); @@ -286,7 +286,7 @@ * Sets the Time Stamp for this message * @param timeStamp time stamp value */ - virtual void setCMSTimeStamp( long timeStamp ) { + virtual void setCMSTimeStamp( long long timeStamp ) { setPropertyValue( CommandConstants::toString( CommandConstants::HEADER_TIMESTAMP ), Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h?view=diff&rev=477334&r1=477333&r2=477334 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/Message.h Mon Nov 20 13:09:29 2006 @@ -96,13 +96,13 @@ * Gets the Expiration Time for this Message * @return time value */ - virtual long getCMSExpiration(void) const = 0; + virtual long long getCMSExpiration(void) const = 0; /** * Sets the Expiration Time for this message * @param expireTime - time value */ - virtual void setCMSExpiration( long expireTime ) = 0; + virtual void setCMSExpiration( long long expireTime ) = 0; /** * Gets the CMS Message Id for this Message @@ -156,13 +156,13 @@ * Gets the Time Stamp for this Message * @return time stamp value */ - virtual long getCMSTimeStamp(void) const = 0; + virtual long long getCMSTimeStamp(void) const = 0; /** * Sets the Time Stamp for this message * @param timeStamp - integer time stamp value */ - virtual void setCMSTimeStamp( long timeStamp ) = 0; + virtual void setCMSTimeStamp( long long timeStamp ) = 0; /** * Gets the CMS Message Type for this Message