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