[Up: Java Interface]
[Previous: Conceptual Graphs] [Next: Anatomy of an operation]
In this section we present a description for CORBAs DII. For the following discussions we refer to the interface Account as specified in section 3.3.2. A client application written in C++ might for example use this interface in the following way:
Account_ptr acc = ...; // Obtain a reference to an Account-object acc->deposit( 100 ); acc->withdraw( 20 ); cout << "Total balance is " << acc->balance() << endl;
If we assume that the current balance of the server object was
when the variable acc was bound with a refence to this
object, then this program fragment prints out ``Total balance is
80''. It should be clear that this program fragment requires the
definition of the class Account_ptr. This class, which
allows a type safe access to a CORBA object implementing the interface
Account, is generated using an IDL compiler. Thus the type of
the operational interface of the server object is known at compile
time. But what if we did not know about the interface Account
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 to invoke operation calls
whose signature was 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();
Note that the variable obj is of type Object_ptr
and not Account_ptr. The code fragment demonstrates how to
model the operation call acc->deposit( 100 )
from the code
fragment above. It does not require the Account_ptr client
stub as in the last example. Despite the generic manner how the
operation is invoked, the problem remains how to write a generic user
interface to access CORBAs DII. Such an interface would allow a user
to invoke arbitrary operations of a priori unknown interfaces.
The next section gives a brief overview of the specific details of an
operation invocation.
[Previous: Conceptual Graphs] [Next: Anatomy of an operation]
[Up: Java Interface]