1 28 29 30 package org.objectweb.corba.runtime; 31 32 51 public class RuntimeMain 52 { 53 static final private String _class_name = "RuntimeMain"; 54 55 59 static public RuntimeConfiguration 60 parseConfiguration(String [] args) 61 { 62 String opname = "parseConfiguration"; 63 64 RuntimeConfiguration config = new RuntimeConfiguration(); 65 66 java.util.Vector virefs = new java.util.Vector (); 69 java.util.Vector vservices = new java.util.Vector (); 70 71 String location = System.getProperty("archive.location"); 75 String entrypt = System.getProperty("archive.entrypoint"); 76 77 for (int i=0;i<args.length;i++) { 79 if (args[i].equals("-ORBInitRef")) { 80 virefs.add(args[i+1]); 81 i++; 82 } 83 84 if (args[i].equals("-SystemService")) { 85 vservices.add(args[i+1]); 86 i++; 87 } 88 89 if (args[i].equals("-ArchiveLocation")) { 90 location = args[i+1]; 91 i++; 92 } 93 94 if (args[i].equals("-ArchiveEntrypoint")) { 95 entrypt = args[i+1]; 96 i++; 97 } 98 99 if (args[i].equals("-RuntimeId")) { 100 System.setProperty("runtime.id", args[i+1]); 102 i++; 103 } 104 } 105 106 String [] irefs = (String [])virefs.toArray(new String [0]); 108 StringifiedInitialReference[] sirefs = new StringifiedInitialReference[irefs.length]; 109 110 int idx = 0; 111 for (int i=0;i<irefs.length;i++) { 112 115 118 idx = irefs[i].indexOf("="); 120 sirefs[i] = new StringifiedInitialReference(); 121 sirefs[i].name = irefs[i].substring(0, idx); 122 sirefs[i].ref = irefs[i].substring(idx+1); 123 } 124 125 config.stringified_initial_references = sirefs; 127 128 String [] services = (String [])vservices.toArray(new String [0]); 130 String [] service_ids = new String [services.length]; 131 String [] service_entrypts = new String [services.length]; 132 133 idx = 0; 134 for (int i=0;i<services.length;i++) { 135 138 141 idx = services[i].indexOf("="); 143 service_ids[i] = services[i].substring(0, idx); 144 service_entrypts[i] = services[i].substring(idx+1); 145 } 146 147 config.service_ids = service_ids; 149 config.service_entrypts = service_entrypts; 150 151 config.archive_location = location; 154 config.archive_entrypoint = entrypt; 155 156 return config; 158 } 159 160 164 static public void 165 main(String [] args) 166 { 167 String opname = "main"; 169 TheLogger.debug(_class_name, opname, "Loading ..."); 170 171 RuntimeConfiguration config = parseConfiguration(args); 173 174 if (config.archive_entrypoint.endsWith(".main")) { 179 Runtime.loadMain(config); 180 TheLogger.debug(_class_name, opname, "Main loaded"); 182 } 183 else { 184 Servant serv = Runtime.loadServant(config); 186 TheLogger.debug(_class_name, opname, "Servant loaded"); 188 } 189 190 System.err.println("Launcher waiting for this usefull message ..."); 191 System.out.println("... or for this one ? :o("); 192 } 193 } 194 | Popular Tags |