Title: CORBA The Interface Definition Language
1CORBAThe Interface Definition Language
1
Appendix 1
- Interface Definition Language
- IDL to Java Mapping
2CORBAThe Interface Definition Language
2
1998 CTIT, Nikolay Diakov
3CORBAThe Interface Definition Language
3
Types, Modules Scoping
- What are Types for?
- Every variable or parameter must be typed
- There is a special type any
- What is Scoping for?
- Scope to module, interface, operation
- Scoping operator "" imports
1998 CTIT, Nikolay Diakov
4CORBAThe Interface Definition Language
4
- 1. IDL Basic (Primitive) Types
- Integer
- short, long, long long
- signed unsigned
- Floating point
- float, double, long double, fixed
- char, boolean, octet
- The special Any
- CORBA Object Reference
1998 CTIT, Nikolay Diakov
5CORBAThe Interface Definition Language
5
- 2. IDL Structured (Constructed) Types
- Structs
- Unions
- Enums
- Sequences
- Strings
- Arrays
1998 CTIT, Nikolay Diakov
6CORBAThe Interface Definition Language
6
Struct Declaration Example
struct PaymentOrder float Price string GoodyN
ame string Authorization
1998 CTIT, Nikolay Diakov
7CORBAThe Interface Definition Language
7
Enum, struct, sequence declarations example
enum ItemTypes food, clothes, other struct
GOODSinfo long id StoreAccess StoreAccessRe
ference float TotalSales float TotalTaxes
typedef sequence ltGOODSinfogt GOODSlist
1998 CTIT, Nikolay Diakov
8CORBAThe Interface Definition Language
8
- 3. Interfaces, Operations, Attributes
- Interface
- groups operations
- it is the unit of inheritance
- and can extend one or more already defined
interfaces - Operation
- has a return value, operation name, list of
parameters, exceptions, oneway declaration - Attribute - a special data holder variable with
access methods
1998 CTIT, Nikolay Diakov
9CORBAThe Interface Definition Language
9
Interface Example
Module OnlineOrdersystem typedef string
OrderNameType interface Identification
typedef short PIN long doPIN (in long uid,
in PIN cardpin, out OrderNameType
name)
1998 CTIT, Nikolay Diakov
10CORBAThe Interface Definition Language
10
- 4. Name Scoping and Inheritance
- In IDL you can derive a new interface from one or
more existing interfaces - this way inheriting
all their elements - And you can extend with new elements
- constants, types, attributes, operations
- interface BasicOrders
- long BasicPayment (in long arg1)
-
- interface ExtendedOrdersBasicOrders
- void AdvancePaymentSystem (in short arg2)
1998 CTIT, Nikolay Diakov
11CORBAThe Interface Definition Language
11
- Exceptions
- CORBA declares some standard exceptions
- Custom exception can be defined this way
exception CreditCardInvalid ORDEROrderNumber
item
1998 CTIT, Nikolay Diakov
12CORBAIDL to Programming Language Mapping
12
1998 CTIT, Nikolay Diakov
13CORBAIDL to Programming Language Mapping
13
- Translates from OMG IDL constructs to programming
language constructs - Special IDL compiler generate stubs for the
client and skeletons for the server objects
1998 CTIT, Nikolay Diakov
14CORBAIDL to Java Mapping
14
- IDL Modules map to Java Packages
- Interfaces map to public Java Interfaces
Helper and Holder Java classes - IDL Operations map to Java methods
- the integral types (Integer, float) map to the
corresponding Java integral types - exceptions map to Java exceptions
1998 CTIT, Nikolay Diakov
15CORBAIDL to Java Mapping (Example)
15
And, a slightly enhanced IDL Declaration (to show
parameter passing) interface example1 long
op1 ( in long arg1, out long arg2, inout
long arg3) produces the following Java public
interface example1 int op1 ( int
arg1, IntHolder arg2, IntHolder arg3)
1998 CTIT, Nikolay Diakov