." Copyright (c) 1999, 2011, 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.
."
.TH tnameserv 1 "05 Jul 2012"
.LP
.SH "̾��"
Java IDL: ����͡��ࡦ�����ӥ� \- \f2tnameserv\fP
.LP
.LP
���Υɥ�����ȤǤϡ�Java IDL����͡��ࡦ�����ӥ�\f2tnameserv\fP�λ�����ˡ�ˤĤ����������ޤ���Java IDL�ˤϡ�Object Request Broker Daemon(ORBD)��ޤޤ�Ƥ��ޤ���ORBD�ϡ��֡��ȥ��ȥ�åס������ӥ�������͡��ࡦ�����ӥ���\f3��³\fP�͡��ࡦ�����ӥ�����ӥ����С����ޥ͡������ޤ�ǡ���󡦥ץ?���Ǥ���Java IDL�Τ��٤ƤΥ��塼�ȥꥢ��Ǥ�ORBD����Ѥ��Ƥ��ޤ���������͡��ࡦ�����ӥ�����Ѥ�����Ǥϡ�\f2orbd\fP�Τ�����\f2tnameserv\fP����ѤǤ��ޤ���\f2orbd\fP�ġ���ξܺ٤ϡ�orbd��orbd(1)�ޤ���
.na
\f2ORBD�˴ޤޤ��Java IDL�͡��ࡦ�����ӥ�\fP @
.fi
http://docs.oracle.com/javase/7/docs/technotes/guides/idl/jidlNaming.html�˴ؤ���ȥԥå��򻲾Ȥ��Ƥ���������
.LP
.LP
�����Ǥϡ��ʲ��ι��ܤˤĤ����������ޤ���
.LP
.RS 3
.TP 2
o
Java\ IDL����͡��ࡦ�����ӥ�
.TP 2
o
Java\ IDL����͡��ࡦ�����ӥ��ε�ư
.TP 2
o
Java\ IDL����͡��ࡦ�����ӥ������
.TP 2
o
����ץ롦���饤�����: ̾�����֤ؤΥ��֥������Ȥ��ɲ�
.TP 2
o
����ץ롦���饤�����: ̾�����֤Υ֥饦��
.RE
.LP
.SH "Java IDL����͡��ࡦ�����ӥ�"
.LP
.LP
CORBA��COS(Common Object Services)�͡��ࡦ�����ӥ��ϡ��ե����롦�����ƥब�ե�������Ф��ƥǥ��쥯�ȥ깽¤���󶡤��Ƥ���Τ�Ʊ���褦�ˡ����֥������Ȼ��Ȥ��Ф��ƥĥ꡼��¤�Υǥ��쥯�ȥ���󶡤��ޤ���Java IDL�ΰ���͡��ࡦ�����ӥ��Ǥ���\f2tnameserv\fP�ϡ�COS�͡��ࡦ�����ӥ��λ��ͤ�ñ��ʷ��Ǽ���������ΤǤ���
.LP
.LP
���֥������Ȼ��Ȥ�̾�����֤�̾���dz�Ǽ���졢���֥������Ȼ��Ȥ�̾���Υڥ��ϡ����줾��͡��ࡦ\f2�Х���ǥ���\fP�ȸƤФ�ޤ����͡��ࡦ�Х���ǥ��󥰤�\f2�͡��ߥ󥰡�����ƥ�����\fP���Ȥ߹��ळ�Ȥ��Ǥ��ޤ����͡��ߥ󥰡�����ƥ����ȤϤ��켫�Τ��͡��ࡦ�Х���ǥ��󥰤Ǥ��ꡢ�ե����롦�����ƥ�Υ��֥ǥ��쥯�ȥ��Ʊ��������ǽ�����ޤ������٤ƤΥХ���ǥ��󥰤�\f2���͡��ߥ󥰡�����ƥ�����\fP�˳�Ǽ����ޤ���̾�����֤ˤ����ơ����͡��ߥ󥰡�����ƥ����Ȥ�ͣ��α�³Ū�Х���ǥ��󥰤Ǥ�������ʳ��Υ͡��ߥ󥰡�����ƥ����Ȥϡ�Java IDL�Υ͡��ߥ󥰡������ӥ����ץ?������ߤ����Ƶ�ư�����ȼ����ޤ���
.LP
.LP
���ץ�åȤޤ��ϥ��ץꥱ������󤫤�COS�͡��ࡦ�����ӥ�����Ѥ��뤿��ˤϡ�����ORB���͡��ࡦ�����ӥ���ư��Ƥ���ۥ��ȤΥݡ��Ȥ��ΤäƤ��뤫�����Υ͡��ࡦ�����ӥ���ʸ���󲽤��줿���͡��ߥ󥰡�����ƥ����Ȥ˥��������Ǥ���ɬ�פ�����ޤ����͡��ࡦ�����ӥ��ϡ�Java IDL�Υ͡��ࡦ�����ӥ��Ǥ⤽��¾��COS���Υ͡��ࡦ�����ӥ��Ǥ⤫�ޤ��ޤ���
.LP
.SH "Java IDL����͡��ࡦ�����ӥ��ε�ư"
.LP
.LP
Java IDL�͡��ࡦ�����ӥ��ϡ��͡��ࡦ�����ӥ�����Ѥ��륢�ץꥱ�������ޤ��ϥ��ץ�åȤ�����˵�ư���Ƥ���ɬ�פ�����ޤ���Java\ IDL���ʤ򥤥󥹥ȡ��뤹��ȡ�Java\ IDL�͡��ࡦ�����ӥ���ư���륹����ץ�(Solaris: \f2tnameserv\fP)�ޤ��ϼ¹Բ�ǽ�ե�����(Windows NT: \f2tnameserv.exe\fP)����������ޤ����Хå����饦��ɤ�ư���褦�ˡ��͡��ࡦ�����ӥ���ư���Ƥ���������
.LP
.LP
�ä˻��ꤷ�ʤ���硢Java IDL�͡��ࡦ�����ӥ��ϡ�ORB��\f2resolve_initial_references()\fP�᥽�åɤ�\f2list_initial_references()\fP�᥽�åɤμ����˻��Ѥ���֡��ȥ��ȥ�åס��ץ�ȥ�����Ф��ƥݡ���900���Ե����ޤ���
.LP
.nf
\f3
.fl
tnameserv \-ORBInitialPort \fP\f4nameserverport\fP\f3&
.fl
\fP
.fi
.LP
.LP
�͡��ࡦ�����С����ݡ��Ȥ���ꤷ�ʤ���硢�ǥե���Ȥǥݡ���900�����Ѥ���ޤ���Solaris���եȥ������μ¹Ի��ϡ�1024��꾮�����ݡ��Ȥǥץ?���򳫻Ϥ����硢root�桼�����ˤʤ�ɬ�פ�����ޤ������Τ��ᡢ1024�ʾ�Υݡ����ֹ����Ѥ��뤳�Ȥ����ᤷ�ޤ���1050�Τ褦���̤Υݡ��Ȥ���ꤷ���͡��ࡦ�����ӥ���Хå����饦��ɤǼ¹Ԥ���ˤϡ�UNIX���ޥ�ɡ�������Ǽ��Τ褦�����Ϥ��ޤ���
.LP
.nf
\f3
.fl
tnameserv \-ORBInitialPort 1050&
.fl
\fP
.fi
.LP
.LP
Windows��MS\-DOS�����ƥࡦ�ץ��ץȤǤϡ����Τ褦�����Ϥ��ޤ���
.LP
.nf
\f3
.fl
start tnameserv \-ORBInitialPort 1050
.fl
\fP
.fi
.LP
.LP
�͡��ࡦ�����С��Υ��饤����Ȥˤϡ��������ݡ����ֹ���Τ餻��ɬ�פ�����ޤ��������Ԥ��ˤϡ�ORB���֥������Ȥκ�������\f2org.omg.CORBA.ORBInitialPort\fP�ץ�ѥƥ��˿������ݡ����ֹ�����ꤷ�ޤ���
.LP
.SS
�ۤʤ�ޥ����ǤΥ��饤����Ȥȥ����С��μ¹�
.LP
.LP
Java IDL��RMI\-IIOP�ΤۤȤ�ɤΥ��塼�ȥꥢ��Ǥϡ��͡��ࡦ�����ӥ��������С�����ӥ��饤����ȤϤ��٤Ƴ�ȯ�ѤΥޥ����Ǽ¹Ԥ���ޤ����ºݤ˥ǥץ?���Ȥ�����ˤϡ����饤����Ȥȥ����С��򡢥͡��ࡦ�����ӥ��Ȥϰۤʤ�ۥ��Ⱦ�Ǽ¹Ԥ��뤳�Ȥ�¿���ʤ�ޤ���
.LP
.LP
���饤����Ȥȥ����С����͡��ࡦ�����ӥ��򸫤Ĥ���ˤϡ����饤����Ȥȥ����С������͡��ࡦ�����ӥ����¹Ԥ���Ƥ���ݡ��Ȥ��ֹ�ȥۥ��Ȥ�ǧ�����Ƥ���ɬ�פ�����ޤ������Τ���ˤϡ����饤����Ȥȥ����С��Υե��������\f2org.omg.CORBA.ORBInitialPort\fP�ץ�ѥƥ���\f2org.omg.CORBA.ORBInitialHost\fP�ץ�ѥƥ���͡��ࡦ�����ӥ����¹Ԥ���Ƥ���ݡ��Ȥ��ֹ�ȥޥ����̾�������ꤷ�ޤ���������ϡ�
.na
\f2RMI\-IIOP����Ѥ���Hello World����\fP @
.fi
http://docs.oracle.com/javase/7/docs/technotes/guides/rmi\-iiop/rmiiiopexample.html�˼�����Ƥ��ޤ������ޥ�ɥ饤�󡦥��ץ����\f2\-ORBInitialPort\fP \f2nameserverport#\fP��\f2\-ORBInitialHost\fP \f2nameserverhostname\fP����Ѥ��ơ����饤����Ȥȥ����С����Ф��ƥ͡��ࡦ�����ӥ���õ��������ꤹ�뤳�Ȥ�Ǥ��ޤ���
.na
\f2Java IDL: 2��Υޥ����Ǽ¹Ԥ���Hello World�ץ?���\fP @
.fi
http://docs.oracle.com/javase/7/docs/technotes/guides/idl/tutorial/jidl2machines.html�ˤϡ����ޥ�ɥ饤�󡦥��ץ�������Ѥ��ƻ��ꤹ����ˡ��������Ƥ��ޤ���
.LP
.LP
���Ȥ��С�����͡��ࡦ�����ӥ�\f2tnameserv\fP�����ۥ���\f2nameserverhost\fP�Υݡ���1050��Ǽ¹Ԥ���Ƥ���Ȥ��ޤ�������ˡ����饤����Ȥ��ۥ���\f2clienthost\fP��Ǽ¹Ԥ��졢�����С��ϥۥ���\f2serverhost\fP��Ǽ¹Ԥ���Ƥ���Ȥ��ޤ���
.LP
.RS 3
.TP 2
o
���Τ褦�ˡ��ۥ���\f2nameserverhost\fP���\f2tnameserv\fP��ư���ޤ���
.nf
\f3
.fl
tnameserv \-ORBInitialPort 1050
.fl
.fl
\fP
.fi
.TP 2
o
���Τ褦�ˡ�\f2serverhost\fP��ǥ����С���ư���ޤ���
.nf
\f3
.fl
java Server \-ORBInitialPort 1050 \-ORBInitialHost nameserverhost
.fl
\fP
.fi
.TP 2
o
���Τ褦�ˡ�\f2clienthost\fP��ǥ��饤����Ȥ�ư���ޤ���
.nf
\f3
.fl
java Client \-ORBInitialPort 1050 \-ORBInitialHost nameserverhost
.fl
\fP
.fi
.RE
.LP
.SS
\-J���ץ����
.LP
���Υ��ޥ�ɥ饤�󡦥��ץ����ϡ�\f2tnameserve\fP�ȤȤ�˻��ѤǤ��ޤ���
.RS 3
.TP 3
\-Joption
Java���ۥޥ����\f2option\fP���Ϥ��ޤ���\f2option\fP�ˤϡ�java(1)�Υ�ե���󥹡��ڡ����˵��ܤ���Ƥ��륪�ץ�����1�Ļ��ꤷ�ޤ������Ȥ��С�\f3\-J\-Xms48m\fP�Ȼ��ꤹ��ȡ��������ȥ��åס����꡼��48M�Х��Ȥ����ꤵ��ޤ���\f3\-J\fP����Ѥ����ظ�β��ۥޥ���˥��ץ������Ϥ����ȤϤ褯�Ԥ��Ƥ��ޤ���
.RE
.LP
.SH "Java IDL����͡��ࡦ�����ӥ������"
.LP
.LP
Java IDL�͡��ࡦ�����ӥ�����ߤ���ˤϡ�Unix�ξ��ϡ�\f2kill\fP�ʤɤΥ��ڥ졼�ƥ��󥰡������ƥ�Υ��ޥ�ɤ���Ѥ���Windows�ξ��ϡ�\f2[Ctrl]+[C]\fP��������Ѥ��ޤ����͡��ࡦ�����ӥ�������Ū����ߤ���ޤǤϡ��ƽФ��Ե����֤�³���ޤ��������ӥ���λ������ȡ�Java IDL�͡��ࡦ�����ӥ�����Ͽ����Ƥ���̾���ϼ����ޤ���
.LP
.SH "����ץ롦���饤�����: ̾�����֤ؤΥ��֥������Ȥ��ɲ�"
.LP
.LP
���˼�������ץ롦�ץ?���ϡ�̾����̾�����֤��ɲä�����ˡ�򼨤���ΤǤ������Υ���ץ롦�ץ?���ϡ����Τޤޤξ��֤Ǵ�����ư������͡��ࡦ�����ӥ������饤����Ȥǡ����Τ褦��ñ��ʥĥ꡼����������ΤǤ���
.LP
.RS 3
.TP 2
o
\f4���͡��ߥ󥰡�����ƥ�����\fP
.RS 3
.TP 2
*
\f3plans\fP
.TP 2
*
\f4Personal\fP
.RS 3
.TP 2
-
\f3calendar\fP
.TP 2
-
\f3schedule\fP
.RE
.RE
.RE
.LP
.LP
������ǡ�\f3plans\fP�ϥ��֥������Ȼ��ȡ�\f3Personal\fP��\f3calendar\fP��\f3schedule\fP��2�ĤΥ��֥������Ȼ��Ȥ�ޤ�͡��ߥ󥰡�����ƥ����ȤǤ���
.LP
.nf
\f3
.fl
import java.util.Properties;
.fl
import org.omg.CORBA.*;
.fl
import org.omg.CosNaming.*;
.fl
.fl
public class NameClient
.fl
{
.fl
public static void main(String args[])
.fl
{
.fl
try {
.fl
\fP
.fi
.LP
���Ҥ�Java IDL����͡��ࡦ�����ӥ��ε�ư�ǡ��͡��ࡦ�����С��ϥݡ���1050����Ѥ��Ƶ�ư���ޤ��������Υ����ɤǡ����Υݡ����ֹ�򥯥饤����ȡ������ƥ���Τ餻�ޤ���
.nf
\f3
.fl
Properties props = new Properties();
.fl
props.put("org.omg.CORBA.ORBInitialPort", "1050");
.fl
ORB orb = ORB.init(args, props);
.fl
.fl
\fP
.fi
.LP
���Υ����ɤǤϡ����͡��ߥ󥰡�����ƥ����Ȥ�������������\f3ctx\fP���������ޤ���2���ܤǤϡ�\f3ctx\fP����ߡ��Υ��֥������Ȼ���\f3objref\fP�˥��ԡ����ޤ�������objref�ˤϡ����Ȥ��͡���̾���������Ƥ�̾�����֤��ɲä��ޤ���
.nf
\f3
.fl
NamingContext ctx =
.fl
NamingContextHelper.narrow(orb.resolve_initial_references("NameService"));
.fl
NamingContext objref = ctx;
.fl
.fl
\fP
.fi
.LP
���Υ����ɤǤϡ�text�����פ�̾��plans����������������ߡ��Υ��֥������Ȼ��Ȥ˥Х���ɤ��ޤ������θ塢\f2rebind\fP����Ѥ��ƽ��͡��ߥ󥰡�����ƥ����Ȥβ���plans���ɲä��Ƥ��ޤ���\f2rebind\fP�᥽�åɤ���Ѥ���С�\f2bind\fP����Ѥ�������ȯ�������㳰��ȯ���������ˡ����Υץ?�����٤ⷫ�֤��¹ԤǤ��ޤ���
.nf
\f3
.fl
NameComponent nc1 = new NameComponent("plans", "text");
.fl
NameComponent[] name1 = {nc1};
.fl
ctx.rebind(name1, objref);
.fl
System.out.println("plans rebind successful!");
.fl
.fl
\fP
.fi
.LP
���Υ����ɤǤϡ�directory�����פ�Personal�Ȥ����͡��ߥ󥰡�����ƥ����Ȥ�������ޤ������η�������륪�֥������Ȼ���\f3ctx2\fP�򤳤�̾���˥Х���ɤ������͡��ߥ󥰡�����ƥ����Ȥ��ɲä��ޤ���
.nf
\f3
.fl
NameComponent nc2 = new NameComponent("Personal", "directory");
.fl
NameComponent[] name2 = {nc2};
.fl
NamingContext ctx2 = ctx.bind_new_context(name2);
.fl
System.out.println("new naming context added..");
.fl
.fl
\fP
.fi
.LP
�Ĥ�Υ����ɤǤϡ����ߡ��Υ��֥������Ȼ��Ȥ�schedule��calendar�Ȥ���̾���ǥ͡��ߥ󥰡�����ƥ����ȡ�Personal��(\f3ctx2\fP)�˥Х���ɤ��ޤ���
.nf
\f3
.fl
NameComponent nc3 = new NameComponent("schedule", "text");
.fl
NameComponent[] name3 = {nc3};
.fl
ctx2.rebind(name3, objref);
.fl
System.out.println("schedule rebind successful!");
.fl
.fl
NameComponent nc4 = new NameComponent("calender", "text");
.fl
NameComponent[] name4 = {nc4};
.fl
ctx2.rebind(name4, objref);
.fl
System.out.println("calender rebind successful!");
.fl
.fl
.fl
} catch (Exception e) {
.fl
e.printStackTrace(System.err);
.fl
}
.fl
}
.fl
}
.fl
\fP
.fi
.LP
.SH "����ץ롦���饤�����: ̾�����֤Υ֥饦��"
.LP
.LP
���Υ���ץ롦�ץ?���Ǥϡ�̾�����֤�֥饦��������ˡ�򼨤��ޤ���
.LP
.nf
\f3
.fl
import java.util.Properties;
.fl
import org.omg.CORBA.*;
.fl
import org.omg.CosNaming.*;
.fl
.fl
public class NameClientList
.fl
{
.fl
public static void main(String args[])
.fl
{
.fl
try {
.fl
\fP
.fi
.LP
���Ҥ�Java IDL����͡��ࡦ�����ӥ��ε�ư�ǡ��͡��ࡦ�����С��ϥݡ���1050����Ѥ��Ƶ�ư���ޤ��������Υ����ɤǡ����Υݡ����ֹ�򥯥饤����ȡ������ƥ���Τ餻�ޤ���
.nf
\f3
.fl
.fl
Properties props = new Properties();
.fl
props.put("org.omg.CORBA.ORBInitialPort", "1050");
.fl
ORB orb = ORB.init(args, props);
.fl
.fl
.fl
\fP
.fi
.LP
���Υ����ɤǤϡ����͡��ߥ󥰡�����ƥ����Ȥ�������Ƥ��ޤ���
.nf
\f3
.fl
NamingContext nc =
.fl
NamingContextHelper.narrow(orb.resolve_initial_references("NameService"));
.fl
.fl
\fP
.fi
.LP
\f2list\fP�᥽�åɤϡ��͡��ߥ󥰡�����ƥ����ȤΥХ���ǥ��󥰤�ꥹ�Ȥ��ޤ������ξ�硢����1000�ĤޤǤΥХ���ǥ��󥰤����͡��ߥ󥰡�����ƥ����Ȥ���BindingListHolder���֤���ޤ����Ĥ�ΥХ���ǥ��󥰤ϡ�BindingIteratorHolder���֤���ޤ���
.nf
\f3
.fl
BindingListHolder bl = new BindingListHolder();
.fl
BindingIteratorHolder blIt= new BindingIteratorHolder();
.fl
nc.list(1000, bl, blIt);
.fl
.fl
\fP
.fi
.LP
���Υ����ɤǤϡ��֤��줿BindingListHolder����Х���ǥ��󥰤������������ޤ����Х���ǥ��󥰤��ʤ����ϡ��ץ?��ब��λ���ޤ���
.nf
\f3
.fl
Binding bindings[] = bl.value;
.fl
if (bindings.length == 0) return;
.fl
.fl
\fP
.fi
.LP
�Ĥ�Υ����ɤǤϡ��Х���ǥ��󥰤��Ф��ƥ롼�׽����Ԥ���̾������Ϥ��ޤ���
.nf
\f3
.fl
for (int i=0; i < bindings.length; i++) {
.fl
.fl
// get the object reference for each binding
.fl
org.omg.CORBA.Object obj = nc.resolve(bindings[i].binding_name);
.fl
String objStr = orb.object_to_string(obj);
.fl
int lastIx = bindings[i].binding_name.length\-1;
.fl
.fl
// check to see if this is a naming context
.fl
if (bindings[i].binding_type == BindingType.ncontext) {
.fl
System.out.println( "Context: " +
.fl
bindings[i].binding_name[lastIx].id);
.fl
} else {
.fl
System.out.println("Object: " +
.fl
bindings[i].binding_name[lastIx].id);
.fl
}
.fl
}
.fl
.fl
} catch (Exception e) {
.fl
e.printStackTrace(System.err);
.fl
}
.fl
}
.fl
}
.fl
\fP
.fi
.LP