corba/src/share/classes/org/omg/CosNaming/package.html
author ohair
Tue, 25 May 2010 15:52:11 -0700
changeset 5555 b2b5ed3f0d0d
parent 4 02bb8761fcce
child 23749 cdbbec8fdf45
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
02bb8761fcce Initial load
duke
parents:
diff changeset
     2
<html>
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
<head>
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
<!--
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
/*
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     6
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     7
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
*
02bb8761fcce Initial load
duke
parents:
diff changeset
     9
* This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
* under the terms of the GNU General Public License version 2 only, as
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    11
* published by the Free Software Foundation.  Oracle designates this
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
* particular file as subject to the "Classpath" exception as provided
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    13
* by Oracle in the LICENSE file that accompanied this code.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
*
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
* This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
* version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
* accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
*
02bb8761fcce Initial load
duke
parents:
diff changeset
    21
* You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    22
* 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    23
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
*
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    25
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    26
* or visit www.oracle.com if you need additional information or have any
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    27
* questions.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
*/ 
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
-->
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
</head>
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
<body bgcolor="white">
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
  Provides a naming service for Java&nbsp;IDL.  The Object Request Broker Daemon
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
  (ORBD) also includes both a transient and persistent naming service.
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
  
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
  The package and all its classes and interfaces 
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
  were generated by running the tool <code>idlj</code> on the file
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
  <code>nameservice.idl</code>, which is a module written in OMG IDL.
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
  
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
  <H3>Package Specification</H3>
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
 
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
<P>For a precise list of supported sections of official specifications with which 
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
the Java[tm] Platform, Standard Edition 6, ORB complies, see <A 
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
support in Java[tm] SE 6</A>.
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
  <H2>Interfaces</H2>
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
  The package <tt>org.omg.CosNaming</tt> contains two public interfaces
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
  and several auxiliary classes. 
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
  The interfaces are:
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
  <UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
  <LI><TT>NamingContext</TT> 
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
  <LI><TT>BindingIterator</TT> 
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
  </UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
  These two interfaces provide the means to bind/unbind names and object
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
  references, to retrieve bound object references, and
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
  to iterate through a list of bindings.  The <code>NamingContext</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
  interface supplies the main functionality for the naming service, and
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
  <code>BindingIterator</code> provides a means of iterating through a list
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
  of name/object reference bindings.
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
  <H2>Auxiliary Classes</H2>
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
  In order to map an OMG IDL interface to the Java programming language,
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
  the idlj compiler creates Java classes that can be thought of
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
  as auxiliary classes.
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
  Comments for the generated auxiliary classes
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
  used by the interfaces <code>NamingContext</code> and 
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
  <code>BindingIterator</code> are included here.
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
  <H3>Classes Used by <code>NamingContext</code> and
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
  <code>BindingIterator</code></H3>
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
  The following are classes used by
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
  the naming service.  (Helper and  holder classes, which are
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
  generated for each of the classes listed here,  are discussed below.)
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
 
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
  <UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
    <LI><code>public final class <B>NameComponent</B></code> -- 
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
    a building block for names.  (Names are bound to object references
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
    in a naming context.)
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
    <P>A name is an array of one or more <code>NameComponent</code> objects.
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
    A name with a single <code>NameComponent</code> is called
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
    a <I>simple name</I>; a name with multiple <code>NameComponent</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
    objects is called a <I>compound name</I>.
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
    <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
    A <code><B>NameComponent</B></code> object consists of two fields:
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
    <OL>
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
    <LI><code><B>id</B></code> -- a <code>String</code> used as an identifier
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
    <LI><code><B>kind</B></code> -- a <code>String</code> that can be used for 
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
any
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
    descriptive purpose.  Its importance is that it
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
    can be used to describe an object without affecting syntax.
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
    The C programming language, for example, uses the the syntactic convention
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
    of appending the extension ".c" to a file name to indicate that it is
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
    a source code file.  In a <code>NameComponent</code> object,
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
    the <code>kind</code> field can be used to describe the type of object
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
    rather than a file extension or some other syntactic convention.
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
    Examples of the value of the <code>kind</code> field include the strings
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
    <code>"c_source"</code>, <code>"object_code"</code>,
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
    <code>"executable"</code>, 
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
    <code>"postscript"</code>, and <code>""</code>.  It is not unusual
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
	for the <code>kind</code> field to be the empty string.
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
    </OL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
    <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
    In a name, each <code>NameComponent</code> object except the last denotes
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
    a <code>NamingContext</code> object; the last <code>NameComponent</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
    object denotes the bound object reference.
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
    This is similar to a path name, in which the last name is the
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
    file name, and all names before it are directory names.<p>
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
    <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
   
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
    <LI><code>public final class <B>Binding</B></code> -- 
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
    an object that associates a name with an object reference or a
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
    naming context.
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
    A <code>Binding</code> object has two fields:
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
    <OL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
    <LI><code><B>binding_name</B></code> - an array of one or more
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
    <code>NameComponent</code> objects that represents the bound name
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
    <LI><code><B>binding_type</B></code> - a <code>BindingType</code> object
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
    indicating whether the binding is between a name and an object
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
    reference or between a name and a naming context
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
    </OL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
    <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
    The interface <code>NamingContext</code> has methods for
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
	binding/unbinding names with object references or naming contexts,
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
	for listing bindings,
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
    and for resolving bindings (given a name, the method
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
    <code>resolve</code> returns the object reference bound to it).
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
   
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
  <LI><code>public final class <B>BindingType</B></code> --
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
    an object that specifies whether the given <code>Binding</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
    object is a binding between a name and an object reference (that is,
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
    not a naming context) or between a name and a naming context.
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
    <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
    The class<code>BindingType</code> consists of two methods and
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
	four constants. Two of these constants are
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
	<code>BindingType</code> objects, and two are <code>int</code>s.
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
	<P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
	The <code>BindingType</code> objects
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
    can be passed to the constructor for the class
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
    <code>Binding</code> or used as parameters or return values.  These
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
	<code>BindingType</code> objects are:
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
    <UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
    <LI><code>public static final BindingType <B>nobject</B></code> -- 
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
	to indicate that the binding is with an object reference
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
    <LI><code>public static final BindingType <B>ncontext</B></code> -- 
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
	to indicate that the binding is with a naming context
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
    </UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
    <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
	The <code>int</code> constants can be supplied to the method
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
	<code>from_int</code> to create  <code>BindingType</code> objects,
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
	or they can be return values for the method <code>value</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
	These constants are:
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
	<UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
    <LI><code>public static final int <B>_nobject</B></code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
    <LI><code>public static final int <B>_ncontext</B></code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
	</UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
    If the method <code>from_int</code> is supplied with anything other
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
	than <code>_nobject</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
    or <code>_ncontext</code>, it will throw
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
	the exception <code>org.omg.CORBA.BAD_PARAM</code>. 
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
	<P>Usage is as follows:
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
    <PRE>
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
       BindingType btObject = from_int(_nobject);
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
       BindingType btContext = from_int(_ncontext);
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
    </PRE>
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
    The variable <code>btObject</code> refers to a <code>BindingType</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
    object initialized to represent a binding with an object reference.
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
    The variable <code>btContext</code> refers to a <code>BindingType</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
    object initialized to represent a binding with a
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
    <code>NamingContex</code> object.
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
    <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
    The method <code>value</code> returns either
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
    <code>_nobject</code> or <code>_ncontext</code>, so
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
    in the following line of code, the variable <code>bt</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
    will contain <code>_nobject</code> or <code>_ncontext</code>:
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
    <PRE>
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
       int bt = BindingType.value();
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
    </PRE>
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
  </UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
  
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
  <H3>Holder Classes</H3>
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
 
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
  OMG IDL uses OUT and INOUT parameters for returning values from operations.
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
  The mapping to the Java programming language, which does not have OUT
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
  and INOUT parameters, creates a special class for each type, called
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
  a holder class. 
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
  An instance of a holder class can be passed to a
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
  Java method as a parameter, and
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
  a value can be assigned to its <code>value</code> field.  This allows
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
  it to perform the function of an OUT or INOUT parameter.  
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
  <P>The following holder classes are generated for the package
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
  <code>org.omg.CosNaming</code>:
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
  <UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
  <LI><code>NamingContextHolder</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
  <LI><code>BindingIteratorHolder</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
  <LI><code>BindingHolder</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
  <LI><code>BindingListHolder</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
  <LI><code>BindingTypeHolder</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
  <LI><code>NameComponentHolder</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
  <LI><code>NameHolder</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
  </UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
  Note that in the <code>org.omg.CORBA</code> package, 
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
  there is a holder class for each of the basic Java types:
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
  <code>IntHolder</code>, <code>ShortHolder</code>, 
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
  <code>StringHolder</code>, and so on.
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   213
  Note also that there is a <code>NameHolder</code> class even though
