Use the Java IDL compiler to process the interface. Inspect the definition of the signatures for the methods pairIn and readPair in the generated Java equivalent of the IDL interface. Look also at the generated definition of the holder method for the value argument for the methods pairIn and readPair. Now give an example showing how the client will invoke the pairIn method, explaining how it will acquire the value returned via the second argument.
What will be an ideal response?
The Java interface is:
```
public interface TaskBag extends org.omg.CORBA.Object {
void pairOut(in Key p, in Value value);
void pairIn(in Key p, out ValueHolder value); void readPair(in Key p, out ValueHolder value); int numberOfTasks();
}
The class ValueHolder has an instance variable
public Value value;
and a constructor
public ValueHolder(Value __arg) {
value = arg;
}
```
The client must first get a remote object reference to the TaskBag (see Figure 20.5). probably via the naming service.
```
...
TaskBag taskBagRef = TaskBagHelper.narrow(taskBagRef.resolve(path)); Value aValue;
taskbagRef.pairIn(“Some key”, new ValueHolder(aValue));
```
The required value will be in the variable aValue.
You might also like to view...
A new database is an empty shell.
Answer the following statement true (T) or false (F)
When using a Windows PC, ________ is the main tool for finding, viewing, and managing files
Fill in the blank(s) with correct word
Using a form for data entry can increase the usefulness of a database by increasing:
A) complexity. B) compatibility. C) accuracy. D) redundancy.
Explain why it is a good idea to place the most important information first on a web page.
What will be an ideal response?