CHAPTER 20
CORBA CASE STUDY
IDL methods ◊ The general form of a method signature is:
[oneway] (parameter, parameterL)[raises (except, exceptN)] context (name, nameM)]where the expressions in square brackets are optional. For an example of a method signature that contains only the required parts, consider:
void getPerson(in string name, out Person p);As explained in the introduction to Section 20.2, the parameters are labelled as
in, outor
inout, where the value of an
in parameter is passed
from the client to the invokedCORBA object and the value of an
out parameter is passed back from the invoked
CORBA object to the client.
Parameters labelled as inout are seldom used, but they indicate that the parameter value maybe passed in both directions. The return type maybe specified as
void if no value is to be returned.
The
optional oneway expression indicates that the client invoking the method will not be blocked while the target object is carrying out the method. In addition,
onewayinvocations are executed once or not at all – that is, with
maybe invocation semantics.
We saw the following example in Section 20.2.1:
oneway void callback(in int version);In this example, where the server calls a client
each time anew shape is added, an occasional lost request is not a problem to the client, because the call just indicates the latest version number and subsequent calls are unlikely to be lost. The optional
raises expression indicates user-defined exceptions that can be raised to terminate an execution of the method. For example, consider the following example from Figure 20.1:
exception FullException{ };Shape newShape(in GraphicalObject g) raises (FullException);The method
newShape specifies with the raises expression that it may raise an exception called
FullException,
which is defined within the
ShapeList interface. In our example,
Share with your friends: