1 / 132

ITEC801 Distributed Systems

ITEC801 Distributed Systems. Middleware Examples 1 Coulouris Chapter 17 Liu Chapter 10. Important Things. What does CORBA do that RPC/RMI doesn’t? How does it do it? How does CORBA allow for components in different languages? What does .Net do that RPC/RMI doesn’t? How does it do it?

quana
Download Presentation

ITEC801 Distributed Systems

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ITEC801Distributed Systems Middleware Examples 1 Coulouris Chapter 17 Liu Chapter 10

  2. Important Things • What does CORBA do that RPC/RMI doesn’t? • How does it do it? • How does CORBA allow for components in different languages? • What does .Net do that RPC/RMI doesn’t? • How does it do it? • How does .Net allow for components in different languages? • What are the differences between CORBA and .Net in how they allow for components in different languages? Middleware Examples 1

  3. You might notice there are a lot of slides here – far more then we can get through in one week • We’ll only be a looking at a few in lectures – the rest are included for interested only Middleware Examples 1

  4. Synchronous Middleware - CORBA • We’ve already looked at RPC and RMI • another synchronous middleware technology is CORBA Middleware Examples 1

  5. CORBA • Common Object Request Broker Architecture • Not an implementation technology (like Java RMI or Sun RPC) • A specification of service • A CORBA implementation adheres to the design Middleware Examples 1

  6. CORBA • A CORBA system supports distributed objects • These objects do not all have to be written in the same language • Can be used for non-object based languages (eg., C, COBOL) • So can be used with legacy applications • This multi-language ability distinguishes it from, for example, Java RMI Middleware Examples 1

  7. CORBA Client Application Object Implementation Stub Skeleton Object Request Broker Request Middleware Examples 1

  8. CORBA IDL • Interface Definition Language (IDL) • Technology that allows objects written in different languages to interact • IDL used to define the instance variables and methods of the distributed objects in a CORBA implemented system Middleware Examples 1

  9. Language Independence Object implementation written in C++ Object client written in Java Skeleton in C++ generated by compiling the CORBA object interface Stub in Java generated by compiling the CORBA object interface ORB written in C++ ORB written in Java Middleware Examples 1

  10. CORBA Client Application Object Implementation Stub Skeleton Object Request Broker Object Request Broker Request Middleware Examples 1

  11. How does it do it? • IDL - client knows the type of object it is invoking • client stub and object skeleton are generated from the same definition • so client knows exactly which operations it may invoke, what the input parameters are, and where they have to go in the invocation • when the invocation reaches the target, everything is there and in the right place. • IIOP - Client and implementation ORBs agree on communication protocols Middleware Examples 1

  12. IDL • IDL definitions define only the interface • They say nothing about the language used to create the actual implementation • This is a very important concept in understanding CORBA Middleware Examples 1

  13. IDL • In simple terms a CORBA IDL interface specifies: • A name • A set of methods that clients can request • Syntax influenced by C++ Middleware Examples 1

  14. Example module Tester { interface Single { attribute string exname; readonly attribute string location; string returnsVals (in string point); } } Middleware Examples 1

  15. Example • This module defines a class single • single has two instance values and one method Middleware Examples 1

  16. IDL Parameters • Parameters to methods may be • For input (in) • For output (out) • For both (inout) Middleware Examples 1

  17. IDL Modules and Interface • A Module • allows type and interface definitions to be grouped together • Defines a naming scope • An Interface • describes the methods that are available in CORBA objects that implement the interface • Can use the type definitions in the module that contains it Middleware Examples 1

  18. IDL Methods and Attributes • Methods are operations on CORBA objects • Attributes are values associated within an object • Are similar to public class fields in Java • Are private to their objects, but have associated retrieve and set methods automatically generated Middleware Examples 1

  19. IDL Data Types • Fifteen basic types defined • Double, float, unsigned long, long, long long, unsigned long long, char, wchar, boolean, octet, string, wstring, short, unsigned short, fixed • IDL constructed types • enum, struct, union, sequence, array Middleware Examples 1

  20. Struct • A facility for associating a number of values together • They can then be passed as a single value Struct employee { string name; long mobile; } Middleware Examples 1

  21. Array and Sequence • Array is one-dimensional set of values of the same type • It is of fixed length • Sequence is similar to array • However it can be of fixed maximum size or can grow • Even if fixed, can be smaller than its possible maximum Middleware Examples 1

  22. Enum • Allows a new type to be declared by stating all possible values of the type Enum EmploymentStatus {employed, unemployed, transient} Middleware Examples 1

  23. Union • Allows a value of one of a number of types to be passed • Which member of the union is used depends on the value of the discriminator Middleware Examples 1

  24. CORBA Object Model • Clients are not necessarily objects • A CORBA Object is a remote object accessed by a client • A CORBA object implements an IDL interface • A CORBA object can be implemented in a language that is not object oriented • Therefore CORBA IDL does not support classes • Instances of classes can not be passed as parameters Middleware Examples 1

  25. CORBA Servers • Contain implementations of one or more IDL interfaces • For OO languages these implementations define servant classes • CORBA objects are instances of servant classes • For non-OO languages a skeleton provides an object wrapper – which is then the CORBA object • The objects are registered with the ORB Middleware Examples 1

  26. Object Implementations • Are CORBA aware • We’ll see a Java example later • Can still use legacy code • But • Need original source code • Either alter it or provide wrappers • Then re-compile Middleware Examples 1

  27. Legacy Code • Modifications minor • Mostly to do with interaction with ORB • Are not in core functionality of application Middleware Examples 1

  28. CORBA Advantages • Server implementation and communication with it all written in one language • Is compiled • Same for client • But server and client can be in different languages • CORBA provides the translation Middleware Examples 1

  29. Language Defined Interfaces IDL Specification Java class defs C++ class defs C Prototypes Standard programming language compiler Compiler Specific Code IDL to language compiler Middleware Examples 1

  30. CORBA Architecture Remote Object on server Client Application Static IDL Skeletons Dynamic Skeleton Interface Stubs ORB Interface ORB Interface Dynamic Invocation Interface Stubs Stubs Object Adapter Client ORB CORE Server ORB CORE Middleware Examples 1

  31. ORB Core • Communication between clients and server objects passes through the ORB cores • Carries out the process of communication between distributed objects • Communicates with transport medium Middleware Examples 1

  32. ORB Communication • From CORBA 2.0 all ORBS should be able to communicate • Use Internet Inter Orb Protocol (IIOP) Middleware Examples 1

  33. ORB Core • Can be started and stopped • Can convert between remote object references and strings • Can provide argument lists for requests using dynamic invocation Middleware Examples 1

  34. Object Invocation • CORBA is flexible • This flexibility allows it to handle code written in very different languages • It provides a two mechanisms to handle remote object invocation • Static invocation • Dynamic invocation Middleware Examples 1

  35. Interface Repository • Maintains representations of IDL definitions • Holds information needed by ORB • to locate and start up object implementations • marshal and unmarshal parameters • Used to activate object implementations so IR specific to operating environment • So is not standardised by CORBA • Note not in the architecture diagram Middleware Examples 1

  36. Object Adapter • Whether static or dynamic invocation is used the invocation passes through the object adapter • The object adapter connects the client and server code (with help from other portions of the architecture) Middleware Examples 1

  37. Object Adapter • Creates remote object references for CORBA objects • Dispatches each RMI to the appropriate server code (via a skeleton) • Activates objects • There may be more than one object adapter for each instance of an ORB core Middleware Examples 1

  38. Object Adapter • All CORBA objects must be registered with their object adapter • Remember a CORBA object is one that can be accessed remotely • The object adapter gives each CORBA object a unique object name • Identifies CORBA object • Same name used each time object activated Middleware Examples 1

  39. Static Invocation • Resembles what we have already seen for RPC/RMI • There is a • Client stub or proxy • Static IDL skeleton Middleware Examples 1

  40. Client Stub/Proxy • Written in client language • Stub for non-OO languages • Proxy for OO languages • Generated beforehand from specification of server • Marshal and un-marshal parameters and exceptions Middleware Examples 1

  41. Static IDL Skeleton • Server side equivalent of the stubs/proxies • Unmarshals parameters in requests • Marshals exceptions and results in reply • Generated in language of server by IDL compiler Middleware Examples 1

  42. Dynamic Invocation • Static invocation used when stubs/proxies and static skeletons exist before compilation of client • This is not always the case • For example, if want to access class created after client compiled Middleware Examples 1

  43. Dynamic Invocation • If can’t use static invocation, must use dynamic invocation • Involves • Dynamic invocation interface on client side • Interface repository • Dynamic skeletons Middleware Examples 1

  44. Dynamic Invocation • CORBA does not allow classes for proxies to be downloaded at runtime • (Java RMI does) • CORBA uses dynamic invocation Middleware Examples 1

  45. Dynamic Invocation Interface • Client obtains necessary information from interface repository to construct an invocation • Like static invocation needs • Operation name • Object reference • Parameter list Middleware Examples 1

  46. Interface Repository • Provides information about registered IDL interfaces • Used by clients and servers • Provides • Names of methods • Names and types of arguments Middleware Examples 1

  47. Interface Repository • For example, a client may be given a reference to a CORBA object for which it has no stub/proxy • Retrieves necessary information from interface repository Middleware Examples 1

  48. DII Structures • Parameters inserted into name-value list • List then used in invocation • DII always accepts a parameter list, so does not matter how many parameters there are • Note list built at run-time Middleware Examples 1

  49. DII Structures • Request pseudo-object Interface Request { ORBStataus add_arg(……); ORBStataus invoke(……); ORBStataus delete(……); ORBStataus send(……); ORBStataus get_response(……); }; • Request first constructed then sent Middleware Examples 1

  50. Dynamic Skeleton Interface • Allows a CORBA object (server) to accept invocation were no static skeleton exists • Type of interface not known at compile time • Dynamic skeleton • Receives invocation • Inspects contents to find target object, method, arguments • Invokes target Middleware Examples 1

More Related