
Transcription
A Tutorial on CORBAMark PleskoJ. Stefan Institute, Ljubljana, Sloveniapresented at the ESOGarching, December 16-th, 1999
M. Plesko, CORBA TutorialSummary Introduction–––– Justification and History ( blah, blah)What is CORBA (Executive summary)How does CORBA work (Programmer summary)CORBA FeaturesConcepts of CORBA– What are Objects in CORBA– Data Flow in CORBA– Definitions CORBA details– Request Invocation– Object References– The Portable Object Adapter (POA) More About CORBAESO, December, 16-th, 19992
M. Plesko, CORBA TutorialJustification and History ( blah, blah) Distributed Applications are heterogeneous– layers, applications, libraries glued together– can all components really work together? Two key rules– build platform-independent models and abstraction– hide as much low-level complexity without sacrificing too muchperformance CORBA provides a well thought balanced set of abstractions andconcrete services– Object Services– Domain Interfaces– Application Interfaces Object Management Group (OMG) since 1989 - now over 800membersESO, December, 16-th, 19993
M. Plesko, CORBA TutorialWhat is CORBA (Executive summary) ORB: Object Request Broker manages remote access to objectsCORBA: Common ORB Architecture software bus for distributedobjectsCORBA provides a framework for distributed OO programming– remote objects are (nearly) transparently accessible from the localprogram– uses the client-server paradigm– platform and language independent “an OO version of RPC”– but a framework rather than a technology lot of theoryESO, December, 16-th, 19994
M. Plesko, CORBA TutorialHow does CORBA work (Programmer summary)Interface PS {attribute double current;readonly attribute Ulong status;octet on(in octet value);void test(out long result) ;}try {PS aPS PSHelper.bind(ORB,“PS1”);if ( ! aPS.on(1) ) return;aPS.set current(3.1415);print (aPS.status());} catch (CORBAexception) { }ESO, December, 16-th, 1999class PSimp extends PSImplBase{ }; PS thisPS new PSimp(“PS1”) ;BOA.obj is ready(thisPS);BOA.impl is ready();5
M. Plesko, CORBA TutorialCORBA Features Don’t worry about unique terminology - these are just words!– CORBA object– request, target object, object reference– client, server, servant Features– Interface Definition Language (IDL)– language mapping official: C, C , Samlltalk, COBOL, Ada, Java also: Eiffel, Modula 3, Perl, Tcl, Objective-C, Python– Operation invocation and dispatch facilities static (known at compile-time) dynamic (determined at run-time)– Object adapters Design pattern: adapt CORBA object interface to servant– Inter-ORB ProtocolESO, December, 16-th, 19996
M. Plesko, CORBA TutorialWhat are Objects in CORBA Objects are abstract: not realized by any particular technology– An object system is a collection of objects that isolates the requestor ofservices (clients) from the providers of services by a well-definedencapsulating interface Objects “talk” through requests: operation, target object, zero ormore parameters, optional request contextObjects are described with interfaces– operations (methods)– attributes (properties)– Standard data types are supported object references AnyESO, December, 16-th, 19997
M. Plesko, CORBA TutorialData Flow in CORBAIIOPESO, December, 16-th, 19998
M. Plesko, CORBA TutorialSome Definitions ORB:– find the object implementation for the request, prepare the objectimplementation to receive the request and communicate the datamaking up the request.– ORB throws exceptions– ORB implementation is not defined in CORBA Object Adapter (POA, BOA, )– provides ORB services to particular groups of object implementations– generation and interpretation of object references, method invocation,security of interactions, object and implementation activation anddeactivation, mapping object references to implementations, andregistration of implementations. IIOP: Internet Inter-ORB Protocol– ORB’s of different vendors can talk– TCP/IP implementation of GIOPESO, December, 16-th, 19999
M. Plesko, CORBA TutorialMore Definitions IDL: Interface Definition Language– IDL is the means by which a particular object implementation tells itspotential clients what operations are available and how they should beinvoked. Language mapping: recipe how to generate stubs&skeletons fromIDL– Clients see objects and ORB interfaces through the perspective of alanguage mapping, bringing the object right up to the programmer’slevel. Interface Repository: where all interfaces are stored network-wide– provides information on interfaces at run-time DII: Dynamic Invocation Interface– construct a remote method call at run-time without the use of stubsESO, December, 16-th, 199910
M. Plesko, CORBA TutorialRequest InvocationThis is transparently handled by the ORB Locate target object activate server application if not yet running transmit any arguments activate a servant if necessary wait for request to complete return any out/inout parameters and return value return exception if call failsESO, December, 16-th, 199911
M. Plesko, CORBA TutorialObject References Several references to one objectCan point to nowhere (death undetected)Are strongly typed (at compile&run time)Support late bindingImplemented by proxies But how do you get a reference?– Bootstrap via well known entry point (Naming service) via reference-to-string (known URL, filename)– from a Object method callESO, December, 16-th, 199912
M. Plesko, CORBA TutorialThe Portable Object Adapter (POA) Provides object creation, servant registration and mapping, requestdispatchingIntended for scalable, high-performance applications – different POAs for 1 object or millions of objectsIs a locally-constrained object, multiple may exist Policies–––––––Object life span: persistent/transientObject Id: system ID/user IDMapping objects to servants: unique ID/multiple IDObject activation: implicit/no implicitMatching requests to servants: object map/default servant/managerObject to servant association: retain/non retainallocation of threads: ORB control/single threadESO, December, 16-th, 199913
M. Plesko, CORBA TutorialCORBA Services Some 20 defined servicescheck vendor for implementation and limitations !Some interesting services– Naming Service “directory-based” single or federated– Event Service decouples suppliers from consumerspush or pull modelsuses Any for event dataNotification Service ?Messaging Service ?ESO, December, 16-th, 199914
M. Plesko, CORBA TutorialMore About CORBA Other features of CORBA– vendor specific implementations - check performance you need !– Gateways to DCOM and OLE automation exist– CORBA Components (futureware) Some buzzwords to know (and use)– thin client– three tier architecture– legacy systems Alternatives to CORBA:––––socketsRPCRMIDCOMlow level, used by CORBAnot OOlanguage dependentmaybe somedayESO, December, 16-th, 199915
M. Plesko, CORBA TutorialMeta IDL - MIDL#parameter P type type {#accessors{#sync, #async, #history};#monitorable;#static{default value, graph min, graph max, min step,resolution pattern, description string, format string, units string};};#parameter RW type type : P type {#eventable{Alarm type };#mutators{#sync, #async, #nonblocking, #step};#static{min value, max value};};#device PowerSupply{#actions{on, off, reset, start ramp(in CBRamp cb, in RampData data)};#methods{double sync method test(in double input, out double output);};#parameters{current RW double , readback RO double , status ROpattern};#static{model PowerSupplyModel};};ESO, December, 16-th, 199916
M. Plesko, CORBA TutorialCallbacks in BACI: device.property.get(CB) Asynchronous completion notificationinterface CB type : CB {oneway void execute(in type value, in Completion c, in CBDescOut desc);oneway void cb done(in type value, in Completion c, in CBDescOut desc);}; monitoringeventsinterface CB event set name : CB {oneway void event 1 name (., in CBDescOut desc);oneway void event 2 name (., in CBDescOut desc);.}.void subscribe event set name (in CB event set name cb, in CBDescIn desc);void unsubscribe event set name (in CB event set name cb);ESO, December, 16-th, 199917
M. Plesko, CORBA TutorialCoCoS DevelopmentDBODBC LIBCLIENT STUBDB ACCESSCORBA WRAPPERDB GenDB PopIDL2CPPCS LIBCW GenIDL2CPPMIDL(BACI)DAGCOB SERVER SKELETONSCW GenCORBA WRAPPERCSIGenSERVER IMPLEMENTATIONDEVICE DRIVERIDL(MACI)COSCOIDL2CPPACTIVATORCWMCSM LIBESO, December, 16-th, 199918
M. Plesko, CORBA TutorialCoCoS RuntimeDBDBLINKServant BServant AM LINKM(C LINOR KBA)(CORBA)MANAGEROBJEC(C T LOR INBA K)DBLINKLINKDB.)BC,(ODADMIN.M(C LINOR KBA)COB SERVERCOBCOBCOBtype ACOBCOBCOBCOBtype BCLIENTESO, December, 16-th, 199919
M. Plesko, CORBA TutorialCoCoS Startup and ManagementESO, December, 16-th, 199920
M. Plesko, CORBA TutorialCoCoS on Pharlap/TNT Real-Time Operating SystemESO, December, 16-th, 199921
CORBA provides a framework for distributed OO programming – remote objects are (nearly) transparently accessible from the local program – uses the client-server paradigm – platform and languag