The Interface Repository in ORBLink

An interface repository is an object implementing the CORBA::Repository interface. This is a standard CORBA interface whose IDL is given in the CORBA Core IDL.

The purpose of the interface repository is to maintain type information about IDL files. Once an IDL file is compiled, its definitions can be stored in an interface repository and can be retrieved remotely by other ORBs.

The semantics of the interface repository are specified in the CORBA Core standard as well as in most good books on CORBA. Therefore, we will not discuss the semantics here in detail except to give a few simple examples. Unlike most ORBs, ORBLink naturally and seamlessly can access multiple interface repositories. Each invocation of the IDL compiler creates a new interface repository that can be navigated.

Getting the root interface repository object

The simplest way to obtain the interface repository object is as the value returned by the IDL/Lisp compiler, corba:idl.

The script below illustrates navigation of the grid example IDL.

; Get the repository object
USER(5): (setq repository (corba:idl "examples/grid/idl/grid.idl")) 

; List all definitions in the repository
USER(6): (op:contents repository :dk_all nil) 
    :NAME "example" :ID "IDL:example:1.0" :DEF_KIND :DK_MODULE  @ #x86b9dca>)

; Get the first (and only) definition
USER(8): (setq moduledef (car (op:contents repository :dk_all nil))) 
   :NAME "example" :ID "IDL:example:1.0" :DEF_KIND :DK_MODULE  @ #x86b9dca>

; Get the name of this definition
USER(9): (op:name moduledef)

; describe the module definition (this returns a struct)
USER(10): (op:describe moduledef)
#< CORBA:MODULEDESCRIPTION :NAME "example" :ID "IDL:example:1.0" 
   :DEFINED_IN "" :VERSION "1.0"  @ #x86bd67a>

; List the contents of the module
USER(11): (op:contents moduledef :dk_all nil)
    :ID "IDL:example/grid:1.0" :DEF_KIND :DK_INTERFACE  @ #x86bf31a>)

; Get the interface defined in the module
USER(12): (setq interfacedef (car (op:contents moduledef :dk_all nil)))
   :ID "IDL:example/grid:1.0" :DEF_KIND :DK_INTERFACE  @ #x86bf31a>

; Describe the interface
USER(13): (op:describe interfacedef)
#< CORBA:INTERFACEDESCRIPTION :NAME "grid" :ID "IDL:example/grid:1.0" 

; Get the repository ID of the interface
USER(14): (op:id interfacedef)

; List the contents of the interface
USER(15): (op:contents interfacedef :dk_all nil)
    :ID "IDL:example/grid/_get_width:1.0" :DEF_KIND :DK_OPERATION  @ #x86c247a>
    :ID "IDL:example/grid/_get_height:1.0" :DEF_KIND :DK_OPERATION  @ #x86c2602>
    :ID "IDL:example/grid/height:1.0" :DEF_KIND :DK_ATTRIBUTE  @ #x86c37aa>
    :ID "IDL:example/grid/width:1.0" :DEF_KIND :DK_ATTRIBUTE  @ #x86c392a>
    :ID "IDL:example/grid/set:1.0" :DEF_KIND :DK_OPERATION  @ #x86c3aca>
    :ID "IDL:example/grid/get:1.0" :DEF_KIND :DK_OPERATION  @ #x86c3c22>)

Getting the interface repository from an object

Given any CORBA object o, in theory the invocation:

(op:_get_interface o)

will return an instance of class CORBA:InterfaceDef that can be used (via the op:containing_repository method) to get the repository. However, in practice some ORBs either do not implement interface repositories or do not enable them by default. However, this call should always work for any ORBLink object. In fact, it can be used to traverse the repository of all CORBA definitions: given any ORBLink object oo, the invocation:

   (op:_get_interface oo)))

should return a corba:repository object that represents all of the CORBA Core definitions.