duke@1: duke@1: duke@1: duke@1: duke@1: duke@1: duke@1: duke@1: Provides a naming service for Java IDL. The Object Request Broker Daemon duke@1: (ORBD) also includes both a transient and persistent naming service. duke@1: duke@1: duke@1:

duke@1: The package and all its classes and interfaces duke@1: were generated by running the tool idlj on the file duke@1: nameservice.idl, which is a module written in OMG IDL. duke@1: duke@1:

Package Specification

duke@1: duke@1:

For a precise list of supported sections of official specifications with which duke@1: the Java[tm] Platform, Standard Edition 6, ORB complies, see Official Specifications for CORBA duke@1: support in Java[tm] SE 6. duke@1:

duke@1:

Interfaces

duke@1: The package org.omg.CosNaming contains two public interfaces duke@1: and several auxiliary classes. duke@1:

duke@1: The interfaces are: duke@1:

duke@1:

duke@1: These two interfaces provide the means to bind/unbind names and object duke@1: references, to retrieve bound object references, and duke@1: to iterate through a list of bindings. The NamingContext duke@1: interface supplies the main functionality for the naming service, and duke@1: BindingIterator provides a means of iterating through a list duke@1: of name/object reference bindings. duke@1:

duke@1:

Auxiliary Classes

duke@1: In order to map an OMG IDL interface to the Java programming language, duke@1: the idlj compiler creates Java classes that can be thought of duke@1: as auxiliary classes. duke@1: Comments for the generated auxiliary classes duke@1: used by the interfaces NamingContext and duke@1: BindingIterator are included here. duke@1:

duke@1:

Classes Used by NamingContext and duke@1: BindingIterator

duke@1: The following are classes used by duke@1: the naming service. (Helper and holder classes, which are duke@1: generated for each of the classes listed here, are discussed below.) duke@1: duke@1: duke@1: duke@1:

Holder Classes

duke@1: duke@1: OMG IDL uses OUT and INOUT parameters for returning values from operations. duke@1: The mapping to the Java programming language, which does not have OUT duke@1: and INOUT parameters, creates a special class for each type, called duke@1: a holder class. duke@1: An instance of a holder class can be passed to a duke@1: Java method as a parameter, and duke@1: a value can be assigned to its value field. This allows duke@1: it to perform the function of an OUT or INOUT parameter. duke@1:

The following holder classes are generated for the package duke@1: org.omg.CosNaming: duke@1:

duke@1:

duke@1: Note that in the org.omg.CORBA package, duke@1: there is a holder class for each of the basic Java types: duke@1: IntHolder, ShortHolder, duke@1: StringHolder, and so on. duke@1:

duke@1: Note also that there is a NameHolder class even though duke@1: there is no Name class; similarly, there is a duke@1: BindingListHolder class even though there is no duke@1: BindingList class. This is true because in the OMG IDL duke@1: interface, Name and BindingList are duke@1: typedefs. There is no mapping from an IDL duke@1: typedef to a Java construct, but holder classes duke@1: are generated if the typedef is for a sequence or duke@1: an array. As mapped to the duke@1: Java programming language, Name is an array of duke@1: NameComponent objects, and a BindingList duke@1: is an array of Binding objects. duke@1: duke@1: All holder classes have at least two constructors and one field: duke@1:

duke@1:

duke@1: A holder class for a user-defined type (a Java class) has three more duke@1: methods, but application developers do not use them directly. duke@1: duke@1:

Helper Classes

duke@1: Helper classes, which are generated for all user-defined types duke@1: in an OMG IDL interface, supply static methods needed to manipulate duke@1: those types. duke@1:

duke@1: There is only one method in a helper class that an duke@1: application programmer uses: the duke@1: method narrow. Only Java interfaces mapped from IDL duke@1: interfaces will have a helper class that includes a narrow duke@1: method, so in the CosNaming package, only the classes duke@1: NamingContextHelper and BindingIteratorHelper duke@1: have a narrow method. duke@1:

duke@1:

Package org.omg.CosNaming.NamingContextPackage

duke@1: This package supplies Helper and Holder classes for the exceptions used duke@1: in the package org.omg.CosNaming and also for the class duke@1: NotFoundReason, which supplies a reason for the exception duke@1: NotFound. duke@1:

duke@1: There are Helper and Holder classes for the following exceptions: duke@1:

duke@1: duke@1:

Naming Service Compatibility

duke@1: duke@1: Sun's implementation of the CosNaming package complies duke@1: with the OMG COSNaming specification. In other words, duke@1: the APIs in Sun's naming service are implemented according to the duke@1: guidelines for a naming service provided by OMG. Therefore, if a duke@1: third-party vendor has implemented a naming service that is OMG duke@1: compliant, it is possible to switch between Sun's implementation of duke@1: CosNaming and the third-party vendor's implementation. duke@1: However, it is important to understand that there can be minor duke@1: variations in the way different vendors implement the naming service, duke@1: such as differences in the exception strings. duke@1: duke@1:

Instructions for Using a Third Party's Naming Service

duke@1: Although we encourage using an ORB and ORB services that are both duke@1: from one vendor, it is possible to plug in a third party's duke@1: COSNaming implementation with Sun's RMI-IIOP ORB. duke@1: Here are the steps to follow: duke@1:
    duke@1:
  1. Create a properties file for the Bootstrap server and give it duke@1: two entries. For example, you could call this properties file duke@1: /tmp/services and put the following in it: duke@1: NameService, <Stringified IOR of the Root Naming duke@1: Context>. duke@1:

    duke@1: This associates NameService with the Root Naming duke@1: Context of the CosNaming implementation that you duke@1: want to use. duke@1:

    duke@1:

  2. Start the standalone Bootstrap server using the following command: duke@1:
    duke@1:       
    duke@1:       java -classpath $(CLASSPATH)
    duke@1:       com.sun.corba.ee.internal.CosNaming.BootstrapServer -InitialServicesFile
    duke@1:       "/tmp/services" [-ORBInitialPort port]
    duke@1:       
    duke@1:   
    duke@1:

    duke@1: Note that the square brackets at the end of the command indicate that duke@1: specifying a port number is optional. duke@1:

duke@1:

duke@1: Now when an application calls the method duke@1: org.omg.CORBA.ORB.resolve_initial_references, CORBA duke@1: processes will contact the Bootstrap Server to get the Root Naming duke@1: Context. duke@1: duke@1:

Package Specification

duke@1: duke@1: duke@1: duke@1:

Related Documentation

duke@1: duke@1: For an overview and examples of how to use the duke@1: CosNaming API, please see: duke@1: duke@1:

duke@1: For an overview of Java IDL, please see: duke@1:

duke@1: duke@1: @since JDK1.3 duke@1: duke@1: duke@1: duke@1: duke@1: duke@1: