1 28 29 30 package org.objectweb.corba.runtime; 31 32 35 public class FactoryFinderServiceImpl 36 extends org.omg.CORBA.LocalObject 37 implements FactoryFinderService 38 { 39 static final private String _class_name = "FactoryFinderServiceImpl"; 41 static final private String _service_id = FactoryFinderService.SERVICE_ID; 42 private java.util.Hashtable _factories; 43 44 public 46 FactoryFinderServiceImpl() 47 { 48 _factories = null; 50 } 51 52 56 static public SystemService 57 create_service() 58 { 59 return new FactoryFinderServiceImpl(); 60 } 61 62 66 final public void 67 system_configuration_complete(SystemConfiguration cfg) 68 { 69 _factories = new java.util.Hashtable (); 70 } 71 72 final public void 73 destroy() 74 { 75 SystemComponent[] facts = (SystemComponent[])_factories.values().toArray(new SystemComponent[0]); 77 for (int i=0;i<facts.length;i++) { 78 facts[i].destroy(); 79 } 80 81 _factories.clear(); 83 } 84 85 89 final public String 90 service_id() 91 { 92 return _service_id; 93 } 94 95 99 final public void 100 register_service_factory(String ssid, String location, String entrypt) 101 { 102 if (location!=null) { 104 TheClassLoader.addResource(location); 106 } 107 108 SystemFactory fact = (SystemFactory)TheClassLoader.newInstance(entrypt); 110 111 if (fact==null) { 113 final String opname = "register_service_factory"; 115 final String msg = "FAILED (factory not created)"; 116 TheLogger.error(_class_name, opname, msg); 117 } 118 119 _factories.put(ssid, fact); 121 } 122 123 final public SystemFactory 124 find_service_factory(String ssid) 125 { 126 return (SystemFactory)_factories.get(ssid); 127 } 128 } 129 | Popular Tags |