Author: tabish Date: Thu Nov 16 16:24:56 2006 New Revision: 475998 URL: http://svn.apache.org/viewvc?view=rev&rev=475998 Log: Updates for planned Openwire Support
Modified: 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/ActiveMQDestination.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h 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/ActiveMQQueue.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempQueue.h incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempTopic.h 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/commands/ActiveMQTopic.h 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=475998&r1=475997&r2=475998 ============================================================================== --- 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 Thu Nov 16 16:24:56 2006 @@ -74,7 +74,10 @@ * caller is required to delete. * @return new copy of this message */ - virtual cms::Message* clone(void) const; + virtual cms::Message* clone(void) const { + return dynamic_cast<cms::Message*>( + this->cloneDataStructure() ); + } /** * Acknowledges all consumed messages of the session Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp?view=diff&rev=475998&r1=475997&r2=475998 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.cpp Thu Nov 16 16:24:56 2006 @@ -25,6 +25,19 @@ using namespace activemq::connector::openwire::commands; //////////////////////////////////////////////////////////////////////////////// +const std::string ActiveMQDestination::ADVISORY_PREFIX = "ActiveMQ.Advisory."; +const std::string ActiveMQDestination::CONSUMER_ADVISORY_PREFIX = + ActiveMQDestination::ADVISORY_PREFIX + "Consumers."; +const std::string ActiveMQDestination::PRODUCER_ADVISORY_PREFIX = + ActiveMQDestination::ADVISORY_PREFIX + "Producers."; +const std::string ActiveMQDestination::CONNECTION_ADVISORY_PREFIX = + ActiveMQDestination::ADVISORY_PREFIX + "Connections."; +const std::string ActiveMQDestination::DEFAULT_ORDERED_TARGET = "coordinator"; +const std::string ActiveMQDestination::TEMP_PREFIX = "{TD{"; +const std::string ActiveMQDestination::TEMP_POSTFIX = "}TD}"; +const std::string ActiveMQDestination::COMPOSITE_SEPARATOR = ","; + +//////////////////////////////////////////////////////////////////////////////// ActiveMQDestination::ActiveMQDestination() { this->physicalName = ""; @@ -59,19 +72,3 @@ { return ActiveMQDestination::ID_ACTIVEMQDESTINATION; } - -//////////////////////////////////////////////////////////////////////////////// -const std::string& ActiveMQDestination::getPhysicalName() const { - return physicalName; -} - -//////////////////////////////////////////////////////////////////////////////// -std::string& ActiveMQDestination::getPhysicalName() { - return physicalName; -} - -//////////////////////////////////////////////////////////////////////////////// -//void ActiveMQDestination::setPhysicalName( const std::string& physicalName ) { -// this->physicalName = physicalName; -//} - Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h?view=diff&rev=475998&r1=475997&r2=475998 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQDestination.h Thu Nov 16 16:24:56 2006 @@ -37,7 +37,50 @@ { protected: + enum DESTINATION_TYPE_IDS { + ACTIVEMQ_TOPIC = 1, + ACTIVEMQ_TEMPORARY_TOPIC = 2, + ACTIVEMQ_QUEUE = 3, + ACTIVEMQ_TEMPORARY_QUEUE = 4 + }; + + /** + * prefix for Advisory message destinations + */ + static const std::string ADVISORY_PREFIX; + + /** + * prefix for consumer advisory destinations + */ + static const std::string CONSUMER_ADVISORY_PREFIX; + + /** + * prefix for producer advisory destinations + */ + static const std::string PRODUCER_ADVISORY_PREFIX; + + /** + * prefix for connection advisory destinations + */ + static const std::string CONNECTION_ADVISORY_PREFIX; + + /** + * The default target for ordered destinations + */ + static const std::string DEFAULT_ORDERED_TARGET; + + static const std::string TEMP_PREFIX; + static const std::string TEMP_POSTFIX; + static const std::string COMPOSITE_SEPARATOR; + + // Cached transient data + bool exclusive; + bool ordered; + bool advisory; + std::string orderedTarget = DEFAULT_ORDERED_TARGET; + std::string physicalName; + std::map<std::string, std::string> options; public: @@ -56,9 +99,105 @@ virtual void copyDataStructure( const DataStructure* src ); virtual unsigned char getDataStructureType() const; - virtual const std::string& getPhysicalName() const; - virtual std::string& getPhysicalName(); - virtual void setPhysicalName( const std::string& physicalName ); + + /** + * Fetch this destination's physical name + * @returns const string containing the name + */ + virtual const std::string& getPhysicalName() const { + return this->physicalName; + } + virtual std::string& getPhysicalName() { + return this->physicalName; + } + + /** + * Set this destination's physical name + * @returns const string containing the name + */ + virtual void setPhysicalName( const std::string& physicalName ){ + this->physicalName = physicalName; + } + + /** + * @return Returns the advisory. + */ + virtual bool isAdvisory() { + return advisory; + } + + /** + * @param advisory The advisory to set. + */ + void setAdvisory( bool advisory ){ + this->advisory = advisory; + } + + /** + * @return true if this is a destination for Consumer advisories + */ + bool isConsumerAdvisory() { + return isAdvisory() && + physicalName.find(CONSUMER_ADVISORY_PREFIX) == 0; + } + + /** + * @return true if this is a destination for Producer advisories + */ + bool isProducerAdvisory() { + return isAdvisory() && + physicalName.find(PRODUCER_ADVISORY_PREFIX) == 0; + } + + /** + * @return true if this is a destination for Connection advisories + */ + bool isConnectionAdvisory() { + return isAdvisory() && + physicalName.find(CONNECTION_ADVISORY_PREFIX) == 0; + } + + /** + * @return Returns the exclusive. + */ + bool isExclusive() { + return exclusive; + } + + /** + * @param exclusive The exclusive to set. + */ + void setExclusive( bool exclusive ) { + this.exclusive = exclusive; + } + + /** + * @return Returns the ordered. + */ + bool isOrdered() { + return ordered; + } + + /** + * @param ordered The ordered to set. + */ + void setOrdered( bool ordered ) { + this.ordered = ordered; + } + + /** + * @return Returns the orderedTarget. + */ + std::string getOrderedTarget() { + return orderedTarget; + } + + /** + * @param orderedTarget The orderedTarget to set. + */ + void setOrderedTarget( const std::string& orderedTarget) { + this.orderedTarget = orderedTarget; + } }; 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=475998&r1=475997&r2=475998 ============================================================================== --- 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 Thu Nov 16 16:24:56 2006 @@ -74,7 +74,10 @@ * caller is required to delete. * @return new copy of this message */ - virtual cms::Message* clone(void) const; + virtual cms::Message* clone(void) const { + return dynamic_cast<cms::Message*>( + this->cloneDataStructure() ); + } /** * Acknowledges all consumed messages of the session Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQQueue.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQQueue.h?view=diff&rev=475998&r1=475997&r2=475998 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQQueue.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQQueue.h Thu Nov 16 16:24:56 2006 @@ -73,13 +73,17 @@ * Retrieve the Destination Type for this Destination * @return The Destination Type */ - virtual cms::Destination::DestinationType getDestinationType(void) const; + virtual cms::Destination::DestinationType getDestinationType(void) const { + return cms::Destination::QUEUE; + } /** * Converts the Destination Name into a String * @return string name */ - virtual std::string toString(void) const; + virtual std::string toString(void) const { + return this->getPhysicalName(); + } /** * Converts the Destination to a String value representing the @@ -87,20 +91,28 @@ * necessarily equal to the User Supplied name of the Destination * @return Provider specific Name */ - virtual std::string toProviderString(void) const; + virtual std::string toProviderString(void) const { + return this->getPhysicalName(); + } /** * Creates a new instance of this destination type that is a * copy of this one, and returns it. * @returns cloned copy of this object */ - virtual cms::Destination* clone(void) const; + virtual cms::Destination* clone(void) const { + return dynamic_cast<cms::Destination*>( + this->cloneDataStructure() ); + } /** * Copies the contents of the given Destinastion object to this one. * @param source The source Destination object. */ - virtual void copy( const cms::Destination& source ); + virtual void copy( const cms::Destination& source ) { + this->copyDataStructure( + dynamic_cast<const DataStructure*>( &source ) ); + } /** * Retrieve any properties that might be part of the destination @@ -117,7 +129,9 @@ * @return The queue name. */ virtual std::string getQueueName() const - throw( cms::CMSException ); + throw( cms::CMSException ) { + return this->getPhysicalName(); + } }; Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempQueue.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempQueue.h?view=diff&rev=475998&r1=475997&r2=475998 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempQueue.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempQueue.h Thu Nov 16 16:24:56 2006 @@ -76,13 +76,17 @@ * Retrieve the Destination Type for this Destination * @return The Destination Type */ - virtual cms::Destination::DestinationType getDestinationType(void) const; + virtual cms::Destination::DestinationType getDestinationType(void) const { + return cms::Destination::TEMPORARY_QUEUE; + } /** * Converts the Destination Name into a String * @return string name */ - virtual std::string toString(void) const; + virtual std::string toString(void) const { + return this->getPhysicalName(); + } /** * Converts the Destination to a String value representing the @@ -90,20 +94,28 @@ * necessarily equal to the User Supplied name of the Destination * @return Provider specific Name */ - virtual std::string toProviderString(void) const; + virtual std::string toProviderString(void) const { + return this->getPhysicalName(); + } /** * Creates a new instance of this destination type that is a * copy of this one, and returns it. * @returns cloned copy of this object */ - virtual cms::Destination* clone(void) const; + virtual cms::Destination* clone(void) const { + return dynamic_cast<cms::Destination*>( + this->cloneDataStructure() ); + } /** * Copies the contents of the given Destinastion object to this one. * @param source The source Destination object. */ - virtual void copy( const cms::Destination& source ); + virtual void copy( const cms::Destination& source ) { + this->copyDataStructure( + dynamic_cast<const DataStructure*>( &source ) ); + } /** * Retrieve any properties that might be part of the destination @@ -120,7 +132,9 @@ * @return The queue name. */ virtual std::string getQueueName(void) const - throw( cms::CMSException ); + throw( cms::CMSException ) { + this->getPhysicalName(); + } }; Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempTopic.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempTopic.h?view=diff&rev=475998&r1=475997&r2=475998 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempTopic.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTempTopic.h Thu Nov 16 16:24:56 2006 @@ -73,13 +73,17 @@ * Retrieve the Destination Type for this Destination * @return The Destination Type */ - virtual cms::Destination::DestinationType getDestinationType(void) const; + virtual cms::Destination::DestinationType getDestinationType(void) const { + return cms::Destination::TEMPORARY_TOPIC; + } /** * Converts the Destination Name into a String * @return string name */ - virtual std::string toString(void) const; + virtual std::string toString(void) const { + return this->getPhysicalName(); + } /** * Converts the Destination to a String value representing the @@ -87,20 +91,28 @@ * necessarily equal to the User Supplied name of the Destination * @return Provider specific Name */ - virtual std::string toProviderString(void) const; + virtual std::string toProviderString(void) const { + return this->getPhysicalName(); + } /** * Creates a new instance of this destination type that is a * copy of this one, and returns it. * @returns cloned copy of this object */ - virtual cms::Destination* clone(void) const; + virtual cms::Destination* clone(void) const { + return dynamic_cast<cms::Destination*>( + this->cloneDataStructure() ); + } /** * Copies the contents of the given Destinastion object to this one. * @param source The source Destination object. */ - virtual void copy( const cms::Destination& source ); + virtual void copy( const cms::Destination& source ) { + this->copyDataStructure( + dynamic_cast<const DataStructure*>( &source ) ); + } /** * Retrieve any properties that might be part of the destination @@ -117,7 +129,9 @@ * @return The topic name. */ virtual std::string getTopicName(void) - const throw( cms::CMSException ); + const throw( cms::CMSException ) { + return this->getPhysicalName(); + } }; 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=475998&r1=475997&r2=475998 ============================================================================== --- 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 Thu Nov 16 16:24:56 2006 @@ -74,7 +74,10 @@ * caller is required to delete. * @return new copy of this message */ - virtual cms::Message* clone(void) const; + virtual cms::Message* clone(void) const { + return dynamic_cast<cms::Message*>( + this->cloneDataStructure() ); + } /** * Acknowledges all consumed messages of the session Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTopic.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTopic.h?view=diff&rev=475998&r1=475997&r2=475998 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTopic.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQTopic.h Thu Nov 16 16:24:56 2006 @@ -73,13 +73,17 @@ * Retrieve the Destination Type for this Destination * @return The Destination Type */ - virtual cms::Destination::DestinationType getDestinationType(void) const; + virtual cms::Destination::DestinationType getDestinationType(void) const { + cms::Destination::TOPIC; + } /** * Converts the Destination Name into a String * @return string name */ - virtual std::string toString(void) const; + virtual std::string toString(void) const { + return this->getPhysicalName(); + } /** * Converts the Destination to a String value representing the @@ -87,20 +91,28 @@ * necessarily equal to the User Supplied name of the Destination * @return Provider specific Name */ - virtual std::string toProviderString(void) const; + virtual std::string toProviderString(void) const { + return this->getPhysicalName(); + } /** * Creates a new instance of this destination type that is a * copy of this one, and returns it. * @returns cloned copy of this object */ - virtual cms::Destination* clone(void) const; + virtual cms::Destination* clone(void) const { + return dynamic_cast<cms::Destination*>( + this->cloneDataStructure() ); + } /** * Copies the contents of the given Destinastion object to this one. * @param source The source Destination object. */ - virtual void copy( const cms::Destination& source ); + virtual void copy( const cms::Destination& source ) { + this->copyDataStructure( + dynamic_cast<const DataStructure*>( &source ) ); + } /** * Retrieve any properties that might be part of the destination @@ -117,7 +129,9 @@ * @return The topic name. */ virtual std::string getTopicName(void) - const throw( cms::CMSException ); + const throw( cms::CMSException ) { + return this->getPhysicalName(); + } };