tnameserv(1) Java IDL and RMI-IIOP Tools tnameserv(1) (NAME) tnameserv-openjdk8 - CORBA (SYNOPSIS) tnameserv -ORBInitialPort [ nameserverport ] -ORBInitialPort nameserverport (bootstrap) resolve_initial_references list_initial_references ORB . (DESCRIPTION) Java IDL (ORBD) . ORBD (Bootstrap Service) (Transient Naming Service) (Persistent Naming Service) (Server Manager) . Java IDL ORBD tnameserv orbd . orbd(1) Naming Service http://docs.oracle.com/javase/8/docs/technotes/guides/idl/jidlNaming.html . Common Object Services (COS) CORBA . Java IDL tnameserv COS Naming Service . << - >> (name binding) . (naming contexts) . . . . Java IDL . COS ORB . Java IDL COS . (START THE NAMING SERVICE) Java IDL . Java IDL ( Oracle Solaris: tnameserv) ( Windows: tnameserv.exe) Java IDL . . Java IDL resolve_initial_references list_initial_references ORB : tnameserv -ORBInitialPort nameserverport& . Oracle Solaris (root) . . : tnameserv -ORBInitialPort 1050& (MS- DOS) : start tnameserv -ORBInitialPort 1050 . org.omg.CORBA.ORBInitialPort ORB . (RUN THE SERVER AND CLIENT ON DIFFERENT HOSTS) Java IDL RMI- IIOP . . . org.omg.CORBA.ORBInitialPort org.omg.CORBA.ORBInitialHost . Getting Started Using RMI-IIOP http://docs.oracle.com/javase/8/docs/technotes/guides/rmi- iiop/rmiiiopexample.html . -ORBInitialPort nameserverport# -ORBInitialHost nameserverhostname . Java IDL: The Hello World Example on Two Machines http://docs.oracle.com/javase/8/docs/technotes/guides/idl/tutorial/jidl2machines.html . tnameserv nameserverhost . clienthost serverhost . tnameserv nameserverhost: tnameserv -ORBInitialPort 1050 serverhost: java Server -ORBInitialPort 1050 -ORBInitialHost nameserverhost clienthost: java Client -ORBInitialPort 1050 -ORBInitialHost nameserverhost (STOP THE NAMING SERVICE) Java IDL kill Ctrl+C . . Java IDL . (OPTIONS) -Joption option (JVM) option . -J- Xms48m . java(1) . (EXAMPLES) (ADD OBJECTS TO THE NAME SPACE) . : Initial Naming Context plans Personal calendar schedule plans Personal : calendar schedule. import java.util.Properties; import org.omg.CORBA.*; import org.omg.CosNaming.*; public class NameClient { public static void main(String args[]) { try { nameserver . : Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1050"); ORB orb = ORB.init(args, props); ctx . ctx objref . NamingContext ctx = NamingContextHelper.narrow( orb.resolve_initial_references("NameService")); NamingContext objref = ctx; plans text . plans rebind . rebind bind . NameComponent nc1 = new NameComponent("plans", "text"); NameComponent[] name1 = {nc1}; ctx.rebind(name1, objref); System.out.println("plans rebind successful!"); Personal directory . ctx2 . NameComponent nc2 = new NameComponent("Personal", "directory"); NameComponent[] name2 = {nc2}; NamingContext ctx2 = ctx.bind_new_context(name2); System.out.println("new naming context added.."); schedule calendar Personal (ctx2) . NameComponent nc3 = new NameComponent("schedule", "text"); NameComponent[] name3 = {nc3}; ctx2.rebind(name3, objref); System.out.println("schedule rebind successful!"); NameComponent nc4 = new NameComponent("calender", "text"); NameComponent[] name4 = {nc4}; ctx2.rebind(name4, objref); System.out.println("calender rebind successful!"); } catch (Exception e) { e.printStackTrace(System.err); } } } (BROWSING THE NAME SPACE) : import java.util.Properties; import org.omg.CORBA.*; import org.omg.CosNaming.*; public class NameClientList { public static void main(String args[]) { try { nameserver . : Properties props = new Properties(); props.put("org.omg.CORBA.ORBInitialPort", "1050"); ORB orb = ORB.init(args, props); : NamingContext nc = NamingContextHelper.narrow( orb.resolve_initial_references("NameService")); list . BindingListHolder BindingIteratorHolder . BindingListHolder bl = new BindingListHolder(); BindingIteratorHolder blIt= new BindingIteratorHolder(); nc.list(1000, bl, blIt); BindingListHolder . . Binding bindings[] = bl.value; if (bindings.length == 0) return; : for (int i=0; i < bindings.length; i++) { // get the object reference for each binding org.omg.CORBA.Object obj = nc.resolve(bindings[i].binding_name); String objStr = orb.object_to_string(obj); int lastIx = bindings[i].binding_name.length-1; // check to see if this is a naming context if (bindings[i].binding_type == BindingType.ncontext) { System.out.println("Context: " + bindings[i].binding_name[lastIx].id); } else { System.out.println("Object: " + bindings[i].binding_name[lastIx].id); } } } catch (Exception e) { e.printStackTrace(System.err) } } } (SEE ALSO) o orbd(1) JDK 8 21 November 2013 tnameserv(1)