1 28 29 30 package org.objectweb.ccm.runtime; 31 32 import org.objectweb.corba.runtime.*; 33 34 37 public class ComponentRuntimeMain 38 { 39 static final private String _class_name = "ComponentRuntimeMain"; 40 41 45 static public ComponentRuntimeConfiguration 46 parseConfiguration(String [] args) 47 { 48 final String opname = "parseConfiguration"; 49 ComponentRuntimeConfiguration config = new ComponentRuntimeConfiguration(); 50 51 String uuid = null; 53 String suuids = null; 54 String rid = null; 55 String riorfile = null; 56 java.util.Vector virefs = new java.util.Vector (); 57 58 for (int i=0;i<args.length;i++) { 59 if (args[i].equals("-ComponentUUID")) { 60 uuid= args[i+1]; 61 i++; 62 } 63 64 if (args[i].equals("-ServiceUUIDs")) { 65 suuids= args[i+1]; 66 i++; 67 } 68 69 if (args[i].equals("-RuntimeId")) { 70 rid = args[i+1]; 71 i++; 72 java.lang.System.getProperties().setProperty("runtime.id", rid); 74 } 75 76 if (args[i].equals("-RuntimeIORFile")) { 77 riorfile = args[i+1]; 78 i++; 79 } 80 81 if (args[i].equals("-ORBInitRef")) { 82 virefs.add(args[i+1]); 83 i++; 84 } 85 86 } 87 88 String [] irefs = (String [])virefs.toArray(new String [0]); 90 org.coach.ECM.DegeneratedServiceRef[] dsrefs = new org.coach.ECM.DegeneratedServiceRef[irefs.length]; 91 StringifiedInitialReference[] sirefs = new StringifiedInitialReference[irefs.length]; 92 93 int idx = 0; 94 for (int i=0;i<irefs.length;i++) { 95 98 String msg = "initial reference found: "+irefs[i]; 99 TheLogger.debug(_class_name, opname, msg); 100 101 idx = irefs[i].indexOf("="); 103 dsrefs[i] = new org.coach.ECM.DegeneratedServiceRef(); 104 dsrefs[i].corba_type = "unknown"; 105 dsrefs[i].orb_registration_name = irefs[i].substring(0, idx); 106 dsrefs[i].initial_reference = irefs[i].substring(idx+1); 107 108 sirefs[i] = new StringifiedInitialReference(); 109 sirefs[i].name = dsrefs[i].orb_registration_name; 110 sirefs[i].ref = dsrefs[i].initial_reference; 111 } 112 113 config.implementation_uuid = uuid; 115 config.runtime_id = rid; 116 config.runtime_iorfile = riorfile; 117 config.dservice_refs = dsrefs; 118 config.initial_references = sirefs; 119 120 if (suuids==null) { 122 return config; 123 } 124 125 java.util.Vector vuuids = new java.util.Vector (); 127 idx = suuids.indexOf(','); 128 String pattern = ""; 129 while (idx!=-1) { 130 pattern = suuids.substring(0, idx); 131 if (!pattern.equals("")) { 132 vuuids.add(pattern); 133 } 134 135 suuids = suuids.substring(idx+1); 136 idx = suuids.indexOf(','); 137 } 138 139 vuuids.add(suuids); 140 141 config.service_uuids = (String [])vuuids.toArray(new String [0]); 143 return config; 144 } 145 146 150 static public void 151 main(String [] args) 152 { 153 final String opname = "main"; 154 TheLogger.log(_class_name, opname, "Loading home"); 156 157 ComponentRuntimeConfiguration config = parseConfiguration(args); 159 160 ComponentRuntime.loadHome(config); 162 163 TheLogger.log(_class_name, opname, "Home loaded"); 165 166 System.err.println("Launcher waiting for this usefull message ..."); 167 System.out.println("... or for this one ? :o("); 168 } 169 } 170 | Popular Tags |