import HelloApp.*; import java.util.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import java.io.*; import org.omg.CORBA.*; /** * HelloServer implemented in the usual fashion * *@author donsez *@created 20 juin 2003 */ public class DSIHelloServer { /** * Description of the Method * *@param args Description of the Parameter */ public static void main(String args[]) { try { // Set or load the ORB properties Properties props = null; // Properties props = new Properties(); // props.put("org.omg.CORBA.ORBInitialPort", "1050"); // props.put("org.omg.CORBA.ORBInitialHost", "MyHost"); // create and initialize the ORB ORB orb = ORB.init(args, props); // create servant and register it with the ORB DSIHelloServant helloRef = new DSIHelloServant(); helloRef.setORB(orb); orb.connect(helloRef); String ior = orb.object_to_string(helloRef); System.out.println("IOR is " + ior); FileOutputStream fos = new FileOutputStream("hello.ior"); PrintStream ps = new PrintStream(fos); ps.print(ior); ps.close(); // wait for invocations from clients java.lang.Object sync = new java.lang.Object(); synchronized (sync) { sync.wait(); } } catch (Exception e) { System.err.println("ERROR: " + e); e.printStackTrace(System.out); } } }