tnameserv.1 revision 12442:aa8e52dfeee9
t
Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.

This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).

You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.

Title: tnameserv
Language: Japanese
Date: 2013��11��21��
SectDesc: Java IDL������RMI-IIOP������
Software: JDK 8
Arch: ����
Part Number: E58103-01
Doc ID: JSSON

"tnameserv" "1" "2013��11��21��" "JDK 8" "Java IDL������RMI-IIOP������"
-----------------------------------------------------------------
* Define some portability stuff
-----------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://bugs.debian.org/507673
http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------
* set default formatting
-----------------------------------------------------------------
disable hyphenation
disable justification (adjust text to left margin only)
-----------------------------------------------------------------
* MAIN CONTENT STARTS HERE *
-----------------------------------------------------------------
"����"
tnameserv - ����������������������(IDL)��
"����"

.\}

tnameserve -ORBInitialPort [ nameserverport ]
.\}

-ORBInitialPort nameserverport

����������������������ORB��resolve_initial_references����������list_initial_references������������������������������������������������������������������������������������

"����"

Java IDL������Object Request Broker Daemon (ORBD)��������������ORBD������������������������������������������������������������������������������������������������������������������������������������������Java IDL����������������������������ORBD��������������������������������������������������������������orbd����������tnameserv����������������

orbd(1)http://docs.oracle.com/javase/8/docs/technotes/guides/idl/jidlNaming.html ��������������Naming Service����������������������

CORBA��COS (Common Object Services)������������������������������������������������������������������������������������������������������������������������������������������������������������������������Java IDL����������������������������tnameserv����COS����������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Java IDL����������������������������������������������������������������������������������������

������������������������������������COS��������������������������������������������ORB����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Java IDL������������������������������COS����������������������������������������

"��������������������������"

Java IDL������������������������������������������������������������������������������������������������������������������Java IDL��������������������������Java IDL����������������������������������������(Oracle Solaris: tnameserv)����������������������(Windows: tnameserv.exe)��������������������������������������������������������������������������������������

��������������������Java IDL������������������������ORB��resolve_initial_references����������list_initial_references methods������������������������������������������������������������������900��������������������

.\}

tnameserv -ORBInitialPort nameserverport&
 
.\}

������������������������������������������������������������900����������������Oracle Solaris����������������������1024��������������������������������������������root����������������������������������������1024����������������������������������������������1050������������������������������������������������������������������������������Solaris��Linux������OS X����������������������������������������

.\}

tnameserv -ORBInitialPort 1050&
 
.\}

Windows��MS-DOS������������������������������������������������

.\}

start tnameserv -ORBInitialPort 1050
 
.\}

����������������������������������������������������������������������������������������������ORB����������������������org.omg.CORBA.ORBInitialPort������������������������������������������

"����������������������������������������������"

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������������������������������������������������������������������������������������������������������������������������������������������������1����������http://docs.oracle.com/javase/8/docs/technotes/guides/idl/tutorial/jidl2machines.html����Java IDL: The Hello World Example on Two Machines�� ������������������

������������������������������tnameserv����������nameserverhost��������1050��������������������������������������������������������clienthost������������������������������serverhost����������������������������

������nameserverhost����tnameserv��������������

.\}

tnameserv -ORBInitialPort 1050
 
.\}

serverhost��������������������������

.\}

java Server -ORBInitialPort 1050 -ORBInitialHost nameserverhost
 
.\}

clienthost������������������������������

.\}

java Client -ORBInitialPort 1050 -ORBInitialHost nameserverhost
 
.\}
"��������������������������"

Java IDL������������������������������������Solaris��Linux������OS X����������kill����������������������������������������������������Windows����������[Ctrl]+[C]������������������������������������������������������������������������������������������������������������������Java IDL��������������������������������������������������

"����������"

-Joption

Java Virtual Machine��option������������option������Java����������������������������������������������������������������������������1������������������������-J-Xms48m����������������������������������������48MB����������������java(1)��������������������

"��"
"������������������������������������"

����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

.\}

Initial Naming Context
 plans
 Personal
 calendar
 schedule
 
.\}

����������plans��������������������Personal��calendar��schedule��2��������������������������������������������������������

.\}

import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.CosNaming.*;
 
public class NameClient {
 
 public static void main(String args[]) {
 
 try {
 
.\}

������������������������������nameserver��������1050������������������������������������������������������������������������������������

.\}

 Properties props = new Properties();
 props.put("org.omg.CORBA.ORBInitialPort", "1050");
 ORB orb = ORB.init(args, props);
 
.\}

������������������������������������������������������������ctx��������������2����������ctx��������������������������objref��������������������objref��������������������������������������������������������������

.\}

 NamingContext ctx =
 NamingContextHelper.narrow(
 orb.resolve_initial_references("NameService"));
 NamingContext objref = ctx;
 
.\}

����������������text������������plans������������������������������������������������������������������rebind����������������������������������������������������plans������������������rebind����������������������bind����������������������������������������������������������������������������������������������

.\}

 NameComponent nc1 = new NameComponent("plans", "text");
 NameComponent[] name1 = {nc1};
 ctx.rebind(name1, objref);
 System.out.println("plans rebind successful!");
 
.\}

����������������directory��������Personal����������������������������������������������������������������������������ctx2��name��������������������������������������������������������

.\}

 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);
 }
 }
}
 
.\}
"��������������������"

��������������������������������������������������������������������������

.\}

import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.CosNaming.*;
 
public class NameClientList {
 
 public static void main(String args[]) {
 
 try {
 
.\}

������������������������������nameserver��������1050������������������������������������������������������������������������������������

.\}

 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����������������������������������������������������������������������������������1000��������������������������������������������������������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)
 }
 }
}
 
.\}
"��������"

\h'-04'\(bu\h'+03'\c .\}

\(bu 2.3
.\} orbd(1)

'pl 8.5i 'bp