[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/security ...
Tom Elrod
tom.elrod at jboss.com
Thu Aug 10 11:39:18 EDT 2006
User: telrod
Date: 06/08/10 11:39:18
Modified: src/main/org/jboss/remoting/security SSLSocketBuilder.java
Log:
JBREM-564 - updated for system property to be used to set default socket factory implementation to be used.
Revision Changes Path
1.12 +41 -5 JBossRemoting/src/main/org/jboss/remoting/security/SSLSocketBuilder.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SSLSocketBuilder.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/security/SSLSocketBuilder.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- SSLSocketBuilder.java 7 Aug 2006 21:17:32 -0000 1.11
+++ SSLSocketBuilder.java 10 Aug 2006 15:39:18 -0000 1.12
@@ -22,6 +22,7 @@
package org.jboss.remoting.security;
import org.jboss.logging.Logger;
+import org.jboss.remoting.serialization.ClassLoaderUtility;
import org.jboss.remoting.util.socket.RemotingKeyManager;
import javax.net.ServerSocketFactory;
@@ -38,6 +39,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.KeyStore;
@@ -57,7 +59,7 @@
* @author <a href="mailto:mazz at jboss.com">John Mazzitelli</a>
* @author <a href="mailto:telrod at jboss.com">Tom Elrod</a>
*
- * @version $Revision: 1.11 $
+ * @version $Revision: 1.12 $
*/
public class SSLSocketBuilder implements SSLSocketBuilderMBean, Cloneable
{
@@ -222,6 +224,12 @@
*/
public static final String STANDARD_TRUST_STORE_PASSWORD = "javax.net.ssl.trustStorePassword";
+ /**
+ * System property key to define the fully qualified class name of default socket factory to use
+ * when not using custom config.
+ */
+ public static final String REMOTING_DEFAULT_SOCKET_FACTORY_CLASS = "org.jboss.remoting.defaultSocketFactory";
+
private SSLContext sslContextServerSocketFactory = null; // context that builds the server socket factories
private SSLContext sslContextSocketFactory = null; // context that builds the socket factories
private Provider provider = null;
@@ -381,10 +389,38 @@
{
SocketFactory sf = null;
- if( getUseSSLSocketFactory() )
+ if (getUseSSLSocketFactory())
+ {
+ String defaultFactoryName = System.getProperty(REMOTING_DEFAULT_SOCKET_FACTORY_CLASS);
+ if (defaultFactoryName != null)
+ {
+ try
+ {
+ Class sfClass = ClassLoaderUtility.loadClass(defaultFactoryName, SSLSocketBuilder.class);
+ Method m = sfClass.getMethod("getDefault", null);
+ if (m == null)
+ {
+ throw new RuntimeException(
+ "Could not create the socket factory "
+ + defaultFactoryName
+ + " because the class "
+ + sfClass
+ + " doesn't provide the getDefault method.");
+ }
+ sf = (SocketFactory) m.invoke(null, null);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(
+ "Could not create the socket factory "
+ + defaultFactoryName, ex);
+ }
+ }
+ if (sf == null)
{
sf = SSLSocketFactory.getDefault();
}
+ }
else
{
if (wrapper == null)
More information about the jboss-cvs-commits
mailing list