Home » Projects » CORBA » DII Interface
Generic User Interface to CORBA's DII
CORBA objects are usually accessed via a stub that is automatically
generated via an IDL compiler. The stub serves as a proxy that allows
type-safe access to a remote object. Stubs are generated at
compile-time and are static in the sense, that they can not be
changed at run-time. Thus, the type of the operational interface of
the server object is known at compile time. But what if the interface
type of an object is not known at compile time? The only possible way
to access the object in this case is to use CORBA's Dynamic
Invocation Interface (DII). This interface to an ORB offers the
possibility of invoking operation calls whose signature is not known
at compile time. The following code excerpt shows the usage of the
DII:
CORBA::Object_ptr obj = ...;
CORBA::Request_ptr req = obj->_request( "deposit" );
req->add_in_arg( "amount" ) <<= (CORBA::ULong) 100;
req->invoke();
This code fragment demonstrates how to model the operation call
account->deposit (100). The various bits and pieces needed
for an operation invocation (such as operation name and actual
parameters) are collected with the help of a CORBA::Request
object. Despite the generic way the operation is invoked, the problem
remains of how to write a generic user interface to access CORBA's
DII. Such an interface would allow a user to invoke arbitrary
operations of a priori unknown interfaces.
The idea is to use a knowledge representation technique to represent
the information necessary for a remote operation invocation. We use
conceptual graphs (CG) as the knowledge representation technique.
The theory of conceptual graphs was developed to model the semantics
of natural language. Specifications based on conceptual graphs are
therefore intuitive in the sense that there is a close relationship to
the way human beings represent and organize their knowledge. From a
mathematical point of view, a conceptual graph is a finite, connected,
directed, bipartite graph. The nodes of the graph are either
concept or relation nodes. Due to the bipartite
nature of the graphs, two concept nodes may only be connected via a
relation node. A concept node represents either a concrete or an
abstract object in the world of discourse, whereas a relation node
defines a context between two or more concepts.
We have developed a conceptual- and relational-catalog, which provides
the "vocabulary" to express the information needed for the
specification of an operation invocation. The conceptual graph
depicted in the figure above shows how to translate the operation
invocation for deposit(100) (concept nodes are denoted by
white rectangles and relation nodes by black rectangles). As can be
seen, a metanotation based on CG provides an easily readable, formal
specification of an operation invocation. It should be clear that the
CG template can be extended arbitrarily to cover such specifics of the
CORBA IDL as complex type definitions or sequences of arbitrary types.
Interface Repository Browser
The following applet demonstrates the concepts described above. The
applet is written for JDK 1.3 and
features a full-fledged conceptual graph editor. Depending on your
browser you might need an appropriate plugin. Beware that the applet
most likely will not work from behind a firewall. It takes a minute to
load the applet. See below for a guided tour.
|
Demo
Upon invoking the applet, it will connect to an interface repository
running on my machine. It has been fed with the following
IDL-specification:
interface Account {
struct Holder {
string name;
unsigned short age;
};
void set_holder (in Holder h);
Holder get_holder ();
void deposit (in unsigned long amount);
void withdraw (in unsigned long amount);
long balance ();
};
To get started, you might want to try the following:
- click with the left mouse button on the Account icon
- click with the right mouse button on the Account icon
- click on the deposit icon with the right mouse button
to invoke the deposit() method
- click on the ULONG:0 node while holding down the shift key,
enter 100 into the appearing entry box and press return
- use the menu option Server/Invoke to do the actual invocation
- click on the withdraw icon with the right mouse button
in the browser window to invoke the withdraw() method
- click on the ULONG:0 node while holding down the shift key,
enter 20 into the appearing entry box and press return
- use Server/Invoke to do the actual invocation
- click on the balance icon with the right mouse button
in the browser window to invoke the balance() method
- use Server/Invoke to do the actual invocation
- the rightmost node of the graph should change to
LONG:80
Enjoy!
[an error occurred while processing this directive]
|