public static void main(String[] args) { java.util.Properties props = new Properties(); props.putAll(System.getProperties()); props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); int status = 0; ORB orb = null; try { orb = ORB.init(args, props); status = run(orb, false, args); } catch (Exception ex) { ex.printStackTrace(); status = 1; } if (orb != null) { try { orb.destroy(); } catch (Exception ex) { ex.printStackTrace(); status = 1; } } System.exit(status); }
public void init() { add(intitule); add(texte); add(bouton); bouton.addActionListener(this); try { ORB orb = ORB.init(this, null); FileReader file = new FileReader(iorfile.value); BufferedReader in = new BufferedReader(file); String ior = in.readLine(); file.close(); org.omg.CORBA.Object obj = orb.string_to_object(ior); annuaire = AnnuaireHelper.narrow(obj); } catch (org.omg.CORBA.SystemException ex) { System.err.println("Error"); ex.printStackTrace(); } catch (FileNotFoundException fnfe) { System.err.println(fnfe.getMessage()); } catch (IOException io) { System.err.println(io.getMessage()); } catch (Exception e) { System.err.println(e.getMessage()); } }
public static void main(String[] args) { try { // init ORB ORB orb = ORB.init(args, null); // init POA POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); poa.the_POAManager().activate(); // create a Adder object AdderImpl adderImpl = new AdderImpl(); // create the object reference org.omg.CORBA.Object adderRef = poa.servant_to_reference(adderImpl); org.omg.CORBA.Object nsObject = orb.resolve_initial_references("NameService"); NamingContextExt nc = NamingContextExtHelper.narrow(nsObject); nc.rebind(nc.to_name("Adder"), adderRef); // wait for requests orb.run(); } catch (Exception e) { System.out.println(e); } }
public static void main(String args[]) { try { // create and initialize the ORB ORB orb = ORB.init(args, null); System.out.println("ORB initialised\n"); // get the root naming context org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); // Use NamingContextExt instead of NamingContext, // part of the Interoperable naming Service. NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); // resolve the Object Reference in Naming String name = "Hello1"; helloImpl = HelloHelper.narrow(ncRef.resolve_str(name)); System.out.println("Obtained a handle on server object: " + helloImpl); System.out.println(helloImpl.sayHello()); helloImpl.shutdown(); } catch (Exception e) { System.out.println("ERROR : " + e); e.printStackTrace(System.out); } } // end main
/* */ public static synchronized TypeCode type() /* */ { /* 57 */ if (__typeCode == null) /* */ { /* 59 */ __typeCode = ORB.init() .create_enum_tc( id(), "SetOverrideType", new String[] {"SET_OVERRIDE", "ADD_OVERRIDE"}); /* */ } /* 61 */ return __typeCode; /* */ }
public static void main(String args[]) { if (args.length == 0) { System.out.println("Koordinator Namen eingeben..."); } else { try { // ORB Eigenschaften setzen Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1050"); props.put("org.omg.CORBA.ORBInitialHost", "localhost"); orb = ORB.init(args, props); // Referenz von rootPOA holen und POA Manager aktivieren POA rootPoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootPoa.the_POAManager().activate(); // NamingContext besorgen NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService")); // Objektreferenz mit Namen "koordinator" besorgen org.omg.CORBA.Object obj = nc.resolve_str(args[1]); // Referenz fuer den Servant besorgen ggt.Koordinator koord = KoordinatorHelper.narrow(obj); // Servant erzeugen StarterImpl starter = new StarterImpl(args[0], koord, rootPoa); // Referenz fuer den Servant besorgen org.omg.CORBA.Object ref = rootPoa.servant_to_reference(starter); // Downcast Corba-Objekt -> koordinator ggt.Starter href = StarterHelper.narrow(ref); // starter bei koordinator anmelden koord.activateStarter(href, args[0]); // binde die Object Reference an einen Namen String name = args[0]; NameComponent path[] = nc.to_name(name); nc.rebind(path, href); System.out.println("Koordinator laeuft ..."); // Orb starten und auf Clients warten orb.run(); } catch (Exception e) { System.err.println("Fehler: " + e); e.printStackTrace(System.out); } System.out.println("BankServer Exit"); } }
public static void main(String[] args) { ORB orb = null; orb = ORB.init(args, null); if (orb != null) { try { new ClientGui(orb); } catch (Exception e) { System.err.println(e); System.exit(-1); } } else { System.err.println("can't initiate orb"); System.exit(-1); } } /*end of main*/
public static void main(String[] args) { java.util.Properties props = new Properties(); props.putAll(System.getProperties()); props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); int status = 0; ORB orb = null; try { Client.ClientRegisterInterceptors(props, true); Server.ServerRegisterInterceptors(props); props.put("yoko.orb.id", "myORB"); orb = ORB.init(args, props); status = Server.ServerRun(orb, true, args); if (status == 0) { status = Client.ClientRun(orb, true, args); // // The ORB must be totally shutdown before the servants // are deleted. // orb.shutdown(true); Server.ServerCleanup(); } } catch (Exception ex) { ex.printStackTrace(); status = 1; } if (orb != null) { try { orb.destroy(); } catch (Exception ex) { ex.printStackTrace(); status = 1; } } System.exit(status); }
public static void main(String args[]) { try { // 创建和初始化ORB ORB orb = ORB.init(args, null); // 获得命名服务的Context org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); // 获得名为“HelloService”的HelloService对象的远程引用 String name = "HelloService"; helloServiceImpl = HelloServiceHelper.narrow(ncRef.resolve_str(name)); // 调用HelloService对象的远程方法 System.out.println("Obtained a handle on server object: " + helloServiceImpl); System.out.println(helloServiceImpl.sayHello()); helloServiceImpl.shutdown(); } catch (Exception e) { System.out.println("ERROR : " + e); e.printStackTrace(System.out); } }
/** * Returns the <code>TypeCode</code> object corresponding to the value held in the Holder. * * @return the TypeCode of the value held in the holder */ public org.omg.CORBA.TypeCode _type() { return ORB.init().get_primitive_tc(TCKind.tk_longlong); }
public static void main(String[] args) { loggedUser = args[0]; try { ORB orb = ORB.init(args, null); // initialize ORB o = orb.resolve_initial_references("NameService"); // get reference to Deal object NamingContext ncRef = NamingContextHelper.narrow(o); NameComponent[] nc = new NameComponent[1]; nc[0] = new NameComponent(); nc[0].id = "Auction"; nc[0].kind = ""; a = AuctionHelper.narrow(ncRef.resolve(nc)); isr = new InputStreamReader(System.in); in = new BufferedReader(isr); int sel = 0; System.out.println("******* You have logged in Successfully! ********"); while (sel == 0) { System.out.println("Please make a selection"); System.out.println("\t1. Get all the listed auctions"); System.out.println("\t2. List a new item for auction."); System.out.println("\t3. Lookup an auction."); System.out.println("\t4. Place a bid on an auction."); System.out.println("\t5. Logout."); System.out.print("Please make your selection > "); String f = in.readLine(); try { sel = Integer.parseInt(f); } catch (Exception e) { sel = 42; } switch (sel) { case 1: allItems(); sel = 0; break; case 2: newAuction(); sel = 0; break; case 3: System.out.println("Stub"); sel = 0; break; case 4: placeBid(); sel = 0; break; case 5: a.logout(loggedUser); System.out.println("BYE!"); System.exit(0); default: System.out.println("You have not made a valid selection, please try again."); sel = 0; break; } } } catch (Exception e) { System.out.println("ERROR : " + e); e.printStackTrace(System.out); } }
/** @param args the command line arguments */ public static void main(String args[]) { try { // create and initialize the ORB ORB orb = ORB.init(args, null); // get reference to rootpoa & activate the POAManager POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootpoa.the_POAManager().activate(); // create servant Log_viewerImpl log_viewerImpl = new Log_viewerImpl(); log_viewerImpl.setORB(orb); LogFrame frame = new LogFrame(log_viewerImpl); frame.setVisible(true); log_viewerImpl.setFrame(frame); // get object reference from the servant org.omg.CORBA.Object ref = rootpoa.servant_to_reference(log_viewerImpl); Log_viewer href = Log_viewerHelper.narrow(ref); // read stringified Registry to file FileReader fr = new FileReader(IORFILE); BufferedReader br = new BufferedReader(fr); String remoteRegistryIOR = br.readLine(); // get the romote Registry org.omg.CORBA.Object ncobj = orb.string_to_object(remoteRegistryIOR); NamingContext rootNC = NamingContextHelper.narrow(ncobj); frame.println("Obtained Name Service reference."); log_viewerImpl.serRootNC(rootNC); NameComponent[] name = new NameComponent[1]; name[0] = new NameComponent("Logger", ""); try { rootNC.bind(name, href); } catch (org.omg.CORBA.UserException ue) { ue.printStackTrace(); System.exit(-1); } frame.println("Logger Remote Interface bound in Name Service"); // wait for invocations from client frame.println("Logger ready and waiting ..."); orb.run(); frame.println("Logger Exiting ..."); System.out.println("Logger Exiting ..."); } catch (Exception e) { System.err.println("ERROR: " + e); // e.printStackTrace(System.out); } }