02bb8761fcce Initial load
duke
parents:
diff changeset
   214
  there is no <code>Name</code> class; similarly, there is a
02bb8761fcce Initial load
duke
parents:
diff changeset
   215
  <code>BindingListHolder</code> class even though there is no
02bb8761fcce Initial load
duke
parents:
diff changeset
   216
  <code>BindingList</code> class.  This is true because in the OMG IDL
02bb8761fcce Initial load
duke
parents:
diff changeset
   217
  interface, <code>Name</code> and <code>BindingList</code> are 
02bb8761fcce Initial load
duke
parents:
diff changeset
   218
  <code>typedef</code>s.  There is no mapping from an IDL 
02bb8761fcce Initial load
duke
parents:
diff changeset
   219
  <code>typedef</code> to a Java construct, but holder classes
02bb8761fcce Initial load
duke
parents:
diff changeset
   220
  are generated if the <code>typedef</code> is for a sequence or
02bb8761fcce Initial load
duke
parents:
diff changeset
   221
  an array.  As mapped to the
02bb8761fcce Initial load
duke
parents:
diff changeset
   222
  Java programming language, <code>Name</code> is an array of
02bb8761fcce Initial load
duke
parents:
diff changeset
   223
  <code>NameComponent</code> objects, and a <code>BindingList</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   224
  is an array of <code>Binding</code> objects.
