Introduction to corba idl
Download
1 / 21

Introduction to CORBA IDL - PowerPoint PPT Presentation


  • 110 Views
  • Uploaded on

Introduction to CORBA IDL. Overview OMG IDL is purely a descriptive language OMG IDL obeys the same lexical rules as C++ OMG IDL grammar is a subset of ANSI C++ standard with additional constructs to support operation invocation mechanism Uses C/C++ #includes and #pragma preprocessor commands.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Introduction to CORBA IDL' - decker


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Introduction to corba idl
Introduction to CORBA IDL

Overview

  • OMG IDL is purely a descriptive language

  • OMG IDL obeys the same lexical rules as C++

  • OMG IDL grammar is a subset of ANSI C++ standard with additional constructs to support operation invocation mechanism

  • Uses C/C++ #includes and #pragma preprocessor commands

CORBA IDL


Introduction to corba idl1
Introduction to CORBA IDL

Basics

  • Comments

    • /* standard C/C++ comments */

    • // standard C++ comments

  • Identifiers

    • Arbitrarily long sequence of alphabetic, digits, and underscore("_") characters

    • First character must be alphabetic

    • All characters are significant

    • Case sensitive, but does not allow same identifiers with different cases, i.e., myName, MyName, or Myname, etc, can not co-exist in the same idl file.

    • All files containing IDL must end in '.idl' or '.IDL‘

    • CORBA_USES_THE_UNDERSCORE_TO separate words in a name

CORBA IDL


Introduction to corba idl2
Introduction to CORBA IDL

Keywords

any, attribute

boolean

case, char, const, context

default, double

enum, exception

FALSE, fixed, float

in, inout, interface

long

module

Object, octet, oneway, out

raises, readonly

sequence, short, string, struct, switch

TRUE, typedef

unsigned, union

void

wchar, wstring

CORBA IDL


Introduction to corba idl3
Introduction to CORBA IDL

Module

  • Module defines a naming scope and can be nested

  • Modules can span several files

  • Modules can be reopened

  • The scoping operator is ::

CORBA IDL


Introduction to corba idl4
Introduction to CORBA IDL

File Bank.idl

module Bank {

interface Account {

readonly attribute float balance;

}; }; // pay attention to these these ';'

module Security {

interface Algorithms {

string MD5(in float data);

Bank::Account idToAccount( in string id); }; };

module Bank {

interface Teller {

Account getAccount( in string customerID ); }; };

CORBA IDL


Introduction to corba idl5
Introduction to CORBA IDL

Nesting of Modules

module IIT {

module CS {

module CS447 {

interface ReportCard {

readonly attribute short grade;

};

};

};

};

CORBA IDL


Introduction to corba idl6
Introduction to CORBA IDL

Using Scoping rules ::

module outer {

module inner {

interface inside {};

};

interface outside {

inner::inside get_inside();

};

};

CORBA IDL


Introduction to corba idl7
Introduction to CORBA IDL

One Pass Compiler – Forward Declarations

Module Bank {

// Forward declare Customer, CustomerAddress

interface Customer;

struct CustomerAddress;

interface Account {

Customer getOwner ();

};

interface Custmoer {

Acount getAccount();

CustomerAddress getAddress();

};

struct CustomerAddress {

string street;

string city;

string state;

int zipcode;

};

};

CORBA IDL


Introduction to corba idl8
Introduction to CORBA IDL

Interface

  • Map to a Java interface

  • Support multiple inheritance

  • Contain:

    • Type declarations

    • Constants declarations

    • Exception declarations

    • Attributes declarations

    • Operations declarations

CORBA IDL


Introduction to corba idl9
Introduction to CORBA IDL

Inheritance

module inheritanceExample{

interface Right {

string getRightInfo(in string ID);

};

interface Left {

string getLeftInfo(in string ID);

};

interface Center: Left, Right {

readonly attribute int x-position;

}

CORBA IDL


Introduction to corba idl10
Introduction to CORBA IDL

Inheritance

  • Multiple inheritance is allowed

  • The order of listing is not important

