What is? Lecture 16 /D February 23, 2005 = Common Model. Platform-independent, distributed OO system for client-server implementations. objects can be created in a variety of languages (like CORBA). Not an object-oriented language but a standard (like CORBA). specifies an object model and programming requirements that enable objects (also called components) to interact with other objects. Principles of Provide a component object model that facilitates binary encapsulation and binary compatibility: binary encapsulation: s do not have to be re-compiled if server objects change binary compatibility: and server objects can be developed with different development environments and in different languages Design Principles Encapsulation: black box - no leakage of implementation details all object manipulation through strict interfaces Polymorphism: via multiple interfaces per class discoverable : QueryInterface IDispatch IRobot IUnknown Microsoft IDL (MIDL) Language for expressing all concepts. MIDL is: programming-language independent evolved from OSF/RPC IDL not computationally complete Different programming language bindings are available. Example (UML Diagram) Club -noofmembers:int -location:address +transfer(p:player) 1 Organization #name:string has * 1 1..* Trainer works for +train() Team coaches +bookgoalies() 1..* 1..* plays in 1 11..16 Player -Number:int +book() uses 1
Interfaces Interfaces IUnknown AddRef Release QueryInterface IDispatch GetIDsOfNames GetTypeInfo GetTypeInfoCount Invoke Custom Interfaces UUID Interfaces [object, uuid(1cf2b120-547d-101b-8e65-08002b2bd118)] interface IOrganization : IUnknown {... [object, Root Interface uuid(1cf2b120-547d-101b-8e65-08002b2bd116)] interface IClub : IOrganization {... Interface Inheritance Interface Impl. in C++ #include "Soccer.h" class TrainerPlayer : public Itrainer, public IPlayer { private: char* name; // name is the same in Itrainer & IPlayer short Number; //for IPlayer protected: virtual TrainerPlayer(void); public: TrainerPlayer(void); IMPLEMENT_UNKNOWN(TrainerPlayer) BEGIN_INTERFACE_TABLE(TrainerPlayer) IMPLEMENTS_INTERFACE(ITrainer) IMPLEMENTS_INTERFACE(IPlayer) END_INTERFACE_TABLE(TrainerPlayer) void train(); // Itrainer method void book(); // IPlayer method s Instances of implementations. References to objects are called interface pointers. Interface pointers refer to main memory locations. References support location transparency. The references are persistent. Attributes does not support direct attribute specification. Attributes must be represented as set and get operations by the designer. has a keyword to designate this. Example: interface IOrganization : IUnknown { [propget] HRESULT Name([out] BSTR val); Operations Parameter kind Parameter list interface IClub : IOrganization { [propget] HRESULT NoOfMembers([out] short *val); [propget] HRESULT Address([out] ADDRESS *val); [propget] HRESULT Teams([in] long cmax, [out] long *pcact, [out,size_is(cmax),length_is(*pcact)] ITeam *val); [propput] HRESULT Teams([in] long celems, [in,size_is(celems)] ITeam *val); [propget] HRESULT Trainers([out] ITrainer *val[3]); [propput] HRESULT Trainers([in] ITrainer *val[3]); HRESULT transfer([in] IPlayer *p); Return value indicating success/failure Operation name Parameter, e.g. Interface pointer 2
Hresults HRESULTS are 32-bit integers Structured into four fields Severity Reserved Facility 31 30-29 28-16 15-0 Information Operation Invocations Invocation provides: interface pointer of server object name of invoked operation actual parameters Invocation is executed synchronously Invocation can be defined statically dynamically s have to interpret HRESULTS! Three Implementations of Requests D Architecture Server Method call Inter-process call with light-weight RPC Remote call with real RPC Local in EXE Server Interface Library proxy stub Class Implementation Interface Library stub Application Presentation Local in In-Process DLL on Remote Host SCM Registry Microsoft RPCs SCM Registry Session Resolver Resolver Architecture D Architecture Communication details handled by runtime. 3
& Stub D Wire Protocol Machine Server Machine TCP, UDP SPX,IPX Net BEUI HTTP Component D Security Security Architecture Secure - security is designed and built in, not an option. D uses the extensible security framework provided by Windows NT. Security configurable D stores Access Control Lists for components ACLs can be configured using the D configuration tool (DCNFG) or programmatically using the Windows NT registry and Win32 security functions. Machine NTLM SSL, Certs. NT Kerberos DCE Server Machine Component Components & Reuse Use existing tools and components. Reduce development time and cost. components easily configured as D components. can use many other components. components are usable by many technologies. Location Transparency object locations are stored in registry. Applications make calls using the interface proxy. Path to server or remote computer to run D server is not needed by the application. 4
Connection Management Low bandwidth: header is 28 bytes over DCE-RPC keep-alive Messages bundled for all connections between machines. employs an efficient pinging protocol to detect if clients are active. uses reference counting mechanism to do garbage collection. Efficient & Scalable Multiplexing - single port per-protocol, per server process, regardless of # of objects Scalable - connection-less protocols like UDP preferred Established connection-oriented (TCP) sessions reused by same client Server Platform Neutrality Basic Principles D run-time is available for various platforms: Win32 platforms, Solaris, DEC UNIX, HPUX, Linux, MVS, VMS, Mac cross-platform interoperability standard Per-platform binary standard: unlike Java, D can utilize powerful platformspecific services and optimizations less abstraction layers prevents additional overheads Language Remote reference IDL interface Marshalling CORBA many reference OMG IDL IDL stub IDL skeleton IIOP, CDR RMI Java object ID JAVA stub, skeleton Serialization /D C++, Java, VB,... Handles to remote interface (interface pointer) MIDL proxy, stub Network data representation (RPC) 5