02bb8761fcce Initial load
duke
parents:
diff changeset
   225
  
02bb8761fcce Initial load
duke
parents:
diff changeset
   226
  All holder classes have at least two constructors and one field:
02bb8761fcce Initial load
duke
parents:
diff changeset
   227
  <UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   228
  <LI><code><B>value</B></code> field -- an instance of the type being used as
02bb8761fcce Initial load
duke
parents:
diff changeset
   229
    an OUT or INOUT parameter.  For example, the <code>value</code> field of a
02bb8761fcce Initial load
duke
parents:
diff changeset
   230
    <code>NamingContextHolder</code> will be a <code>NamingContext</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   231
    object.  
02bb8761fcce Initial load
duke
parents:
diff changeset
   232
  <LI>default constructor -- a constructor that creates a new holder object
02bb8761fcce Initial load
duke
parents:
diff changeset
   233
    initialized with the default value for the type.  For example, a new
02bb8761fcce Initial load
duke
parents:
diff changeset
   234
    <code>BindingHolder</code> object created with the default constructor
02bb8761fcce Initial load
duke
parents:
diff changeset
   235
    will have its <code>value</code> field set to <code>null</code> because
02bb8761fcce Initial load
duke
parents:
diff changeset
   236
    that is the default value for an object.  Other defaults are
02bb8761fcce Initial load
duke
parents:
diff changeset
   237
    <code>false</code> for  <code>boolean</code>,
02bb8761fcce Initial load
duke
parents:
diff changeset
   238
    <code>0</code> for numeric and char types, and
