John Aguayo
Introduction
The CORBA 2.x specifications for a Naming Service define a mechanism that allows applications to locate and obtain references to objects (or services). Given a reference to an initial naming context and a name, an application would be able to traverse through the naming contexts until they found the object (or service) they were looking for. As mentioned by OMG, being able to obtain object references is a cornerstone of CORBA. The Naming Service provides a way of publishing objects in a central location by binding names (which are sequences of naming contexts) to objects. What is achieved is a tree like hierarchy similar to a filesystem where there are a series of directories and files. A user who is given a full path to a file and wished to find that file would traverse the directories until they reached the file they were looking for. Similarly an application given an initial naming context and a name (which is defined as a sequence of naming contexts) would traverse the naming contexts until they reach the final naming context which would be the reference to the object they were looking for.
The specifications for the service was flexible since it didn't place too many restrictions on how an implementation built the Naming Service nor did it place too many restrictions on how a client might traverse a Naming Service. It also was able to define a set of structures representing names that were bound to object references.
In time, people started to notice that there was not a uniform way that naming service providers and users were utilizing the naming server. Service implementers and users were establishing their own conventions. Enhancements to the naming service was identified that the OMG felt would increase "interoperability" and portability of applications that use the service. Hence an RFP for an Interoperable Naming Service was created.
The RFP was seeking proposals that would address issues such as the specification of a name string syntax, a standard way for clients to "bootstrap" an initial naming context, and additional support for URL based names.
The purpose of this document is to address the enhancements and modifications in the Interoperable Naming Service specification and demonstrate how they might affect the implementation and use of the Naming Service mechanism.
RFP
The RFP defined a set of mandatory requirements that must be met. The requirements include the following:
The participants involved in creating the proposal were
The RFP stated that one of it's mandatory requirements was a definition
of the concept of a stringified name as well as how it was to be used.
With the CORBA 2.x specification, once an initial naming context was obtained,
the application would need to build a Name object (which is just a typedef'd
sequence of NameComponent) and use the NamingContext methods to bind, or
resolve, an object or other naming context.
As defined in the CosNaming module, the Name object is really just
a sequence of NameComponent structures. Each structure had an id and a
kind field. The Name object would be passed to one of the NamingContext
methods
For example, if an application wanted to resolve a Name it might
have the following piece of code
//resolve the path
org.omg.CORBA.Object ref = ncRef.resolve(name);
SimpleObject obj = SimpleObjectHelper.narrow(ref);
StringName to_string(in Name n)
Name to_name(in StringName sn)
exception InvalidAddress {};
URLString to_url(in Address addr, in StringName sn)
Object resolve_str(in StringName n)
One of the mandatory requirements of the RFP was that a specification
should state mechanisms and interfaces defining a common way for CORBA
applications to obtain an initial naming context. When a CORBA application
is started, before an object can be resolved, an initial naming context
must be obtained. This naming context is the starting point for an application
when it attempts to resolve a name referring to an object. Since there
is no specification on how an application goes about obtaining an initial
naming context, different vendors have implemented this different ways.
For example, with the JAVA IDL, an initial naming context for the Naming
Service might be obtained in one of two ways.
One way is by using the two command line arguments, -ORBInitialHost <host_name>
and -ORBInitialPort <port>, as follows
This call initializes the ORB with arguments passed from the command
line. The arguments, -ORBInitialHost and -ORBInitialPort, specify the host
and port where the COS Naming Service is located.
Now with a call to the ORB method resolve_initial_references( ), the
application can obtain a reference to the initial naming context. The following
code demonstrates how this is done.
//narrow reference to a NamingContext
NamingContext ncRef;
ncRef = NamingContextHelper.narrow(objRef);
This approach, however, is proprietary to the JAVA IDL.
A more flexible approach, suggested by Andy Krumel, in his article to
JavaWorld was to use the published IOR of the Naming Service. He suggests
that the IOR be passed as an argument in the command line, and the argument
then be used in an ORB method call string_to_object( ), to obtain a reference
to the initial naming context. This is demonstrated in the following piece
of code
org.omg.CORBA.Object ref;
NamingContext ncRef;
//get naming context reference using IOR
String ior = args[0];
ref = orb.string_to_object(ior);
//narrow reference to a NamingContext
ncRef = NamingContextHelper.narrow(ref);
With Andy's approach, the client only need the IOR in order to obtain
a reference to the initial naming context.
The writers of the specification took an approach, which is a combination of the two.
The writers specified two command line arguments, -ORBInitRef and -ORBDefaultInitRef, which can be passed to the ORB.init( ) method.
The format of the -ORBInitRef argument is
where <ObjectID> represents the id of a service defined in the
CORBA specification such as the NameService. The definition of <ObjectURL>
is any URL scheme supported by the ORB method string_to_object( ). This
includes the iioploc and iiopname URL schemes defined in the new specification.
Now, if the application were started with
Or
The line of code
would return a reference to the initial naming context for the Naming
Service based on the command line argument.
The format of the -ORBDefaultInitRef argument is
The definition of <ObjectURL> is any URL scheme supported by
the ORB method string_to_object( ). This command line argument assists
in the resolution of an initial reference that may not have been specified
with the -ORBInitRef argument.
For example, if the application were started with
If the application had the following line of code,
The application would use the URL associated with the ORBDefaultInitRef
argument to attempt to resolve the name.
The specification went on to define the order that the call to resolve_initial_references
would attempt to resolve a given name. The order would use the value of
the ORBInitRef argument, if possible, followed by the ORBDefaultInitRef
argument and finally if not resolved with those two URLs, the call would
use any pre-configured ORB settings.
The RFP required that proposals specify how an application might
utilize URLs as well as specify the relationship between URLs and Names.
The specification defined two URL formats, iioploc and iiopname, which
are very similar to the ftp and http formats.
The iioploc URL is similar to the IOR (which is also a valid URL). The iioploc URL specifies the address where a CORBA service can be found.
The iiopname URL is similar to the iioploc URL but it also a stringified name that identifies a binding in a naming context.
The BNF for iiopname as defined in the proposal is
<addr_list> = [<address> ","]* <address>
<address> = [<version> <host> [":" <port>]]
<host> = DNS Style Host Name | ip_address
<version> = <major> "." <minor> "@" | empty_string
<port> = number
<major> = number
<minor> = number
<string_name>= stringified Name | empty_string
address: A single address
host: DNS-style host name or IP address. If not present, the local host is assumed.
version: a major and minor version number, separated by "." and followed by "@". If the version is absent, 1.0 is assumed.
ip_address: numeric IP address (dotted decimal notation).
port: port number object is listening on. Default is 9999.
string_name: a stringified Name with URL escapes as defined in
section .
The specification provides an example of how the iiopname URL can be resolved using iioploc.
Using the iiopname URL described above, the client would do the following:
The Name type defined in the CosNaming module consists of a sequence
of NameComponent structures. When a client application needs to obtain
a reference to an object given an instance of Name (a process known as
resolving), the application would need to build the Name sequence, and
call the resolve( ) method of the object referencing the naming server
object.
The following piece of code shows how this works
//resolve the path
org.omg.CORBA.Object ref = ncRef.resolve(name);
SimpleObject obj = SimpleObjectHelper.narrow(ref);
The NameComponent structure has two fields, the id field and the
kind field. When attempting to resolve the sequence of NameComponent structures,
a product implementing a CORBA ORB would need to compare two NameComponent
structures for equality. The problem is that there is no specifications
defining what made two NameComponent structures equal. The result of having
no specifications was that different vendors had different implementation
of equality.
The simple resolution to this was to define two NameComponents being
equal if both the id and kind fields are equal.
The following are enhancements that addressed open issues in the
OMG issues database. The writers felt that addressing these issues would
help increase the interoperability of the Naming Service
Any host with a CORBA ORB has the ability to publish or use objects through the use of the CORBA Naming Service. The enhancements in the Interoperable Naming Service specification will ease the ability of hosts to locate objects through such mechanisms as stringified names and new URL schemes. More importantly, the new specifications will reduce the amount of parity between ORB vendors by adding clearer definition to some parts of the CORBA 2.x specifications.
References
Chapter 3: Naming Service Specification, Object Management Group, 1995
Locating CORBA Objects Using JAVA IDL, JavaWorld, 02/1999, Andy Krumel
IIOP Specification: A Closer Look, UNIX Review, Gabriel Minton, 1997
Interoperable Naming Service, Object Management Group, BEA Systems, Inc., Cooperative Research Centre for Distributed Systems Technology (DSTC Pty Ltd), Inprise Corporation, IONA Technologies, PLC, 1998
RFP/orbos/97-12-20, Object Management Group, 1997