Middleware 1
Middleware Lehrstuhl für Informatik 4 Middleware: Realisation of distributed accesses by suitable software infrastructure Hiding the complexity of the distributed system from the programmer Supporting the interaction between application components which could run on heterogeneous systems Separation of interface and implementation Is added to the operating system or build upon it to take over some of its tasks The middleware is build upon different operating systems, networks, and communication protocols (layer 1-4). The applications can be programmed in different languages.... and the middleware realises the cooperation between the software components. 2
Middleware Lehrstuhl für Informatik 4 Middleware supports... The communication between application components (usually RPC- or RMI-based) Constructing modular applications Dynamic binding Supporting services, e.g. Naming Synchronization Replication 3
Examples for middleware DCOM as Microsoft's solution on distributed objects The Common Object Request Broker Architecture (CORBA) as a general (industry defined) way to support distribution in heterogeneous systems Web Services as an approach integrated with common Internet protocols forming a lightweight version of CORBA 4
Distributed Component Object Model (DCOM) Basic Technique in Microsoft's Windows: COM (Component Object Model) Supports the development of components that can be dynamically activated and interact with each other Can be used in executables as well as in dynamic link libraries Was developed to support compound documents ActiveX: covers the tasks of OLE, together with new features like starting variants, scripting support, OLE: Object Linking and Embedding. Serves for gluing together different parts of compound documents COM: communication infrastructure between different objects located on the same computer DCOM: 'distributed version' of COM to support activation/interaction with components located on another machine. For a programmer, the distinction between COM and DCOM is hidden behind interfaces (access transparency) 5
Object Model DCOM bases on the remote object model: objects can be placed in the same process as the client, in another process on the same machine, or in a process on a remote machine Basic concept: Distinction between interface and implementation The developer first specifies an object by its interface in an Interface Definition Language (IDL; Microsoft IDL = MIDL) An object simply is an implementation of an interface Interface means binary interface: a table of pointers to methods belonging to an interface. In this way, interfaces are language-independent Each interface is assigned with a globally unique Interface Identifier (IID) DCOM object: Instance of a class object, which represents an interface By calling a function CreateInstance on a class object (identified by a class ID, CLSID), a new object with this interface is build. 6
Object Model All objects implement a standard interface: IUnknown A pointer to IUnknown is passed back when creating an object Important method in this interface: QueryInterface, which returns a pointer to another interface implemented by the object By this, a standard method to get access to each object's methods is given create Reference: IUnknown QueryInterface(deposit) Reference: deposit IUnknown withdraw getbal. deposit setbal. 7
Object Model All objects in DCOM are transient Reference counting is part of IUnknown Having no more references, an object is destroyed An object can implement the IDispatch interface Dynamic invocation of objects An object does not have to know in advance all interfaces it will have to contact in its lifetime When an object implements this interface, calls to it can be constructed at runtime 8
Object Identifiaction and Activation Type library: storage for interface definitions Associated with an application Used to figure out the signature of a method to be invoked dynamically Used as a type library for supporting program developers Registry (Windows registry) Used to provide a mapping from class identifiers to executable code. In case of a remote invocation, the Service Control Manager (SCM) on the target host is contacted by a client to access the remote registry 9
Communication in DCOM Client side: Client proxy: providing the object's interface and sending the request to the object Proxy marshaller: translating a request into a transport format before sending Server side: Object stub: receives a call from a client proxy and passes it on to the object Proxy marshaller: extracts a request from a receives message Communication at the beginning only was synchronous using RPC Alternatives: Callback interfaces The client provides an interface where the server can call back after working on a request Asynchronous communication For each method, two methods are implemented: A start method the client passes its request to A finish method the client calls to read the response of the server 10
Events Lehrstuhl für Informatik 4 Real asynchronous communication without the need for both, client and object, to be active: using events An event is modelled as a method call An event class groups events and can be instantiated to event objects which can send events of specific types To register an implementation for a method so that events can be sent to it, a pointer to the corresponding interface has to be sent to the event system The event system can store events to pass them on to the receiver later Supplier: someone who creates events Consumer: someone who receives events m_event: method of an object 11
Passing Interface Pointers A client does not see distribution; the invocation of remote objects with DCOM is the same as an invocation of a local object with COM Difference: in COM an object is referenced by an interface pointer, in DCOM a remote object is referenced by implementing an interface as a proxy Passing on an object reference to another client is made by sending it the proxy which contains all connection information 12
Naming in DCOM Only low-level naming Objects are only transient. To expand an object's lifetime, additionally a persistent object reference is stored to an object. This reference is called moniker. Monikers have all information available to reconstruct an object and reload its state Step 1 2 3 4 5 6 7 Performer Client Moniker SCM Class object Moniker Object Moniker Description Calls BindMoniker at moniker Looks up associated CLSID and instructs SCM to create object Loads class object Creates object and returns interface pointer to moniker Instructs object to load previously stored state Loads its state from file Returns interface pointer of object to client 13
Types of Monikers Moniker type File moniker URL moniker Class moniker Composite moniker Item moniker Pointer moniker Description Reference to an object constructed from a file Reference to an object constructed from a URL Reference to a class object Reference to a composition of monikers Reference to a moniker in a composition Reference to an object in a remote process 14
Active Directory Windows 2000 contains a directory service called Active Directory which can be used by DCOM A distributed system based on Windows 2000 is partitioned into domains consisting of a number of resources and users Each domain has a domain controller which is a local directory server A domain controller is implemented as a LDAP directory server LDAP servers are registered in DNS Problem: a client has to know the target domain for its request 15