/* * Copyright (c) 1997-98 * NorthEast Parallel Architectures Center, Syracuse University. * All Rights Reserved. Permission to use, copy, modify, and distribute this * software and its documentation for educational, research and non-profit * purposes, without fee, and without a written agreement is hereby granted, * provided that the above copyright notice and this paragraph appear in all * copies. Permission to incorporate this software into commercial products may * be obtained by contacting the NorthEast Parallel Architectures Center. * * The software program and documentation are supplied "as is", * without any accompanying services from NPAC. NPAC does not * warrant that the operation of the program will be uninterrupted or * error-free. The end-user understands that the program was developed for * research purposes and is advised not to rely exclusively on the program for * any reason. * */ package cis600.impl; import java.io.*; import org.omg.CosNaming.*; public class randomServer { public static void main(String[] args) { try { /* Initialize the ORB.*/ org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null); /* Create the RandomGenerator object. */ cis600.util.RandomGen _randomGenerator = new RandomGenImpl("Randomizer"); /* Export the newly create object. */ orb.connect(_randomGenerator); /* Get a reference to the Naming Service */ org.omg.CORBA.Object nameServiceObj = orb.resolve_initial_references("NameService"); if (nameServiceObj == null) { System.out.println("Name Service Object = null"); return; } org.omg.CosNaming.NamingContext nameService = org.omg.CosNaming.NamingContextHelper.narrow(nameServiceObj); if (nameService == null) { System.out.println("nameService = null"); return; } /* Bind the RandomGenerator Object in the Naming Service */ NameComponent[] randomGeneratorName = { new NameComponent("Utilities", "Randomizer") }; nameService.rebind(randomGeneratorName, _randomGenerator); System.out.println( _randomGenerator + " is ready."); } catch(Exception e) { System.out.println("Exception " + e); } try { Thread.currentThread().join(); } catch(InterruptedException e) { System.out.println(e); } } }