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