02bb8761fcce Initial load
duke
parents:
diff changeset
   239
    <code>null</code> for  object references.
02bb8761fcce Initial load
duke
parents:
diff changeset
   240
  <LI>constructor from an instance -- a constructor that creates a new
02bb8761fcce Initial load
duke
parents:
diff changeset
   241
    holder object whose <code>value</code> field is
02bb8761fcce Initial load
duke
parents:
diff changeset
   242
    initialized with the instance supplied
02bb8761fcce Initial load
duke
parents:
diff changeset
   243
  </UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   244
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   245
  A holder class for a user-defined type (a Java class) has three more
02bb8761fcce Initial load
duke
parents:
diff changeset
   246
  methods, but application developers do not use them directly.
02bb8761fcce Initial load
duke
parents:
diff changeset
   247
 
02bb8761fcce Initial load
duke
parents:
diff changeset
   248
  <H3>Helper Classes</H3>
02bb8761fcce Initial load
duke
parents:
diff changeset
   249
  Helper classes, which are generated for all user-defined types
02bb8761fcce Initial load
duke
parents:
diff changeset
   250
  in an OMG IDL interface, supply static methods needed to manipulate
02bb8761fcce Initial load
duke
parents:
diff changeset
   251
  those types.  
02bb8761fcce Initial load
duke
parents:
diff changeset
   252
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   253
  There is only one method in a helper class that an
02bb8761fcce Initial load
duke
parents:
diff changeset
   254
  application programmer uses:  the
02bb8761fcce Initial load
duke
parents:
diff changeset
   255
  method <code>narrow</code>.  Only Java interfaces mapped from IDL
02bb8761fcce Initial load
duke
parents:
diff changeset
   256
  interfaces will have a helper class that includes a <code>narrow</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   257
  method, so in the <code>CosNaming</code> package, only the classes
02bb8761fcce Initial load
duke
parents:
diff changeset
   258
  <code>NamingContextHelper</code> and <code>BindingIteratorHelper</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   259
  have a <code>narrow</code> method.
02bb8761fcce Initial load
duke
parents:
diff changeset
   260
  <UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   261
  <LI><code>public static NamingContext
02bb8761fcce Initial load
duke
parents:
diff changeset
   262
  <B>narrow</B>(org.omg.CORBA.Object obj)</code> -- converts the given
02bb8761fcce Initial load
duke
parents:
diff changeset
   263
   CORBA object to a <code>NamingContext</code> object
02bb8761fcce Initial load
duke
parents:
diff changeset
   264
  <LI><code>public static BindingIterator
02bb8761fcce Initial load
duke
parents:
diff changeset
   265
  <B>narrow</B>(org.omg.CORBA.Object obj)</code> -- converts the given
02bb8761fcce Initial load
duke
parents:
diff changeset
   266
   CORBA object to a <code>BindingIterator</code> object
02bb8761fcce Initial load
duke
parents:
diff changeset
   267
  </UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   268
<H2>Package <code>org.omg.CosNaming.NamingContextPackage</code></H2>
02bb8761fcce Initial load
duke
parents:
diff changeset
   269
This package supplies Helper and Holder classes for the exceptions used
02bb8761fcce Initial load
duke
parents:
diff changeset
   270
in the package <code>org.omg.CosNaming</code> and also for the class
02bb8761fcce Initial load
duke
parents:
diff changeset
   271
<code>NotFoundReason</code>, which supplies a reason for the exception
02bb8761fcce Initial load
duke
parents:
diff changeset
   272
<code>NotFound</code>.  
02bb8761fcce Initial load
duke
parents:
diff changeset
   273
<P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   274
There are Helper and Holder classes for the following exceptions:
02bb8761fcce Initial load
duke
parents:
diff changeset
   275
<UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   276
<LI><code>AlreadyBound</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   277
<LI><code>CannotProceed</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   278
<LI><code>InvalidName</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   279
<LI><code>NotEmpty</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   280
<LI><code>NotFound</code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   281
</UL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   282
02bb8761fcce Initial load
duke
parents:
diff changeset
   283
<h2>Naming Service Compatibility</h2>
02bb8761fcce Initial load
duke
parents:
diff changeset
   284
02bb8761fcce Initial load
duke
parents:
diff changeset
   285
Sun's implementation of the <code>CosNaming</code> package complies
02bb8761fcce Initial load
duke
parents:
diff changeset
   286
with the OMG <code>COSNaming</code> specification.  In other words,
02bb8761fcce Initial load
duke
parents:
diff changeset
   287
the APIs in Sun's naming service are implemented according to the
02bb8761fcce Initial load
duke
parents:
diff changeset
   288
guidelines for a naming service provided by OMG.  Therefore, if a 
02bb8761fcce Initial load
duke
parents:
diff changeset
   289
third-party vendor has implemented a naming service that is OMG
02bb8761fcce Initial load
duke
parents:
diff changeset
   290
compliant, it is possible to switch between Sun's implementation of
02bb8761fcce Initial load
duke
parents:
diff changeset
   291
<code>CosNaming</code> and the third-party vendor's implementation.
02bb8761fcce Initial load
duke
parents:
diff changeset
   292
However, it is important to understand that there can be minor
02bb8761fcce Initial load
duke
parents:
diff changeset
   293
variations in the way different vendors implement the naming service,
02bb8761fcce Initial load
duke
parents:
diff changeset
   294
such as differences in the exception strings.
02bb8761fcce Initial load
duke
parents:
diff changeset
   295
02bb8761fcce Initial load
duke
parents:
diff changeset
   296
<h3>Instructions for Using a Third Party's Naming Service</h3>
02bb8761fcce Initial load
duke
parents:
diff changeset
   297
Although we encourage using an ORB and ORB services that are both
02bb8761fcce Initial load
duke
parents:
diff changeset
   298
from one vendor, it is possible to plug in a third party's 
02bb8761fcce Initial load
duke
parents:
diff changeset
   299
<code>COSNaming</code> implementation with Sun's RMI-IIOP ORB.
02bb8761fcce Initial load
duke
parents:
diff changeset
   300
Here are the steps to follow:
02bb8761fcce Initial load
duke
parents:
diff changeset
   301
<OL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   302
  <LI>Create a properties file for the Bootstrap server and give it
02bb8761fcce Initial load
duke
parents:
diff changeset
   303
      two entries.  For example, you could call this properties file 
02bb8761fcce Initial load
duke
parents:
diff changeset
   304
      <code>/tmp/services</code> and put the following in it:
02bb8761fcce Initial load
duke
parents:
diff changeset
   305
      <code>NameService, &lt;Stringified IOR of the Root Naming 
02bb8761fcce Initial load
duke
parents:
diff changeset
   306
Context&gt;</code>.
02bb8761fcce Initial load
duke
parents:
diff changeset
   307
      <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   308
      This associates <code>NameService</code> with the Root Naming
02bb8761fcce Initial load
duke
parents:
diff changeset
   309
      Context of the <code>CosNaming</code> implementation that you 
02bb8761fcce Initial load
duke
parents:
diff changeset
   310
      want to use.
02bb8761fcce Initial load
duke
parents:
diff changeset
   311
	  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   312
  <LI>Start the standalone Bootstrap server using the following command:
02bb8761fcce Initial load
duke
parents:
diff changeset
   313
  <pre>
02bb8761fcce Initial load
duke
parents:
diff changeset
   314
      <code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   315
      java -classpath $(CLASSPATH)
02bb8761fcce Initial load
duke
parents:
diff changeset
   316
      com.sun.corba.ee.internal.CosNaming.BootstrapServer -InitialServicesFile
02bb8761fcce Initial load
duke
parents:
diff changeset
   317
      "/tmp/services" [-ORBInitialPort port]
