CorbaScript: Difference between revisions
imported>Boleyn |
imported>Boleyn has ref |
||
| Line 1: | Line 1: | ||
{{Short description|Object-oriented scripting language}} | {{Short description|Object-oriented scripting language}} | ||
{{notability|date=October 2011}} | {{notability|date=October 2011}} | ||
{{ | {{primarysources|date=April 2024}} | ||
'''CorbaScript''' is an [[object-oriented programming|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 (programming language)|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 [[garbage collection (computer science)|reference-counting garbage collector]].<ref>[https://web.archive.org/web/20050422083703/http://corbaweb.lifl.fr/CorbaScript/#Features CorbaScript Features], corbaweb.lifl.fr (archived April 22, 2005)</ref> | |||
==Features== | |||
===Basic scripting=== | |||
CorbaScript includes typical scripting features: | |||
* Interpreted execution, suitable for both interactive mode and batch modes. | |||
* Runtime type checking. | |||
* Basic types including [[integer (computer science)|long]], [[double-precision floating-point format|double]], [[boolean]], [[character (computing)|char]], [[string (computer science)|string]], [[array data structure|array]], and [[associative array|dictionary]]. | |||
* Control structures such as [[If-then-else|if-else]], [[while loop|while]], do-while, and for-in. | |||
* [[Exception handling]] using throw, try-catch-finally. | |||
* User-defined procedures and modules (reusable script files). | |||
* [[Object-oriented programming]] constructs, including [[class (computer programming)|classes]], [[multiple inheritance]], and [[polymorphism (computer science)|polymorphism]]. | |||
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 [[Object Management Group|OMG]] [[Interface Definition Language]] (IDL)-defined data types, including complex types such as [[struct (C programming language)|struct]], [[union (computer science)|union]], [[sequence]] and [[array data structure|array]]. | |||
* Access to in, out, and inout parameters using the CORBA [[Dynamic Any|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 (computer programming)|reflection]]. | |||
===Advanced integration=== | |||
CorbaScript also includes additional capabilities beyond basic scripting: | |||
* Dynamic loading of [[C (programming language)|C]] libraries for native code integration. | |||
* Experimental support for interaction with a [[Java virtual machine|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: | |||
* LIBC: dynamic access to standard C library functions. | |||
* IO: support for reading/writing binary and text files. | |||
* [[Mathematics|math]]: standard math operations. | |||
* [[POSIX]]: POSIX system calls like system() and fork(). | |||
* [[Network socket|socket]]: TCP/IP networking support. | |||
* IOR: simplified storage/retrieval of CORBA object references (IORs). | |||
* NSTools and CosNamingImpl: tools and implementation for managing the CORBA [[Naming service]]. | |||
* shell: base class for creating shell programs. | |||
* [[Simple Mail Transfer Protocol|SMTP]]: a basic SMTP implementation. | |||
* [[Unix time|time]]: date and time utilities. | |||
==Demonstrations== | |||
A number of example applications and tools are included in the CorbaScript distribution: | |||
* hello: a basic CORBA client/server "Hello World" application. | |||
* calc: a simple calculator service. | |||
* chat: a chat system implementing [[factory method pattern|factory]] and [[observer pattern|observer design patterns]]. | |||
* component: client callback components using implicit connections. | |||
* computer: a distributed prime number service. | |||
* event: [[event-driven programming|event channel]] implementation using the OMG Event Service. | |||
* grid: factory pattern for grid objects. | |||
* ir: navigation through the CORBA Interface Repository. | |||
* linked: demonstration of recursive object invocation. | |||
* naming: integration with the CORBA Naming Service. | |||
* test: argument type and passing mode demonstrations. | |||
* worker: client-server example using [[asynchronous procedure call|deferred (asynchronous) invocations]]. | |||
* remote_cssh: scripting engine interface using OMG IDL and shell-based remote invocation. | |||
* process: CORBA object access and factory pattern using [[Uniform Resource Locator|URLs]]. | |||
==Examples== | |||
===Hello Example=== | |||
The following illustrates how CorbaScript can be used to interact with a CORBA object defined by the following OMG IDL interface: | |||
<syntaxhighlight lang="omg-idl"> | |||
interface Hello { | |||
void hello (); | |||
void display (in string message); | |||
}; | |||
</syntaxhighlight> | |||
Using CorbaScript, you can invoke operations on a CORBA object implementing this interface: | |||
<syntaxhighlight lang="pycon"> | |||
>>> # 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!") | |||
</syntaxhighlight> | |||
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: | |||
<syntaxhighlight lang="python"> | |||
# 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) | |||
} | |||
} | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="pycon"> | |||
>>> # 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) | |||
</syntaxhighlight> | |||
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 [[Microsoft Windows|Windows]]. | |||
==References== | ==References== | ||
| Line 9: | Line 153: | ||
==External links== | ==External links== | ||
*[https://web.archive.org/web/20050422083703/http://corbaweb.lifl.fr/CorbaScript/ The CorbaScript Language] | * [https://web.archive.org/web/20050422083703/http://corbaweb.lifl.fr/CorbaScript/ The CorbaScript Language (archived)] | ||
*[http://www.omg.org/cgi-bin/doc?orbos/98-12-08 CORBA Scripting joint revised submission] | * [http://www.omg.org/cgi-bin/doc?orbos/98-12-08 CORBA Scripting joint revised submission] | ||
*[https://web.archive.org/web/20010512143952/http://www.itworld.com/AppDev/4061/UIR010502regex1/pfindex.html Regular Expressions: Manage CORBA with scripting] | * [https://web.archive.org/web/20010512143952/http://www.itworld.com/AppDev/4061/UIR010502regex1/pfindex.html Regular Expressions: Manage CORBA with scripting] – ITworld | ||
*[https://web.archive.org/web/20040108071216/http://corbaweb.lifl.fr/papers/ebi.pdf IDLScript/CorbaScript Tutorial] by [[Christophe Gransart]] | * [https://web.archive.org/web/20040108071216/http://corbaweb.lifl.fr/papers/ebi.pdf IDLScript/CorbaScript Tutorial] by [[Christophe Gransart]] | ||
[[Category:Object-oriented programming languages]] | [[Category:Object-oriented programming languages]] | ||
[[Category:Scripting languages]] | [[Category:Scripting languages]] | ||
[[Category:Common Object Request Broker Architecture]] | |||
[[Category:Programming languages]] | |||
{{Compu-lang-stub}} | {{Compu-lang-stub}} | ||
Latest revision as of 08:56, 10 October 2025
Template:Short description Script error: No such module "Unsubst". Template:Primarysources
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.[1]
Features
Basic scripting
CorbaScript includes typical scripting features:
- Interpreted execution, suitable for both interactive mode and batch modes.
- Runtime type checking.
- Basic types including long, double, boolean, char, string, array, and dictionary.
- Control structures such as if-else, while, do-while, and for-in.
- Exception handling using throw, try-catch-finally.
- User-defined procedures and modules (reusable script files).
- Object-oriented programming constructs, including classes, multiple inheritance, and polymorphism.
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:
- LIBC: dynamic access to standard C library functions.
- IO: support for reading/writing binary and text files.
- math: standard math operations.
- POSIX: POSIX system calls like system() and fork().
- socket: TCP/IP networking support.
- IOR: simplified storage/retrieval of CORBA object references (IORs).
- NSTools and CosNamingImpl: tools and implementation for managing the CORBA Naming service.
- shell: base class for creating shell programs.
- SMTP: a basic SMTP implementation.
- time: date and time utilities.
Demonstrations
A number of example applications and tools are included in the CorbaScript distribution:
- hello: a basic CORBA client/server "Hello World" application.
- calc: a simple calculator service.
- chat: a chat system implementing factory and observer design patterns.
- component: client callback components using implicit connections.
- computer: a distributed prime number service.
- event: event channel implementation using the OMG Event Service.
- grid: factory pattern for grid objects.
- ir: navigation through the CORBA Interface Repository.
- linked: demonstration of recursive object invocation.
- naming: integration with the CORBA Naming Service.
- test: argument type and passing mode demonstrations.
- worker: client-server example using deferred (asynchronous) invocations.
- remote_cssh: scripting engine interface using OMG IDL and shell-based remote invocation.
- process: CORBA object access and factory pattern using URLs.
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
<templatestyles src="Reflist/styles.css" />
- ↑ CorbaScript Features, corbaweb.lifl.fr (archived April 22, 2005)
Script error: No such module "Check for unknown parameters".
External links
- The CorbaScript Language (archived)
- CORBA Scripting joint revised submission
- Regular Expressions: Manage CORBA with scripting – ITworld
- IDLScript/CorbaScript Tutorial by Christophe Gransart
- REDIRECT Template:Prog-lang-stub