| Lesson 6 | Mapping of method signatures |
| Objective | Describe mapping of operations in IDL interfaces |
To use an interface, you need to be able to use the operations defined in that interface. As stated previously, an IDL interface will map to a Java
interface. Any operations in the interface will map to methods in the Java interface. The return type and all parameters will map naïvely to
Java types in accordance with the primitive type mappings.
By value
In CORBA the in parameters are all passed one way over the wire, so they are all sent by value. In fact, because all
communication is across the wire rather than in the same address space, all elements passed back and forth must be copied, and as such pass by
value. In Java, all parameters are always by value, so this works well. All values are copied and push across to the server. When the information
about a parameter reaches the server process, it is reconstructed into a new object of the appropriate type, generated from the IDL in the language
of choice. Any variable passed in as a parameter cannot have its local value changed during the processing of a remote method. Even if the
parameter is an object reference (nonremote), that object cannot be side-effected like in a normal local method call. The FlipBook below
illustrates the mapping of individual features of method signatures:
- Wire: The communication socket between the servers where all communication is reduced to a byte stream.
- By value: The value of the parameter is copied, and so any changes to the value are made on the copy, not the original reference.
- Side-effected: In pass by value, the value of the parameter can't change, but if it is an object reference, methods on that reference can still be called, even accessors and mutators. So the internal state of that object can be changed, even if the parameter can't be made to reference a different object .
Simple Mapped Operations
Return value
The return value can be thought of as passed by value from the server instead of to the server. Any value the server passes back as a
return value is copied and reconstructed in the local space of the client. Any operation defined as oneway maps to the Java interface
exactly as if it was not declared oneway. The difference between a oneway and a regular operation is how the stub handles the
communication, not in the programming interface.
Pass by value: The value of the parameter is copied, and so any changes to the value are made on the copy, not the original reference.
In the next lesson, you will learn how to describe the mapping of IDL operations with out and inout parameters.
Java Mapping - Quiz
Pass by value: The value of the parameter is copied, and so any changes to the value are made on the copy, not the original reference.
In the next lesson, you will learn how to describe the mapping of IDL operations with out and inout parameters.
Click the Quiz link below to take another quiz on IDL-to-Java mapping.
Java Mapping - Quiz
Mapping Method Signatures - Exercise
Java Mapping - Quiz
Click the Exercise link below to implement calling remote methods by using the Java mapping for the IDL in the course project.
Mapping Method Signatures - Exercise
Mapping Method Signatures - Exercise