CorbaScript

CorbaScript is an object-oriented scripting language designed to support interaction with Common Object Request Broker Architecture (CORBA) objects. It was developed to provide a flexible scripting environment for both client- and server-side CORBA application development, leveraging dynamic invocation and interface reflection capabilities.

CorbaScript is a dynamic, interpreted language whose syntax resembles that of C++ and Java. However, it integrates several design elements from dynamic languages such as Python and Smalltalk. Like those languages, CorbaScript treats all values as objects and supports dynamic type checking at runtime. Source code is translated into pseudocode executed by a dedicated Virtual Object-Oriented Machine that includes a simple reference-counting garbage collector.

Features

Basic scripting

CorbaScript includes typical scripting features:

The runtime includes a simple garbage collector based on reference counting.

CORBA integration

CorbaScript is tightly integrated with CORBA middleware and provides full access to both the Dynamic Invocation Interface (DII) and Dynamic Skeleton Interface (DSI):

  • Invocation of any CORBA object via DII, enabling scripting of CORBA clients.
  • Implementation of CORBA objects via DSI, allowing servers to be written in CorbaScript.
  • Full support for OMG Interface Definition Language (IDL)-defined data types, including complex types such as struct, union, sequence and array.
  • Access to in, out, and inout parameters using the CORBA DynAny API.
  • Type checking supported via the Interface Repository, with optional caching to improve performance.
  • Scripting access to the structure of IDL interfaces for dynamic discovery and reflection.

Advanced integration

CorbaScript also includes additional capabilities beyond basic scripting:

  • Dynamic loading of C libraries for native code integration.
  • Experimental support for interaction with a Java Virtual Machine.
  • Extensible runtime that allows embedding new functionality in C++.

Modules

CorbaScript allows any script to function as an importable module. Some standard modules include:

Demonstrations

A number of example applications and tools are included in the CorbaScript distribution:

Examples

Hello Example

The following illustrates how CorbaScript can be used to interact with a CORBA object defined by the following OMG IDL interface:

interface Hello {
  void hello ();
  void display (in string message);
};

Using CorbaScript, you can invoke operations on a CORBA object implementing this interface:

>>> # the `hello` variable refers to a CORBA `Hello` object.
>>> hello = Hello("IOR:....")
>>> # invoking the 'hello' operation
>>> hello.hello()
>>> # invoking the 'display' operation
>>> hello.display("Hello World!")

>>> # obtain the CORBA Naming Service
>>> NS = CORBA.ORB.resolve_initial_references ("NameService")
>>> # resolve a name in the CORBA Naming Service
>>> object = NS.resolve(CosNaming.Name(CosNaming.NameComponent("anHelloObject","")))

>>> # easier syntax with automatic sequence conversion
>>> object = NS.resolve ([["anHelloObject",""]])

>>> # invoke operations on the resolved object
>>> object.display("Hello World!")

CorbaScript allows for easy and intuitive invocation of CORBA objects.

Implementing CORBA objects in CorbaScript

The following example demonstrates implementing the `Hello` interface in CorbaScript:

    # define a script class implementing the Hello interface
    class HelloImpl
    {
      # constructor
      proc __HelloImpl__(self) {}

      # implementation of the `hello` operation
      proc hello (self) {
        println ("The OMG IDL `hello` operation is invoked.")
      }

      # implementation of the `display` operation
      proc display (self, message) {
        println (message)
      }
    }
>>> # create an instance
>>> hello = HelloImpl()

>>> # local invocation
>>> hello.hello()
The OMG IDL `hello` operation is invoked.

>>> hello.display("Hello World!")
Hello World!

>>> # connect to CORBA and specify implemented interface
>>> CORBA.ORB.connect(hello, Hello)

>>> # register the object in the CORBA Naming Service
>>> NS = CORBA.ORB.resolve_initial_references ("NameService")
>>> NS.bind ([["anHelloObject",""]], hello._this)

This example demonstrates how CorbaScript simplifies both the invocation and implementation of CORBA objects. Additional examples, such as a CORBA Naming Service shell and a CORBA CosNaming implementation, are provided in the CorbaScript distribution.

Availability

The CorbaScript interpreter is implemented in C++ and is available on most major Unix-based systems as well as on Windows.

References

  1. ↑ Merle, P.; Gransart, C.; Geib, J. M. (1997). "Using and implementing CORBA objects with CorbaScript". In Bahsoun, Jean-Paul (ed.). Object-oriented Parallel and Distributed Programming. OBPDC '97. Hermès. ISBN 2-7462-0091-0. Academia 19256437. {{cite conference}}: More than one of |publication-date= and |date= specified (help)
  2. ↑ CorbaScript Features, corbaweb.lifl.fr (archived April 22, 2005)
  3. ↑ Gransart, C.; Merle, P.; Roos, J. F.; Geib, J. M. (1998). "Corbascript: A dedicated corba scripting language". International Conference on Computing in High Energy Physics. CHEP'98. Chicago, Illinois, USA. Academia 881547.
  4. ↑ "CORBA Scripting Language Specification" (1.1 ed.). Object Management Group. February 2003.