activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r507189 [2/2] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/connector/openwire/commands/ main/activemq/util/ test/activemq/network/
Date Tue, 13 Feb 2007 20:07:11 GMT
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Properties.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Properties.h?view=diff&rev=507189&r1=507188&r2=507189
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Properties.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/Properties.h Tue Feb 13
12:07:10 2007
@@ -23,22 +23,22 @@
 
 namespace activemq{
 namespace util{
-   
+
     /**
-     * Interface for a Java-like properties object.  This is essentially 
+     * Interface for a Java-like properties object.  This is essentially
      * a map of key-value string pairs.
      */
     class Properties{
     public:
-   
+
         virtual ~Properties(){}
-        
+
         /**
          * Returns true if the properties object is empty
          * @return true if empty
          */
         virtual bool isEmpty() const = 0;
-        
+
         /**
          * Looks up the value for the given property.
          * @param name The name of the property to be looked up.
@@ -46,7 +46,7 @@
          * 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.
@@ -55,20 +55,20 @@
          * @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, 
+        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, 
+        virtual void setProperty(
+            const std::string& name,
             const std::string& value ) = 0;
-      
+
         /**
          * Check to see if the Property exists in the set
          * @param name the name of the property to check
@@ -81,7 +81,7 @@
          * @param name the name of the property to be removed.s
          */
         virtual void remove( const std::string& name ) = 0;
-        
+
         /**
          * Method that serializes the contents of the property map to
          * an arryay.
@@ -89,26 +89,33 @@
          * 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;
 
+        /**
+         * Formats the contents of the Properties Object into a string
+         * that can be logged, etc.
+         * @returns string value of this object.
+         */
+        virtual std::string toString() const = 0;
+
    };
-   
+
 }}
 
 #endif /*ACTIVEMQ_UTIL_PROPERTIES_H_*/

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h?view=diff&rev=507189&r1=507188&r2=507189
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h Tue
Feb 13 12:07:10 2007
@@ -19,23 +19,24 @@
 
 #include <map>
 #include <string>
+#include <sstream>
 #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(){}
-        
+
         /**
          * Returns true if the properties object is empty
          * @return true if empty
@@ -51,16 +52,16 @@
          * 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 = 
+
+            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.
@@ -69,29 +70,29 @@
          * @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, 
+        virtual std::string getProperty( const std::string& name,
                                          const std::string& defaultValue ) const {
-            
-            std::map< std::string, std::string >::const_iterator iter = 
+
+            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, 
+        virtual void setProperty( const std::string& name,
                                   const std::string& value ){
             properties[name] = value;
         }
-        
+
         /**
          * Check to see if the Property exists in the set
          * @param name - property name to check for in this properties set.
@@ -103,10 +104,10 @@
             {
                 return true;
             }
-         
+
             return false;
         }
-        
+
         /**
          * Removes the property with the given name.
          * @param name the name of the property to remove.
@@ -122,57 +123,80 @@
          * 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();
         }
+
+        /**
+         * Formats the contents of the Properties Object into a string
+         * that can be logged, etc.
+         * @returns string value of this object.
+         */
+        virtual std::string toString() const {
+
+            std::ostringstream stream;
+            std::map< std::string, std::string >::const_iterator iter;
+
+            stream << "Begin Class SimpleProperties:" << std::endl;
+
+            for( iter = properties.begin(); iter != properties.end(); ++iter ){
+                stream << " properties[" << iter->first << "] = "
+                       << iter->second << std::endl;
+            }
+
+            stream << "End Class SimpleProperties:" << std::endl;
+
+            return stream.str();
+        }
+
     };
-    
+
 }}
 
 #endif /*ACTIVEMQ_UTIL_SIMPLEPROPERTIES_H_*/

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h?view=diff&rev=507189&r1=507188&r2=507189
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/network/SocketFactoryTest.h
Tue Feb 13 12:07:10 2007
@@ -161,9 +161,9 @@
 
             Socket* client = SocketFactory::createSocket(properties);
 
-            BufferedSocket* buffSocket = dynamic_cast<BufferedSocket*>(client);
+            //BufferedSocket* buffSocket = dynamic_cast<BufferedSocket*>(client);
 
-            CPPUNIT_ASSERT( buffSocket != NULL );
+            //CPPUNIT_ASSERT( buffSocket != NULL );
 
             synchronized(&serverThread.mutex)
             {



Mime
View raw message