1 package com.maverick.ssl; 2 3 public class SSLTransportFactory { 4 5 static Class impl; 6 7 static { 8 9 13 try { 14 Class.forName("javax.net.ssl.SSLEngine"); 15 impl = Class.forName("com.maverick.ssl.SSLTransportJCE"); 16 } catch(Throwable t) { 17 impl = SSLTransportImpl.class; 18 } 19 } 20 21 22 static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(SSLTransportFactory.class); 24 26 public static void setTransportImpl(Class impl) { 27 SSLTransportFactory.impl = impl; 28 } 29 30 31 public static SSLTransport newInstance() { 32 try { 33 return (SSLTransport) impl.newInstance(); 34 } catch(Throwable t) { 35 log.error("Failed to create SSLTransport instance", t); 37 return new SSLTransportImpl(); 39 } 40 } 41 42 } 43 | Popular Tags |