The Casbah Project: Oriel API

The Casbah Language Abstraction Layer

Oriel API documents the Casbah Language Abstraction Layer.


Table of Contents
Introduction
Oriel Driver

Introduction

Oriel drivers form the the "language agnostic" portion of Casbah's application framework. Oriel drivers allow the Cairo Application Object Server to invoke methods in different languages or to convert language X to language Y.

Cairo must plot the conversion path between source and a final target p-code which can be executed by an Oriel driver. Cairo may use more than one Oriel driver, with multiple passes in the compile stage until it obtains a p-code that an Oriel driver can execute. For example, Cairo might follow this path to run Python code:

Example 1. Python Code Pathway

Python Source --> PythonJavaOrielDriver.compile() --> Java Source
Java Source --> JavaOrielDriver.compile() --> Java Byte Code
Java Byte Code --> JavaOrielDriver.invoke()

Cairo should take the last p-code form, i.e., the one that is handed to an invoke, and cache it as the p-code for the script/method that Cairo was requested to execute. Cairo should use this cached form of the script/method in order to save compile time during subsequent invocations of the same script/method.

When an Oriel driver needs to throw an exception, it must throw the exception in the language in which the driver is implemented in. If OrielJavaVM was written in C and catches an exception from the JVM while running a Java method, OrielJavaVM must convert that exception into the equivilant exception in C, and then throw the C exception to its caller. [1] The reason for this is that OrielJavaVM understands the language which it is providing services for (the JVM in this case), and its author has available to it the utilities which OrielJavaVM's implementation language provides to the author.

Cairo must provide a bootstrap Oriel driver. This bootstrap driver must document what sources it can accept, and what p-codes it can invoke. Other Oriel drivers can then be written to execute using this bootstrap Oriel driver. The Oriel bootstrap driver should be written in the same language which the Cairo Application Object Server it is invoked by is written in. The Oriel bootstrap driver must always be available, as other Oriel drivers may be executed through this bootstrap driver.

Notes

[1]

An exception package for C exists in this example using setjmp/longjmp to unwind the stack frame.