[Previous] [Contents] [Next] [IONA Technologies]


Chapter 7
Publishing Object References in Servers


Contents

7.1 Object Identification
7.1.1 OrbixWeb Object References
7.1.2 Interoperable Object References
7.1.3 Assigning Markers to OrbixWeb Objects
7.2 Making Object References Available to Clients
7.2.1 Publishing Object References using the Naming Service



This chapter presents details of how OrbixWeb objects are identified in a distributed system. Chapter 8, "Retrieving Object References in Clients" will discuss the closely related issue of how applications locate objects in the system and how proxies can be constructed for those objects.

7.1 Object Identification

An OrbixWeb object is uniquely identified by its object reference; an object reference is an internal identification structure which contains a fixed set of fields.

OrbixWeb supports two protocols for communications between distributed applications: the Orbix protocol and the CORBA standard Internet Inter-ORB Protocol (IIOP) for interoperability between different ORB implementations. IIOP is the default protocol and is described in detail in Chapter 9, "ORB Interoperability". Each of the two available protocols requires a different object reference format; the Orbix protocol requires an OrbixWeb object reference format and IIOP requires the CORBA Interoperable Object Reference (IOR) format. In this section, we will introduce each type of object reference and describe how a programmer may use the fields of an object reference.

If an application wishes to bind to an object, then it must have a mechanism for obtaining the information stored in the object reference. There are several ways for a server to make this information available, and these will be discussed in section 7.2.

7.1.1 OrbixWeb Object References

Each OrbixWeb object reference includes the following information:

For example, the object reference for a bank account would include the name of the server which manages the account, a marker name, and the name of the server's host. The bank server could, if it were appropriate to the application, create and name different bank objects with different names, all managed by the same server.

In more detail, an OrbixWeb object reference is fully specified by the following fields:

All OrbixWeb objects implement the Java interface _ObjectRef. This interface supplies several methods common to all object references, including _object_to_string() which (with a single parameter value IE.Iona.Orbix2._CORBA.IT_ORBIX_OR_KIND) produces a stringified form of the object reference in the following format:

:\server_host:server_name:marker:IR_host:IR_server:IDL_interface

_ObjectRef also provides access to the individual fields of an object reference string via the following set of accessor methods:

In general, the IR host name (interfaceHost) and IR server (interfaceImplementation) fields are set to default values; in the stringified form these are `IR' and the blank string, respectively. OrbixWeb automatically assigns the server host, server name and IDL interface fields on object creation and it is not generally necessary to update these values. OrbixWeb also assigns a marker value to each object, but programmers may choose alternative marker values in order to explicitly name OrbixWeb objects. The assignment of marker names to objects is discussed in section 7.1.3.

7.1.2 Interoperable Object References

An object which is accessible via IIOP is identified by an interoperable object reference (IOR). Since an ORB's object reference format is not prescribed by the OMG, the format of an IOR includes an ORB's internal object reference as well as an internet host address and a port number.

An IOR is managed internally by the interoperating ORBs–it is not necessary for an application programmer to know the structure of an IOR. However, an application may wish to publish the stringified form of an object's IOR. In OrbixWeb, the stringified IOR can be by obtained calling the method _object_to_string() on the required object, passing the value IE.Iona.Orbix2._CORBA.IT_INTEROPERABLE_OR_KIND as a parameter.

7.1.3 Assigning Markers to OrbixWeb Objects

An OrbixWeb marker value allows a name (in string format) to be associated with an object, as part of its object reference. A marker name may be specified at the time an object is created as we will see in "Assigning a Marker on Creation". If a marker is not specified for a newly created object, a name is automatically chosen by OrbixWeb.

An object which has a user-specified name or a name assigned by OrbixWeb may be renamed using the modifier method _marker(String) which is defined on the interface _ObjectRef, in package IE.Iona.Orbix2.CORBA and is available on every OrbixWeb object.

The marker name associated with an object may be found using the accessor method _marker(). The following code demonstrates the use of this method:

Assigning a Marker on Creation

A marker for an object may be assigned on creation by:

Choosing Marker Names

The marker names chosen by OrbixWeb consist of a string composed entirely of decimal digits. Programmers can ensure that their markers are different from those chosen by OrbixWeb by not using strings that consist entirely of digits.

Marker names cannot contain the character `:' and cannot contain the null character.

An object's interface name together with its marker name must be unique within a server. If a chosen marker is already in use when an object is named, OrbixWeb will (silently) assign a different marker to the object (and the object with the original marker will be unaffected). There are two ways to test for this, depending on how a marker is assigned to an object:

7.2 Making Object References Available to Clients

Clients must be able to locate objects in a distributed system. Consequently, servers must make information about the objects they create available to other system components. There are four fundamental ways to do this:

The first of these approaches is commonly used in OrbixWeb applications and can be used with either the Orbix or IIOP communications protocol. However, this method only applies to objects created in OrbixWeb servers and not to servers implemented using other ORBs.

Passing an object reference as a parameter is very useful and is frequently implemented in CORBA applications. However, it is important to note that this system implies that the client is already connected to a server object. Therefore, it must be used in conjunction with one of the other approaches.

The CORBA Naming Service approach is suitable for a wide range of applications. The Naming Service is defined as part of the CORBAservices specification and allows ORB applications to assign abstract names to objects in a distributed system. These names can be assigned, and the objects associated with the names can be retrieved, through a standard IDL interface.

For example, if an OrbixWeb application assigns a name to an IOR for one of its objects, then this object can be located using the Naming Service interface by an application implemented using any ORB. In section 7.2.1, we will illustrate how to use the Naming Service in this context.

7.2.1 Publishing Object References using the Naming Service

The role of the CORBA Naming Service is to allow a name to be bound to (associated with) an object and to allow that object to be found subsequently by resolving that name.

A server that holds an object reference can register it with the Naming Service, giving it a name that can be used by other components of the system to subsequently find the object. The Naming Service has a number of interfaces defined in IDL that allow the components of the system to use its facilities. OrbixNames, IONA Technologies' implementation of the CORBA Naming Service,. runs as an Orbix (or OrbixWeb) server.

One of the advantages of the Naming Service is that the names it associates with objects are independent of any properties of the objects they refer to: in particular, a name is independent of an object's interface, server or host name. This allows application designers to chose any appropriate naming system for locating objects, independent of object reference formats.

For details of how the Naming Service operates, the reader should refer to the OrbixNames Guide. In summary, a name is always resolved within a given naming context. The naming context objects in the system are organised into a naming graph, which may form a naming hierarchy, much like that of a filing system. This gives rise to the notion of a compound name. The first component of a compound name gives the name of a NamingContext, in which the second name in the compound name is looked up. This process continues until the last component of the compound name has been reached.

The following code segment shows how to build naming contexts objects and objects.banks, and then to bind the name objects.banks.national to the object reference for a Bank implementation object.

In Chapter 8, we will describe how clients can resolve object references using the Naming Service.



[Roadmap] [Introduction] [GS: Applications] [GS: Applets]
[IDL] [Mapping] [Programming OrbixWeb] [Publishing Objects] [Retrieving Objects] [IIOP]
[Running Clients] [Running Servers] [Exceptions] [Inheritance] [Callbacks] [Contexts]
[API Configuration] [TypeCode] [Any] [DII] [IR] [Filters] [Smart Proxies] [Loaders] [Locators]
[Index]