1 16 package org.apache.axis.components.net; 17 18 import org.apache.axis.AxisProperties; 19 import org.apache.axis.components.logger.LogFactory; 20 import org.apache.commons.logging.Log; 21 22 import java.util.Hashtable ; 23 24 30 public class SocketFactoryFactory { 31 32 33 protected static Log log = 34 LogFactory.getLog(SocketFactoryFactory.class.getName()); 35 36 37 private static Hashtable factories = new Hashtable (); 38 39 private static final Class classes[] = new Class [] { Hashtable .class }; 40 41 42 static { 43 AxisProperties.setClassOverrideProperty(SocketFactory.class, 44 "axis.socketFactory"); 45 46 AxisProperties.setClassDefault(SocketFactory.class, 47 "org.apache.axis.components.net.DefaultSocketFactory"); 48 49 AxisProperties.setClassOverrideProperty(SecureSocketFactory.class, 50 "axis.socketSecureFactory"); 51 52 AxisProperties.setClassDefault(SecureSocketFactory.class, 53 "org.apache.axis.components.net.JSSESocketFactory"); 54 } 55 56 64 public static synchronized SocketFactory getFactory(String protocol, 65 Hashtable attributes) { 66 SocketFactory theFactory = (SocketFactory)factories.get(protocol); 67 68 if (theFactory == null) { 69 Object objects[] = new Object [] { attributes }; 70 71 if (protocol.equalsIgnoreCase("http")) { 72 theFactory = (SocketFactory) 73 AxisProperties.newInstance(SocketFactory.class, classes, objects); 74 } else if (protocol.equalsIgnoreCase("https")) { 75 theFactory = (SecureSocketFactory) 76 AxisProperties.newInstance(SecureSocketFactory.class, classes, objects); 77 } 78 79 if (theFactory != null) { 80 factories.put(protocol, theFactory); 81 } 82 } 83 return theFactory; 84 } 85 } 86 | Popular Tags |