1 /* 2 * JAXRTest.java 3 * 4 * Created on April 8, 2002, 10:53 AM 5 * 6 * $Header: /cvsroot/ebxmlrr/jaxr/test/com/sun/xml/registry/ebxml/JAXRTest.java,v 1.5 2002/11/09 01:44:09 jasilva Exp $ 7 * 8 */ 9 10 package com.sun.xml.registry.ebxml; 11 12 import javax.xml.registry.*; 13 14 import java.util.*; 15 16 17 /*** 18 * Common base class for all JAXR tests 19 * 20 * To use the JAAS authentication mechanisms you must create a file ~/.java.login.config with following content 21 * 22 * JAXRTest { 23 * com.sun.security.auth.module.KeyStoreLoginModule required debug=true keyStoreURL="file://c:/Docume~1/najmi/jaxr-ebxml/security/keystore.jks"; 24 * }; 25 * 26 * Note that the keyStoreURL must point to wherever your keySTore file is. The ~ home directory is teh one pointed to the 27 * user.home System property. On windows 2000 it is file://c:/Docume~1/<uour login>. 28 * 29 * The password dialog usually takes a little while to pop up and does not always appear on top of other windows. 30 * 31 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 32 */ 33 public abstract class JAXRTest { 34 35 Connection connection = null; 36 RegistryService service = null; 37 BusinessLifeCycleManager lcm = null; 38 BusinessQueryManager bqm = null; 39 DeclarativeQueryManager dqm = null; 40 41 private JAXRTest() { 42 //Not allowed to be used 43 } 44 45 /*** Creates new JAXRTest */ 46 public JAXRTest(Properties connectionProps) throws JAXRException { 47 createConnection(connectionProps); 48 } 49 50 /*** 51 * Makes a connection to a JAXR Registry. 52 * 53 * @param url The URL of the registry. 54 */ 55 public void createConnection(Properties connectionProps) throws JAXRException { 56 if (connectionProps == null) { 57 connectionProps = new Properties(); 58 connectionProps.put("javax.xml.registry.queryManagerURL", 59 "http://localhost:8080/ebxmlrr/registry/soap"); //http://registry.csis.hku.hk:8201/ebxmlrr/registry/soap 60 } 61 62 ConnectionFactory connFactory = getConnectionFactory(connectionProps); 63 connFactory.setProperties(connectionProps); 64 connection = connFactory.createConnection(); 65 service = connection.getRegistryService(); 66 67 bqm = service.getBusinessQueryManager(); 68 dqm = service.getDeclarativeQueryManager(); 69 lcm = service.getBusinessLifeCycleManager(); 70 } 71 72 private ConnectionFactory getConnectionFactory(Properties connectionProps) throws JAXRException { 73 //Get factory class 74 String factoryClass = System.getProperty("javax.xml.registry.ConnectionFactoryClass"); 75 if (factoryClass == null) { 76 String url = (String)connectionProps.get("javax.xml.registry.queryManagerURL"); 77 if (url == null) { 78 throw new JAXRException("Connection property javax.xml.registry.queryManagerURL not defined."); 79 } 80 81 //Choose provider based on hack for now. 82 if (url.toLowerCase().indexOf("uddi") >=0 ) { 83 System.setProperty("javax.xml.registry.ConnectionFactoryClass", "com.sun.xml.registry.uddi.ConnectionFactoryImpl"); 84 } 85 else { 86 System.setProperty("javax.xml.registry.ConnectionFactoryClass", "com.sun.xml.registry.ebxml.ConnectionFactoryImpl"); 87 } 88 } 89 90 ConnectionFactory connFactory = ConnectionFactory.newInstance(); 91 92 return connFactory; 93 } 94 95 }

This page was automatically generated by Maven