activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r652104 [18/29] - in /activemq/activemq-cpp/trunk: ./ m4/ src/examples/ src/examples/consumers/ src/main/ src/main/decaf/ src/main/decaf/internal/ src/main/decaf/internal/net/ src/main/decaf/internal/nio/ src/main/decaf/internal/util/ src/m...
Date Tue, 29 Apr 2008 20:52:37 GMT
Added: activemq/activemq-cpp/trunk/src/main/decaf/security/cert/CertificateParsingException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security/cert/CertificateParsingException.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security/cert/CertificateParsingException.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security/cert/CertificateParsingException.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_SECURITY_CERT_CERTIFICATEPARSINGEXCEPTION_H_
+#define _DECAF_SECURITY_CERT_CERTIFICATEPARSINGEXCEPTION_H_
+
+#include <decaf/security/cert/CertificateException.h>
+
+namespace decaf{
+namespace security{
+namespace cert{
+
+    /*
+     * Certificate Parsing Exception. This is thrown whenever an invalid 
+     * DER-encoded certificate is parsed or unsupported DER features are found 
+     * in the Certificate.
+     */
+    class DECAF_API CertificateParsingException : public CertificateException
+    {
+    public:
+
+        /**
+         * Default Constructor
+         */
+        CertificateParsingException() throw() {};
+
+        /**
+         * Conversion Constructor from some other Exception
+         * @param ex
+         *      An exception that should become this type of Exception
+         */
+        CertificateParsingException(const Exception& ex) throw()
+        : Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Copy Constructor
+         * @param ex
+         *      An exception that should become this type of Exception
+         */
+        CertificateParsingException(const CertificateParsingException& ex) throw()
+        : Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occured.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * 
+         * @param file 
+         *      name where exception occurs
+         * @param lineNumber
+         *      line number where the exception occurred.
+         * @param msg
+         *      message to report
+         * @param ...
+         *      list of primitives that are formatted into the message
+         */
+        CertificateParsingException( const char* file,
+                               const int lineNumber,
+                               const char* msg, ...) throw()
+        : Exception()
+        {
+            va_list vargs;
+            va_start(vargs, msg);
+            buildMessage(msg, vargs);
+
+            // Set the first mark for this exception.
+            setMark(file, lineNumber);
+        }
+
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         * 
+         * @return A deep copy of this exception.
+         */
+        virtual CertificateParsingException* clone() const{
+            return new CertificateParsingException(*this);
+        }
+
+        virtual ~CertificateParsingException() throw() {}
+
+   };
+
+}}}
+
+#endif /*_DECAF_SECURITY_CERT_CERTIFICATEPARSINGEXCEPTION_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/security/cert/X509Certificate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security/cert/X509Certificate.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security/cert/X509Certificate.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security/cert/X509Certificate.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_SECURITY_CERT_X509CERTIFICATE_H_
+#define _DECAF_SECURITY_CERT_X509CERTIFICATE_H_
+
+#include <decaf/security/cert/Certificate.h>
+
+#include <decaf/util/Date.h>
+
+namespace decaf {
+namespace security {
+namespace cert {
+
+    /**
+     * Base interface for all identity certificates.
+     */
+    class DECAF_API X509Certificate : public Certificate {
+    
+    public:
+        
+        virtual ~X509Certificate() {}
+        
+        virtual void checkValidity() const 
+            throw(CertificateExpiredException, CertificateNotYetValidException) = 0;
+        
+        virtual void checkValidity(const decaf::util::Date& date) const 
+                    throw(CertificateExpiredException, CertificateNotYetValidException) = 0;                    
+        
+        virtual int getBasicConstraints() const = 0;
+        
+        virtual void getIssuerUniqueID( std::vector<bool>& output ) const = 0;
+        
+        virtual const X500Principal* getIssuerX500Principal() const = 0;
+        
+        virtual void getKeyUsage( std::vector<unsigned char>& output ) const = 0;
+        
+        virtual Date getNotAfter() const = 0;
+        
+        virtual Date getNotBefore() const = 0;
+        
+        //virtual BigInteger getSerialNumber() const = 0;
+        
+        virtual std::string getSigAlgName() const = 0;
+        
+        virtual std::string getSigAlgOID() const = 0;
+        
+        virtual void getSigAlgParams( std::vector<unsigned char>& output ) const = 0;
+        
+        virtual void getSignature( std::vector<unsigned char>& output ) const = 0;
+        
+        virtual void getSubjectUniqueID( std::vector<bool>& output ) const = 0;
+        
+        virtual const X500Principal* getSubjectX500Principal() const = 0;
+        
+        virtual void getTBSCertificate( std::vector<unsigned char>& output ) const 
+            throw( CertificateEncodingException ) = 0;
+        
+        virtual int getVersion() const = 0;
+    };
+    
+}}}
+
+#endif /*_DECAF_SECURITY_CERT_X509CERTIFICATE_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProvider.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProvider.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProvider.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProvider.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_SECURITY_PROVIDER_SECURITYPROVIDER_H_
+#define _DECAF_SECURITY_PROVIDER_SECURITYPROVIDER_H_
+
+namespace decaf {
+namespace security_provider {
+
+    class SecurityProvider {
+    public:
+        
+        virtual ~SecurityProvider() {}
+        
+        virtual X500Principal* createX500Principal( const std::string& name ) = 0;
+        virtual X500Principal* createX500Principal( InputStream& is ) = 0;
+        virtual X500Principal* createX500Principal( unsigned char* buffer, int offset, int len ) = 0;
+    };
+}}
+
+#endif /*_DECAF_SECURITY_PROVIDER_SECURITYPROVIDER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderMap.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderMap.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderMap.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderMap.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 "SecurityProviderMap.h"
+
+using namespace decaf::security_provider;
+
+////////////////////////////////////////////////////////////////////////////////
+SecurityProviderMap* SecurityProviderMap::getInstance()
+{
+    // Static instance of this Map, create here so that one will
+    // always exist, the one and only Connector Map.      
+    static SecurityProviderMap instance;
+    
+    return &instance;
+} 
+
+////////////////////////////////////////////////////////////////////////////////
+void SecurityProviderMap::registerSecurityProvider( const std::string& name, 
+                                                    SecurityProvider* provider )
+{
+    providerMap[name] = provider;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void SecurityProviderMap::unregisterSecurityProvider( const std::string& name )
+{
+    providerMap.erase( name );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SecurityProvider* SecurityProviderMap::lookup( const std::string& name ) 
+{
+    std::map<std::string, SecurityProvider*>::const_iterator itr = 
+        providerMap.find( name );
+
+    if( itr != providerMap.end() )
+    {
+        return itr->second;
+    }
+
+    // Didn't find it, return nothing, not a single thing.
+    return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t SecurityProviderMap::getFactoryNames(
+   std::vector<std::string>& factoryList )
+{
+    std::map<std::string, SecurityProvider*>::const_iterator itr =
+        providerMap.begin();
+      
+    for( ; itr != providerMap.end(); ++itr )
+    {
+        providerMap.insert( factoryList.end(), itr->first );
+    }
+      
+    return providerMap.size();
+}

Added: activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderMap.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderMap.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderMap.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_SECURITY_PROVIDER_SECURITYPROVIDERMAP_H
+#define _DECAF_SECURITY_PROVIDER_SECURITYPROVIDERMAP_H
+
+#include <map>
+#include <vector>
+#include <string>
+
+#include <decaf/lang/Exception.h>
+
+namespace activemq{
+namespace connector{
+
+    /**
+     * Lookup Map for Connector Factories.  Use the Connector name to
+     * find the associated factory.  This class does not take ownership
+     * of the stored factories, they must be deallocated somewhere.
+     */
+    class SecurityProviderMap
+    {
+    private:
+   
+        /**
+         * Map of Factories
+         */
+        std::map< std::string, SecurityProvider* > providerMap;
+                
+        /**
+         * Hidden Contrustor, prevents instantiation
+         */
+        SecurityProviderMap() {};
+      
+        /**
+         * Hidden Destructor.
+         */
+        virtual ~SecurityProviderMap() {};
+ 
+        /**
+         * Hidden Copy Constructore
+         */
+        SecurityProviderMap( const ConnectorFactoryMap& factoryMap );
+      
+        /**
+         * Hidden Assignment operator
+         */
+        SecurityProviderMap operator=( const ConnectorFactoryMap& factoryMap );
+        
+    public:
+      
+        /**
+         * Gets a singleton instance of this class.
+         */
+        static SecurityProviderMap* getInstance();
+
+        /**
+         * Registers a new provider with this map
+         * 
+         * @param name 
+         *      A name to associate the provider with
+         * @param provider 
+         *      the provider object to store in the map.
+        */
+        void registerSecurityProvider( const std::string& name, 
+                                       SecurityProvider* provider );
+      
+        /**
+         * Unregisters a provider from this map
+         * 
+         * @param name 
+         *      the name of the provider to remove
+         */
+        void unregisterSecurityProvider( const std::string& name );
+
+        /**
+         * Lookup the named provider in the Map
+         * 
+         * @param name 
+         *      the provider name to lookup
+         * @return the provider assciated with the name, or NULL
+         */
+        SecurityProvider* lookup( const std::string& name );
+      
+        /**
+         * Fetch a list of provider names that this Map contains
+         * 
+         * @param providers 
+         *      A vector object to receive the list
+         * @returns count of providers.
+         */
+        std::size_t getSecurityProviderNames( std::vector< std::string >& providers );
+      
+    };
+
+}}
+
+#endif /*_DECAF_SECURITY_PROVIDER_SECURITYPROVIDERMAP_H*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderRegistrar.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderRegistrar.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderRegistrar.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security_provider/SecurityProviderRegistrar.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_SECURITY_PROVIDER_SECURITYPROVIDERREGISTRAR_H
+#define _DECAF_SECURITY_PROVIDER_SECURITYPROVIDERREGISTRAR_H
+
+#include <string>
+
+#include <decaf/security_provider/SecurityProviderMap.h>
+
+namespace decaf{
+namespace security_provider{
+
+    /**
+     * Registers the passed in provider into the provider map, this class
+     * can manage the lifetime of the registered provider (default behaviour).
+     */
+    class SecurityProviderRegistrar {
+    private:
+          
+        /**
+         * Unique name used to identify this provider in the map.
+         */
+        std::string name;
+        
+        /**
+         * The provider object.
+         */
+        SecurityProvider* provider;
+        
+        /**
+         * Indicates whether or not the provider will be destroyed
+         * when this registrar object is destroyed.
+         */
+        bool manageLifetime;
+        
+    public:
+   
+        /** 
+         * Creates a registrar and registers the provider with
+         * the provider map.
+         * 
+         * @param name 
+         *      name of the provider to register
+         * @param provider 
+         *      the provider object
+         * @param manageLifetime 
+         *      boolean indicating if this object manages the 
+         *      lifetime of the factory that is being registered.
+         */
+        SecurityProviderRegistrar( const std::string& name, 
+                                   SecurityProvider* provider,
+                                   bool manageLifetime = true ) {       
+            // Register it in the map.
+            SecurityProviderMap::getInstance()->
+                registerSecurityProvider(name, provider);
+
+            // Store for later deletion            
+            this->provider        = provider;
+            this->manageLifetime = manageLifetime;
+            this->name           = name;
+        }
+      
+        /**
+         * Unregisters the provider from the provider map and
+         * destroys it if <code>manageLifetime</code> is set.
+         */
+        virtual ~SecurityProviderRegistrar() {
+            
+            try {
+                
+                // UnRegister it in the map.
+                SecurityProviderMap::getInstance()->
+                    unregisterSecurityProvider( name );
+            
+                if( manageLifetime ) {
+                    delete provider;
+                }
+                
+            }
+            catch( ... ) {
+                // Destructors should not propagate exceptions.
+            }
+        }
+      
+        /**
+         * get a reference to the factory that this class is holding
+         * @return reference to a factory class
+         */
+        virtual SecurityProvider* getProvider() {
+            return provider;
+        }    
+
+    }; 
+      
+}}
+
+#endif /*_DECAF_SECURITY_PROVIDER_SECURITYPROVIDERREGISTRAR_H*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX500Principal.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX500Principal.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX500Principal.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX500Principal.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 "OpenSSLX500Principal.h"
+
+using namespace decaf::security_provider::unix::openssl;
+using namespace decaf::security;
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+OpenSSLX500Principal::OpenSSLX500Principal( X509_NAME* name ) {
+    
+    // Save the X509 name
+    this->x509Name = name;
+    
+    // Indicate that the cached values have not yet been stored.
+    cachedNameString = false;
+    cachedEncoded = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool OpenSSLX500Principal::equals( const Principal& another ) const {
+
+    // Cast the principal to the correct type.
+    const OpenSSLX500Principal* other = 
+        dynamic_cast<const OpenSSLX500Principal*>(&another);
+    if( other == NULL || x509Name == NULL || other->x509Name == NULL ) {
+        return false;
+    }
+        
+    // Compare the underlying X509_NAME structures.
+    int value = X509_NAME_cmp(x509Name, other->x509Name);
+    
+    // Return true if they match.
+    return (value == 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void OpenSSLX500Principal::getEncoded( X509_NAME* name, 
+        std::vector<unsigned char>& output ) {        
+    
+    // Allocate the out buffer and store the encoded data there.
+    char* buffer = NULL;
+    int len = i2d_X509_NAME(name, NULL);
+    if( len < 0 ) {
+        
+        // Error - should never get here since we already have a valid certificate.
+        return;
+    }
+    
+    // Resize the output buffer and copy over the encoded data.
+    output.resize(len);
+    for( int ix=0; ix<len; ++ix ) {
+        output[ix] = buffer[ix];
+    }
+    
+    // Destroy the allocated buffer.
+    delete [] buffer;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+string OpenSSLX500Principal::toString(X509_NAME* name) const {
+    
+    string retVal;
+    if( name == null ) {
+        return retVal;
+    }
+    
+    // Create an in-memory BIO structure to be the target
+    // of the conversion.
+    BIO* bio = BIO_new( BIO_s_mem() );
+    if( bio != NULL ) {
+        
+        // Print the name to the BIO buffer, using RFC2253 formatting
+        if( X509_NAME_print_ex(bio, name, 2, XN_FLAG_RFC2253) ) {
+
+            // Get a pointer to the internal buffer and the length.
+            char* chars = NULL;
+            size_t len = (size_t)BIO_get_mem_ptr(bio, &chars);
+            
+            // Add the characters to the output string.
+            retVal.append(chars, len);                        
+        }        
+        
+        // Free the BIO structure.
+        BIO_free(bio);
+    }
+    
+    // Return the string
+    return retVal;
+}

Added: activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX500Principal.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX500Principal.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX500Principal.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX500Principal.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_SECURITY_PROVIDER_UNIX_OPENSSL_OPENSSLX500PRINCIPAL_H_
+#define _DECAF_SECURITY_PROVIDER_UNIX_OPENSSL_OPENSSLX500PRINCIPAL_H_
+
+#include <decaf/security/auth/x500/X500Principal.h>
+
+#include <openssl/x509.h>
+
+namespace decaf {
+namespace security_provider {
+namespace unix {
+namespace openssl {
+
+    /**
+     * The <code>OpenSSLX500Principal</code> wraps around an OpenSSL 
+     * <code>X509_NAME</code> structure.  It does not, however, control the 
+     * lifetime of the structure.
+     */
+    class OpenSSLX500Principal : public X500Principal {
+        
+    private:
+        
+        /**
+         * The underlying X509 name structure.
+         */
+        X509_NAME* x509Name;
+        
+        /**
+         * Indicates whether or not the name string has been
+         * cached.
+         */
+        mutable bool cachedNameString;
+        
+        /**
+         * Cached string representation of the X509 name.
+         */
+        mutable std::string nameString;
+        
+        /**
+         * Indicates whether or not the encoded buffer has been
+         * cached.
+         */
+        mutable bool cachedEncoded;
+        
+        /**
+         * Cached encoded representation of teh X509 name.
+         */
+        mutable std::vector<unsigned char> encoded;
+        
+    public:
+        
+        /**
+         * Constructor.  Saves the internal X509 name and caches the
+         * string representation of the name.
+         * 
+         * @param name
+         *      The underlying X509 name structure.
+         */
+        OpenSSLX500Principal( X509_NAME* name );
+        
+        /**
+         * Destructor.  Does nothing.
+         */
+        virtual ~OpenSSLX500Principal() {}
+        
+        /**
+         * Accessor to the underlying X509 name structure.
+         */
+        virtual X509_NAME* getX509Name() {
+            return x509Name;
+        }
+        
+        /**
+         * Compares two principals to see if they are the same.
+         * 
+         * @param another
+         *      A principal to be tested for equality to this one.
+         * @return true if the given principal is equivalent to this one.
+         */
+        virtual bool equals( const Principal& another ) const;
+            
+        /**
+         * Returns the distinguished name string using the RFC2253 formatting.
+         * 
+         * @return the RFC2253 formatted distinguished name string.
+         */
+        virtual std::string getName() const {
+            
+            // If we haven't cached the name yet - do it now.
+            if( !cachedNameString ) {
+                nameString = toString(x509Name);
+                cachedNameString = true;
+            }
+            
+            return nameString;
+        }
+        
+        /**
+         * Serializes the distinguished name to its ASN.1 DER encoded form.
+         * 
+         * @param output
+         *      Receives the distinguished name in ASN.1 DER encoded form.
+         */
+        virtual void getEncoded( std::vector<unsigned char>& output ) const {
+            
+            // If we haven't cached the encoded buffer yet, do it now.
+            if( !cachedEncoded ) {
+                getEncoded(x509Name, encoded);
+                cachedEncoded = true;
+            }
+            
+            // Copy the encoded buffer to the output buffer.
+            output = encoded;
+        }
+        
+        /**
+         * Serializes the given distinguished name to its ASN.1 DER encoded 
+         * form.
+         * 
+         * @param name
+         *      the X509 name structure to be encoded.
+         * @param output
+         *      Receives the distinguished name in ASN.1 DER encoded form.
+         */
+        static void getEncoded( X509_NAME* name, 
+                std::vector<unsigned char>& output );
+                
+        /**
+         * Converts the given name to a string using the RFC2253 formatting.
+         * @param name
+         *      the X509 name structure to be formatted.
+         * @return the RFC2253 formatted name string.
+         */
+        static std::string toString( X509_NAME* name ) const;
+        
+    };
+
+}}}}
+
+#endif /*_DECAF_SECURITY_PROVIDER_UNIX_OPENSSL_OPENSSLX500PRINCIPAL_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX509Certificate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX509Certificate.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX509Certificate.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/security_provider/unix/openssl/OpenSSLX509Certificate.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_SECURITY_PROVIDER_UNIX_OPENSSL_OPENSSLX509CERTIFICATE_H_
+#define _DECAF_SECURITY_PROVIDER_UNIX_OPENSSL_OPENSSLX509CERTIFICATE_H_
+
+#include <decaf/security/cert/X509Certificate.h>
+
+namespace decaf {
+namespace security_provider {
+namespace unix {
+namespace openssl {
+
+    class OpenSSLX509Certificate : public decaf::security::cert::X509Certificate {
+    public:
+        
+        virtual ~OpenSSLX509Certificate();
+        
+        /**
+         * Compares the encoded form of the two certificates.
+         * 
+         * @param cert
+         *      The certificate to be tested for equality with this certificate.
+         * @return true if the given certificate is equal to this certificate.
+         */
+        virtual bool equals( const Certificate& cert ) const = 0;
+        
+        /**
+         * Provides the encoded form of this certificate.
+         * 
+         * @param output
+         *      Receives the encoded form of this certificate.
+         * @throws CertificateEncodingException if an encoding error occurs
+         */
+        virtual void getEncoded( std::vector<unsigned char>& output ) const 
+            throw ( CertificateEncodingException ) = 0;
+        
+        /**
+         * Returns the type of this certificate
+         * 
+         * @return the type of this certificate
+         */
+        virtual std::string getType() const = 0;
+        
+        /**
+         * Gets the public key of this certificate.
+         * 
+         * @return the public key
+         */
+        virtual PublicKey* getPublicKey() = 0;
+        
+        /**
+         * Gets the public key of this certificate.
+         * 
+         * @return the public key
+         */
+        virtual const PublicKey* getPublicKey() const = 0;
+        
+        /**
+         * Verifies that this certificate was signed with the private key
+         * that corresponds to the specified public key.
+         * 
+         * @param publicKey
+         *      The public key used to carry out the validation.
+         * @throws NoSuchAlgorithmException - on unsupported signature algorithms. 
+         * @throws InvalidKeyException - on incorrect key. 
+         * @throws NoSuchProviderException - if there's no default provider. 
+         * @throws SignatureException - on signature errors. 
+         * @throws CertificateException - on encoding errors.
+         */
+        virtual void verify( const PublicKey& publicKey ) const 
+            throw( NoSuchAlgorithmException, 
+                   InvalidKeyException, 
+                   NoSuchProviderException, 
+                   SignatureException, 
+                   CertificateException) = 0;
+        
+        /**
+         * Verifies that this certificate was signed with the private key
+         * that corresponds to the specified public key.  Uses the verification
+         * engine of the specified provider.
+         * 
+         * @param publicKey
+         *      The public key used to carry out the validation.
+         * @param sigProvider
+         *      The name of the signature provider
+         * @throws NoSuchAlgorithmException - on unsupported signature algorithms. 
+         * @throws InvalidKeyException - on incorrect key. 
+         * @throws NoSuchProviderException - if there's no default provider. 
+         * @throws SignatureException - on signature errors. 
+         * @throws CertificateException - on encoding errors.
+         */
+        virtual void verify( const PublicKey& publicKey, 
+                             const std::string& sigProvider ) const 
+                    throw( NoSuchAlgorithmException, 
+                           InvalidKeyException, 
+                           NoSuchProviderException, 
+                           SignatureException, 
+                           CertificateException) = 0;
+        
+        /**
+         * Returns a string representation of this certificate.
+         * 
+         * @return a string representation of this certificate
+         */
+        virtual std::string toString() const = 0;
+                
+        virtual void checkValidity() const 
+                    throw(CertificateExpiredException, CertificateNotYetValidException) = 0;
+                
+        virtual void checkValidity(const decaf::util::Date& date) const 
+                    throw(CertificateExpiredException, CertificateNotYetValidException) = 0;                    
+        
+        virtual int getBasicConstraints() const = 0;
+        
+        virtual void getIssuerUniqueID( std::vector<bool>& output ) const = 0;
+        
+        virtual const X500Principal* getIssuerX500Principal() const = 0;
+        
+        virtual void getKeyUsage( std::vector<unsigned char>& output ) const = 0;
+        
+        virtual Date getNotAfter() const = 0;
+        
+        virtual Date getNotBefore() const = 0;
+        
+        //virtual BigInteger getSerialNumber() const = 0;
+        
+        virtual std::string getSigAlgName() const = 0;
+        
+        virtual std::string getSigAlgOID() const = 0;
+        
+        virtual void getSigAlgParams( std::vector<unsigned char>& output ) const = 0;
+        
+        virtual void getSignature( std::vector<unsigned char>& output ) const = 0;
+        
+        virtual void getSubjectUniqueID( std::vector<bool>& output ) const = 0;
+        
+        virtual const X500Principal* getSubjectX500Principal() const = 0;
+        
+        virtual void getTBSCertificate( std::vector<unsigned char>& output ) const 
+            throw( CertificateEncodingException ) = 0;
+        
+        virtual int getVersion() const = 0;
+    };
+    
+}}}}
+
+#endif /*_DECAF_SECURITY_PROVIDER_UNIX_OPENSSL_OPENSSLX509CERTIFICATE_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_UTIL_COLLECTION_H_
+#define _DECAF_UTIL_COLLECTION_H_
+
+#include <decaf/util/Config.h>
+#include <devaf/lang/exceptions/UnsupportedOperationException.h>
+#include <devaf/lang/exceptions/NullPointerException.h>
+#include <devaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/util/Iterator.h>
+
+namespace decaf{
+namespace util{
+
+    /**
+     * The root interface in the collection hierarchy. A collection represents
+     * a group of objects, known as its elements. Some collections allow
+     * duplicate elements and others do not. Some are ordered and others
+     * unordered. This interface is typically used to pass collections
+     * around and manipulate them where maximum generality is desired.
+     *
+     * All general-purpose Collection implementation classes (which typically
+     * implement Collection indirectly through one of its subinterfaces) should
+     * provide two "standard" constructors: a void (no arguments) constructor,
+     * which creates an empty collection, and a constructor with a single argument
+     * of type Collection, which creates a new collection with the same elements
+     * as its argument. In effect, the latter constructor allows the user to copy
+     * any collection, producing an equivalent collection of the desired
+     * implementation type. There is no way to enforce this convention
+     * (as interfaces cannot contain constructors) but all of the general-purpose
+     * Collection implementations in the Decaf platform libraries comply.
+     *
+     * The "destructive" methods contained in this interface, that is, the methods
+     * that modify the collection on which they operate, are specified to throw
+     * UnsupportedOperationException if this collection does not support the
+     * operation. If this is the case, these methods may, but are not required
+     * to, throw an UnsupportedOperationException if the invocation would have
+     * no effect on the collection. For example, invoking the addAll(Collection)
+     * method on an unmodifiable collection may, but is not required to, throw
+     * the exception if the collection to be added is empty.
+     *
+     * Many methods in Collections Framework interfaces are defined in terms of
+     * the equals method. For example, the specification for the
+     * contains(Object o) method says: "returns true if and only if this
+     * collection contains at least one element e such that
+     * (o==null ? e==null : o.equals(e))."
+     *
+     * @since 1.0
+     */
+    template< typename T >
+    class Collection
+    {
+    public:
+
+        virtual ~Collection() {}
+
+        /**
+         * Returns the number of elements in this collection. If this collection
+         * contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
+         * @returns the number of elements in this collection
+         */
+        virtual int size() = 0;
+
+        /**
+         * @returns true if this collection contains no elements.
+         */
+        virtual bool isEmpty() = 0;
+
+        /**
+         * Returns true if this collection contains the specified element. More
+         * formally, returns true if and only if this collection contains at
+         * least one element e such that (o==null ? e==null : o.equals(e)).
+         * @param value - value to check for presence in the collection
+         * @returns true if there is at least one of the elements in the collection
+         * @thorws NullPointerException
+         */
+        virtual bool contains( const E& value )
+            throw ( lang::exceptions::NullPointerException ) = 0;
+
+        /**
+         * Returns an iterator over the elements in this collection. There are
+         * no guarantees concerning the order in which the elements are
+         * returned (unless this collection is an instance of some class that
+         * provides a guarantee).
+         * @returns an Iterator over the elements in this collection
+         */
+        virtual Iterator<E>* iterator() = 0;
+
+        /**
+         * Returns an array containing all of the elements in this collection. If
+         * the collection makes any guarantees as to what order its elements are
+         * returned by its iterator, this method must return the elements in the
+         * same order.
+         *
+         * This method acts as bridge between array-based and collection-based APIs.
+         * @returns an array of the elements in this collection.
+         */
+        virtual std::vector<E> toArray() = 0;
+
+        /**
+         * Returns true if this collection changed as a result of the call.
+         * (Returns false if this collection does not permit duplicates and
+         * already contains the specified element.)
+         *
+         * Collections that support this operation may place limitations on
+         * what elements may be added to this collection. In particular,
+         * some collections will refuse to add null elements, and others
+         * will impose restrictions on the type of elements that may be
+         * added. Collection classes should clearly specify in their
+         * documentation any restrictions on what elements may be added.
+         *
+         * If a collection refuses to add a particular element for any
+         * reason other than that it already contains the element, it must
+         * throw an exception (rather than returning false). This preserves
+         * the invariant that a collection always contains the specified
+         * element after this call returns.
+         *
+         * For non-pointer values, i.e. class instances or string's the object
+         * will be copied into the collection, thus the object must support
+         * being copied, must not hide the copy constructor and assignment
+         * operator.
+         *
+         * @param value - reference to the element to add.
+         * @returns true if the element was added
+         * @throw UnsupportedOperationException
+         * @throw NullPointerException
+         * @throw IllegalArgumentException
+         */
+        virtual bool add( const E& value )
+            throw ( lang::exceptions::UnsupportedOperationException,
+                    lang::exceptions::NullPointerException,
+                    lang::exceptions::IllegalArgumentException ) = 0;
+
+        /**
+         * Removes a single instance of the specified element from the
+         * collection.  More formally, removes an element e such that
+         * (o==null ? e==null : o.equals(e)), if this collection contains one
+         * or more such elements. Returns true if this collection contained
+         * the specified element (or equivalently, if this collection changed
+         * as a result of the call).
+         * @param value - reference to the element to remove.
+         * @returns true if the collection was changed
+         * @throw UnsupportedOperationException
+         * @throw NullPointerException
+         */
+        virtual bool remove( const E& value )
+            throw ( lang::exceptions::UnsupportedOperationException,
+                    lang::exceptions::NullPointerException ) = 0;
+
+        /**
+         * Returns true if this collection contains all of the elements in
+         * the specified collection.
+         * @param source - Collection to compare to this one.
+         * @thorw Exception
+         */
+        virtual bool containsAll( const Collection<E>& source )
+            throw ( lang::Exception ) = 0;
+
+        /**
+         * Adds all of the elements in the specified collection to this
+         * collection. The behavior of this operation is undefined if the
+         * specified collection is modified while the operation is in progress.
+         * (This implies that the behavior of this call is undefined if the
+         * specified collection is this collection, and this collection is
+         * nonempty.)
+         * @param source - Collection whose elements are added to this one.
+         * @return true if this collection changed as a result of the call
+         * @throw UnsupportedOperationException
+         * @throw NullPointerException
+         * @throw IllegalArgumentException
+         */
+        virtual bool addAll( const Collection<E>& source )
+            throw ( lang::exceptions::UnsupportedOperationException,
+                    lang::exceptions::NullPointerException,
+                    lang::exceptions::IllegalArgumentException ) = 0;
+
+        /**
+         * Removes all this collection's elements that are also contained in
+         * the specified collection (optional operation). After this call returns,
+         * this collection will contain no elements in common with the specified
+         * collection.
+         * @param value - The Collection whose elements are to be removed
+         * @returns true if the collection changed as a result of this call
+         * @throw UnsupportedOperationException
+         * @throw NullPointerException
+         * @throw IllegalArgumentException
+         */
+        virtual bool removeAll( const Collection<E>& value )
+            throw ( lang::exceptions::UnsupportedOperationException,
+                    lang::exceptions::NullPointerException,
+                    lang::exceptions::IllegalArgumentException ) = 0;
+
+        /**
+         * Retains only the elements in this collection that are contained in the
+         * specified collection (optional operation). In other words, removes from
+         * this collection all of its elements that are not contained in the
+         * specified collection.
+         * @param value - The Collection whose elements are to be retained
+         * @returns true if the collection changed as a result of this call
+         * @throw UnsupportedOperationException
+         * @throw NullPointerException
+         * @throw IllegalArgumentException
+         */
+        virtual bool retainAll( const Collection<E> value )
+            throw ( lang::exceptions::UnsupportedOperationException,
+                    lang::exceptions::NullPointerException,
+                    lang::exceptions::IllegalArgumentException ) = 0;
+
+        /**
+         * Removes all of the elements from this collection (optional operation).
+         * This collection will be empty after this method returns unless it throws
+         * an exception.
+         * @throw UnsupportedOperationException
+         */
+        virtual void clear()
+            throw ( lang::exceptions::UnsupportedOperationException ) = 0;
+
+        /**
+         * Compares the passed collection to this one, if they contain the
+         * same elements, i.e. all their elements are equivalent, then it
+         * returns true.
+         * @returns true if the Collections contain the same elements.
+         */
+        virtual bool equals( const Collection<E>& value ) = 0;
+
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_COLLECTION_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/Comparator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Comparator.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Comparator.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Comparator.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_UTIL_COMPARATOR_H_
+#define _DECAF_UTIL_COMPARATOR_H_
+
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+
+    /**
+     * A comparison function, which imposes a total ordering on some collection
+     * of objects. Comparators can be passed to a sort method (such as
+     * Collections.sort) to allow precise control over the sort order. Comparators
+     * can also be used to control the order of certain data structures.
+     *
+     * The ordering imposed by a Comparator c on a set of elements S is said to
+     * be consistent with equals if and only if
+     * ( compare( e1, e2) == 0 ) has the same boolean value as ( e1 == e2 ) for
+     * every e1 and e2 in S.
+     */
+    template<typename T>
+    class Comparator
+    {
+    public:
+
+        virtual ~Comparator() {}
+
+        /**
+         * Compares its two arguments for order. Returns a negative integer, zero,
+         * or a positive integer as the first argument is less than, equal to, or
+         * greater than the second.
+         *
+         * The implementor must ensure that
+         * sgn( compare(x, y)) == -sgn(compare(y, x) ) for all x and y.
+         * (This implies that compare(x, y) must throw an exception if and only
+         * if compare(y, x) throws an exception.)
+         *
+         * The implementor must also ensure that the relation is transitive:
+         * ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.
+         *
+         * Finally, the implementer must ensure that compare(x, y)==0 implies
+         * that sgn(compare(x, z))==sgn(compare(y, z)) for all z.
+         *
+         * It is generally the case, but not strictly required that
+         * (compare(x, y)==0) == ( x == y) ). Generally speaking, any comparator
+         * that violates this condition should clearly indicate this fact. The
+         * recommended language is "Note: this comparator imposes orderings that
+         * are inconsistent with equals."
+         * @param o1 - the first object to be compared
+         * @param o2 - the second object to be compared
+         * @returns a negative integer, zero, or a positive integer as the first
+         * argument is less than, equal to, or greater than the second.
+         */
+        virtual int compare( const E& o1, const E& o2 ) = 0;
+
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_COMPARATOR_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/Config.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Config.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Config.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Config.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_UTIL_CONFIG_H_
+#define _DECAF_UTIL_CONFIG_H_
+
+#ifdef DECAF_DLL
+#ifdef DECAF_EXPORTS
+#define DECAF_API __declspec(dllexport)
+#else
+#define DECAF_API __declspec(dllimport)
+#endif
+#else
+#define DECAF_API
+#endif
+
+//
+// The purpose of this header is to try to detect the supported headers
+// of the platform when the ./configure script is not being used to generate
+// the config.h file.
+//
+#if defined(HAVE_CONFIG_H)
+
+    // config.h is generated by the ./configure script and it only
+    // used by unix like systems (including cygwin)
+    #include <config.h>
+
+#else /* !defined(HAVE_CONFIG_H) */
+
+    // Not using ./configure script and make system.. chances are your using the native build tools
+    // of Windows or OS X to do this build
+
+    #if defined(_WIN32)
+        #ifndef HAVE_OBJBASE_H
+            #define HAVE_OBJBASE_H
+        #endif
+        #ifndef HAVE_RPCDCE_H
+            #define HAVE_RPCDCE_H
+        #endif
+        #ifndef HAVE_WINSOCK2_H
+            #define HAVE_WINSOCK2_H
+        #endif
+        #ifndef HAVE_STRUCT_ADDRINFO
+            #define HAVE_STRUCT_ADDRINFO
+        #endif
+        #ifndef HAVE_SYS_TIMEB_H
+            #define HAVE_SYS_TIMEB_H
+        #endif
+        #ifndef HAVE_FTIME
+            #define HAVE_FTIME
+        #endif
+        #ifndef HAVE_WINDOWS_H
+            #define HAVE_WINDOWS_H
+        #endif
+    #else
+        #ifndef HAVE_UUID_UUID_H
+            #define HAVE_UUID_UUID_H
+        #endif
+        #ifndef HAVE_UUID_T
+            #define HAVE_UUID_T
+        #endif
+        #ifndef HAVE_PTHREAD_H
+            #define HAVE_PTHREAD_H
+        #endif
+    #endif
+
+#endif /* !defined(HAVE_CONFIG_H) */
+
+// Macro to mark attributes as unused
+#ifdef __GNUC__
+   #define DECAF_UNUSED __attribute__ ((__unused__))
+#else
+   #define DECAF_UNUSED
+#endif
+
+#endif /*_DECAF_UTIL_CONFIG_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/Date.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Date.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Date.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Date.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 <decaf/util/Date.h>
+#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+
+#include <apr_time.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+long long Date::getCurrentTimeMilliseconds(){
+    return apr_time_now() / 1000;
+}

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/Date.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Date.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Date.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Date.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_UTIL_DATE_H_
+#define _DECAF_UTIL_DATE_H_
+
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+
+    /**
+     * Wrapper class around a time value in milliseconds.  This
+     * class is comparable to Java's java.util.Date class.
+     */
+    class DECAF_API Date
+    {
+    private:
+
+        /**
+         * The underlying time value in milliseconds�
+         */
+        long long time;
+
+    public:
+
+        /**
+         * Default constructor - sets time to now.
+         */
+        Date(){
+            time = getCurrentTimeMilliseconds();
+        }
+
+        /**
+         * Constructs the date with a given time value.
+         * @param milliseconds The time in milliseconds;
+         */
+        Date( long long milliseconds ){
+            this->time = milliseconds;
+        }
+
+        /**
+         * Copy constructor.
+         */
+        Date( const Date& source ){
+            (*this) = source;
+        }
+
+        virtual ~Date(){}
+
+        /**
+         * Gets the underlying time.
+         * @return The underlying time value in milliseconds.
+         */
+        long long getTime() const{
+            return time;
+        }
+
+        /**
+         * Sets the underlying time.
+         * @param milliseconds The underlying time value in
+         * milliseconds.
+         */
+        void setTime( long long milliseconds ){
+            this->time = milliseconds;
+        }
+
+        /**
+         * Determines wether or not this date falls after the
+         * specified time.
+         * @param when The date to compare
+         * @return true if this date falls after when.
+         */
+        bool after( Date& when ) const{
+            return time > when.time;
+        }
+
+        /**
+         * Determines wether or not this date falls before the
+         * specified time.
+         * @param when The date to compare
+         * @return true if this date falls before when.
+         */
+        bool before( Date& when ) const{
+            return time < when.time;
+        }
+
+        /**
+         * Determines wether or not this date is equal to the
+         * specified time.
+         * @param when The date to compare
+         * @return true if this date is equal to when.
+         */
+        bool equals( Date& when ) const{
+            return time == when.time;
+        }
+
+        /**
+         * Assignment operator.
+         */
+        Date& operator =( const Date& source ){
+            this->time = source.time;
+            return *this;
+        }
+
+        /**
+         * Returns the current time in milliseconds.  Comparable
+         * to Java's System.currentTimeMillis method.
+         * @return The current time in milliseconds.
+         */
+        static long long getCurrentTimeMilliseconds();
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_DATE_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/Iterator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Iterator.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Iterator.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Iterator.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_UTIL_ITERATOR_H_
+#define _DECAF_UTIL_ITERATOR_H_
+
+#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/lang/exceptions/IllegalStateException.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+
+namespace decaf{
+namespace util{
+
+    /**
+     * Defines an object that can be used to iterate over the elements of a
+     * collection.  The iterator provides a way to access and remove elements
+     * with well defined semantics.
+     */
+    template< typename T>
+    class Iterator {
+    public:
+
+        virtual ~Iterator() {}
+
+        /**
+         * Returns the next element in the iteration. Calling this method
+         * repeatedly until the hasNext() method returns false will return
+         * each element in the underlying collection exactly once.
+         * @returns next element in the iteration of elements
+         * @throws NoSuchElementException - iteration has no more elements.
+         */
+        virtual T next() throw( lang::exceptions::NoSuchElementException ) = 0;
+
+        /**
+         * Returns true if the iteration has more elements.  Returns false if
+         * the next call to next would result in an NoSuchElementException to
+         * be thrown.
+         */
+        virtual bool hasNext() const = 0;
+
+        /**
+         * Removes from the underlying collection the last element returned
+         * by the iterator (optional operation). This method can be called
+         * only once per call to next. The behavior of an iterator is
+         * unspecified if the underlying collection is modified while the
+         * iteration is in progress in any way other than by calling this
+         * method.
+         * @throws UnsupportedOperationException - if the remove  operation
+         *         is not supported by this Iterator.
+         * @throws IllegalStateException - if the next method has not yet been
+         *         called, or the remove method has already been called after
+         *         the last call to the next  method.
+         */
+        virtual void remove() throw ( lang::exceptions::IllegalStateException,
+                                      lang::exceptions::UnsupportedOperationException ) = 0;
+
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_ITERATOR_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_UTIL_MAP_H_
+#define _DECAF_UTIL_MAP_H_
+
+#include <map>
+#include <vector>
+#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/util/concurrent/Synchronizable.h>
+#include <decaf/util/concurrent/Mutex.h>
+
+namespace decaf{
+namespace util{
+
+    /**
+     * Map template that wraps around a std::map to provide
+     * a more user-friendly interface and to provide common
+     * functions that do not exist in std::map.
+     */
+    template <typename K, typename V> class Map : public concurrent::Synchronizable
+    {
+    private:
+
+        std::map<K,V> valueMap;
+        concurrent::Mutex mutex;
+
+    public:
+
+        /**
+         * Default constructor - does nothing.
+         */
+        Map() {}
+
+        /**
+         * Copy constructor - copies the content of the given map into this
+         * one.
+         * @param source The source map.
+         */
+        Map( const Map& source ) : concurrent::Synchronizable() {
+            copy( source );
+        }
+
+        virtual ~Map() {}
+
+        /**
+         * Comparison, equality is dependant on the method of determining
+         * if the element are equal.
+         * @param source - Map to compare to this one.
+         * @returns true if the Map passed is equal in value to this one.
+         */
+        virtual bool equals( const Map& source ) const {
+            return this->valueMap == source.valueMap;
+        }
+
+        /**
+         * Copies the content of the source map into this map.  Erases
+         * all existing data in this map.
+         * @param source The source object to copy from.
+         */
+        virtual void copy( const Map& source ) {
+
+            // Erase the content of this object, and copy from the source
+            // all the elements.  We access source's private map since we
+            // are also a Map, this saves us a lot of time.
+            valueMap.clear();
+            valueMap.insert( source.valueMap.begin(), source.valueMap.end() );
+        }
+
+        /**
+         * Removes all keys and values from this map.
+         */
+        virtual void clear() {
+            valueMap.clear();
+        }
+
+        /**
+         * Indicates whether or this map contains a value for the
+         * given key.
+         * @param key The key to look up.
+         * @return true if this map contains the value, otherwise false.
+         */
+        virtual bool containsKey( const K& key ) const {
+            typename std::map<K,V>::const_iterator iter;
+            iter = valueMap.find(key);
+            return iter != valueMap.end();
+        }
+
+        /**
+         * Indicates whether or this map contains a value for the
+         * given value, i.e. they are equal, this is done by operator==
+         * so the types must pass equivalence testing in this manner.
+         * @param value The Value to look up.
+         * @return true if this map contains the value, otherwise false.
+         */
+        virtual bool containsValue( const V& value ) const {
+
+            if( valueMap.empty() ){
+                return false;
+            }
+
+            typename std::map<K,V>::const_iterator iter = valueMap.begin();
+            for( ; iter != valueMap.end(); ++iter ){
+                if( (*iter).second == value ) {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
+        /**
+         * @return if the Map contains any element or not, TRUE or FALSE
+         */
+        virtual bool isEmpty() const {
+            return valueMap.empty();
+        }
+
+        /**
+         * @return The number of elements (key/value pairs) in this map.
+         */
+        virtual std::size_t size() const {
+            return valueMap.size();
+        }
+
+        /**
+         * Gets the value for the specified key.
+         * @param key The search key.
+         * @return The value for the given key.
+         * @throws activemq::exceptions::NoSuchElementException
+         */
+        virtual V getValue( const K& key ) const
+            throw( lang::exceptions::NoSuchElementException ) {
+
+            typename std::map<K,V>::const_iterator iter;
+            iter = valueMap.find(key);
+            if( iter == valueMap.end() ){
+                throw lang::exceptions::NoSuchElementException( __FILE__,
+                    __LINE__,
+                    "Key does not exist in map" );
+            }
+
+            return iter->second;
+        }
+
+        /**
+         * Sets the value for the specified key.
+         * @param key The target key.
+         * @param value The value to be set.
+         */
+        virtual void setValue( const K& key, V value ) {
+            valueMap[key] = value;
+        }
+
+        /**
+         * Removes the value (key/value pair) for the specified key from
+         * the map.
+         * @param key The search key.
+         */
+        virtual void remove( const K& key ) {
+            valueMap.erase( key );
+        }
+
+        /**
+         * @return the entire set of keys in this map as a std::vector.
+         */
+        virtual std::vector<K> getKeys() const{
+            std::vector<K> keys( valueMap.size() );
+
+            typename std::map<K,V>::const_iterator iter;
+            iter=valueMap.begin();
+            for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
+                keys[ix] = iter->first;
+            }
+
+            return keys;
+        }
+
+        /**
+         * @return the entire set of values in this map as a std::vector.
+         */
+        virtual std::vector<V> getValues() const {
+            std::vector<V> values( valueMap.size() );
+
+            typename std::map<K,V>::const_iterator iter;
+            iter=valueMap.begin();
+            for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
+                values[ix] = iter->second;
+            }
+
+            return values;
+        }
+
+    public:     // Methods from Synchronizable
+
+        /**
+         * Locks the object.
+         * @throws ActiveMQException
+         */
+        virtual void lock() throw( lang::Exception ) {
+            mutex.lock();
+        }
+
+        /**
+         * Unlocks the object.
+         * @throws ActiveMQException
+         */
+        virtual void unlock() throw( lang::Exception ) {
+            mutex.unlock();
+        }
+
+        /**
+         * Waits on a signal from this object, which is generated
+         * by a call to Notify.  Must have this object locked before
+         * calling.
+         * @throws ActiveMQException
+         */
+        virtual void wait() throw( lang::Exception ) {
+            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 millisecs the time in millisecsonds to wait, or
+         * WAIT_INIFINITE
+         * @throws ActiveMQException
+         */
+        virtual void wait( unsigned long millisecs )
+            throw( lang::Exception ) {
+            mutex.wait(millisecs);
+        }
+
+        /**
+         * Signals a waiter on this object that it can now wake
+         * up and continue.  Must have this object locked before
+         * calling.
+         * @throws ActiveMQException
+         */
+        virtual void notify() throw( lang::Exception ) {
+            mutex.notify();
+        }
+
+        /**
+         * Signals the waiters on this object that it can now wake
+         * up and continue.  Must have this object locked before
+         * calling.
+         * @throws ActiveMQException
+         */
+        virtual void notifyAll() throw( lang::Exception ) {
+            mutex.notifyAll();
+        }
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_MAP_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/Properties.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Properties.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Properties.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Properties.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 _DECAF_UTIL_PROPERTIES_H_
+#define _DECAF_UTIL_PROPERTIES_H_
+
+#include <map>
+#include <vector>
+#include <string>
+#include <sstream>
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+
+    /**
+     * Java-like properties class for mapping string names to string values.
+     */
+    class DECAF_API Properties{
+    private:
+
+        std::map< std::string, std::string > properties;
+
+    public:
+
+        virtual ~Properties(){}
+
+        /**
+         * Returns true if the properties object is empty
+         * @return true if empty
+         */
+        virtual bool isEmpty() const {
+            return properties.empty();
+        }
+
+        /**
+         * 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;
+            //properties.insert( std::make_pair( name, value ) );
+        }
+
+        /**
+         * Check to see if the Property exists in the set
+         * @param name - property name to check for in this properties 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;
+        }
+
+        /**
+         * Removes the property with the given name.
+         * @param name the name of the property to remove.
+         */
+        virtual void remove( const std::string& name ){
+            properties.erase( name );
+        }
+
+        /**
+         * 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.begin(), properties.end() );
+
+            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();
+            this->properties = source->properties;
+        }
+
+        /**
+         * Clones this object.
+         * @returns a replica of this object.
+         */
+        virtual Properties* clone() const{
+
+            Properties* props = new Properties();
+
+            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 activemq::util::Properties:" << std::endl;
+
+            for( iter = properties.begin(); iter != properties.end(); ++iter ){
+                stream << " properties[" << iter->first << "] = "
+                       << iter->second << std::endl;
+            }
+
+            stream << "End Class activemq::util::Properties:" << std::endl;
+
+            return stream.str();
+        }
+
+    };
+
+}}
+
+#endif /*_DECAF_UTIL_PROPERTIES_H_*/



Mime
View raw message