1 7 8 package com.sun.corba.se.internal.CosNaming; 9 10 import java.util.Enumeration ; 11 import java.util.Properties ; 12 13 import java.io.File ; 14 import java.io.FileInputStream ; 15 16 import com.sun.corba.se.spi.orb.ORB ; 17 18 import com.sun.corba.se.spi.resolver.Resolver ; 19 import com.sun.corba.se.spi.resolver.LocalResolver ; 20 import com.sun.corba.se.spi.resolver.ResolverDefault ; 21 22 import com.sun.corba.se.impl.orbutil.CorbaResourceUtil; 23 import com.sun.corba.se.impl.orbutil.ORBConstants; 24 25 31 public class BootstrapServer 32 { 33 private ORB orb; 34 35 43 public static final void main(String [] args) 44 { 45 String propertiesFilename = null; 46 int initialPort = ORBConstants.DEFAULT_INITIAL_PORT; 47 48 for (int i=0;i<args.length;i++) { 50 if (args[i].equals("-InitialServicesFile") && i < args.length -1) { 52 propertiesFilename = args[i+1]; 53 } 54 55 if (args[i].equals("-ORBInitialPort") && i < args.length-1) { 61 initialPort = java.lang.Integer.parseInt(args[i+1]); 62 } 63 } 64 65 if (propertiesFilename == null) { 66 System.out.println( CorbaResourceUtil.getText("bootstrap.usage", 67 "BootstrapServer")); 68 return; 69 } 70 71 File file = new File (propertiesFilename); 73 74 if (file.exists() == true && file.canRead() == false) { 76 System.err.println(CorbaResourceUtil.getText( 77 "bootstrap.filenotreadable", file.getAbsolutePath())); 78 return; 79 } 80 81 System.out.println(CorbaResourceUtil.getText( 83 "bootstrap.success", Integer.toString(initialPort), 84 file.getAbsolutePath())); 85 86 Properties props = new Properties () ; 87 88 props.put( ORBConstants.SERVER_PORT_PROPERTY, 93 Integer.toString( initialPort ) ) ; 94 95 ORB orb = (ORB) org.omg.CORBA.ORB.init(args,props); 96 97 LocalResolver lres = orb.getLocalResolver() ; 98 Resolver fres = ResolverDefault.makeFileResolver( orb, file ) ; 99 Resolver cres = ResolverDefault.makeCompositeResolver( fres, lres ) ; 100 LocalResolver sres = ResolverDefault.makeSplitLocalResolver( cres, lres ) ; 101 102 orb.setLocalResolver( sres ) ; 103 104 try { 105 orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME); 107 } catch (org.omg.CORBA.ORBPackage.InvalidName e) { 108 RuntimeException rte = new RuntimeException ("This should not happen"); 109 rte.initCause(e); 110 throw rte; 111 } 112 113 orb.run() ; 114 } 115 } 116 | Popular Tags |