activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r946225 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main: ./ decaf/internal/net/ssl/ decaf/internal/net/ssl/openssl/ decaf/net/ssl/
Date Wed, 19 May 2010 15:39:08 GMT
Author: tabish
Date: Wed May 19 15:39:07 2010
New Revision: 946225

URL: http://svn.apache.org/viewvc?rev=946225&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-140

Implement the code supporting the SSLServerSocketFacory, and some more locking in some of the Create methods for SSL Socket factory classes.

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp   (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h   (with props)
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContextSpi.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Wed May 19 15:39:07 2010
@@ -491,6 +491,7 @@ cc_sources = \
     decaf/internal/net/URIEncoderDecoder.cpp \
     decaf/internal/net/URIHelper.cpp \
     decaf/internal/net/ssl/DefaultSSLContext.cpp \
+    decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp \
     decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp \
     decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp \
     decaf/internal/net/ssl/openssl/OpenSSLServerSocket.cpp \
@@ -1178,6 +1179,7 @@ h_sources = \
     decaf/internal/net/URIHelper.h \
     decaf/internal/net/URIType.h \
     decaf/internal/net/ssl/DefaultSSLContext.h \
+    decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h \
     decaf/internal/net/ssl/DefaultSSLSocketFactory.h \
     decaf/internal/net/ssl/openssl/OpenSSLContextSpi.h \
     decaf/internal/net/ssl/openssl/OpenSSLServerSocket.h \

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp?rev=946225&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp Wed May 19 15:39:07 2010
@@ -0,0 +1,74 @@
+/*
+ * 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 "DefaultSSLServerSocketFactory.h"
+
+#include <decaf/io/IOException.h>
+
+using namespace decaf;
+using namespace decaf::io;
+using namespace decaf::net;
+using namespace decaf::net::ssl;
+using namespace decaf::internal;
+using namespace decaf::internal::net;
+using namespace decaf::internal::net::ssl;
+
+////////////////////////////////////////////////////////////////////////////////
+DefaultSSLServerSocketFactory::DefaultSSLServerSocketFactory( const std::string& errorMessage ) :
+    SSLServerSocketFactory(), errorMessage( errorMessage ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+DefaultSSLServerSocketFactory::~DefaultSSLServerSocketFactory() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket* DefaultSSLServerSocketFactory::createServerSocket() {
+
+    throw IOException( __FILE__, __LINE__, errorMessage.c_str() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket* DefaultSSLServerSocketFactory::createServerSocket( int port DECAF_UNUSED ) {
+
+    throw IOException( __FILE__, __LINE__, errorMessage.c_str() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket* DefaultSSLServerSocketFactory::createServerSocket( int port DECAF_UNUSED, int backlog DECAF_UNUSED ) {
+
+    throw IOException( __FILE__, __LINE__, errorMessage.c_str() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket* DefaultSSLServerSocketFactory::createServerSocket( int port DECAF_UNUSED,
+                                                                 int backlog DECAF_UNUSED,
+                                                                 const InetAddress* address DECAF_UNUSED ) {
+
+    throw IOException( __FILE__, __LINE__, errorMessage.c_str() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> DefaultSSLServerSocketFactory::getDefaultCipherSuites() {
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> DefaultSSLServerSocketFactory::getSupportedCipherSuites() {
+    return std::vector<std::string>();
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h?rev=946225&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h Wed May 19 15:39:07 2010
@@ -0,0 +1,83 @@
+/*
+ * 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_INTERNAL_NET_DEFAULTSSLSERVERSOCKETFACTORY_H_
+#define _DECAF_INTERNAL_NET_DEFAULTSSLSERVERSOCKETFACTORY_H_
+
+#include <decaf/util/Config.h>
+
+#include <decaf/net/ssl/SSLServerSocketFactory.h>
+
+namespace decaf {
+namespace internal {
+namespace net {
+namespace ssl {
+
+    /**
+     * Default implementation of the SSLServerSocketFactory, this factory throws an Exception
+     * from all its create methods to indicate that SSL is not supported, this factory is
+     * used when OpenSSL is not enabled in the builds.
+     *
+     * @since 1.0
+     */
+    class DECAF_API DefaultSSLServerSocketFactory : public decaf::net::ssl::SSLServerSocketFactory {
+    private:
+
+        std::string errorMessage;
+
+    public:
+
+        DefaultSSLServerSocketFactory( const std::string& errorMessage );
+
+        virtual ~DefaultSSLServerSocketFactory();
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocket* createServerSocket();
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocket* createServerSocket( int port );
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocket* createServerSocket( int port, int backlog );
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocket* createServerSocket( int port, int backlog,
+                                                              const decaf::net::InetAddress* address );
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual std::vector<std::string> getDefaultCipherSuites();
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual std::vector<std::string> getSupportedCipherSuites();
+
+    };
+
+}}}}
+
+#endif /* _DECAF_INTERNAL_NET_DEFAULTSSLSERVERSOCKETFACTORY_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp Wed May 19 15:39:07 2010
@@ -28,6 +28,7 @@
 #include <decaf/util/concurrent/Mutex.h>
 #include <decaf/internal/net/ssl/openssl/OpenSSLSocketException.h>
 #include <decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.h>
