corba/src/java.corba/share/classes/org/omg/CosNaming/package.html
changeset 29827 aac4782e69ac
parent 25862 a5e25d68f971
child 32688 936c391804a5
equal deleted inserted replaced
29659:f40752db7773 29827:aac4782e69ac
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
     2 <html>
     2 <html>
     3 <head>
     3 <head>
     4 <!--
     4 <!--
     5 /*
     5 /*
     6 * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
     6 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
     7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8 *
     8 *
     9 * This code is free software; you can redistribute it and/or modify it
     9 * This code is free software; you can redistribute it and/or modify it
    10 * under the terms of the GNU General Public License version 2 only, as
    10 * under the terms of the GNU General Public License version 2 only, as
    11 * published by the Free Software Foundation.  Oracle designates this
    11 * published by the Free Software Foundation.  Oracle designates this
    30 </head>
    30 </head>
    31 <body bgcolor="white">
    31 <body bgcolor="white">
    32 
    32 
    33   Provides a naming service for Java&nbsp;IDL.  The Object Request Broker Daemon
    33   Provides a naming service for Java&nbsp;IDL.  The Object Request Broker Daemon
    34   (ORBD) also includes both a transient and persistent naming service.
    34   (ORBD) also includes both a transient and persistent naming service.
    35   
    35 
    36 
    36 
    37   <P>
    37   <P>
    38   The package and all its classes and interfaces 
    38   The package and all its classes and interfaces 
    39   were generated by running the tool <code>idlj</code> on the file
    39   were generated by running the tool <code>idlj</code> on the file
    40   <code>nameservice.idl</code>, which is a module written in OMG IDL.
    40   <code>nameservice.idl</code>, which is a module written in OMG IDL.
    41   
    41 
    42   <H3>Package Specification</H3>
    42   <H3>Package Specification</H3>
    43  
    43 
    44 <P>For a precise list of supported sections of official specifications with which 
    44 <P>For a precise list of supported sections of official specifications with which 
    45 the Java[tm] Platform, Standard Edition 6, ORB complies, see <A 
    45 the Java[tm] Platform, Standard Edition 6, ORB complies, see <A 
    46 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
    46 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA 
    47 support in Java[tm] SE 6</A>.
    47 support in Java[tm] SE 6</A>.
    48   <P>
    48 
    49   <H2>Interfaces</H2>
    49   <H2>Interfaces</H2>
    50   The package <tt>org.omg.CosNaming</tt> contains two public interfaces
    50   The package <tt>org.omg.CosNaming</tt> contains two public interfaces
    51   and several auxiliary classes. 
    51   and several auxiliary classes. 
    52   <P>
    52   <P>
    53   The interfaces are:
    53   The interfaces are:
    60   references, to retrieve bound object references, and
    60   references, to retrieve bound object references, and
    61   to iterate through a list of bindings.  The <code>NamingContext</code>
    61   to iterate through a list of bindings.  The <code>NamingContext</code>
    62   interface supplies the main functionality for the naming service, and
    62   interface supplies the main functionality for the naming service, and
    63   <code>BindingIterator</code> provides a means of iterating through a list
    63   <code>BindingIterator</code> provides a means of iterating through a list
    64   of name/object reference bindings.
    64   of name/object reference bindings.
    65   <P>
    65 
    66   <H2>Auxiliary Classes</H2>
    66   <H2>Auxiliary Classes</H2>
    67   In order to map an OMG IDL interface to the Java programming language,
    67   In order to map an OMG IDL interface to the Java programming language,
    68   the idlj compiler creates Java classes that can be thought of
    68   the idlj compiler creates Java classes that can be thought of
    69   as auxiliary classes.
    69   as auxiliary classes.
    70   Comments for the generated auxiliary classes
    70   Comments for the generated auxiliary classes
    71   used by the interfaces <code>NamingContext</code> and 
    71   used by the interfaces <code>NamingContext</code> and 
    72   <code>BindingIterator</code> are included here.
    72   <code>BindingIterator</code> are included here.
    73   <P>
    73 
    74   <H3>Classes Used by <code>NamingContext</code> and
    74   <H3>Classes Used by <code>NamingContext</code> and
    75   <code>BindingIterator</code></H3>
    75   <code>BindingIterator</code></H3>
    76   The following are classes used by
    76   The following are classes used by
    77   the naming service.  (Helper and  holder classes, which are
    77   the naming service.  (Helper and  holder classes, which are
    78   generated for each of the classes listed here,  are discussed below.)
    78   generated for each of the classes listed here,  are discussed below.)
    79  
    79 
    80   <UL>
    80   <UL>
    81     <LI><code>public final class <B>NameComponent</B></code> -- 
    81     <LI><code>public final class <B>NameComponent</B></code> -- 
    82     a building block for names.  (Names are bound to object references
    82     a building block for names.  (Names are bound to object references
    83     in a naming context.)
    83     in a naming context.)
    84     <P>A name is an array of one or more <code>NameComponent</code> objects.
    84     <P>A name is an array of one or more <code>NameComponent</code> objects.
    87     objects is called a <I>compound name</I>.
    87     objects is called a <I>compound name</I>.
    88     <P>
    88     <P>
    89     A <code><B>NameComponent</B></code> object consists of two fields:
    89     A <code><B>NameComponent</B></code> object consists of two fields:
    90     <OL>
    90     <OL>
    91     <LI><code><B>id</B></code> -- a <code>String</code> used as an identifier
    91     <LI><code><B>id</B></code> -- a <code>String</code> used as an identifier
    92     <LI><code><B>kind</B></code> -- a <code>String</code> that can be used for 
    92     <LI><code><B>kind</B></code> -- a <code>String</code> that can be used for any
    93 any
       
    94     descriptive purpose.  Its importance is that it
    93     descriptive purpose.  Its importance is that it
    95     can be used to describe an object without affecting syntax.
    94     can be used to describe an object without affecting syntax.
    96     The C programming language, for example, uses the the syntactic convention
    95     The C programming language, for example, uses the the syntactic convention
    97     of appending the extension ".c" to a file name to indicate that it is
    96     of appending the extension ".c" to a file name to indicate that it is
    98     a source code file.  In a <code>NameComponent</code> object,
    97     a source code file.  In a <code>NameComponent</code> object,
   100     rather than a file extension or some other syntactic convention.
    99     rather than a file extension or some other syntactic convention.
   101     Examples of the value of the <code>kind</code> field include the strings
   100     Examples of the value of the <code>kind</code> field include the strings
   102     <code>"c_source"</code>, <code>"object_code"</code>,
   101     <code>"c_source"</code>, <code>"object_code"</code>,
   103     <code>"executable"</code>, 
   102     <code>"executable"</code>, 
   104     <code>"postscript"</code>, and <code>""</code>.  It is not unusual
   103     <code>"postscript"</code>, and <code>""</code>.  It is not unusual
   105 	for the <code>kind</code> field to be the empty string.
   104     for the <code>kind</code> field to be the empty string.
   106     </OL>
   105     </OL>
   107     <P>
   106     <P>
   108     In a name, each <code>NameComponent</code> object except the last denotes
   107     In a name, each <code>NameComponent</code> object except the last denotes
   109     a <code>NamingContext</code> object; the last <code>NameComponent</code>
   108     a <code>NamingContext</code> object; the last <code>NameComponent</code>
   110     object denotes the bound object reference.
   109     object denotes the bound object reference.
   111     This is similar to a path name, in which the last name is the
   110     This is similar to a path name, in which the last name is the
   112     file name, and all names before it are directory names.<p>
   111     file name, and all names before it are directory names.
   113     <P>
   112 
   114    
       
   115     <LI><code>public final class <B>Binding</B></code> -- 
   113     <LI><code>public final class <B>Binding</B></code> -- 
   116     an object that associates a name with an object reference or a
   114     an object that associates a name with an object reference or a
   117     naming context.
   115     naming context.
   118     A <code>Binding</code> object has two fields:
   116     A <code>Binding</code> object has two fields:
   119     <OL>
   117     <OL>
   123     indicating whether the binding is between a name and an object
   121     indicating whether the binding is between a name and an object
   124     reference or between a name and a naming context
   122     reference or between a name and a naming context
   125     </OL>
   123     </OL>
   126     <P>
   124     <P>
   127     The interface <code>NamingContext</code> has methods for
   125     The interface <code>NamingContext</code> has methods for
   128 	binding/unbinding names with object references or naming contexts,
   126     binding/unbinding names with object references or naming contexts,
   129 	for listing bindings,
   127     for listing bindings,
   130     and for resolving bindings (given a name, the method
   128     and for resolving bindings (given a name, the method
   131     <code>resolve</code> returns the object reference bound to it).
   129     <code>resolve</code> returns the object reference bound to it).
   132    
   130 
   133   <P>
   131     <LI><code>public final class <B>BindingType</B></code> --
   134   <LI><code>public final class <B>BindingType</B></code> --
       
   135     an object that specifies whether the given <code>Binding</code>
   132     an object that specifies whether the given <code>Binding</code>
   136     object is a binding between a name and an object reference (that is,
   133     object is a binding between a name and an object reference (that is,
   137     not a naming context) or between a name and a naming context.
   134     not a naming context) or between a name and a naming context.
   138     <P>
   135     <P>
   139     The class<code>BindingType</code> consists of two methods and
   136     The class<code>BindingType</code> consists of two methods and
   140 	four constants. Two of these constants are
   137     four constants. Two of these constants are
   141 	<code>BindingType</code> objects, and two are <code>int</code>s.
   138     <code>BindingType</code> objects, and two are <code>int</code>s.
   142 	<P>
   139     <P>
   143 	The <code>BindingType</code> objects
   140     The <code>BindingType</code> objects
   144     can be passed to the constructor for the class
   141     can be passed to the constructor for the class
   145     <code>Binding</code> or used as parameters or return values.  These
   142     <code>Binding</code> or used as parameters or return values.  These
   146 	<code>BindingType</code> objects are:
   143     <code>BindingType</code> objects are:
   147     <UL>
   144     <UL>
   148     <LI><code>public static final BindingType <B>nobject</B></code> -- 
   145     <LI><code>public static final BindingType <B>nobject</B></code> -- 
   149 	to indicate that the binding is with an object reference
   146     to indicate that the binding is with an object reference
   150     <LI><code>public static final BindingType <B>ncontext</B></code> -- 
   147     <LI><code>public static final BindingType <B>ncontext</B></code> -- 
   151 	to indicate that the binding is with a naming context
   148     to indicate that the binding is with a naming context
   152     </UL>
   149     </UL>
   153     <P>
   150     <P>
   154 	The <code>int</code> constants can be supplied to the method
   151     The <code>int</code> constants can be supplied to the method
   155 	<code>from_int</code> to create  <code>BindingType</code> objects,
   152     <code>from_int</code> to create  <code>BindingType</code> objects,
   156 	or they can be return values for the method <code>value</code>.
   153     or they can be return values for the method <code>value</code>.
   157 	These constants are:
   154     These constants are:
   158 	<UL>
   155     <UL>
   159     <LI><code>public static final int <B>_nobject</B></code>
   156     <LI><code>public static final int <B>_nobject</B></code>
   160     <LI><code>public static final int <B>_ncontext</B></code>
   157     <LI><code>public static final int <B>_ncontext</B></code>
   161 	</UL>
   158     </UL>
   162     If the method <code>from_int</code> is supplied with anything other
   159     If the method <code>from_int</code> is supplied with anything other
   163 	than <code>_nobject</code>
   160     than <code>_nobject</code>
   164     or <code>_ncontext</code>, it will throw
   161     or <code>_ncontext</code>, it will throw
   165 	the exception <code>org.omg.CORBA.BAD_PARAM</code>. 
   162     the exception <code>org.omg.CORBA.BAD_PARAM</code>. 
   166 	<P>Usage is as follows:
   163     <P>Usage is as follows:
   167     <PRE>
   164     <PRE>
   168        BindingType btObject = from_int(_nobject);
   165        BindingType btObject = from_int(_nobject);
   169        BindingType btContext = from_int(_ncontext);
   166        BindingType btContext = from_int(_ncontext);
   170     </PRE>
   167     </PRE>
   171     The variable <code>btObject</code> refers to a <code>BindingType</code>
   168     The variable <code>btObject</code> refers to a <code>BindingType</code>
   180     will contain <code>_nobject</code> or <code>_ncontext</code>:
   177     will contain <code>_nobject</code> or <code>_ncontext</code>:
   181     <PRE>
   178     <PRE>
   182        int bt = BindingType.value();
   179        int bt = BindingType.value();
   183     </PRE>
   180     </PRE>
   184   </UL>
   181   </UL>
   185   
   182 
   186   <H3>Holder Classes</H3>
   183   <H3>Holder Classes</H3>
   187  
   184 
   188   OMG IDL uses OUT and INOUT parameters for returning values from operations.
   185   OMG IDL uses OUT and INOUT parameters for returning values from operations.
   189   The mapping to the Java programming language, which does not have OUT
   186   The mapping to the Java programming language, which does not have OUT
   190   and INOUT parameters, creates a special class for each type, called
   187   and INOUT parameters, creates a special class for each type, called
   191   a holder class. 
   188   a holder class. 
   192   An instance of a holder class can be passed to a
   189   An instance of a holder class can be passed to a
   306 Context&gt;</code>.
   303 Context&gt;</code>.
   307       <P>
   304       <P>
   308       This associates <code>NameService</code> with the Root Naming
   305       This associates <code>NameService</code> with the Root Naming
   309       Context of the <code>CosNaming</code> implementation that you 
   306       Context of the <code>CosNaming</code> implementation that you 
   310       want to use.
   307       want to use.
   311 	  <P>
       
   312   <LI>Start the standalone Bootstrap server using the following command:
   308   <LI>Start the standalone Bootstrap server using the following command:
   313   <pre>
   309   <pre>
   314       <code>
   310       <code>
   315       java -classpath $(CLASSPATH)
   311       java -classpath $(CLASSPATH)
   316       com.sun.corba.ee.internal.CosNaming.BootstrapServer -InitialServicesFile
   312       com.sun.corba.ee.internal.CosNaming.BootstrapServer -InitialServicesFile
   338 
   334 
   339 For an overview and examples of how to use the 
   335 For an overview and examples of how to use the 
   340 <code>CosNaming</code> API, please see:
   336 <code>CosNaming</code> API, please see:
   341 <ul>
   337 <ul>
   342   <li><a href="../../../../technotes/guides/idl/tnameserv.html">
   338   <li><a href="../../../../technotes/guides/idl/tnameserv.html">
   343 	Naming Service</a>
   339     Naming Service</a>
   344 </ul>
   340 </ul>
   345 <p>
   341 <p>
   346 For an overview of Java&nbsp;IDL, please see:
   342 For an overview of Java&nbsp;IDL, please see:
   347 <ul>
   343 <ul>
   348   <li><a href="../../../../technotes/guides/idl/index.html">
   344   <li><a href="../../../../technotes/guides/idl/index.html">
   349 	Java&nbsp;IDL home page</a>
   345     Java&nbsp;IDL home page</a>
   350 </ul>
   346 </ul>
   351 
   347 
   352 @since JDK1.3
   348 @since JDK1.3
   353 
   349 
   354 
   350