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.
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")) #< ORBLINK::CORBA-REPOSITORY-IMPLEMENTATION :DEF_KIND :DK_REPOSITORY @ #x86b680a> ; List all definitions in the repository USER(6): (op:contents repository :dk_all nil) (#< ORBLINK::CORBA-MODULEDEF-IMPLEMENTATION :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))) #< ORBLINK::CORBA-MODULEDEF-IMPLEMENTATION :NAME "example" :ID "IDL:example:1.0" :DEF_KIND :DK_MODULE @ #x86b9dca> ; Get the name of this definition USER(9): (op:name moduledef) "example" ; 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) (#< ORBLINK::CORBA-INTERFACEDEF-IMPLEMENTATION :NAME "grid" :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))) #< ORBLINK::CORBA-INTERFACEDEF-IMPLEMENTATION :NAME "grid" :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" :DEFINED_IN "IDL:example:1.0" :VERSION "1.0" :BASE_INTERFACES NIL @ #x86c0732> ; Get the repository ID of the interface USER(14): (op:id interfacedef) "IDL:example/grid:1.0" ; List the contents of the interface USER(15): (op:contents interfacedef :dk_all nil) (#< ORBLINK::CORBA-OPERATIONDEF-IMPLEMENTATION :NAME "_get_width" :ID "IDL:example/grid/_get_width:1.0" :DEF_KIND :DK_OPERATION @ #x86c247a> #< ORBLINK::CORBA-OPERATIONDEF-IMPLEMENTATION :NAME "_get_height" :ID "IDL:example/grid/_get_height:1.0" :DEF_KIND :DK_OPERATION @ #x86c2602> #< ORBLINK::CORBA-ATTRIBUTEDEF-IMPLEMENTATION :NAME "height" :ID "IDL:example/grid/height:1.0" :DEF_KIND :DK_ATTRIBUTE @ #x86c37aa> #< ORBLINK::CORBA-ATTRIBUTEDEF-IMPLEMENTATION :NAME "width" :ID "IDL:example/grid/width:1.0" :DEF_KIND :DK_ATTRIBUTE @ #x86c392a> #< ORBLINK::CORBA-OPERATIONDEF-IMPLEMENTATION :NAME "set" :ID "IDL:example/grid/set:1.0" :DEF_KIND :DK_OPERATION @ #x86c3aca> #< ORBLINK::CORBA-OPERATIONDEF-IMPLEMENTATION :NAME "get" :ID "IDL:example/grid/get:1.0" :DEF_KIND :DK_OPERATION @ #x86c3c22>)
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:containing_repository (op:_get_interface (op:_get_interface oo)))
should return a corba:repository object that represents all of the CORBA Core definitions.