YU-INFO-2000
Advances in Infrastructure for E-Business on the Internet
Kopaonik, Yugoslavia, March 27 - 31, 2000

Internet and Object-oriented Design Methods
Tutorial

Andrea Domenici
SSSUP S. Anna, Pisa
andrea@sssup.it
http://www.ing.unipi.it/˜d8651

1  Introduction

This talk introduces the basic concepts of the Common Object Request Broker Architecture. These concepts are tools that designers can use to meet the requirements of large scale distributed applications, such as those that are made possible by the existence of a world-scale Internet.


Introduction

This talk introduces the basic concepts of the Common Object Request Broker Architecture.

The structure of a very simple application is described through an example taken from the book MICO is CORBA, by A. Puder and K. Römer, (dpunkt.verlag, Heidelberg, 1999), Copyright 2000 by Academic Press and dpunkt-Verlag für digitale Technologie GmbH. Used with Permission.


2  Internet and distributed systems

Like Proteus in the ancient myth, the Internet can show innumerable shapes and faces to its users. Designers must cope with ever evolving needs and demands, and deliver open-ended, adjustable and extensible systems.

Several services or activities are supported by clusters of computers connected by local networks. Each service or activity needs to interact with the others. Each service or activity may belong to a different organization. New suppliers and consumers of services show up on the Net in time.

3  A large scale object-oriented approach


A Large Scale OO Approach

The Common Object Request Broker Architecture is an OO approach for large scale distributed systems, where emphasis is on application-centered object interaction. The CORBA architecture provides:

The CORBA specifications are produced and maintained by the Object Management Group (OMG) (www.omg.org).


4  The Common Object Request Broker Architecture

4.1  Computation model


The CORBA Model



Execution Semantics and Synchronization


At-most-once operations are synchronous by default, i.e., the caller is blocked until the call returns.

Best-effort operations may be (and in most implementations are) executed asynchronously, i.e., the caller continues execution after sending a request. Best-effort operations can be used when non-reliable communication is appropriate, but implementations are free to deliver best-effort operation requests on a reliable protocol.

Best-effort semantics is specified by the oneway keyword in IDL interfaces (see Slide ).

In deferred-synchronous mode the caller continues execution while the target object is processing of the request, and can later poll the target for the results. This mode of execution is possible for requests issued through the Dynamic Invocation Interface (see Slide ).

4.2  Core architecture


The CORBA Architecture (1)

To support the computation model, on the client side the CORBA architecture must:


The CORBA Architecture (2)

On the server side:


CORBA Architecture (3)

corba0.gif

Classes Client and Object are designed by application developers (not necessarily by the same developers). Classes Stub and Skeleton are application-specific classes, generated by CORBA utilities, that connect the application code with the CORBA run time support, represented by CORBA_here and CORBA_there. The CORBA run time support uses the host operating system and networking facilities.


CORBA Architecture (4)

corba2.gif

In this slide the OS and network layer is omitted, and the structure of the CORBA architecture is more detailed.


Objects, Servants, and Servers



Object Adapter

Object adapters are responsible for the following functions (from CORBA V2.2 Spec.):

The purpose of the Object Adapter in the architecture is to provide for maximum flexibility in the design and management of object implementation, while keeping the ORB interface small and its implementation efficient. The needs of different implementations can be accommodated for by different adapters.


The Adapter pattern

adapter.gif


The POA

Early CORBA specifications (before CORBA 2.2) defined a Basic Object Adapter. Current specifications define a more flexible and powerful adapter, the Portable Object Adapter:

4.3  The Interface Description Language


Interface Description Language (1)

Object interfaces are specified in the Interface Description Language (IDL). This language allows application components to communicate with each other and with the CORBA environment.


Interface Description Language (2)


The structure of a very simple application is described through the following example taken from the book MICO is CORBA, by A. Puder and K. Römer, (dpunkt.verlag, Heidelberg, 1999), Copyright 2000 by Academic Press and dpunkt-Verlag für digitale Technologie GmbH. Used with Permission.

The code excerpts have been edited for clarity of exposition.


Example: banking

// account.idl

interface Account {
    void deposit( in unsigned long amount );
    void withdraw( in unsigned long amount );
    long balance();
};

interface Bank {
    Account create();
};


Banking: C++ mapping

/*  MICO --- a free CORBA implementation
 *  Copyright (C) 1997-98 Kay Roemer & Arno Puder */

// account.h

class Account : virtual public CORBA::Object {
public:
    virtual void deposit( CORBA::ULong amount ) = 0;
    virtual void withdraw( CORBA::ULong amount ) = 0;
    virtual CORBA::Long balance() = 0;
    // ...
};


Banking: client-side mapping

// Stub for interface Account
class Account_stub : virtual public Account {
public:
    void deposit( CORBA::ULong amount );
    void withdraw( CORBA::ULong amount );
    CORBA::Long balance();
    // ...
};


Banking client (C++)

main (int argc, char *argv[])
{ CORBA::ORB_var orb =
       CORBA::ORB_init(argc, argv, "mico-local-orb");
  // Connect to the Bank
  CORBA::Object_var obj = orb->bind("IDL:Bank:1.0");
  Bank_var bank = Bank::_narrow(obj);
  // Open an account
  Account_var account = bank->create();
  // Deposit and withdraw some money
  account->deposit(700);
  account->withdraw(450);
  printf("Balance is %ld.\n", account->balance ());
}


Banking client (UML)

account1.gif


Banking: server-side mapping (1)

class Account_impl : virtual public POA_Account {
public:
    void deposit (CORBA::ULong);
    void withdraw (CORBA::ULong);
    CORBA::Long balance ();
    // ...
};


Banking: server-side mapping (2)

class Bank_impl : virtual public POA_Bank {
    PortableServer::POA_var mypoa;
public:
    Bank_impl(PortableServer::POA_ptr);
    Account_ptr create();
};
Account_ptr Bank_impl::create()
{
    CORBA::Object_var obj =
         mypoa->create_reference("IDL:Account:1.0");
    Account_ptr aref = Account::_narrow(obj);
    return aref;
}


Banking server (C++) (1)

main (int argc, char *argv[])
{
  CORBA::ORB_var orb =
       CORBA::ORB_init(argc, argv, "mico-local-orb");
  // Obtain a reference to the RootPOA and its Manager
  CORBA::Object_var poaobj =
       orb->resolve_initial_references("RootPOA");
  PortableServer::POA_var poa =
       PortableServer::POA::_narrow(poaobj);
  PortableServer::POAManager_var mgr =
       poa->the_POAManager();
  // more POA setup...


Banking server (C++) (2)

  // more POA setup...
  // Create a Bank
  Bank_impl* micocash = new Bank_impl(mypoa);
  // Activate the Bank
  PortableServer::ObjectId_var oid =
      poa->activate_object(micocash);
  // Activate both POAs and start serving requests
  mgr->activate();
  orb->run();
}


Banking server (UML)

account2.gif

4.4  Dynamic interfaces


Dynamic Invocation Interface

Static invocation (by way of stubs and skeletons) suits most applications, but some, such as browsers, design tools, and gateways, may need a more flexible mechanism.


Dynamic Skeleton Interface



Interface Repository


4.5  The Object Management Architecture

The Object Management Architecture builds upon the core architecture (the ORB and its mechanisms and interfaces) to provide a comprehensive framework of higher-level services.


Interoperability and Protocols



File translated from TEX by TTH, version 2.32.
On 10 Jul 2000, 15:36.