Netscape Internet Service Broker for Java: Programmer's Guide, Version 1.0

[Contents] [Previous] [Next]

Chapter 7
The Interface Repository

This chapter describes ISB for Java's interface repository, the objects it contains, and the interfaces you can use to access it. For more information about interface repositories, see the CORBA 2.0 specification produced by the OMG at http://www.omg.org. This chapter includes the following major sections:

Overview

The interface repository (IR) maintains information about ORB objects and their type. Type information is stored on objects such as modules, interfaces, operations, attributes and exceptions. An IDL interface is provided that enables client applications to query the IR to obtain language binding information or to discover newly added interfaces. The ORB accesses the IR to check the type of values in a client request or to verify an interface inheritance graph. Every object in the IR can be accessed as an org.omg.CORBA.IRObject, which is the most generic interface. IRObject provides methods for narrowing, cloning, and duplicating an IRObject reference. It also allows you to identify the type of an IRObject.

IR Structure

The IR organizes the objects it contains into a hierarchy that corresponds to the way objects are defined in an IDL specification. Some objects in the IR contain other objects, just as an IDL module definition might contain several interface definitions. Consider how the following IDL file would translate to a hierarchy of objects in the IR. 

The bank/bank.idl file.

// Bank.idl

module Bank {
    interface Account {
        float balance();
    };
    interface AccountManager {
        Account open(in string name);
    };
};

Figure 7.1    IR object hierarchy for the Bank.idl specification.

Identifying IR Objects

The following table lists objects provided to identify and classify IR objects.

Item Description
name

A character string that corresponds to the identifier assigned in an IDL specification to a module, interface, operation, etc. An Identifier is not necessarily unique.

id

A character string that uniquely identifies an IRObject. A RepositoryID contains a sequence of identifiers, separated by "::" delimiters and always begins with a "::" delimiter.

def_kind

An enumeration that defines values which represent all the possible types of IR objects.

IRObject Types

The following table summarizes the objects that can be contained in the IR. 

Object type Description
Repository

Represents the top-level module that contains all other objects in this repository.

ModuleDef

Contains a grouping of interfaces. Can also contain constants, typedefs and even other ModuleDef objects.

InterfaceDef

Contains a list of operations, exceptions, typedefs, constants and attributes that make up an interface.

AttributeDef

Represents an attribute associated with an interface.

OperationDef

Defines an operation on an interface. It includes a list of parameters required for this operation and a list of exceptions that can be raised by this operation.

TypedefDef

A base interface for named types that are not interfaces. This includes AliasDef, EnumDef, StructDef, and UnionDef.

ConstantDef

Defines a named constant.

ExceptionDef

Defines an exception that can be raised by an operation.

IDLType

A base interface for IDL types. This includes ArrayDef, PrimitiveDef, SequenceDef, and StringDef.

Using the IR

To use the IR, do the following:

Setting VBROKER_ADM

The VBROKER_ADM environment variable specifies the default location for the ORB log file. It enables the Interface Repository to locate the default repository files. If VBROKER_ADM is not set, the files will reside in a \log directory on the current drive by default.

Starting the IR

Use the irep command to start the IR. Specify an interface repository server and, optionally, a database containing detailed descriptions of IDL interfaces. For example:

prompt> irep my_ir ir_db
This command is described in the Netscape Internet Service Broker for Java Reference Guide.

Populating the IR

The idl2ir command can be used to populate an IR instance with objects defined in an IDL file. For example, the following command populates an IR named my_repository with objects defined in the file Bank.idl.

prompt> idl2ir -ir my_repository java_examples/bank/Bank.idl
This command is described in the Netscape Internet Service Broker for Java Reference Guide. You can also write your own applications that bind to an IR and add objects.

Accessing the IR

The IR offers an ORB interface that provides your client applications with a variety of methods for obtaining information about objects in the IR. Your client application can bind to the Repository and then invoke the methods shown in the Repository class (described in the Netscape Internet Service Broker for Java Reference Guide).


[Contents] [Previous] [Next]

Last Updated: 02/04/98 13:47:00


Copyright © 1997 Netscape Communications Corporation

Any sample code included above is provided for your use on an "AS IS" basis, under the Netscape License Agreement - Terms of Use