You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2006/07/03 13:51:54 UTC

svn commit: r418749 [12/17] - in /incubator/activemq/trunk/activemq-cpp: ./ src/ src/main/ src/main/activemq/ src/main/activemq/concurrent/ src/main/activemq/connector/ src/main/activemq/connector/openwire/ src/main/activemq/connector/stomp/ src/main/a...

Added: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_UTIL_NUMBER_H_
+#define _ACTIVEMQ_UTIL_NUMBER_H_
+
+#include <sstream>
+
+namespace activemq{
+namespace util{
+
+    /**
+     * The abstract class Number is the superclass of classes Byte, Double, 
+     * Float, Integer, Long, and Short.
+     * 
+     * Subclasses of Number must provide methods to convert the represented 
+     * numeric value to byte, double, float, int, long, and short. 
+     */
+    class Number
+    {
+    public:
+
+    	virtual ~Number(void) {}
+        
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_NUMBER_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ACTIVEMQ_UTIL_PROPERTIES_H_
+#define ACTIVEMQ_UTIL_PROPERTIES_H_
+
+#include <map>
+#include <string>
+#include <vector>
+
+namespace activemq{
+namespace util{
+   
+   /**
+    * Interface for a Java-like properties object.  This is essentially 
+    * a map of key-value string pairs.
+    */
+   class Properties{
+   public:
+   
+      virtual ~Properties(){}
+      
+      /**
+       * Looks up the value for the given property.
+       * @param name The name of the property to be looked up.
+       * @return the value of the property with the given name, if it
+       * exists.  If it does not exist, returns NULL.
+       */
+      virtual const char* getProperty( const std::string& name ) const = 0;
+      
+      /**
+       * Looks up the value for the given property.
+       * @param name the name of the property to be looked up.
+       * @param defaultValue The value to be returned if the given
+       * property does not exist.
+       * @return The value of the property specified by <code>name</code>, if it
+       * exists, otherwise the <code>defaultValue</code>.
+       */
+      virtual std::string getProperty( const std::string& name, 
+         const std::string& defaultValue ) const = 0;
+      
+      /**
+       * Sets the value for a given property.  If the property already
+       * exists, overwrites the value.
+       * @param name The name of the value to be written.
+       * @param value The value to be written.
+       */
+      virtual void setProperty( const std::string& name, 
+         const std::string& value ) = 0;
+      
+      /**
+       * Check to see if the Property exists in the set
+       * @return true if property exists, false otherwise.
+       */
+      virtual bool hasProperty( const std::string& name ) const = 0;
+
+      /**
+       * Method that serializes the contents of the property map to
+       * an arryay.
+       * @return list of pairs where the first is the name and the second
+       * is the value.
+       */
+      virtual std::vector< std::pair<std::string, std::string> > toArray() const = 0;
+      
+      /**
+       * Copies the contents of the given properties object to this one.
+       * @param source The source properties object.
+       */
+      virtual void copy( const Properties* source ) = 0;
+      
+      /**
+       * Clones this object.
+       * @returns a replica of this object.
+       */
+      virtual Properties* clone() const = 0;
+      
+      /**
+       * Clears all properties from the map.
+       */
+      virtual void clear() = 0;
+   };
+   
+}}
+
+#endif /*ACTIVEMQ_UTIL_PROPERTIES_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,308 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ACTIVEMQ_UTIL_QUEUE_H
+#define ACTIVEMQ_UTIL_QUEUE_H
+
+#include <queue>
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+namespace activemq{
+namespace util{
+
+  /**
+   * The Queue class accepts messages with an psuh(m) command 
+   * where m is the message to be queued.  It destructively 
+   * returns the message with pop().  pop() returns messages in
+   * the order they were enqueued.                                               
+   *                                                              
+   * Queue is implemented with an instance of the STL queue object.
+   * The interface is essentially the same as that of the STL queue
+   * except that the pop method actually reaturns a reference to the
+   * element popped.  This frees the app from having to call the
+   * <code>front</code> method before calling pop.
+   *
+   *  Queue<string> sq;     // make a queue to hold string messages
+   *  sq.push(s);           // enqueues a message m
+   *  string s = sq.pop();  // dequeues a message
+   *
+   * = DESIGN CONSIDERATIONS
+   *
+   * The Queue class inherits from the Synchronizable interface and
+   * provides methods for locking and unlocking this queue as well as
+   * waiting on this queue.  In a multi-threaded app this can allow
+   * for multiple threads to be reading from and writing to the same
+   * Queue.
+   *
+   * Clients should consider that in a multiple threaded app it is 
+   * possible that items could be placed on the queue faster than
+   * you are taking them off, so protection should be placed in your
+   * polling loop to ensure that you don't get stuck there.
+   */
+
+   template <typename T> class Queue : public concurrent::Synchronizable
+   {
+   public:
+   
+      /**
+       * Constructor
+       */
+      Queue(void);
+
+      /**
+       * Destructor
+       */
+      virtual ~Queue(void);
+
+      /**
+       * Returns a Reference to the element at the head of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      T& front(void);
+
+      /**
+       * Returns a Reference to the element at the head of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      const T& front(void) const;
+
+      /**
+       * Returns a Reference to the element at the tail of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      T& back(void);
+
+      /**
+       * Returns a Reference to the element at the tail of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      const T& back(void) const;
+
+      /**
+       * Places a new Object at the Tail of the queue
+       * @param Queue Object Type reference.
+       */
+      void push(const T &t);
+
+      /**
+       * Removes and returns the element that is at the Head of the queue
+       * @return reference to a queue type object or (safe)
+       */
+      T pop(void);
+
+      /**
+       * Gets the Number of elements currently in the Queue
+       * @return Queue Size
+       */
+      size_t size(void) const;
+
+      /**
+       * Checks if this Queue is currently empty
+       * @return boolean indicating queue emptiness
+       */
+      bool empty(void) const;
+   
+      /**
+       * Locks the object.
+       */
+      virtual void lock() throw(exceptions::ActiveMQException){
+         mutex.lock();
+      }
+   
+      /**
+       * Unlocks the object.
+       */
+      virtual void unlock() throw(exceptions::ActiveMQException){   
+         mutex.unlock();
+      }
+       
+      /**
+       * Waits on a signal from this object, which is generated
+       * by a call to Notify.  Must have this object locked before
+       * calling.
+       */
+      virtual void wait() throw(exceptions::ActiveMQException){
+         mutex.wait();
+      }
+    
+      /**
+       * Waits on a signal from this object, which is generated
+       * by a call to Notify.  Must have this object locked before
+       * calling.  This wait will timeout after the specified time
+       * interval.
+       * @param time in millisecsonds to wait, or WAIT_INIFINITE
+       * @throws ActiveMQException
+       */
+      virtual void wait(unsigned long millisecs) 
+         throw(exceptions::ActiveMQException) {
+         
+         mutex.wait(millisecs);
+      }
+
+      /**
+       * Signals a waiter on this object that it can now wake
+       * up and continue.  Must have this object locked before
+       * calling.
+       */
+      virtual void notify() throw(exceptions::ActiveMQException){
+         mutex.notify();
+      }
+        
+      /**
+       * Signals the waiters on this object that it can now wake
+       * up and continue.  Must have this object locked before
+       * calling.
+       */
+      virtual void notifyAll() throw(exceptions::ActiveMQException){
+         mutex.notifyAll();
+      }
+   
+   public:   // Statics
+
+      /**
+       * Fetch a reference to the safe value this object will return
+       * when there is nothing to fetch from the queue.
+       * @return Reference to this Queues safe object
+       */
+      static const T& getSafeValue(void) { return safe; }
+
+   private:
+   
+      // The real queue
+      std::queue<T> queue;
+
+      // Object used for sync
+      concurrent::Mutex mutex;
+
+      // Safe value used when pop, front or back are
+      // called and the queue is empty.
+      static T safe;
+      
+   };
+   
+   //-----{ Static Init }-----------------------------------------------------//
+   template <typename T>
+   T Queue<T>::safe;
+   
+   //-----{ Retrieve current length of Queue }--------------------------------//
+   
+   template <typename T> inline size_t Queue<T>::size() const
+   {
+      return queue.size();
+   }
+   
+   //-----{ Retrieve whether Queue is empty or not }--------------------------//
+   
+   template <typename T> inline bool Queue<T>::empty(void) const
+   {
+      return queue.empty();
+   }
+   
+   //-----{ Defulat Constructor }---------------------------------------------//
+   
+   template <typename T> 
+   Queue<T>::Queue()
+   {
+   }
+
+   //-----{ Default Destructor }----------------------------------------------//
+   
+   template <typename T> Queue<T>::~Queue()
+   {
+   }
+
+   //-----{ Add Elements to Back of Queue }-----------------------------------//
+
+   template <typename T> 
+   void Queue<T>::push(const T &t)
+   {
+      queue.push(t);
+   }
+
+   //-----{ Remove Elements from Front of Queue }-----------------------------//
+
+   template <typename T> 
+   T Queue<T>::pop(void)
+   {
+      if(queue.empty())
+      {   
+         return safe;
+      }
+
+      // Pop the element into a temp, since we need to remain locked.
+      // this means getting front and then popping.
+      T temp = queue.front();
+      queue.pop();
+   
+      return temp;
+   }
+
+   //-----{ Returnreference to element at front of Queue }--------------------//
+
+   template <typename T> 
+   T& Queue<T>::front(void)
+   {
+      if(queue.empty())
+      {
+         return safe;
+      }
+         
+      return queue.front();
+   }
+   
+   //-----{ Returnreference to element at front of Queue }--------------------//
+
+   template <typename T> 
+   const T& Queue<T>::front(void) const
+   {
+      if(queue.empty())
+      {   
+         return safe;
+      }
+
+      return queue.front();
+   }
+   
+   //-----{ Returnreference to element at back of Queue }---------------------//
+
+   template <typename T> 
+   T& Queue<T>::back(void)
+   {
+      if(queue.empty())
+      {
+         return safe;
+      }
+         
+      return queue.back();
+   }
+   
+   //-----{ Returnreference to element at back of Queue }---------------------//
+
+   template <typename T> 
+   const T& Queue<T>::back(void) const
+   {
+      if(queue.empty())
+      {
+         return safe;
+      }
+   
+      return queue.back();
+   }
+
+}}
+
+#endif /* ACTIVEMQ_UTIL_QUEUE_H */

Added: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ACTIVEMQ_UTIL_SIMPLEPROPERTIES_H_
+#define ACTIVEMQ_UTIL_SIMPLEPROPERTIES_H_
+
+#include <map>
+#include <string>
+#include <activemq/util/Properties.h>
+
+namespace activemq{
+namespace util{
+	
+	/**
+	 * Basic implementation of the Properties interface.
+	 */
+	class SimpleProperties : public Properties{
+	private:
+	
+		std::map< std::string, std::string > properties;
+		
+	public:
+	
+		virtual ~SimpleProperties(){}
+		
+		/**
+		 * Looks up the value for the given property.
+		 * @param name The name of the property to be looked up.
+		 * @return the value of the property with the given name, if it
+		 * exists.  If it does not exist, returns NULL.
+		 */
+		virtual const char* getProperty( const std::string& name ) const{
+			
+			std::map< std::string, std::string >::const_iterator iter = 
+            properties.find( name );
+			if( iter == properties.end() ){
+				return NULL;
+			}
+			
+			return iter->second.c_str();
+		}
+		
+		/**
+		 * Looks up the value for the given property.
+		 * @param name the name of the property to be looked up.
+		 * @param defaultValue The value to be returned if the given
+		 * property does not exist.
+		 * @return The value of the property specified by <code>name</code>, if it
+		 * exists, otherwise the <code>defaultValue</code>.
+		 */
+		virtual std::string getProperty( const std::string& name, 
+		const std::string& defaultValue ) const {
+			
+			std::map< std::string, std::string >::const_iterator iter = 
+            properties.find( name );
+			if( iter == properties.end() ){
+				return defaultValue;
+			}
+			
+			return iter->second;
+		}
+		
+		/**
+		 * Sets the value for a given property.  If the property already
+		 * exists, overwrites the value.
+		 * @param name The name of the value to be written.
+		 * @param value The value to be written.
+		 */
+		virtual void setProperty( const std::string& name, 
+		const std::string& value ){
+			properties[name] = value;
+		}
+		
+      /**
+       * Check to see if the Property exists in the set
+       * @return true if property exists, false otherwise.
+       */
+      virtual bool hasProperty( const std::string& name ) const
+      {
+         if(properties.find(name) != properties.end())
+         {
+            return true;
+         }
+         
+         return false;
+      }
+
+		/**
+		 * Method that serializes the contents of the property map to
+		 * an arryay.
+		 * @return list of pairs where the first is the name and the second
+		 * is the value.
+		 */
+		virtual std::vector< std::pair<std::string, std::string> > toArray() const{
+			
+			// Create a vector big enough to hold all the elements in the map.
+			std::vector< std::pair<std::string, std::string> > vec( properties.size() );
+			
+			// Get an iterator at the beginning of the map.
+			std::map< std::string, std::string >::const_iterator iter = properties.begin();
+			
+			// Copy all of the elements from the map to the vector.
+			for( int ix=0; iter != properties.end(); ++iter, ++ix ){
+				vec[ix] = *iter;
+			}
+			
+			return vec;
+		}
+		
+		/**
+		 * Copies the contents of the given properties object to this one.
+		 * @param source The source properties object.
+		 */
+		virtual void copy( const Properties* source ){
+			
+			clear();
+			
+			std::vector< std::pair< std::string, std::string > > vec =
+				source->toArray();
+			for( unsigned int ix=0; ix<vec.size(); ++ix ){
+				properties[vec[ix].first] = vec[ix].second;
+			}
+		}
+		
+		/**
+		 * Clones this object.
+		 * @returns a replica of this object.
+		 */
+		virtual Properties* clone() const{
+			
+			SimpleProperties* props = new SimpleProperties();
+			
+            props->properties = properties;
+			
+			return props;
+		}
+		
+		/**
+		 * Clears all properties from the map.
+		 */
+		virtual void clear(){
+			properties.clear();
+		}
+	};
+	
+}}
+
+#endif /*ACTIVEMQ_UTIL_SIMPLEPROPERTIES_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp Mon Jul  3 04:51:36 2006
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "StringTokenizer.h"
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+StringTokenizer::StringTokenizer(const std::string& str, 
+                                 const std::string& delim, 
+                                 bool returnDelims)
+{
+   // store off the data
+   this->str = str;
+   this->delim = delim;
+   this->returnDelims = returnDelims;
+   
+   // Start and the beginning
+   pos = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+StringTokenizer::~StringTokenizer(void)
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int StringTokenizer::countTokens(void) const
+{
+   int count = 0;
+   string::size_type localPos = pos;
+   string::size_type lastPos  = pos;
+
+   while(localPos != string::npos)
+   {
+      if(returnDelims && str.find_first_of(delim, localPos) == localPos)
+      {
+         count += 1;
+         localPos += 1;
+
+         continue;
+      }
+
+      // Find first token by spanning the fist non-delimiter, to the
+      // next delimiter, skipping any delimiters that are at the curret
+      // location.
+      lastPos  = str.find_first_not_of(delim, localPos);
+      localPos = str.find_first_of(delim, lastPos);
+
+      if(lastPos != string::npos)
+      {
+         count++;
+      }
+   }
+
+	return count;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool StringTokenizer::hasMoreTokens(void) const
+{
+   string::size_type nextpos = 
+      returnDelims ? str.find_first_of(delim, pos) :
+                     str.find_first_not_of(delim, pos);
+
+   return (nextpos != string::npos);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string StringTokenizer::nextToken(void)
+   throw ( exceptions::NoSuchElementException )
+{
+   if(pos == string::npos)
+   {
+      throw NoSuchElementException(
+         __FILE__, __LINE__,
+         "StringTokenizer::nextToken - No more Tokens available");
+   }
+
+   if(returnDelims)
+   {
+      // if char at current pos is a delim return it and advance pos
+      if(str.find_first_of(delim, pos) == pos)
+      {
+         return str.substr(pos++, 1);
+      }
+   }
+
+   // Skip delimiters at beginning.
+   string::size_type lastPos = str.find_first_not_of(delim, pos);
+   
+   // Find the next delimiter in the string, the charactors in between
+   // will be the token to return.  If this returns string::npos then
+   // there are no more delimiters in the string.
+   pos = str.find_first_of(delim, lastPos);
+
+   if(string::npos != lastPos)
+   {
+      // Found a token, count it, if the pos of the next delim is npos
+      // then we set length to copy to npos so that all the remianing
+      // portion of the string is copied, otherwise we set it to the 
+      return str.substr(lastPos, 
+                        pos == string::npos ? pos : pos-lastPos);
+   }
+   else
+   {
+      throw NoSuchElementException(
+         __FILE__, __LINE__,
+         "StringTokenizer::nextToken - No more Tokens available");
+   }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string StringTokenizer::nextToken(const std::string& delim)
+   throw ( exceptions::NoSuchElementException )
+{
+    this->delim = delim;
+
+    return nextToken();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned int StringTokenizer::toArray(std::vector<std::string>& array)
+{
+    int count = 0;
+
+    while(hasMoreTokens())
+    {
+        array.push_back(nextToken());
+        count++;
+    }
+
+    return count;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void StringTokenizer::reset(const std::string& str,
+                            const std::string& delim,
+                            bool returnDelims)
+{
+    if(str != "")
+    {
+        this->str = str;
+    }
+
+    if(delim != "")
+    {
+        this->delim = delim;
+    }
+
+    this->returnDelims = returnDelims;
+
+    // Begin at the Beginning
+    this->pos = 0;
+}

Added: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ACTIVEMQ_UTIL_STRINGTOKENIZER_H_
+#define _ACTIVEMQ_UTIL_STRINGTOKENIZER_H_
+
+#include <activemq/exceptions/NoSuchElementException.h>
+#include <string>
+
+namespace activemq{
+namespace util{
+
+   class StringTokenizer
+   {
+   private:
+   
+      // String to tokenize
+      std::string str;
+      
+      // The delimiter string
+      std::string delim;
+      
+      // The current pos in the string
+      std::string::size_type pos;
+      
+      // Are we returning delimiters
+      bool returnDelims;
+      
+   public:
+
+      /**
+       * Constructs a string tokenizer for the specified string. All 
+       * characters in the delim argument are the delimiters for separating 
+       * tokens.
+       *
+       * If the returnDelims flag is true, then the delimiter characters are 
+       * also returned as tokens. Each delimiter is returned as a string of 
+       * length one. If the flag is false, the delimiter characters are 
+       * skipped and only serve as separators between tokens.
+       *
+       * Note that if delim is "", this constructor does not throw an 
+       * exception. However, trying to invoke other methods on the resulting 
+       * StringTokenizer may result in an Exception. 
+       * @param string to tokenize
+       * @param String containing the delimiters
+       * @param boolean indicating if the delimiters are returned as tokens
+       */
+      StringTokenizer(const std::string& str,
+                      const std::string& delim = " \t\n\r\f",
+                      bool returnDelims = false);
+
+      /**
+       * Destructor
+       */
+   	  virtual ~StringTokenizer(void);
+      
+      /**
+       * Calculates the number of times that this tokenizer's nextToken 
+       * method can be called before it generates an exception. The current 
+       * position is not advanced.
+       * @return Count of remaining tokens
+       */
+      virtual int countTokens(void) const;
+
+      /**
+       * Tests if there are more tokens available from this tokenizer's 
+       * string.
+       * @return true if there are more tokens remaining
+       */
+      virtual bool hasMoreTokens(void) const;
+      
+      /**
+       * Returns the next token from this string tokenizer.
+       * @return string value of next token
+       * @thorws NoSuchElementException
+       */
+      virtual std::string nextToken(void) 
+         throw ( exceptions::NoSuchElementException );
+      
+      /**
+       * Returns the next token in this string tokenizer's string. First, 
+       * the set of characters considered to be delimiters by this 
+       * StringTokenizer object is changed to be the characters in the 
+       * string delim. Then the next token in the string after the current 
+       * position is returned. The current position is advanced beyond the 
+       * recognized token. The new delimiter set remains the default after 
+       * this call.
+       * @param string containing the new set of delimiters
+       * @return next string in the token list
+       * @throw NoSuchElementException
+       */
+      virtual std::string nextToken(const std::string& delim) 
+         throw ( exceptions::NoSuchElementException );
+
+      /**
+       * Grab all remaining tokens in the String and return them
+       * in the vector that is passed in by reference.
+       * @param vector to place token strings in
+       * @return number of string placed into the vector
+       */
+      virtual unsigned int toArray(std::vector<std::string>& array);
+
+      /**
+       * Resets the Tokenizer's position in the String to the Beginning
+       * calls to countToken and nextToken now start back at the beginning.
+       * This allows this object to be reused, the caller need not create
+       * a new instance every time a String needs tokenizing.
+       * If set the string param will reset the string that this Tokenizer
+       * is working on.  If set to "" no change is made.
+       * If set the delim param will reset the string that this Tokenizer
+       * is using to tokenizer the string.  If set to "", no change is made
+       * If set the return Delims will set if this Tokenizer will return
+       * delimiters as tokens. Defaults to false.
+       * @param New String to tokenize or "", defaults to ""
+       * @param New Delimiter String to use or "", defaults to ""
+       * @param Should the Tokenizer return delimiters as Tokens, default false
+       */
+      virtual void reset(const std::string& str = "",
+                         const std::string& delim = "",
+                         bool returnDelims = false);
+   
+   };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_STRINGTOKENIZER_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/BytesMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/BytesMessage.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/BytesMessage.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/BytesMessage.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef _CMS_BYTESMESSAGE_H_
+#define _CMS_BYTESMESSAGE_H_
+ 
+#include <cms/Message.h>
+
+namespace cms{
+   
+    class BytesMessage : public Message{
+      
+    public:
+   
+        /**
+         * Destructor
+         */
+        virtual ~BytesMessage(){}
+
+        /**
+         * sets the bytes given to the message body.  
+         * @param Byte Buffer to copy
+         * @param Number of bytes in Buffer to copy
+         * @throws CMSException
+         */
+        virtual void setBodyBytes( 
+            const unsigned char* buffer, const unsigned long numBytes ) 
+                throw( CMSException ) = 0;
+            
+        /**
+         * Gets the bytes that are contained in this message, user should
+         * copy this data into a user allocated buffer.  Call 
+         * <code>getBodyLength</code> to determine the number of bytes
+         * to expect.
+         * @return const pointer to a byte buffer
+         */
+        virtual const unsigned char* getBodyBytes(void) const = 0;
+      
+        /**
+         * Returns the number of bytes contained in the body of this message.
+         * @return number of bytes.
+         */
+        virtual unsigned long getBodyLength(void) const = 0;
+      
+   };
+}
+
+#endif /*_CMS_BYTESMESSAGE_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/CMSException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/CMSException.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/CMSException.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/CMSException.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef CMS_CMSEXCEPTION_H
+#define CMS_CMSEXCEPTION_H
+ 
+// Includes
+#include <string>
+#include <vector>
+#include <iostream>
+
+namespace cms{
+	
+	/**
+	 * This class represents an error that has occurred in 
+	 * cms.
+	 */
+	class CMSException{
+		
+	public:
+		
+		/**
+		 * Destruction
+		 */
+		virtual ~CMSException(){}
+		
+		/**
+         * Gets the cause of the error.
+		 */
+		virtual const char* getMessage() const = 0;
+        
+        /**
+         * Provides the stack trace for every point where
+         * this exception was caught, marked, and rethrown.
+         */
+        virtual std::vector< std::pair< std::string, int> > getStackTrace() const = 0;
+        
+        /**
+         * Prints the stack trace to std::err
+         */
+        virtual void printStackTrace() const = 0;
+        
+        /**
+         * Prints the stack trace to the given output stream.
+         * @param stream the target output stream.
+         */
+        virtual void printStackTrace( std::ostream& stream ) const = 0;
+	};
+
+}
+
+#endif /*CMS_CMSEXCEPTION_H*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Closeable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Closeable.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Closeable.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Closeable.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef CMS_CLOSEABLE_H
+#define CMS_CLOSEABLE_H
+ 
+#include <cms/CMSException.h>
+
+namespace cms{
+	
+	/**
+	 * Interface for a class that implements the close method.
+	 */
+	class Closeable{
+		
+	public:
+	
+		virtual ~Closeable(void){}
+		
+		/**
+		 * Closes this object and deallocates the appropriate resources.
+		 */
+		virtual void close() throw( CMSException ) = 0;
+	};
+}
+
+#endif /*CMS_CLOSEABLE_H*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Connection.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Connection.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Connection.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Connection.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_CONNECTION_H_
+#define _CMS_CONNECTION_H_
+
+#include <cms/Startable.h>
+#include <cms/Stoppable.h>
+#include <cms/Closeable.h>
+#include <cms/Session.h>
+
+namespace cms
+{
+    class ExceptionListener;
+   
+    class Connection :
+        public Startable,
+        public Stoppable,
+        public Closeable
+    {
+    public:
+
+        /**
+         * Destructor
+         */
+        virtual ~Connection(void) {}
+
+        /**
+         * Creates a new Session to work for this Connection
+         */
+        virtual Session* createSession(void) throw ( CMSException ) = 0;
+      
+        /**
+         * Creates a new Session to work for this Connection using the
+         * specified acknowledgment mode
+         * @param the Acknowledgement Mode to use.
+         */
+        virtual Session* createSession(Session::AcknowledgeMode ackMode) 
+            throw ( CMSException ) = 0;
+         
+        /**
+         * Get the Client Id for this session
+         */
+        virtual std::string getClientId(void) const = 0;      
+         
+        /**
+         * Gets the registered Exception Listener for this connection
+         * @return pointer to an exception listnener or NULL
+         */
+        virtual ExceptionListener* getExceptionListener(void) const = 0;
+      
+        /**
+         * Sets the registed Exception Listener for this connection
+         * @param pointer to and <code>ExceptionListener</code>
+         */
+        virtual void setExceptionListener(ExceptionListener* listener) = 0;
+      
+    };
+
+}
+
+#endif /*_CMS_CONNECTION_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/ConnectionFactory.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _CMS_CONNECTIONFACTORY_H_
+#define _CMS_CONNECTIONFACTORY_H_
+
+#include <cms/Connection.h>
+#include <cms/CMSException.h>
+
+#include <string>
+
+namespace cms
+{
+
+   class ConnectionFactory
+   {
+   public:
+
+      /**
+       * Destructor
+       */
+   	virtual ~ConnectionFactory(void) {}
+
+      /**
+       * Creates a connection with the default user identity. The 
+       * connection is created in stopped mode. No messages will be 
+       * delivered until the Connection.start method is explicitly 
+       * called. 
+       * @throws CMSException
+       */
+      virtual Connection* createConnection(void) throw ( CMSException ) = 0;
+
+      /**
+       * Creates a connection with the specified user identity. The 
+       * connection is created in stopped mode. No messages will be 
+       * delivered until the Connection.start method is explicitly called.
+       * @throw CMSException.
+       */
+      virtual Connection* createConnection(const std::string& username,
+                                           const std::string& password,
+                                           const std::string& clientId) 
+                                              throw ( CMSException ) = 0;
+
+   };
+
+}
+
+#endif /*_CMS_CONNECTIONFACTORY_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Destination.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Destination.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Destination.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Destination.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_DESTINATION_H_
+#define _CMS_DESTINATION_H_
+
+#include <string>
+
+namespace cms{
+	
+    /**
+     * A Destination object encapsulates a provider-specific address. 
+     */
+    class Destination{
+    public:
+   
+        enum DestinationType
+        {
+            TOPIC,
+            QUEUE,
+            TEMPORARY_TOPIC,
+            TEMPORARY_QUEUE
+        };
+		
+	public:
+
+        /**
+         * Destructor
+         */	
+        virtual ~Destination(void){}
+      
+        /**
+         * Retrieve the Destination Type for this Destination
+         * @return The Destination Type
+         */
+        virtual DestinationType getDestinationType(void) const = 0;
+        
+        /**
+         * Converts the Destination Name into a String 
+         * @return string name
+         */
+        virtual std::string toString(void) const = 0;
+
+        /**
+         * Converts the Destination to a String value representing the
+         * Provider specific name fot this destination, which is not
+         * necessarily equal to the User Supplied name of the Destination
+         * @return Provider specific Name
+         */
+        virtual std::string toProviderString(void) const = 0;
+        
+        /**
+         * 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 = 0;
+      
+        /**
+         * Copies the contents of the given Destinastion object to this one.
+         * @param source The source Destination object.
+         */
+        virtual void copy( const cms::Destination& source ) = 0;
+
+    };
+}
+
+#endif /*_CMS_DESTINATION_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/ExceptionListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/ExceptionListener.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/ExceptionListener.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/ExceptionListener.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_EXCEPTIONLISTENER_H_
+#define _CMS_EXCEPTIONLISTENER_H_
+
+#include <cms/CMSException.h>
+
+namespace cms{
+
+   class ExceptionListener
+   {
+   public:
+   
+      /**
+       * Destructor
+       */
+      virtual ~ExceptionListener(void) {}
+   
+      /**
+       * Called when an exception occurs.
+       * @param Exception Object that occurred.
+       */
+      virtual void onException(const cms::CMSException& ex) = 0;
+      
+   };
+
+}
+
+#endif /*_CMS_EXCEPTIONLISTENER_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MapMessage.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _CMS_MAPMESSAGE_H_
+#define _CMS_MAPMESSAGE_H_
+
+#include <cms/Message.h>
+
+namespace cms
+{
+
+   class MapMessage : public Message
+   {
+   public:
+
+      /**
+       * Destructor
+       */
+      virtual ~MapMessage(void) {}
+
+   };
+
+}
+
+#endif /*_CMS_MAPMESSAGE_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Message.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Message.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Message.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Message.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_MESSAGE_H_
+#define _CMS_MESSAGE_H_
+
+#include <activemq/util/Properties.h>
+
+#include <cms/Destination.h>
+#include <cms/CMSException.h>
+
+namespace cms{
+   
+    /**
+     * Root of all messages.
+     */
+    class Message{ 
+    public:
+
+        /**
+         * Enumeration value for Message Delivery Mode   
+         */
+        enum DeliveryMode
+        {
+            PERSISTANT,
+            NONPERSISTANT
+        };
+         
+    public:
+   
+        virtual ~Message(void){}
+      
+        /**
+         * Clonse this message exactly, returns a new instance that the
+         * caller is required to delete.
+         * @return new copy of this message
+         */
+        virtual Message* clone(void) const = 0;
+        
+        /**
+         * Acknowledges all consumed messages of the session 
+         * of this consumed message.
+         */
+        virtual void acknowledge(void) const throw( CMSException ) = 0;
+      
+        /**
+         * Retrieves a reference to the properties object owned
+         * by this message
+         * @return A Properties Object reference
+         */
+        virtual activemq::util::Properties& getProperties(void) = 0;
+        virtual const activemq::util::Properties& getProperties(void) const = 0;
+      
+        /**
+         * Get the Correlation Id for this message
+         * @return string representation of the correlation Id
+         */
+        virtual const char* getCMSCorrelationId(void) const = 0;
+
+        /**
+         * Sets the Correlation Id used by this message
+         * @param String representing the correlation id.
+         */
+        virtual void setCMSCorrelationId(const std::string& correlationId) = 0;
+
+        /**
+         * Sets the DeliveryMode for this message
+         * @return DeliveryMode enumerated value.
+         */
+        virtual DeliveryMode getCMSDeliveryMode(void) const = 0;
+
+        /**
+         * Sets the DeliveryMode for this message
+         * @param DeliveryMode enumerated value.
+         */
+        virtual void setCMSDeliveryMode(DeliveryMode mode) = 0;
+      
+        /**
+         * Gets the Destination for this Message, returns a
+         * @return Destination object
+         */
+        virtual const Destination& getCMSDestination(void) const = 0;
+      
+        /**
+         * Sets the Destination for this message
+         * @param Destination Object
+         */
+        virtual void setCMSDestination(const Destination& destination) = 0;
+      
+        /**
+         * Gets the Expiration Time for this Message
+         * @return time value
+         */
+        virtual long getCMSExpiration(void) const = 0;
+      
+        /**
+         * Sets the Expiration Time for this message
+         * @param time value
+         */
+        virtual void setCMSExpiration(long expireTime) = 0;
+      
+        /**
+         * Gets the CMS Message Id for this Message
+         * @return time value
+         */
+        virtual const char* getCMSMessageId(void) const = 0;
+      
+        /**
+         * Sets the CMS Message Id for this message
+         * @param time value
+         */
+        virtual void setCMSMessageId(const std::string& id) = 0;
+      
+        /**
+         * Gets the Priority Value for this Message
+         * @return priority value
+         */
+        virtual int getCMSPriority(void) const = 0;
+      
+        /**
+         * Sets the Priority Value for this message
+         * @param priority value
+         */
+        virtual void setCMSPriority(int priority) = 0;
+
+        /**
+         * Gets the Redelivered Flag for this Message
+         * @return redelivered value
+         */
+        virtual bool getCMSRedelivered(void) const = 0;
+      
+        /**
+         * Sets the Redelivered Flag for this message
+         * @param redelivered value
+         */
+        virtual void setCMSRedelivered(bool redelivered) = 0;
+
+        /**
+         * Gets the CMS Reply To Address for this Message
+         * @return Reply To Value
+         */
+        virtual const char* getCMSReplyTo(void) const = 0;
+      
+        /**
+         * Sets the CMS Reply To Address for this message
+         * @param Reply To value
+         */
+        virtual void setCMSReplyTo(const std::string& id) = 0;
+
+        /**
+         * Gets the Time Stamp for this Message
+         * @return time stamp value
+         */
+        virtual long getCMSTimeStamp(void) const = 0;
+      
+        /**
+         * Sets the Time Stamp for this message
+         * @param time stamp value
+         */
+        virtual void setCMSTimeStamp(long timeStamp) = 0;
+
+        /**
+         * Gets the CMS Message Type for this Message
+         * @return type value
+         */
+        virtual const char* getCMSMessageType(void) const = 0;
+      
+        /**
+         * Sets the CMS Message Type for this message
+         * @param type value
+         */
+        virtual void setCMSMessageType(const std::string& type) = 0;
+    };
+}
+
+#endif /*_CMS_MESSAGE_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageConsumer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageConsumer.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageConsumer.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageConsumer.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef _CMS_MESSAGECONSUMER_H_
+#define _CMS_MESSAGECONSUMER_H_
+
+#include <cms/MessageListener.h>
+#include <cms/Message.h>
+
+namespace cms
+{
+
+   class MessageConsumer
+   {
+   public:
+
+      /**
+       * Destructor
+       */
+      virtual ~MessageConsumer(void) {}
+      
+      /**
+       * Synchronously Receive a Message
+       * @return new message
+       * @throws CMSException
+       */
+      virtual Message* receive(void) throw ( CMSException ) = 0;
+
+      /**
+       * Synchronously Receive a Message, time out after defined interval.
+       * Returns null if nothing read.
+       * @return new message
+       * @throws CMSException
+       */
+      virtual Message* receive(int millisecs) throw ( CMSException ) = 0;
+
+      /**
+       * Receive a Message, does not wait if there isn't a new message
+       * to read, returns NULL if nothing read.
+       * @return new message
+       * @throws CMSException
+       */
+      virtual Message* receiveNoWait(void) throw ( CMSException ) = 0;
+
+      /**
+       * Sets the MessageListener that this class will send notifs on
+       * @param MessageListener interface pointer
+       */
+      virtual void setMessageListener(MessageListener* listener) = 0;
+      
+      /**
+       * Gets the MessageListener that this class will send notifs on
+       * @param MessageListener interface pointer
+       */
+      virtual MessageListener* getMessageListener(void) const = 0;
+      
+      /**
+       * Gets this message consumer's message selector expression.
+       * @return This Consumer's selector expression or "".
+       * @throws cms::CMSException
+       */
+      virtual std::string getMessageSelector(void) const 
+        throw ( cms::CMSException ) = 0;
+            
+   };
+
+}
+
+#endif /*_CMS_MESSAGECONSUMER_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageListener.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageListener.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageListener.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_MESSAGELISTENER_H_
+#define _CMS_MESSAGELISTENER_H_
+
+//#include <cms/Message.h>
+ 
+namespace cms{
+    
+    class Message;
+    
+    class MessageListener{
+    public:
+    
+        virtual ~MessageListener(void){}
+        
+        /**
+         * Called asynchronously when a new message is received, the message
+         * reference can be to any othe Message types. a dynamic cast is used
+         * to find out what type of message this is.  The lifetime of this
+         * object is only garunteed to be for life of the onMessage function
+         * after this returns the message may no longer exists.  User should
+         * copy the data or clone the message if they wish to keep something
+         * around about this message.
+         * 
+         * It is considered a programming error for this method to throw and
+         * exception.
+         * 
+         * @param Message object reference
+         */
+        virtual void onMessage( const Message& message ) = 0;
+
+    };
+    
+}
+
+#endif /*_CMS_MESSAGELISTENER_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageProducer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageProducer.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageProducer.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/MessageProducer.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef _CMS_MESSAGEPRODUCER_H_
+#define _CMS_MESSAGEPRODUCER_H_
+
+#include <cms/Message.h>
+#include <cms/Destination.h>
+#include <cms/CMSException.h>
+
+namespace cms
+{
+   /** 
+    * defines the <code>MEssageProducer</code> interface that is used
+    * by all MessageProducer derivations.  This class defines the JMS
+    * spec'd interface for a MessageProducer.
+    */
+   class MessageProducer
+   {
+   public:
+
+      /**
+       * Destructor
+       */
+      virtual ~MessageProducer(void) {}
+      
+      /**
+       * Sends the message to the default producer destination.
+       * @param a Message Object Pointer
+       * @throws CMSException
+       */
+      virtual void send(Message& message) throw ( CMSException ) = 0;
+      
+      /**
+       * Sends the message to the designated destination.
+       * @param a Message Object Pointer
+       * @throws CMSException
+       */
+      virtual void send(const Destination& destination,
+                        Message& message) throw ( CMSException ) = 0;
+
+      /** 
+       * Sets the delivery mode for this Producer
+       * @param The DeliveryMode
+       */
+      virtual void setDeliveryMode(Message::DeliveryMode mode) = 0;
+      
+      /** 
+       * Gets the delivery mode for this Producer
+       * @return The DeliveryMode
+       */
+      virtual Message::DeliveryMode getDeliveryMode(void) const = 0;
+      
+      /**
+       * Sets if Message Ids are disbled for this Producer
+       * @param boolean indicating enable / disable (true / false)
+       */
+      virtual void setDisableMessageId(bool value) = 0;
+      
+      /**
+       * Sets if Message Ids are disbled for this Producer
+       * @param boolean indicating enable / disable (true / false)
+       */
+      virtual bool getDisableMessageId(void) const = 0;
+
+      /**
+       * Sets if Message Time Stamps are disbled for this Producer
+       * @param boolean indicating enable / disable (true / false)
+       */
+      virtual void setDisableMessageTimeStamp(bool value) = 0;
+      
+      /**
+       * Sets if Message Time Stamps are disbled for this Producer
+       * @param boolean indicating enable / disable (true / false)
+       */
+      virtual bool getDisableMessageTimeStamp(void) const = 0;
+      
+      /**
+       * Sets the Priority that this Producers sends messages at
+       * @param int value for Priority level
+       */
+      virtual void setPriority(int priority) = 0;
+      
+      /**
+       * Gets the Priority level that this producer sends messages at
+       * @return int based priority level
+       */
+      virtual int getPriority(void) const = 0;
+      
+      /**
+       * Sets the Time to Live that this Producers sends messages with
+       * @param int value for time to live
+       */
+      virtual void setTimeToLive(int time) = 0;
+      
+      /**
+       * Gets the Time to Live that this producer sends messages with
+       * @return int based Time to Live
+       */
+      virtual int getTimeToLive(void) const = 0;
+      
+   };
+
+}
+
+#endif /*_CMS_MESSAGEPRODUCER_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Queue.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Queue.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Queue.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Queue.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_QUEUE_H_
+#define _CMS_QUEUE_H_
+ 
+#include <cms/Destination.h>
+#include <cms/CMSException.h>
+
+namespace cms{
+	
+	/**
+	 * An interface encapsulating a provider-specific queue name.
+	 */
+	class Queue : public Destination{
+		
+	public:
+	
+		virtual ~Queue(void){}
+		
+		/**
+		 * Gets the name of this queue.
+		 * @return The queue name.
+		 */
+		virtual std::string getQueueName() const 
+            throw( CMSException ) = 0;
+
+	};
+
+}
+
+#endif /*_CMS_QUEUE_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Session.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Session.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Session.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Session.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,232 @@
+/*
+* Copyright 2006 The Apache Software Foundation or its licensors, as
+* applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#ifndef _CMS_SESSION_H_
+#define _CMS_SESSION_H_
+
+#include <cms/Closeable.h>
+#include <cms/Message.h>
+#include <cms/TextMessage.h>
+#include <cms/BytesMessage.h>
+#include <cms/MapMessage.h>
+#include <cms/MessageProducer.h>
+#include <cms/MessageConsumer.h>
+#include <cms/Topic.h>
+#include <cms/Queue.h>
+#include <cms/TemporaryTopic.h>
+#include <cms/TemporaryQueue.h>
+#include <cms/CMSException.h>
+
+namespace cms
+{
+
+    class Session : public Closeable
+    {
+    public:
+
+        enum AcknowledgeMode
+        {
+            /**
+            * With this acknowledgment mode, the session automatically
+            * acknowledges a client's receipt of a message either when
+            * the session has successfully returned from a call to receive
+            * or when the message listener the session has called to
+            * process the message successfully returns.
+            */
+            AutoAcknowledge,
+
+            /**
+            * With this acknowledgment mode, the session automatically
+            * acknowledges a client's receipt of a message either when
+            * the session has successfully returned from a call to receive
+            * or when the message listener the session has called to
+            * process the message successfully returns.  Acknowlegements
+            * may be delayed in this mode to increase performance at
+            * the cost of the message being redelivered this client fails.
+            */
+            DupsOkAcknowledge,
+
+            /**
+            * With this acknowledgment mode, the client acknowledges a
+            * consumed message by calling the message's acknowledge method.
+            */
+            ClientAcknowledge,
+
+            /**
+            * Messages will be consumed when the transaction commits.
+            */
+            Transactional         
+        };
+
+    public:
+
+        /**
+        * Destructor
+        */
+        virtual ~Session(void) {}
+
+        /**
+        * Commits all messages done in this transaction and releases any 
+        * locks currently held.
+        * @throws CMSException
+        */
+        virtual void commit(void) throw ( CMSException ) = 0;
+
+        /**
+        * Rollsback all messages done in this transaction and releases any 
+        * locks currently held.
+        * @throws CMSException
+        */
+        virtual void rollback(void) throw ( CMSException ) = 0;
+
+        /**
+        * Creates a MessageConsumer for the specified destination.
+        * @param the Destination that this consumer receiving messages for.
+        * @throws CMSException
+        */
+        virtual MessageConsumer* createConsumer(
+            Destination& destination )
+                throw ( CMSException ) = 0;
+
+        /**
+        * Creates a MessageConsumer for the specified destination, using a 
+        * message selector.
+        * @param the Destination that this consumer receiving messages for.
+        * @throws CMSException
+        */
+        virtual MessageConsumer* createConsumer( 
+            Destination& destination,
+            const std::string& selector )
+                throw ( CMSException ) = 0;
+
+        /**
+        * Creates a durable subscriber to the specified topic, using a 
+        * message selector
+        * @param the topic to subscribe to
+        * @param name used to identify the subscription
+        * @param only messages matching the selector are received
+        * @throws CMSException
+        */
+        virtual MessageConsumer* createDurableConsumer(
+            Topic& destination,
+            const std::string& name,
+            const std::string& selector,
+            bool noLocal = false )
+                throw ( CMSException ) = 0;
+
+        /**
+        * Creates a MessageProducer to send messages to the specified 
+        * destination.
+        * @param the Destination to publish on
+        * @throws CMSException
+        */
+        virtual MessageProducer* createProducer( Destination& destination )
+            throw ( CMSException ) = 0;
+
+        /**
+        * Creates a queue identity given a Queue name.
+        * @param the name of the new Queue
+        * @throws CMSException
+        */
+        virtual Queue* createQueue( const std::string& queueName )
+            throw ( CMSException ) = 0;
+
+        /**
+        * Creates a topic identity given a Queue name.
+        * @param the name of the new Topic
+        * @throws CMSException
+        */
+        virtual Topic* createTopic( const std::string& topicName )
+            throw ( CMSException ) = 0;
+
+        /**
+        * Creates a TemporaryQueue object.
+        * @throws CMSException
+        */
+        virtual TemporaryQueue* createTemporaryQueue(void)
+            throw ( CMSException ) = 0;
+
+        /**
+        * Creates a TemporaryTopic object.
+        * @throws CMSException
+        */
+        virtual TemporaryTopic* createTemporaryTopic(void)
+            throw ( CMSException ) = 0;
+
+        /**
+        * Creates a new Message
+        * @throws CMSException
+        */
+        virtual Message* createMessage(void) 
+            throw ( CMSException ) = 0;
+
+        /**
+        * Creates a BytesMessage
+        * @throws CMSException
+        */
+        virtual BytesMessage* createBytesMessage(void) 
+            throw ( CMSException) = 0;
+
+        /**
+        * Creates a BytesMessage and sets the paylod to the passed value
+        * @param an array of bytes to set in the message
+        * @param the size of the bytes array, or number of bytes to use
+        * @throws CMSException
+        */
+        virtual BytesMessage* createBytesMessage(
+            const unsigned char* bytes,
+            unsigned long bytesSize ) 
+                throw ( CMSException) = 0;
+
+        /**
+        * Creates a new TextMessage
+        * @throws CMSException
+        */
+        virtual TextMessage* createTextMessage(void) 
+            throw ( CMSException ) = 0;
+
+        /**
+        * Creates a new TextMessage and set the text to the value given
+        * @param the initial text for the message
+        * @throws CMSException
+        */
+        virtual TextMessage* createTextMessage( const std::string& text ) 
+            throw ( CMSException ) = 0;
+
+        /**
+        * Creates a new MapMessage
+        * @throws CMSException
+        */
+        virtual MapMessage* createMapMessage(void) 
+            throw ( CMSException ) = 0;
+
+        /**
+        * Returns the acknowledgement mode of the session.
+        * @return the Sessions Acknowledge Mode
+        */
+        virtual AcknowledgeMode getAcknowledgeMode(void) const = 0;
+
+        /**
+        * Gets if the Sessions is a Transacted Session
+        * @return transacted true - false.
+        */
+        virtual bool isTransacted(void) const = 0;
+
+    };
+
+}
+
+#endif /*_CMS_SESSION_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Startable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Startable.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Startable.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Startable.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef CMS_STARTABLE_H
+#define CMS_STARTABLE_H
+ 
+#include <cms/CMSException.h>
+
+namespace cms{
+	
+	/**
+	 * Interface for a class that implements the start method.
+	 */
+	class Startable{
+		
+	public:
+	
+		virtual ~Startable(){}
+		
+		/**
+		 * Starts the service.
+		 */
+		virtual void start() throw( CMSException ) = 0;
+	};
+}
+
+#endif /*CMS_STARTABLE_H*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Stoppable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Stoppable.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Stoppable.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Stoppable.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef CMS_STOPPABLE_H
+#define CMS_STOPPABLE_H
+ 
+#include <cms/CMSException.h>
+
+namespace cms{
+    
+    /**
+     * Interface for a class that implements the stop method.
+     */
+    class Stoppable{
+        
+    public:
+    
+        virtual ~Stoppable(){}
+        
+        /**
+         * Stops this service.
+         */
+        virtual void stop() throw( CMSException ) = 0;
+    };
+}
+
+#endif /*CMS_STOPPABLE_H*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryQueue.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_TEMPORARYQUEUE_H_
+#define _CMS_TEMPORARYQUEUE_H_
+
+#include <cms/Destination.h>
+#include <cms/CMSException.h>
+
+namespace cms{
+
+    /**
+     * An interface encapsulating a provider-specific queue name.
+     */
+    class TemporaryQueue : public Destination
+    {
+    public:
+
+        virtual ~TemporaryQueue(void) {}
+
+        /**
+         * Gets the name of this queue.
+         * @return The queue name.
+         */
+        virtual const char* getQueueName(void) const 
+            throw( CMSException ) = 0;
+        
+   };
+
+}
+
+#endif /*_CMS_TEMPORARYQUEUE_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryTopic.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryTopic.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryTopic.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/TemporaryTopic.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_TEMPORARYTOPIC_H_
+#define _CMS_TEMPORARYTOPIC_H_
+
+#include <cms/Destination.h>
+#include <cms/CMSException.h>
+
+namespace cms{
+
+    /**
+     * An interface encapsulating a provider-specific topic name.
+     */
+    class TemporaryTopic : public Destination
+    {
+    public:
+
+        virtual ~TemporaryTopic(void) {}
+
+        /**
+         * Gets the name of this topic.
+         * @return The topic name.
+         */
+        virtual const char* getTopicName(void) 
+            const throw( CMSException ) = 0;
+            
+   };
+
+}
+
+#endif /*_CMS_TEMPORARYTOPIC_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/TextMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/TextMessage.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/TextMessage.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/TextMessage.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_TEXTMESSAGE_H_
+#define _CMS_TEXTMESSAGE_H_
+ 
+#include <cms/Message.h>
+#include <cms/CMSException.h>
+
+namespace cms{
+	
+	/**
+	 * Interface for a text message.
+	 */
+	class TextMessage : public Message{
+		
+	public:
+	
+		virtual ~TextMessage(){}
+		
+		/**
+		 * Gets the message character buffer.
+		 * @return The message character buffer.
+		 */
+		virtual const char* getText() const throw( CMSException ) = 0;
+		
+		/**
+		 * Sets the message contents.
+		 * @param msg The message buffer.
+		 */
+		virtual void setText( const char* msg ) throw( CMSException ) = 0;
+	};
+}
+
+#endif /*_CMS_TEXTMESSAGE_H_*/

Added: incubator/activemq/trunk/activemq-cpp/src/main/cms/Topic.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Topic.h?rev=418749&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Topic.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Topic.h Mon Jul  3 04:51:36 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CMS_TOPIC_
+#define _CMS_TOPIC_
+ 
+#include <cms/Destination.h>
+#include <cms/CMSException.h>
+
+namespace cms{
+    
+    /**
+     * An interface encapsulating a provider-specific topic name.
+     */
+    class Topic : public Destination{
+        
+    public:
+    
+        virtual ~Topic(void) {}
+        
+        /**
+         * Gets the name of this topic.
+         * @return The topic name.
+         */
+        virtual std::string getTopicName(void) 
+            const throw( CMSException ) = 0;
+            
+    };
+
+}
+
+#endif /*_CMS_TOPIC_*/