jdk/src/linux/doc/man/ja/tnameserv.1
author jjg
Tue, 11 Mar 2008 13:14:55 -0700
changeset 168 25697c18650b
parent 2 90ce3da70b43
child 2692 345bc8d65b19
permissions -rw-r--r--
6307187: clean up code for -Xlint:options Summary: introduce common code for handling one-of and any-of options Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
'\" t
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
.\" Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
.\" This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
.\" under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
.\" published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
.\" This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
.\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
.\" version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
.\" accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
.\" You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
.\" 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
.\" Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
.\" CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
.\" have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
.\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
.\" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
.TH tnameserv 1 "2006 年 9 月 4 日" "Java SE 6" "ユーザーコマンド"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
.SH "名前"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
Java IDL: 一時ネームサービス \- \f2tnameserv\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
このドキュメントでは、Java IDL 一時ネームサービス \f2tnameserv\fP の使用方法について説明します。Java IDL には ORBD (Object Request Broker Daemon) も含まれています。ORBD は、ブートストラップサービス、一時ネームサービス、\f3持続\fPネームサービス、およびサーバーマネージャを含むデーモンプロセスです。Java IDL のすべてのチュートリアルでは ORBD が使用されていますが、一時ネームサービスを使用する例の \f2orbd\fP はどれも、\f2tnameserv\fP で置き換えることができます。\f2orbd\fP ツールのドキュメントについては、そのマニュアルページか、
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
\f2Java IDL Naming Service Included with ORBD\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
(http://java.sun.com/javase/6/docs/technotes/guides/idl/jidlNaming.html) のトピックを参照してください。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
ここでは、次の項目について説明します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
Java\ IDL 一時ネームサービス
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
Java\ IDL 一時ネームサービスの起動
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
Java\ IDL 一時ネームサービスの停止
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
サンプルクライアント: 名前空間へのオブジェクトの追加
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
サンプルクライアント: 名前空間のブラウズ
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
.SH "Java\ IDL 一時ネームサービス"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
.IX "Java IDL name server starter script" "" "Java IDL name server starter script \(em \fLtnameserv\fP"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
.IX "tnameserv" "" "\fLtnameserv\fP \(em Java IDL name server starter script"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
.SM CORBA
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
.SM COS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
(Common Object Services) ネームサービスは、ファイルシステムがファイルに対してディレクトリ
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
構造を提供しているのと同じように、オブジェクト参照に対してツリー構造のディレクトリを提供し
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
ます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
.SM IDL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
の一時ネームサービス、\f2tnameserv\fP は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
.SM COS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
ネームサービスの仕様を単純な形で実装したものです。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
オブジェクト参照は名前空間に名前で格納され、オブジェクト参照と名前の組は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
それぞれ「ネームバインディング」と呼ばれます。ネームバインディングは「ネーミ
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
ングコンテキスト」に組み込むことができます。ネーミングコンテキストはそれ自体
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
がネームバインディングであり、ファイルシステムのサブディレクトリと同じ編成機
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
能を持ちます。すべてのバインディングは「初期ネーミングコンテキスト」に格納さ
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
れます。名前空間において、初期ネーミングコンテキストは唯一の持続的バイン
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
ディングです。それ以外のネーミングコンテキストは、Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
.SM IDL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
のネームサーバープロセスが停止し、再起動されると失われます。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
アプレットまたはアプリケーションから
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
.SM COS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
ネームサービスを使用するためには、その
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
.SM ORB
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
はネームサービスが動作しているホストのポートを知っているか、そのネームサービスの
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
文字列化された初期ネーミングコンテキストにアクセスできなければなりません。
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
ネームサービスは、Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
.SM IDL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
のネームサービスでもその他の
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
.SM COS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
準拠のネームサービスでもかまいません。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
.SH "Java\ IDL 一時ネームサービスの起動"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
.IX "tnameserv" "Starting the Java IDL Name Server" "\fLtnameserv\fP \(em Java IDL name server starter script"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
.SM IDL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
ネームサービスは、ネームサービスを使用するアプリケーションまたはアプレットより前に
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
起動しておかなければなりません。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
Java\ IDL 製品をインストールすると、Java\ IDL ネームサービスを起動するためのスクリプト (Solaris: \f2tnameserv\fP) または実行可能ファイル (Windows NT: \f2tnameserv.exe\fP) が作成されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
バックグラウンドで
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
動作するように、ネームサービスを起動してください。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
特に指定しない場合、Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
.SM IDL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
ネームサービスは、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
.SM ORB
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
.I resolve_initial_references(\|)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
メソッドと
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
.I list_initial_references(\|)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
メソッドの実装に使用するブートストラッププロトコルに対してポート 900 で待機します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
次のようにします。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        tnameserv \-ORBInitialPort \fP\f4nameserverport\fP\f3&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
ネームサーバーのポートを指定しなかった場合、デフォルトでポート 900 が使用されます。Solaris ソフトウェアを実行する場合、1024 よりも小さいポートでプロセスを起動するには root になる必要があります。このため、1024 かそれよりも大きいポート番号を使用することをお勧めします。1050 などの異なるポートを指定し、かつネームサービスをバックグラウンドで実行するには、UNIX コマンドシェルから次のように入力します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        tnameserv \-ORBInitialPort 1050&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
Windows の場合は、MS\-DOS システムプロンプトから次のように入力します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        start tnameserv \-ORBInitialPort 1050
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
ネームサーバーのクライアントには、新しいポート番号を知らせる必要があります。このため、ORB オブジェクトの作成時に \f2org.omg.CORBA.ORBInitialPort\fP プロパティに新しいポート番号を設定します。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
異なるホスト上でのサーバーとクライアントの実行
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
Java IDL および RMI\-IIOP に関するチュートリアルの大部分では、ネームサービス、サーバー、クライアントのすべてが開発マシン上で実行されています。実際の配備では通常、ネームサービスとは異なるホストマシン上でクライアントとサーバーが実行されます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
クライアントとサーバーでネームサービスを検索するには、ネームサービスが実行されているポート番号とホストをそれらが知っている必要があります。そこで、クライアントとサーバーのファイル内の \f2org.omg.CORBA.ORBInitialPort\fP と \f2org.omg.CORBA.ORBInitialHost\fP プロパティを、ネームサービスが実行されているマシン名とポート番号に設定します。この例については、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
「\f2The Hello World Example Using RMI\-IIOP\fP」
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
(http://java.sun.com/javase/6/docs/technotes/guides/rmi\-iiop/rmiiiopexample.html) を参照してください。また、コマンド行オプション \f2\-ORBInitialPort\fP \f2nameserverport#\fP と \f2\-ORBInitialHost\fP \f2nameserverhostname\fP を使ってネームサービスの検索場所をクライアントとサーバーに知らせることも可能です。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
「\f2Java IDL: Running the Hello World Example on TWO Machines\fP」
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
(http://java.sun.com/javase/6/docs/technotes/guides/idl/tutorial/jidl2machines.html) では、このコマンド行オプションを使う方法の 1 つが示されています。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
たとえば、一時ネームサービス \f2tnameserv\fP がホスト \f2nameserverhost\fP のポート 1050 上で、クライアントがホスト \f2clienthost\fP 上で、サーバーがホスト \f2serverhost\fP 上で、それぞれ実行されているとします。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
ホスト \f2nameserverhost\fP 上の \f2tnameserv\fP を次のようにして起動します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     tnameserv \-ORBInitialPort 1050
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
\f2serverhost\fP 上のサーバーを次のようにして起動します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     java Server \-ORBInitialPort 1050 \-ORBInitialHost nameserverhost
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
\f2clienthost\fP 上のクライアントを次のようにして起動します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     java Client \-ORBInitialPort 1050 \-ORBInitialHost nameserverhost
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
\-J オプション
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
\f2tnameserv\fP で使用可能なコマンド行オプションは、次のとおりです。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
\-Joption 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
\f2option\fP を Java 仮想マシンに渡します。ここで、\f2option\fP は、
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
\f2Java アプリケーション起動ツール\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
(http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html) のリファレンスページで説明されているオプションの 1 つです。たとえば、\f3\-J\-Xms48m\fP とすると、起動時のメモリが 48M バイトに設定されます。\f3\-J\fP を使って実行元の仮想マシンにオプションを渡すことは、よく行われています。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
.SH "Java IDL 一時ネームサービスの停止"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
Java\ IDL ネームサービスを停止するには、対応するオペレーティングシステムコマンドを使用します。たとえば、Unix プロセスの場合は \f2kill\fP を、Windows プロセスの場合は \f2Ctrl\-C\fP を、それぞれ使用します。ネームサービスは明示的にシャットダウンされるまで、呼び出しを待ち続けます。なお、ネームサービスを終了させると、Java\ IDL ネームサービスに登録されている名前は失われます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
.SH "サンプルクライアント: 名前空間へのオブジェクトの追加"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
以下に示すサンプルプログラムは、名前を名前空間に追加する方法を示すものです。このサンプルプログラムは、このままの状態で完全に動作する一時ネームサービスクライアントで、次のような単純なツリーを作成するものです。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
\fP\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                    \fP\f4初期\fP\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
           \fP\f4ネーミングコンテキスト\fP\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                  /      \\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                 /        \\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
              plans     \fP\f4Personal\fP\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                         /   \\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                        /     \\
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                   calendar  schedule\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
この例で、\f3plans\fP はオブジェクト参照、\f3Personal\fP は \f3calendar\fP と \f3schedule\fP の 2 つのオブジェクト参照が含まれるネーミングコンテキストです。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
import java.util.Properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
import org.omg.CORBA.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
import org.omg.CosNaming.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
public class NameClient
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
   public static void main(String args[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
      try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
前述の「Java IDL 一時ネームサービスの起動」では、ネームサーバーはポート 1050 を使用して起動しました。次のコードで、このポート番号をクライアントプログラムに知らせます。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        Properties props = new Properties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        props.put("org.omg.CORBA.ORBInitialPort", "1050");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        ORB orb = ORB.init(args, props);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
このコードでは、初期ネーミングコンテキストを取得し、それを \f3ctx\fP に代入します。2 行目では、\f3ctx\fP をダミーのオブジェクト参照 \f3objref\fP にコピーします。この \f3objref\fP には、あとでさまざまな名前を割り当てて名前空間に追加します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        NamingContext ctx =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
NamingContextHelper.narrow(orb.resolve_initial_references("NameService"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        NamingContext objref = ctx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
このコードでは、text 型の名前「plans」を作成し、それをダミーのオブジェクト参照にバインドします。その後、\f2rebind\fP を使用して初期ネーミングコンテキストの下に「plans」を追加しています。\f2rebind\fP メソッドを使用すれば、\f2bind\fP を使用した場合に発生する例外を発生させずに、このプログラムを何度も繰り返し実行できます。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
        NameComponent nc1 = new NameComponent("plans", "text");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        NameComponent[] name1 = {nc1};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        ctx.rebind(name1, objref);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        System.out.println("plans rebind sucessful!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
このコードでは、directory 型の「Personal」というネーミングコンテキストを作成します。その結果得られるオブジェクト参照 \f3ctx2\fP をこの名前にバインドし、初期ネーミングコンテキストに追加します。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        NameComponent nc2 = new NameComponent("Personal", "directory");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        NameComponent[] name2 = {nc2};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        NamingContext ctx2 = ctx.bind_new_context(name2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        System.out.println("new naming context added..");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
残りのコードでは、ダミーのオブジェクト参照を「schedule」と「calendar」という名前でネーミングコンテキスト「Personal」(\f3ctx2\fP) にバインドします。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        NameComponent nc3 = new NameComponent("schedule", "text");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        NameComponent[] name3 = {nc3};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        ctx2.rebind(name3, objref);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        System.out.println("schedule rebind sucessful!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        NameComponent nc4 = new NameComponent("calender", "text");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        NameComponent[] name4 = {nc4};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        ctx2.rebind(name4, objref);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        System.out.println("calender rebind sucessful!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        e.printStackTrace(System.err);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
.SH "サンプルクライアント: 名前空間のブラウズ"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
次のサンプルプログラムでは、名前空間をブラウズする方法を示します。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
import java.util.Properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
import org.omg.CORBA.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
import org.omg.CosNaming.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
public class NameClientList
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
   public static void main(String args[])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
      try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
前述の「Java IDL 一時ネームサービスの起動」で、ネームサーバーはポート 1050 を使用して起動しました。次のコードで、このポート番号をクライアントプログラムに知らせます。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        Properties props = new Properties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        props.put("org.omg.CORBA.ORBInitialPort", "1050");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        ORB orb = ORB.init(args, props);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
次のコードでは、初期ネーミングコンテキストを取得しています。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        NamingContext nc =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
NamingContextHelper.narrow(orb.resolve_initial_references("NameService"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
\f2list\fP メソッドは、ネーミングコンテキストに追加されているバインディングをリストします。この場合、最大 1000 個までのバインディングが初期ネーミングコンテキストから BindingListHolder に返されます。残りのバインディングは、BindingIteratorHolder に返されます。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        BindingListHolder bl = new BindingListHolder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        BindingIteratorHolder blIt= new BindingIteratorHolder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        nc.list(1000, bl, blIt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
このコードでは、返された BindingListHolder からバインディングの配列を取得します。バインディングがない場合は、プログラムは終了します。 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
        Binding bindings[] = bl.value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        if (bindings.length == 0) return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
残りのコードでは、バインディングに対してループ処理を行い、名前を出力します。
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        for (int i=0; i < bindings.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
            // get the object reference for each binding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            org.omg.CORBA.Object obj = nc.resolve(bindings[i].binding_name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
            String objStr = orb.object_to_string(obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
            int lastIx = bindings[i].binding_name.length\-1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
            // check to see if this is a naming context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
            if (bindings[i].binding_type == BindingType.ncontext) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
              System.out.println( "Context: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
bindings[i].binding_name[lastIx].id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
                System.out.println("Object: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
bindings[i].binding_name[lastIx].id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
       } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        e.printStackTrace(System.err);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545