You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/01/29 01:40:46 UTC
svn commit: r500913 - in
/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands:
ActiveMQBytesMessage.cpp ActiveMQBytesMessage.h ActiveMQMessageBase.h
Author: tabish
Date: Sun Jan 28 16:40:45 2007
New Revision: 500913
URL: http://svn.apache.org/viewvc?view=rev&rev=500913
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30
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/ActiveMQMessageBase.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=500913&r1=500912&r2=500913
==============================================================================
--- 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 Sun Jan 28 16:40:45 2007
@@ -24,7 +24,8 @@
using namespace activemq::connector::openwire::commands;
////////////////////////////////////////////////////////////////////////////////
-ActiveMQBytesMessage::ActiveMQBytesMessage()
+ActiveMQBytesMessage::ActiveMQBytesMessage() :
+ ActiveMQMessageBase< cms::BytesMessage >()
{
}
@@ -36,20 +37,281 @@
////////////////////////////////////////////////////////////////////////////////
unsigned char ActiveMQBytesMessage::getDataStructureType() const
{
- return ActiveMQBytesMessage::ID_ACTIVEMQBYTESMESSAGE;
+ return ActiveMQBytesMessage::ID_ACTIVEMQBYTESMESSAGE;
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQBytesMessage::acknowledge(void) const throw( cms::CMSException ) {
+void ActiveMQBytesMessage::setBodyBytes( const unsigned char* buffer,
+ std::size_t numBytes )
+ throw( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const unsigned char* ActiveMQBytesMessage::getBodyBytes(void) const {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t ActiveMQBytesMessage::getBodyLength(void) const {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::reset() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool ActiveMQBytesMessage::readBoolean() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeBoolean( bool value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQBytesMessage::readByte() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeByte( unsigned char value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t ActiveMQBytesMessage::readBytes( std::vector<unsigned char>& value )
+ throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeBytes( const std::vector<unsigned char>& value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t ActiveMQBytesMessage::readBytes( unsigned char*& buffer, std::size_t length )
+ throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeBytes( const unsigned char* value,
+ std::size_t offset,
+ std::size_t length ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+char ActiveMQBytesMessage::readChar() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeChar( char value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+float ActiveMQBytesMessage::readFloat() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeFloat( float value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+double ActiveMQBytesMessage::readDouble() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeDouble( double value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+short ActiveMQBytesMessage::readShort() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeShort( short value ) 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() );
+unsigned short ActiveMQBytesMessage::readUnsignedShort() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeUnsignedShort( unsigned short value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQBytesMessage::readInt() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeInt( int value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long ActiveMQBytesMessage::readLong() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeLong( long long value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQBytesMessage::readString() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeString( const std::string& value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQBytesMessage::readUTF() throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessage::writeUTF( const std::string& value ) throw ( cms::CMSException ) {
+
+ try{
+ }
+ AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
+ AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
}
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=500913&r1=500912&r2=500913
==============================================================================
--- 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 Sun Jan 28 16:40:45 2007
@@ -23,7 +23,7 @@
#pragma warning( disable : 4290 )
#endif
-#include <activemq/connector/openwire/commands/ActiveMQMessage.h>
+#include <activemq/connector/openwire/commands/ActiveMQMessageBase.h>
#include <activemq/util/Config.h>
#include <cms/BytesMessage.h>
#include <vector>
@@ -34,8 +34,8 @@
namespace openwire{
namespace commands{
- class ActiveMQBytesMessage : public ActiveMQMessage,
- public cms::BytesMessage
+ class ActiveMQBytesMessage :
+ public ActiveMQMessageBase< cms::BytesMessage >
{
public:
@@ -65,7 +65,7 @@
* @return src - Source Object
*/
virtual void copyDataStructure( const DataStructure* src ) {
- ActiveMQMessage::copyDataStructure( src );
+ ActiveMQMessageBase<cms::BytesMessage>::copyDataStructure( src );
}
public: // CMS Message
@@ -79,334 +79,7 @@
return dynamic_cast<cms::BytesMessage*>(
this->cloneDataStructure() );
}
-
- /**
- * Acknowledges all consumed messages of the session
- * of this consumed message.
- */
- virtual void acknowledge(void) const throw( cms::CMSException );
-
- /**
- * Clears out the body of the message. This does not clear the
- * headers or properties.
- */
- virtual void clearBody();
-
- /**
- * Clears the message properties. Does not clear the body or
- * header values.
- */
- virtual void clearProperties();
-
- /**
- * Retrieves the propery names.
- * @return The complete set of property names currently in this
- * message.
- */
- virtual std::vector<std::string> getPropertyNames() const ;
-
- /**
- * Indicates whether or not a given property exists.
- * @param name The name of the property to look up.
- * @return True if the property exists in this message.
- */
- virtual bool propertyExists( const std::string& name ) const;
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * 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( cms::CMSException );
-
- /**
- * Get the Correlation Id for this message
- * @return string representation of the correlation Id
- */
- 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 ) {
- this->setCorrelationId( correlationId );
- }
-
- /**
- * Gets the DeliveryMode for this message
- * @return DeliveryMode enumerated value.
- */
- virtual int getCMSDeliveryMode(void) const {
- return this->isPersistent();
- }
-
- /**
- * Sets the DeliveryMode for this message
- * @param mode - DeliveryMode enumerated value.
- */
- virtual void setCMSDeliveryMode( int mode ) {
- this->setPersistent( mode != 0 );
- }
-
- /**
- * Gets the Destination for this Message, returns a
- * @return Destination object
- */
- virtual const cms::Destination* getCMSDestination(void) const {
- return dynamic_cast<const cms::Destination*>(
- this->getDestination() );
- }
-
- /**
- * Sets the Destination for this message
- * @param destination - Destination Object
- */
- virtual void setCMSDestination( const cms::Destination* destination AMQCPP_UNUSED) {
- // this->setDestination( destination );
- }
-
- /**
- * Gets the Expiration Time for this Message
- * @return time value
- */
- virtual long long getCMSExpiration(void) const {
- return this->getExpiration();
- }
-
- /**
- * Sets the Expiration Time for this message
- * @param expireTime - time value
- */
- virtual void setCMSExpiration( long long expireTime ) {
- this->setExpiration( expireTime );
- }
-
- /**
- * Gets the CMS Message Id for this Message
- * @return time value
- */
- virtual std::string getCMSMessageId(void) const;
-
- /**
- * Sets the CMS Message Id for this message
- * @param id - time value
- */
- virtual void setCMSMessageId( const std::string& id AMQCPP_UNUSED) {}
-
- /**
- * Gets the Priority Value for this Message
- * @return priority value
- */
- 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 ) {
- this->setPriority( priority );
- }
-
- /**
- * Gets the Redelivered Flag for this Message
- * @return redelivered value
- */
- 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 AMQCPP_UNUSED) {}
-
- /**
- * Gets the CMS Reply To Address for this Message
- * @return Reply To Value
- */
- virtual const cms::Destination* getCMSReplyTo(void) const;
-
- /**
- * Sets the CMS Reply To Address for this message
- * @param id - Reply To value
- */
- virtual void setCMSReplyTo( const cms::Destination* destination );
-
- /**
- * Gets the Time Stamp for this Message
- * @return time stamp value
- */
- 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 long timeStamp ) {
- this->setTimestamp( timeStamp );
- }
-
- /**
- * Gets the CMS Message Type for this Message
- * @return type value
- */
- 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 ) {
- this->setType( type );
- }
-
public: // CMS BytesMessage
/**
@@ -668,22 +341,6 @@
* @throws CMSException
*/
virtual void writeUTF( const std::string& value ) throw ( cms::CMSException );
-
- public: // ActiveMQMessage
-
- /**
- * Returns if this message has expired, meaning that its
- * Expiration time has elapsed.
- * @returns true if message is expired.
- */
- virtual bool isExpired() const {
- long long expireTime = this->getCMSExpiration();
- long long currentTime = util::Date::getCurrentTimeMilliseconds();
- if( expireTime > 0 && currentTime > expireTime ) {
- return true;
- }
- return false;
- }
};
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h?view=diff&rev=500913&r1=500912&r2=500913
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMessageBase.h Sun Jan 28 16:40:45 2007
@@ -26,7 +26,7 @@
#include <activemq/util/Date.h>
#include <activemq/util/PrimitiveMap.h>
-namespace activenq{
+namespace activemq{
namespace connector{
namespace openwire{
namespace commands{
@@ -40,7 +40,7 @@
*/
template< typename T>
class ActiveMQMessageBase : public T,
- public Message,
+ public Message,
public core::ActiveMQMessage {
public:
@@ -72,13 +72,13 @@
* wire
* @param wireFormat - the wireformatting controller
*/
- virtual void beforeMarshall( OpenWireFormat* wireFormat ) {
+ virtual void beforeMarshall( OpenWireFormat* wireFormat AMQCPP_UNUSED ) {
try{
marshalledProperties.clear();
if( !properties.isEmpty() )
{
- PrimitiveMapMarshaller::marshal(
+ marshal::PrimitiveMapMarshaller::marshal(
&properties, marshalledProperties );
}
}
@@ -129,6 +129,11 @@
* @returns true if message is expired.
*/
virtual bool isExpired() const {
+ long long expireTime = this->getCMSExpiration();
+ long long currentTime = util::Date::getCurrentTimeMilliseconds();
+ if( expireTime > 0 && currentTime > expireTime ) {
+ return true;
+ }
return false;
}
@@ -158,21 +163,27 @@
* Clears the message properties. Does not clear the body or
* header values.
*/
- virtual void clearProperties() {}
+ virtual void clearProperties() {
+ properties.clear();
+ }
/**
* Retrieves the propery names.
* @return The complete set of property names currently in this
* message.
*/
- virtual std::vector<std::string> getPropertyNames() const ;
+ virtual std::vector<std::string> getPropertyNames() const {
+ return properties.getKeys();
+ }
/**
* Indicates whether or not a given property exists.
* @param name The name of the property to look up.
* @return True if the property exists in this message.
*/
- virtual bool propertyExists( const std::string& name ) const;
+ virtual bool propertyExists( const std::string& name ) const {
+ return properties.contains( name );
+ }
/**
* Gets a boolean property.
@@ -181,7 +192,10 @@
* @throws CMSException if the property does not exist.
*/
virtual bool getBooleanProperty( const std::string& name ) const
- throw( cms::CMSException );
+ throw( cms::CMSException ) {
+
+ return properties.getBool( name );
+ }
/**
* Gets a byte property.
@@ -190,7 +204,10 @@
* @throws CMSException if the property does not exist.
*/
virtual unsigned char getByteProperty( const std::string& name ) const
- throw( cms::CMSException );
+ throw( cms::CMSException ) {
+
+ return properties.getByte( name );
+ }
/**
* Gets a double property.
@@ -199,7 +216,10 @@
* @throws CMSException if the property does not exist.
*/
virtual double getDoubleProperty( const std::string& name ) const
- throw( cms::CMSException );
+ throw( cms::CMSException ) {
+
+ return properties.getDouble( name );
+ }
/**
* Gets a float property.
@@ -208,7 +228,10 @@
* @throws CMSException if the property does not exist.
*/
virtual float getFloatProperty( const std::string& name ) const
- throw( cms::CMSException );
+ throw( cms::CMSException ) {
+
+ return properties.getFloat( name );
+ }
/**
* Gets a int property.
@@ -217,7 +240,10 @@
* @throws CMSException if the property does not exist.
*/
virtual int getIntProperty( const std::string& name ) const
- throw( cms::CMSException );
+ throw( cms::CMSException ) {
+
+ return properties.getInt( name );
+ }
/**
* Gets a long property.
@@ -226,7 +252,10 @@
* @throws CMSException if the property does not exist.
*/
virtual long long getLongProperty( const std::string& name ) const
- throw( cms::CMSException );
+ throw( cms::CMSException ) {
+
+ return properties.getLong( name );
+ }
/**
* Gets a short property.
@@ -235,7 +264,10 @@
* @throws CMSException if the property does not exist.
*/
virtual short getShortProperty( const std::string& name ) const
- throw( cms::CMSException );
+ throw( cms::CMSException ) {
+
+ return properties.getShort( name );
+ }
/**
* Gets a string property.
@@ -244,7 +276,10 @@
* @throws CMSException if the property does not exist.
*/
virtual std::string getStringProperty( const std::string& name ) const
- throw( cms::CMSException );
+ throw( cms::CMSException ) {
+
+ return properties.getString( name );
+ }
/**
* Sets a boolean property.
@@ -253,7 +288,11 @@
* @throws CMSException
*/
virtual void setBooleanProperty( const std::string& name,
- bool value ) throw( cms::CMSException );
+ bool value )
+ throw( cms::CMSException ) {
+
+ properties.setBool( name, value );
+ }
/**
* Sets a byte property.
@@ -262,7 +301,11 @@
* @throws CMSException
*/
virtual void setByteProperty( const std::string& name,
- unsigned char value ) throw( cms::CMSException );
+ unsigned char value )
+ throw( cms::CMSException ) {
+
+ properties.setByte( name, value );
+ }
/**
* Sets a double property.
@@ -271,7 +314,11 @@
* @throws CMSException
*/
virtual void setDoubleProperty( const std::string& name,
- double value ) throw( cms::CMSException );
+ double value )
+ throw( cms::CMSException ) {
+
+ properties.setDouble( name, value );
+ }
/**
* Sets a float property.
@@ -280,8 +327,12 @@
* @throws CMSException
*/
virtual void setFloatProperty( const std::string& name,
- float value ) throw( cms::CMSException );
-
+ float value )
+ throw( cms::CMSException ) {
+
+ properties.setFloat( name, value );
+ }
+
/**
* Sets a int property.
* @param name The name of the property to retrieve.
@@ -289,7 +340,11 @@
* @throws CMSException
*/
virtual void setIntProperty( const std::string& name,
- int value ) throw( cms::CMSException );
+ int value )
+ throw( cms::CMSException ) {
+
+ properties.setInt( name, value );
+ }
/**
* Sets a long property.
@@ -298,7 +353,11 @@
* @throws CMSException
*/
virtual void setLongProperty( const std::string& name,
- long long value ) throw( cms::CMSException );
+ long long value )
+ throw( cms::CMSException ) {
+
+ properties.setLong( name, value );
+ }
/**
* Sets a short property.
@@ -307,7 +366,11 @@
* @throws CMSException
*/
virtual void setShortProperty( const std::string& name,
- short value ) throw( cms::CMSException );
+ short value )
+ throw( cms::CMSException ) {
+
+ properties.setShort( name, value );
+ }
/**
* Sets a string property.
@@ -316,7 +379,11 @@
* @throws CMSException
*/
virtual void setStringProperty( const std::string& name,
- const std::string& value ) throw( cms::CMSException );
+ const std::string& value )
+ throw( cms::CMSException ) {
+
+ properties.setString( name, value );
+ }
/**
* Get the Correlation Id for this message
@@ -364,7 +431,9 @@
* @param destination - Destination Object
*/
virtual void setCMSDestination( const cms::Destination* destination ) {
- this->setDestination( destination );
+ this->setDestination(
+ dynamic_cast<ActiveMQDestination*>(
+ destination->clone() ) );
}
/**
@@ -432,7 +501,8 @@
* @return Reply To Value
*/
virtual const cms::Destination* getCMSReplyTo(void) const {
- return this->getReplyTo();
+ return dynamic_cast< const cms::Destination* >(
+ this->getReplyTo() );
}
/**
@@ -440,7 +510,9 @@
* @param id - Reply To value
*/
virtual void setCMSReplyTo( const cms::Destination* destination ) {
- this->setRepyTo( destination );
+ this->setReplyTo(
+ dynamic_cast<ActiveMQDestination*>(
+ destination->clone() ) );
}
/**