1 28 29 30 package org.objectweb.ccm.runtime; 31 32 import org.objectweb.corba.runtime.*; 33 34 40 public class ComponentRuntime 41 { 42 static private String _class_name = "ComponentRuntime"; 43 static private SlotFactory _slot_factory; 44 static private ContainerFactoryImpl _container_factory; 45 static private org.omg.CORBA.ORB _orb; 47 48 static { 49 _slot_factory = new SlotFactory(); 51 52 _container_factory = (ContainerFactoryImpl)ContainerFactoryImpl.create_factory(); 54 55 String entrypt = "org.objectweb.ccm.runtime.ComponentPOAFactoryImpl.create_factory"; 57 getFFService().register_service_factory(ComponentPOAService.SERVICE_ID, null, entrypt); 58 59 ORBFactory fact = (ORBFactory)getFFService().find_service_factory(ORBService.SERVICE_ID); 61 62 String tid = org.omg.Components.CookieHelper.id(); 64 org.omg.CORBA.portable.ValueFactory pfact = new CookieFactoryImpl(); 65 ValueFactory vfact = new ValueFactoryImpl(tid, pfact); 66 fact.add_default_valuefactory(vfact); 67 68 71 _orb = null; 72 } 73 74 78 static public FactoryFinderService 79 getFFService() 80 { 81 return org.objectweb.corba.runtime.Runtime.getFFService(); 82 } 83 84 static public RegistrationService 85 getRegistrationService() 86 { 87 return org.objectweb.corba.runtime.Runtime.getRegistrationService(); 88 } 89 90 static public MainThread 91 getMainThread() 92 { 93 return org.objectweb.corba.runtime.Runtime.getMainThread(); 94 } 95 96 static public SlotFactory 97 getSlotFactory() 98 { 99 return _slot_factory; 100 } 101 102 static public ContainerFactoryImpl 103 getContainerFactory() 104 { 105 return _container_factory; 106 } 107 108 static public org.omg.CORBA.ORB 109 getORB() 110 { 111 return _orb; 112 } 113 114 static public org.omg.Components.CCMHome 115 loadHome(ComponentRuntimeConfiguration config) 116 { 117 final String opname = "loadHome"; 118 119 ContainerService conts = null; 122 String poasid = ComponentPOAService.SERVICE_ID; 123 if (config.orb_service!=null) { 124 conts = _container_factory.asContainerService(config.service_uuids, config.dservice_refs, config.orb_service, poasid); 126 } 127 else { 128 conts = _container_factory.asContainerService(config.service_uuids, config.dservice_refs, config.initial_references, poasid); 130 } 131 132 try { 134 ORBServiceImpl orbimpl = (ORBServiceImpl)conts.orb_service(); 135 _orb = orbimpl.getORB(); 136 } catch (ClassCastException ex) { 137 } 139 140 org.omg.Components.CCMHome href = null; 141 href = conts.component_poa_service().activate_home(config.implementation_uuid); 142 143 RegistrationService regs = getRegistrationService(); 145 String iorfile = config.runtime_iorfile; 147 if (iorfile!=null) { 148 FileRegistrationScheme filescheme = (FileRegistrationScheme)regs.get_scheme(FileRegistrationScheme.SCHEME_ID); 150 filescheme.write_ior(iorfile, href, conts.orb_service()); 151 } 152 153 String insname = config.runtime_id; 155 INSRegistrationScheme insscheme = (INSRegistrationScheme)regs.get_scheme(INSRegistrationScheme.SCHEME_ID); 156 insscheme.bind(insname, href, conts.orb_service()); 157 158 return href; 160 } 161 } 162 | Popular Tags |