+#include <decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.h>
 
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
@@ -70,6 +71,7 @@ namespace openssl {
 
         Mutex monitor;
         Pointer<SocketFactory> clientSocketFactory;
+        Pointer<ServerSocketFactory> serverSocketFactory;
         Pointer<SecureRandom> random;
         std::string password;
 
@@ -260,6 +262,24 @@ SocketFactory* OpenSSLContextSpi::provid
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+ServerSocketFactory* OpenSSLContextSpi::providerGetServerSocketFactory() {
+
+    try{
+
+        synchronized( &( this->data->monitor ) ) {
+            if( this->data->serverSocketFactory == NULL ) {
+                this->data->serverSocketFactory.reset( new OpenSSLServerSocketFactory( this ) );
+            }
+        }
+
+        return this->data->serverSocketFactory.get();
+    }
+    DECAF_CATCH_RETHROW( IllegalStateException )
+    DECAF_CATCH_RETHROW( Exception )
+    DECAF_CATCHALL_THROW( Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
 std::vector<std::string> OpenSSLContextSpi::getDefaultCipherSuites() {
 
     return std::vector<std::string>();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.h Wed May 19 15:39:07 2010
@@ -56,6 +56,11 @@ namespace openssl {
          */
         virtual decaf::net::SocketFactory* providerGetSocketFactory();
 
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocketFactory* providerGetServerSocketFactory();
+
     private:
 
         friend class OpenSSLSocket;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.cpp Wed May 19 15:39:07 2010
@@ -41,9 +41,45 @@ using namespace decaf::internal::net::ss
 using namespace decaf::internal::net::ssl::openssl;
 
 ////////////////////////////////////////////////////////////////////////////////
-OpenSSLServerSocketFactory::OpenSSLServerSocketFactory() {
+OpenSSLServerSocketFactory::OpenSSLServerSocketFactory( OpenSSLContextSpi* parent ) :
+    SSLServerSocketFactory(), parent( parent ) {
+
+    if( parent == NULL ) {
+        throw NullPointerException(
+            __FILE__, __LINE__, "Parent Pointer was NULL." );
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 OpenSSLServerSocketFactory::~OpenSSLServerSocketFactory() {
 }
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket* OpenSSLServerSocketFactory::createServerSocket() {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket* OpenSSLServerSocketFactory::createServerSocket( int port ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket* OpenSSLServerSocketFactory::createServerSocket( int port, int backlog ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket* OpenSSLServerSocketFactory::createServerSocket( int port, int backlog, const InetAddress* address ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLServerSocketFactory::getDefaultCipherSuites() {
+    return std::vector<std::string>();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::vector<std::string> OpenSSLServerSocketFactory::getSupportedCipherSuites() {
+    return std::vector<std::string>();
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLServerSocketFactory.h Wed May 19 15:39:07 2010
@@ -20,18 +20,63 @@
 
 #include <decaf/util/Config.h>
 
+#include <decaf/net/ssl/SSLServerSocketFactory.h>
+
 namespace decaf {
 namespace internal {
 namespace net {
 namespace ssl {
 namespace openssl {
 
-    class DECAF_API OpenSSLServerSocketFactory {
+    class OpenSSLContextSpi;
+
+    /**
+     * SSLServerSocketFactory that creates Server Sockets that use OpenSSL.
+     *
+     * @since 1.0
+     */
+    class DECAF_API OpenSSLServerSocketFactory : public decaf::net::ssl::SSLServerSocketFactory {
+    private:
+
+        OpenSSLContextSpi* parent;
+
     public:
 
-        OpenSSLServerSocketFactory();
+        OpenSSLServerSocketFactory( OpenSSLContextSpi* parent );
+
         virtual ~OpenSSLServerSocketFactory();
 
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocket* createServerSocket();
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocket* createServerSocket( int port );
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocket* createServerSocket( int port, int backlog );
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual decaf::net::ServerSocket* createServerSocket( int port, int backlog,
+                                                              const decaf::net::InetAddress* address );
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual std::vector<std::string> getDefaultCipherSuites();
+
+        /**
+         * {@inheritDoc}
+         */
+        virtual std::vector<std::string> getSupportedCipherSuites();
+
     };
 
 }}}}}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp Wed May 19 15:39:07 2010
@@ -308,24 +308,6 @@ void OpenSSLSocket::setEnabledProtocols(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool OpenSSLSocket::getWantClientAuth() const {
-    return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void OpenSSLSocket::setWantClientAuth( bool value DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool OpenSSLSocket::getNeedClientAuth() const {
-    return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void OpenSSLSocket::setNeedClientAuth( bool value DECAF_UNUSED ) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
 int OpenSSLSocket::read( unsigned char* buffer, int size, int offset, int length ) {
 
     try{

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.h Wed May 19 15:39:07 2010
@@ -133,26 +133,6 @@ namespace openssl {
          */
         virtual void setEnabledProtocols( const std::vector<std::string>& protocols );
 
-        /**
-         * {@inheritDoc}
-         */
-        virtual bool getWantClientAuth() const;
-
-        /**
-         * {@inheritDoc}
-         */
-        virtual void setWantClientAuth( bool value );
-
-        /**
-         * {@inheritDoc}
-         */
-        virtual bool getNeedClientAuth() const;
-
-        /**
-         * {@inheritDoc}
-         */
-        virtual void setNeedClientAuth( bool value );
-
     public:
 
         /**

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketFactory.cpp Wed May 19 15:39:07 2010
@@ -106,7 +106,7 @@ Socket* OpenSSLSocketFactory::createSock
 
 ////////////////////////////////////////////////////////////////////////////////
 Socket* OpenSSLSocketFactory::createSocket( const std::string& hostname, int port,
-                                            const InetAddress* ifAddress, int localPort  )
+                                            const InetAddress* ifAddress, int localPort )
     throw( decaf::io::IOException, decaf::net::UnknownHostException ) {
 
     try{

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.cpp Wed May 19 15:39:07 2010
@@ -91,6 +91,16 @@ SocketFactory* SSLContext::getSocketFact
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+ServerSocketFactory* SSLContext::getServerSocketFactory() {
+    try{
+        return this->contextImpl->providerGetServerSocketFactory();
+    }
+    DECAF_CATCH_RETHROW( IllegalStateException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IllegalStateException)
+    DECAF_CATCHALL_THROW( IllegalStateException)
+}
+
+////////////////////////////////////////////////////////////////////////////////
 SSLParameters* SSLContext::getDefaultSSLParameters() {
     try{
         return this->contextImpl->providerGetDefaultSSLParameters();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContext.h Wed May 19 15:39:07 2010
@@ -85,6 +85,17 @@ namespace ssl {
         SocketFactory* getSocketFactory();
 
         /**
+         * Returns an ServerSocketFactory instance for use with this Context, the ServerSocketFactory
+         * is owned by the Context and should not be deleted by the caller.
+         *
+         * @returns a pointer to this SSLContext's ServerSocketFactory for creating SSLServerSocket objects.
+         *
+         * @throws IllegalStateException if the SSLContextSpi requires initialization but it
+         *         has not yet been initialized.
+         */
+        ServerSocketFactory* getServerSocketFactory();
+
+        /**
          * @return a new instance of an SSLParameters object containing the default set
          *         of settings for this SSLContext.
          *

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContextSpi.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContextSpi.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContextSpi.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLContextSpi.h Wed May 19 15:39:07 2010
@@ -26,6 +26,7 @@ namespace decaf {
 namespace net {
 
     class SocketFactory;
+    class ServerSocketFactory;
 
 namespace ssl {
 
@@ -90,6 +91,18 @@ namespace ssl {
          */
         virtual SocketFactory* providerGetSocketFactory() = 0;
 
+        /**
+         * Returns a ServerSocketFactory instance that can be used to create new SSLServerSocket objects.
+         *
+         * The ServerSocketFactory is owned by the Service Provider and should not be destroyed by the caller.
+         *
+         * @returns SocketFactory instance that can be used to create new SSLServerSockets.
+         *
+         * @throws IllegalStateException if the SSLContextSpi object requires initialization but
+         *         has not been initialized yet.
+         */
+        virtual ServerSocketFactory* providerGetServerSocketFactory() = 0;
+
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.cpp Wed May 19 15:39:07 2010
@@ -31,5 +31,17 @@ SSLServerSocket::SSLServerSocket() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+SSLServerSocket::SSLServerSocket( int port ) : ServerSocket( port ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SSLServerSocket::SSLServerSocket( int port, int backlog ) : ServerSocket( port, backlog ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SSLServerSocket::SSLServerSocket( int port, int backlog, const InetAddress* address ) : ServerSocket( port, backlog, address ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
 SSLServerSocket::~SSLServerSocket() {
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocket.h Wed May 19 15:39:07 2010
@@ -20,20 +20,180 @@
 
 #include <decaf/util/Config.h>
 
+#include <decaf/net/ServerSocket.h>
+
 namespace decaf {
 namespace net {
 namespace ssl {
 
     /**
+     * Represents a server socket that is used to accept connections from clients using the
+     * Secure Sockets protocol or the Top Level Security protocol.  The main function of this
+     * class is to create SSLSocket objects by accepting connections from client sockets over SSL.
      *
      * @since 1.0
      */
-    class DECAF_API SSLServerSocket {
-    public:
+    class DECAF_API SSLServerSocket : public ServerSocket {
+    protected:
 
+        /**
+         * Creates a non-bound server socket.
+         */
         SSLServerSocket();
 
+        /**
+         * Creates a new ServerSocket bound to the specified port, if the value of port is 0, then
+         * any free port is chosen.
+         *
+         * When this constructor is called the size of the backlog queue is set at 50, connections
+         * that arrive after the backlog has been reached are refused.
+         *
+         * If a SocketImplFactory is registered then the createSocketImpl method on the factory
+         * will be called otherwise a default SocketImpl is created.
+         *
+         * @param port
+         *      The port to bind the ServerSocket to.
+         *
+         * @throws IOException if there is an I/O error while performing this operation.
+         * @throws IllegalArgumentException if the port value is negative or greater than 65535.
+         */
+        SSLServerSocket( int port );
+
+        /**
+         * Creates a new ServerSocket bound to the specified port, if the value of port is 0, then
+         * any free port is chosen.
+         *
+         * When this constructor is called the size of the backlog queue is set at backlog, connections
+         * that arrive after the backlog has been reached are refused.  If backlog is zero or negative
+         * then the default backlog value of 50 is used.
+         *
+         * If a SocketImplFactory is registered then the createSocketImpl method on the factory
+         * will be called otherwise a default SocketImpl is created.
+         *
+         * @param port
+         *      The port to bind the ServerSocket to.
+         * @param backlog
+         *      The the number of incoming connection attempts to queue before connections are refused.
+         *
+         * @throws IOException if there is an I/O error while performing this operation.
+         * @throws IllegalArgumentException if the port value is negative or greater than 65535.
+         */
+        SSLServerSocket( int port, int backlog );
+
+        /**
+         * Creates a new ServerSocket bound to the specified port, if the value of port is 0, then
+         * any free port is chosen.  If the value of the ifAddress is empty or NULL then the ANY address
+         * is used.
+         *
+         * When this constructor is called the size of the backlog queue is set at backlog, connections
+         * that arrive after the backlog has been reached are refused.  If backlog is zero or negative
+         * then the default backlog value of 50 is used.
+         *
+         * If a SocketImplFactory is registered then the createSocketImpl method on the factory
+         * will be called otherwise a default SocketImpl is created.
+         *
+         * @param port
+         *      The port to bind the ServerSocket to.
+         * @param backlog
+         *      The the number of incoming connection attempts to queue before connections are refused.
+         * @param ifAddress
+         *      The IP Address to bind to on the local machine.
+         *
+         * @throws IOException if there is an I/O error while performing this operation.
+         * @throws IllegalArgumentException if the port value is negative or greater than 65535.
+         */
+        SSLServerSocket( int port, int backlog, const decaf::net::InetAddress* address );
+
+    public:
+
         virtual ~SSLServerSocket();
+
+        /**
+         * Gets a vector containing the names of all the cipher suites that are supported by this
+         * SSLServerSocket.  Normally not all of these cipher suites will be enabled on the Socket.
+         *
+         * @returns a vector containing the names of all the supported cipher suites.
+         */
+        virtual std::vector<std::string> getSupportedCipherSuites() const = 0;
+
+        /**
+         * Gets a vector containing the names of all the protocols that could be enabled for
+         * this SSLServerSocket instance.
+         *
+         * @returns a vector containing the names of all the supported protocols.
+         */
+        virtual std::vector<std::string> getSupportedProtocols() const = 0;
+
+        /**
+         * Returns a vector containing the names of all the currently enabled Cipher Suites for
+         * this SSLServerSocket.
+         *
+         * @return vector of the names of all enabled Cipher Suites.
+         */
+        virtual std::vector<std::string> getEnabledCipherSuites() const = 0;
+
+        /**
+         * Sets the Cipher Suites that are to be enabled on the SSLServerSocket connection.  Each of the
+         * named Cipher Suites must appear in the list of supported cipher suites for this connection
+         * or an exception will be thrown.
+         *
+         * @param suites
+         *      An Vector of names for all the Cipher Suites that are to be enabled.
+         *
+         * @throws IllegalArgumentException if the vector is empty or one of the names is invalid.
+         */
+        virtual void setEnabledCipherSuites( const std::vector<std::string>& suites ) = 0;
+
+        /**
+         * Returns a vector containing the names of all the currently enabled Protocols for
+         * this SSLServerSocket.
+         *
+         * @return vector of the names of all enabled Protocols.
+         */
+        virtual std::vector<std::string> getEnabledProtocols() const = 0;
+
+        /**
+         * Sets the Protocols that are to be enabled on the SSLServerSocket connection.  Each of the
+         * named Protocols must appear in the list of supported protocols suites for this connection
+         * or an exception will be thrown.
+         *
+         * @param protocols
+         *      An Vector of names for all the Protocols that are to be enabled.
+         *
+         * @throws IllegalArgumentException if the vector is empty or one of the names is invalid.
+         */
+        virtual void setEnabledProtocols( const std::vector<std::string>& protocols ) = 0;
+
+        /**
+         * @returns true if the Socket request client Authentication.
+         */
+        virtual bool getWantClientAuth() const = 0;
+
+        /**
+         * Sets whether or not this Socket will request Client Authentication.  If set to true the
+         * Socket (when used in server mode) will request that the client authenticate itself, if the
+         * client doesn't send authentication the socket will still allow negotiation to continue.
+         *
+         * @param value
+         *      Whether the server socket should request client authentication.
+         */
+        virtual void setWantClientAuth( bool value ) = 0;
+
+        /**
+         * @returns true if the Socket requires client Authentication.
+         */
+        virtual bool getNeedClientAuth() const = 0;
+
+        /**
+         * Sets whether or not this Socket will require Client Authentication.  If set to true the
+         * Socket (when used in server mode) will require that the client authenticate itself, if the
+         * client doesn't send authentication the socket will not allow negotiation to continue.
+         *
+         * @param value
+         *      Whether the server socket should require client authentication.
+         */
+        virtual void setNeedClientAuth( bool value ) = 0;
+
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.cpp Wed May 19 15:39:07 2010
@@ -19,10 +19,20 @@
 
 #include <decaf/io/IOException.h>
 
+#include <decaf/internal/net/Network.h>
+
+#include <decaf/internal/net/ssl/DefaultSSLContext.h>
+#include <decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h>
+
 using namespace decaf;
 using namespace decaf::net;
 using namespace decaf::net::ssl;
 using namespace decaf::lang;
+using namespace decaf::internal::net;
+using namespace decaf::internal::net::ssl;
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocketFactory* SSLServerSocketFactory::defaultFactory = NULL;
 
 ////////////////////////////////////////////////////////////////////////////////
 SSLServerSocketFactory::SSLServerSocketFactory() {
@@ -32,3 +42,34 @@ SSLServerSocketFactory::SSLServerSocketF
 SSLServerSocketFactory::~SSLServerSocketFactory() {
 }
 
+////////////////////////////////////////////////////////////////////////////////
+ServerSocketFactory* SSLServerSocketFactory::getDefault() {
+
+    if( defaultFactory != NULL ) {
+        return defaultFactory;
+    }
+
+    Network* netRuntime = Network::getNetworkRuntime();
+
+    synchronized( netRuntime->getRuntimeLock() ) {
+
+        // Check the DefaultSSLContext to see if any SSL Providers are enabled
+        SSLContext* context = DefaultSSLContext::getContext();
+        if( context != NULL ) {
+
+            // The SSLContext owns the Factory returned here, no need to manage it.
+            defaultFactory = context->getServerSocketFactory();
+        }
+
+        // Non found, use the non-functional default one.
+        if( defaultFactory == NULL ) {
+            defaultFactory = new DefaultSSLServerSocketFactory( "SSL Support is not enabled in this build." );
+
+            // Since we created this one we need to make sure it is destroyed when the Network
+            // Runtime is shutdown.
+            netRuntime->addAsResource( defaultFactory );
+        }
+    }
+
+    return defaultFactory;
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLServerSocketFactory.h Wed May 19 15:39:07 2010
@@ -30,16 +30,60 @@ namespace net {
 namespace ssl {
 
     /**
+     * Factory class interface that provides methods to create SSL Server Sockets.
      *
      * @since 1.0
      */
-    class DECAF_API SSLServerSocketFactory {
-    public:
+    class DECAF_API SSLServerSocketFactory : public decaf::net::ServerSocketFactory {
+    private:
+
+        static ServerSocketFactory* defaultFactory;
+
+    protected:
 
         SSLServerSocketFactory();
 
+    public:
+
         virtual ~SSLServerSocketFactory();
 
+        /**
+         * Returns the current default SSL ServerSocketFactory, the factory is returned as a pointer
+         * however the caller does not own this pointer and should not delete it.
+         *
+         * This method returns SSLContext::getDefault()->getServerSocketFactory(). If that call fails,
+         * a non-functional factory is returned.
+         *
+         * @returns the default SSL ServerSocketFactory pointer.
+         *
+         * @see decaf::net::ssl::SSLContext::getDefault()
+         */
+        static ServerSocketFactory* getDefault();
+
+        /**
+         * Returns the list of cipher suites which are enabled by default. Unless a different list
+         * is enabled, handshaking on an SSL connection will use one of these cipher suites. The
+         * minimum quality of service for these defaults requires confidentiality protection and
+         * server authentication (that is, no anonymous cipher suites).
+         *
+         * @returns an STL vector containing the list of cipher suites enabled by default.
+         *
+         * @see getSupportedCipherSuites()
+         */
+        virtual std::vector<std::string> getDefaultCipherSuites() = 0;
+
+        /**
+         * Returns the names of the cipher suites which could be enabled for use on an SSL connection.
+         * Normally, only a subset of these will actually be enabled by default, since this list may
+         * include cipher suites which do not meet quality of service requirements for those defaults.
+         * Such cipher suites are useful in specialized applications.
+         *
+         * @returns an STL vector containing the list of supported cipher suites.
+         *
+         * @see getDefaultCipherSuites()
+         */
+        virtual std::vector<std::string> getSupportedCipherSuites() = 0;
+
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.cpp Wed May 19 15:39:07 2010
@@ -39,9 +39,6 @@ SSLParameters SSLSocket::getSSLParameter
     SSLParameters params( this->getEnabledCipherSuites(),
                           this->getEnabledProtocols() );
 
-    params.setWantClientAuth( this->getWantClientAuth() );
-    params.setNeedClientAuth( this->getNeedClientAuth() );
-
     return params;
 }
 
@@ -57,13 +54,6 @@ void SSLSocket::setSSLParameters( const 
         if( !value.getProtocols().empty() ) {
             this->setEnabledProtocols( value.getProtocols() );
         }
-
-        if( value.getWantClientAuth() || value.getNeedClientAuth() ) {
-            this->setNeedClientAuth( value.getNeedClientAuth() );
-            this->setWantClientAuth( value.getWantClientAuth() );
-        } else {
-            this->setWantClientAuth( false );
-        }
     }
     DECAF_CATCH_RETHROW( IllegalArgumentException )
     DECAF_CATCH_EXCEPTION_CONVERT( Exception, IllegalArgumentException )

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocket.h Wed May 19 15:39:07 2010
@@ -124,36 +124,6 @@ namespace ssl {
          */
         virtual void setSSLParameters( const SSLParameters& value );
 
-        /**
-         * @returns true if the Socket request client Authentication.
-         */
-        virtual bool getWantClientAuth() const = 0;
-
-        /**
-         * Sets whether or not this Socket will request Client Authentication.  If set to true the
-         * Socket (when used in server mode) will request that the client authenticate itself, if the
-         * client doesn't send authentication the socket will still allow negotiation to continue.
-         *
-         * @param value
-         *      Whether the server socket should request client authentication.
-         */
-        virtual void setWantClientAuth( bool value ) = 0;
-
-        /**
-         * @returns true if the Socket requires client Authentication.
-         */
-        virtual bool getNeedClientAuth() const = 0;
-
-        /**
-         * Sets whether or not this Socket will require Client Authentication.  If set to true the
-         * Socket (when used in server mode) will require that the client authenticate itself, if the
-         * client doesn't send authentication the socket will not allow negotiation to continue.
-         *
-         * @param value
-         *      Whether the server socket should require client authentication.
-         */
-        virtual void setNeedClientAuth( bool value ) = 0;
-
     };
 
 }}}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.cpp Wed May 19 15:39:07 2010
@@ -42,27 +42,31 @@ SSLSocketFactory::~SSLSocketFactory() {
 ////////////////////////////////////////////////////////////////////////////////
 SocketFactory* SSLSocketFactory::getDefault() {
 
-    if( SSLSocketFactory::defaultSocketFactory != NULL ) {
-        return SSLSocketFactory::defaultSocketFactory;
+    if( defaultSocketFactory != NULL ) {
+        return defaultSocketFactory;
     }
 
-    // Check the DefaultSSLContext to see if any SSL Providers are enabled
-    SSLContext* context = DefaultSSLContext::getContext();
-    if( context != NULL ) {
+    Network* netRuntime = Network::getNetworkRuntime();
 
-        // The SSLContext owns the Factory returned here, no need to manage it.
-        SSLSocketFactory::defaultSocketFactory = context->getSocketFactory();
-    }
+    synchronized( netRuntime->getRuntimeLock() ) {
 
-    // Non found, use the non-functional default one.
-    if( SSLSocketFactory::defaultSocketFactory == NULL ) {
-        SSLSocketFactory::defaultSocketFactory =
-            new DefaultSSLSocketFactory( "SSL Support is not enabled in this build." );
-
-        // Since we created this one we need to make sure it is destroyed when the Network
-        // Runtime is shutdown.
-        Network::getNetworkRuntime()->addAsResource( SSLSocketFactory::defaultSocketFactory );
+        // Check the DefaultSSLContext to see if any SSL Providers are enabled
+        SSLContext* context = DefaultSSLContext::getContext();
+        if( context != NULL ) {
+
+            // The SSLContext owns the Factory returned here, no need to manage it.
+            defaultSocketFactory = context->getSocketFactory();
+        }
+
+        // Non found, use the non-functional default one.
+        if( defaultSocketFactory == NULL ) {
+            defaultSocketFactory = new DefaultSSLSocketFactory( "SSL Support is not enabled in this build." );
+
+            // Since we created this one we need to make sure it is destroyed when the Network
+            // Runtime is shutdown.
+            Network::getNetworkRuntime()->addAsResource( defaultSocketFactory );
+        }
     }
 
-    return SSLSocketFactory::defaultSocketFactory;
+    return defaultSocketFactory;
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h?rev=946225&r1=946224&r2=946225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ssl/SSLSocketFactory.h Wed May 19 15:39:07 2010
@@ -39,23 +39,20 @@ namespace ssl {
 
         static SocketFactory* defaultSocketFactory;
 
-    public:
+    protected:
 
         SSLSocketFactory();
 
+    public:
+
         virtual ~SSLSocketFactory();
 
         /**
          * Returns the current default SSL SocketFactory, the factory is returned as a pointer
          * however the caller does not own this pointer and should not delete it.
          *
-         * The first time this method is called, the system property "ssl.SocketFactory.provider"
-         * is examined. If it is non-null, a class by that name is loaded and instantiated. If
-         * that is successful and the object is an instance of SSLSocketFactory, it is made the
-         * default SSL socket factory.
-         *
-         * Otherwise, this method returns SSLContext::getDefault()->getSocketFactory(). If that
-         * call fails, an non-functional factory is returned.
+         * This method returns SSLContext::getDefault()->getSocketFactory(). If that call fails,
+         * a non-functional factory is returned.
          *
          * @returns the default SSL SocketFactory pointer.
          *



Mime
View raw message