  • Names of operations must be unique and must not be redeclared in derived interfaces

CORBA IDL


Introduction to corba idl11
Introduction to CORBA IDL

Basic Data Types – Java Mappings

CORBA IDL


Introduction to corba idl12
Introduction to CORBA IDL

Parameter Passing

  • in

  • out

  • in-out

    Rules for different type of parameters:

  • An implementation should not attempt to modify an in parameter

  • If an exception is raised in an operation, the values of out, inout parameters are not defined.

  • When an unbounded string or sequence passed as an inout parameter, the returned value cannot be longer than the input value

CORBA IDL


Introduction to corba idl13
Introduction to CORBA IDL

valuetypes:

  • Mixture of interfaces and structures and are declared using the key workd valuetype.

  • Providing call-by-value semantics for object references

  • Provide sharing semantics for IDL values like structs, sequences.

    Example:

    Interface Observer{

    void notify();

    };

    valuetype ShoppingCart supports Observer{

    readonly attribute long value;

    private long numIterms;

    factory init(in long i);

    };

CORBA IDL


Introduction to corba idl14
Introduction to CORBA IDL

Java Mapping to Parameters

Java uses a Holder class to implement out and inout parameters

The IDL

interface In_Out_Examples {

void just_out( out short a);

void in_out( inout string b);

void just_in( in char c); };

The Java generated interface

public interface In_Out_Examples

extends org.omg.CORBA.Object {

public void just_out(org.omg.CORBA.ShortHolder a) ;

public void in_out(org.omg.CORBA.StringHolder b) ;

public void just_in(char c) ; public java.lang.Object _deref() ;

}

CORBA IDL


Introduction to corba idl15
Introduction to CORBA IDL

Oneway operation

  • Oneway method does not block on a response from the server object

  • The method is not guaranteed to be delivered

  • The invocation semantics are “best-effort”, which implies the method will invoked at most once

  • Return must be void

  • Must not have ‘raises’ clause

  • Must not have inout or out parameters

    Example

    interface No_Blocking_Here {

    oneway void no_reply (in string message);

    };

CORBA IDL


Introduction to corba idl16
Introduction to CORBA IDL

Attributes

  • Attributes are logically equivalent to a pair of accessor functions

  • A readonly attribute means just produce the get accessor methods

    Example

    interface Student {

    readonly attribute string studentId;

    atribute string name;

    …;};

    Java Mappings

    public interface Student extends org.omg.CORBA.Object {

    public String studentId();

    public String name();

    public void name(String value);

    …; }

CORBA IDL


Introduction to corba idl17
Introduction to CORBA IDL

Exceptions

  • User defined exceptions are checked

    Example

    module University {

    exception InvalidDepart{string name;};

    interface OnLineHelper {

    string findChair (in string dept, in string id, out string chair)

    raises(InvalidDepart, InvalidStudentId);

    };

    Java Mappings

    public interface OnLineHelperOperations {

    public String findChair (

    Java.lang.String dept,

    java.lang.String id,

    org.omg.CORBA.StringHolder id)

    throws InvalidDepar;

    }

CORBA IDL


Introduction to corba idl18
Introduction to CORBA IDL

Template types --- String

  • OMG IDL strings are mapped to java.lang.String

  • Since java strings do not have bounds, IDL strings passed to/from operations are checked for size

  • If the actual size is larger than the OML IDL string allows, a run time exception is thrown

    interface Bank {

    // unbonded string readonly

    attribute string address;

    // bounded size string

    attribute string first_name<10>;

    attribute string last_name<5>; };

CORBA IDL


Introduction to corba idl19
Introduction to CORBA IDL

Template types --- sequence

  • One-dimensional array with a maximum size and length

  • Using typedef to declare

  • Must be defined before it can be used

CORBA IDL


Introduction to corba idl20
Introduction to CORBA IDL

module Bank_One {

interface Account {

readonly attribute string name; };

struct Accounts {

// bounded

sequence<Account, 10> acountList;

// unbounded

sequence<short> ID;

};

typedef sequence<long> accountNmbers;

interface Bank {

void accountList( out accountNmbers list);

};

};

CORBA IDL


ad