/** * CORBA Training * The Repertory Application * 1999-2003 * *@author Fabienne.Boyer@imag.fr , Didier.Donsez@imag.fr */ package corbatraining; import MAdmin.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; /** * Description of the Class * *@author Fabienne Boyer, Didier Donsez *@created 3 juin 2003 */ public class ShutdownCommand { static Shutdown shutdownImpl; /** * Description of the Method * *@param args Description of the Parameter */ public static void main(String args[]) { try { // create and initialize the ORB ORB orb = ORB.init(args, null); // get the root naming context org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); // Use NamingContextExt instead of NamingContext. This is // part of the Interoperable naming Service. NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); // resolve the Object Reference in Naming String name = "Shutdown"; shutdownImpl = ShutdownHelper.narrow(ncRef.resolve_str(name)); System.out.println("Obtained a handle on server object: " + shutdownImpl); int delayInSec; if (args.length == 0) { delayInSec = 0; } else { delayInSec = Integer.parseInt(args[0]); } shutdownImpl.shutdown(delayInSec); } catch (Exception e) { System.out.println("ERROR : " + e); e.printStackTrace(System.out); } } }