02bb8761fcce Initial load
duke
parents:
diff changeset
   318
      </code>
02bb8761fcce Initial load
duke
parents:
diff changeset
   319
  </pre>
02bb8761fcce Initial load
duke
parents:
diff changeset
   320
  <P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   321
  Note that the square brackets at the end of the command indicate that
02bb8761fcce Initial load
duke
parents:
diff changeset
   322
  specifying a port number is optional.
02bb8761fcce Initial load
duke
parents:
diff changeset
   323
</OL>
02bb8761fcce Initial load
duke
parents:
diff changeset
   324
<P>
02bb8761fcce Initial load
duke
parents:
diff changeset
   325
Now when an application calls the method 
02bb8761fcce Initial load
duke
parents:
diff changeset
   326
<code>org.omg.CORBA.ORB.resolve_initial_references</code>, CORBA
02bb8761fcce Initial load
duke
parents:
diff changeset
   327
processes will contact the Bootstrap Server to get the Root Naming
02bb8761fcce Initial load
duke
parents:
diff changeset
   328
Context.
02bb8761fcce Initial load
duke
parents:
diff changeset
   329
02bb8761fcce Initial load
duke
parents:
diff changeset
   330
<h2>Package Specification</h2>
02bb8761fcce Initial load
duke
parents:
diff changeset
   331
02bb8761fcce Initial load
duke
parents:
diff changeset
   332
<ul>
02bb8761fcce Initial load
duke
parents:
diff changeset
   333
 <li>Interoperable Naming Service (<a 
02bb8761fcce Initial load
duke
parents:
diff changeset
   334
href="http://cgi.omg.org/cgi-bin/doc?ptc/00-08-07">ptc/00-08-07</a>)
02bb8761fcce Initial load
duke
parents:
diff changeset
   335
</ul>
02bb8761fcce Initial load
duke
parents:
diff changeset
   336
02bb8761fcce Initial load
duke
parents:
diff changeset
   337
<h2>Related Documentation</h2>
02bb8761fcce Initial load
duke
parents:
diff changeset
   338
02bb8761fcce Initial load
duke
parents:
diff changeset
   339
For an overview and examples of how to use the 
02bb8761fcce Initial load
duke
parents:
diff changeset
   340
<code>CosNaming</code> API, please see:
02bb8761fcce Initial load
duke
parents:
diff changeset
   341
<ul>
02bb8761fcce Initial load
duke
parents:
diff changeset
   342
  <li><a href="../../../../technotes/guides/idl/tnameserv.html">
02bb8761fcce Initial load
duke
parents:
diff changeset
   343
	Naming Service</a>
02bb8761fcce Initial load
duke
parents:
diff changeset
   344
</ul>
02bb8761fcce Initial load
duke
parents:
diff changeset
   345
<p>
02bb8761fcce Initial load
duke
parents:
diff changeset
   346
For an overview of Java&nbsp;IDL, please see:
02bb8761fcce Initial load
duke
parents:
diff changeset
   347
<ul>
02bb8761fcce Initial load
duke
parents:
diff changeset
   348
  <li><a href="../../../../technotes/guides/idl/index.html">
02bb8761fcce Initial load
duke
parents:
diff changeset
   349
	Java&nbsp;IDL home page</a>
02bb8761fcce Initial load
duke
parents:
diff changeset
   350
</ul>
02bb8761fcce Initial load
duke
parents:
diff changeset
   351
02bb8761fcce Initial load
duke
parents:
diff changeset
   352
@since JDK1.3
02bb8761fcce Initial load
duke
parents:
diff changeset
   353
02bb8761fcce Initial load
duke
parents:
diff changeset
   354
02bb8761fcce Initial load
duke
parents:
diff changeset
   355
02bb8761fcce Initial load
duke
parents:
diff changeset
   356
</body>
02bb8761fcce Initial load
duke
parents:
diff changeset
   357
</html>
02bb8761fcce Initial load
duke
parents:
diff changeset
   358