1 22 package javax.xml.registry; 23 24 import java.util.Collection ; 25 import java.util.Properties ; 26 27 56 public abstract class ConnectionFactory 57 { 58 private static final String SYS_PROP_NAME = 59 "javax.xml.registry.ConnectionFactoryClass"; 60 61 public static ConnectionFactory newInstance() throws JAXRException 62 { 63 String factoryName = null; 64 ConnectionFactory factory = null; 65 try 66 { 67 String defaultName = null; 68 factoryName = System.getProperty(SYS_PROP_NAME, defaultName); 69 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 70 Class factoryClass = loader.loadClass(factoryName); 71 factory = (ConnectionFactory ) factoryClass.newInstance(); 72 } 73 catch(Throwable e) 74 { 75 throw new JAXRException ("Failed to create instance of: "+factoryName, e); 76 } 77 return factory; 78 } 79 80 public ConnectionFactory() 81 { 82 } 83 84 public abstract Connection createConnection() 85 throws JAXRException ; 86 public abstract FederatedConnection createFederatedConnection(Collection connections) 87 throws JAXRException ; 88 89 public abstract Properties getProperties() 90 throws JAXRException ; 91 115 public abstract void setProperties(Properties factoryProps) 116 throws JAXRException ; 117 118 } 119 | Popular Tags |