1 / 69

Distributed Objects

Distributed Objects. Outline. Introduction Why, What, How The general framework CORBA Java RMI Summary. Acknowledgement. 本节 ppt 有关 CORBA 部分内容从下列文献摘录或改编: Bamshad Mobasher http://maya.cs.depaul.edu/~mobasher/classes/ds520/ Douglas C. Schmidt http://www.cs.wustl.edu/~schmidt/corba.html.

mora
Télécharger la présentation

Distributed Objects

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. Distributed Objects

  2. Outline • Introduction • Why, What, How • The general framework • CORBA • Java RMI • Summary Institute of Computer Software Nanjing University

  3. Acknowledgement • 本节ppt 有关CORBA部分内容从下列文献摘录或改编: • Bamshad Mobasher • http://maya.cs.depaul.edu/~mobasher/classes/ds520/ • Douglas C. Schmidt • http://www.cs.wustl.edu/~schmidt/corba.html Institute of Computer Software Nanjing University

  4. Introduction • Distributed computing • What: • the process of running a single computational task on more than one distinct computer -- from Wikipedia • “The network is the computer” • Why? • How? • 实践表明,分布式应用系统的开发比集中式应用系统开发困难的多。 Institute of Computer Software Nanjing University

  5. Distributed Computing • Why? • “世界是分布的”。 • 有时将涉及的用户、应用、数据集中化不合适、不可行。 • 资源共享 • 并行处理 • 冗余容错 Institute of Computer Software Nanjing University

  6. The Business Model • Every application is part of your business model • must make them work together! Payables/ Receivables Sales Accounting Manufacturing Inventory Shipping/ Receiving Engineering Distributed Systems Frameworks

  7. The Problem • Application Integration and Distributed Processing are the same thing • Constructing information-sharing distributed systems from diverse sources: • heterogeneous • networked • physically disparate • multi-vendor Distributed Systems Frameworks

  8. Client-Server Architecture Client Code Server Code Stub Skeleton Infrastructure Client: Thin or Fat? Distributed Systems Frameworks

  9. Some Architectural Patterns • Multi-Tier Systems • separates persistence from logic and logic from presentation • all activity originates in user interface • arrows represent client-server relation Business Logic User Interface Persistent Store Distributed Systems Frameworks

  10. Architectural Patterns • Peer-to-Peer Systems Application Requests Message queue Notifications Persistent Store User Interface (mixed initiative) Monitor Enterprise Applications Distributed Systems Frameworks

  11. Architectural Patterns • Web Applications • interaction initiated by user • UI based on HTML, Java, Javascript, etc. • CGI/Servelet composes HTML, forwards interaction requests to business logic Firewall Business Logic HTTP Servers CGI / Servelets Data Store User Interface Distributed Systems Frameworks

  12. Anatomy of a Distributed Application • 3 layers of a distributed application: • network level (TCP/IP, network protocols) • higher-level services (directory services, security protocols, etc.) • application level • At the application level: • processes • threads • objects: processes can be made up of one or more objects which can be accessed by one or more threads within the process • agents: an “independent” functional element (e.g., in a banking application we may have a customer agent, a transaction agent, an information brokerage agent) Distributed Systems Frameworks

  13. Requirements for a Distributed Application • Partitioning and Distributing Data and Functions • data-driven distribution • functional distribution • object-based distribution • Flexible, Extendible Communication Protocols • allocation of tasks to agents has a direct influence on the complexity of the communication protocol (type of data, amount of data, persistence of connections) • may also be dictated by legacy systems that need to be incorporated Distributed Systems Frameworks

  14. Requirements for a Distributed Application • Multi-threading Requirements • server object may need to service multiple remote clients at once • effective way to optimize resources • Security Requirements • authentication of client identities • define resource access levels • data encryption Distributed Systems Frameworks

  15. Distributed Computing • How? • 理想主义:Distributed Operating System • 现实主义: • 操作系统提供网络通信功能 • (中间件) • 分布应用程序 Institute of Computer Software Nanjing University

  16. Distributed Programming • Socket programming in Java // listen to port 5000 on the local host for socket connection requests ServerSocket s = new ServerSocket(5000); while (true) { // wait for connection request from client Socket clientConn = s.accept(); InputStream in = clientConn.getInputStream(); OutputStream out = clientConn.getOutputStream(); // now IO streams are connected to client; do something with them... Institute of Computer Software Nanjing University

  17. // create the socket InetAddress addr = InetAddress.getByName(“our.remote.host”); Socket s = new Socket(addr, 5000); InputStream in = s.getInputStream(); OutputStream out = s.getOutputStream(); // now we have IO streams to remote process; do something with them... Institute of Computer Software Nanjing University

  18. Distributed Computing • Message Passing Libraries • PVM, MPI • Send/Recv, Multicast • Virtual Shared Memory Institute of Computer Software Nanjing University

  19. Distributed Computing • Remote Procedure Call (RPC) • 结构化方法用于分布环境 • Request – response pattern of messages • provides a function-oriented interface to socket-level communications (sits on top of the TCP/IP transport layer) Institute of Computer Software Nanjing University

  20. Procedural API for Remote Invocation • DCE (Distributed Computing Environment) • OSF standard for RPC • provides a common set of services • Directory Services--Store the names of resources that are available within the distributed environment. The Cell Directory Service (CDS) supports naming within a cell, and the Global Directory Service (GDS) supports naming across all cells within an enterprise. GDS implements the X.500 directory service standard. • Distributed File Service (DFS)--An optional DCE service that provides a seamless file system that operates across all computers contained within a cell. • Distributed Time Service (DTS)--Used for synchronization. • Security Service--Used for authentication and control access. • DCE Threads--Similar to Java threads. They are lightweight processes that simplify the design of client/server applications. Distributed Systems Frameworks

  21. General Pattern for Remote Invocation • Call: • marshal arguments • convert to network format • locate server • transmit data Client Code Server Code Stub Skeleton Infrastructure • Serve: • receive data • convert & unmarshal • invoke method • marshal return value • transmit data Distributed Systems Frameworks

  22. Distributed Object Computing • 对象计算模型和分布计算模型的结合 • 自然 • decentralized nature of dist. computing • encapsulation required by distributed components • information hiding requirements (location transparency, security, etc.) • 优越: Institute of Computer Software Nanjing University

  23. Distributed Objects • Location Transparency Caller Machine 1 Machine 2 local call remote call Implementor Proxy Distributed Systems Frameworks

  24. Institute of Computer Software Nanjing University

  25. Key Advantages of DOC • Providing the same enhancements to procedural RPC toolkits that OO languages provide to conventional procedural languages • encapsulation, interface inheritance, object-based exception handling • promotes separation of interface from implementation (crucial for scalable distributed applications) Distributed Systems Frameworks

  26. Key Advantages of DOC • Enabling interworking between applications at a higher level of abstraction • developing distributed applications using familiar techniques such as method calls on objects • again, location transparency • Providing a foundation for building higher-level mechanisms that facilitate collaboration among services in distributed applications • common object services (e.g., global naming, transactional messaging, quality of service facilities, etc.) Distributed Systems Frameworks

  27. Distributed Object Computing • 实现分布对象计算的几个核心概念 • 接口 • 对象引用 • 参数传递 • 相关服务设施 • 底层通信协议 Institute of Computer Software Nanjing University

  28. o.m(...) Institute of Computer Software Nanjing University

  29. Features of DOC Systems • Object Interface Specification • allow clients to access objects regardless of implementation details • allow object server flexibility in implementing objects • existing services may be incorporated via wrappers • platform-independent specification languages • interface descriptions can be converted into server skeletons which can be compiled and implemented in any language • some object interfaces also generate client stub interfaces. • Examples: • CORBA: Interface Definition Language (IDL) • DCOM: Component Object Model language Distributed Systems Frameworks

  30. 远程对象引用 • 对象通过相互引用来通信 • 本地对象引用:仅在当前地址空间有效 • 运行系统维护; • 远程对象引用 • 不同地址空间? • 异构? • 生命周期? • 需要某种“对象管理器”来支持、维护之 Institute of Computer Software Nanjing University

  31. Features of DOC Systems • Object Manager • The core of a distributed object system • Manages object skeletons and object references on the server • E.g., Object Request Broker (ORB) in CORBA or Registry Service in RMI • When a client requests a new object, the object manager • locates the skeleton for the class of the requested object • creates new instance based on skeleton • stores new object in the object storage • sends a reference to the new object back to the client Distributed Systems Frameworks

  32. Features of DOC Systems • Object Manager • Remote method calls by clients are routed by object manager to the proper object on the server • Object manager may also destroy objects after clients are done • Some other possible features of OM • dynamic object activation/deactivation • persistent objects Distributed Systems Frameworks

  33. Features of DOC Systems • Registration / Naming Service • Acts as an intermediary between the object client and the object manager • Once the interface to an object is defined, an implementation of the interface must be registered with the service so that it can be addressed by clients • Through the naming service the client can specify • the type of the object it needs • or the name of a particular object, if it already exists Distributed Systems Frameworks

  34. Features of DOC Systems • Object Communication Protocol • General protocol for handling remote object requests • Must support a means of transmitting and receiving object and method references, and data in the form of objects or basic data types • Ideally should be transparent to clients • should interact with local object proxies (stubs) and let the object distribution scheme handle communication behind the scenes Distributed Systems Frameworks

  35. Object Interface Specification General Architecture for a DOC System Registration Service Object Skeleton Object Storage Server Implementation Object Manager IDL Compilers Naming Service Client Stub Interface Client Application Distributed Systems Frameworks

  36. Remote Object Transactions at Runtime Server Object Implementation Object Skeleton 4. Object Interactions 2. Resolve Object Object Manager Naming Service 1. Request Object 3. Object Handle Object Stubs Client Application Distributed Systems Frameworks

  37. Comparing DOC Frameworks • Distributed Object Computing Frameworks • CORBA - Common Object Request Broker Architecture, an industry standard developed by OMG • DCOM - Microsoft’s Distributed Component Object Model, a descendant of DCE RPC • RMI - Java’s Remote Method Invocation Distributed Systems Frameworks

  38. OMG Reference Model Architecture Institute of Computer Software Nanjing University

  39. Object Management Architecture • Object Services • Domain-independent foundational services for use by developers of implementation objects • some published services: • Naming • Trading • Events • Transactions • Security Distributed Systems Frameworks

  40. Object Management Architecture • Common Facilities • object services provide functionality for use by objects, CORBAfacilities provide standards for services used by applications • generic functionality needed by many applications (e.g., printing, document management, email, etc.) Distributed Systems Frameworks

  41. Object Management Architecture • Domain Interfaces • provide domain-specific objects for vertical application domains • Examples: Finance, Healthcare, Manufacturing, Telecom, Electronic Commerce, Transportation • Application Interfaces • Thus not standardized Distributed Systems Frameworks

  42. Common Object Request Broker Architecture • 一个典型的分布对象计算架构 • The architecture • 对象 Objects and Clients • 接口 OMG IDL • “对象管理器” ORB • 底层通信协议 IIOP • 其他 Institute of Computer Software Nanjing University

  43. Institute of Computer Software Nanjing University

  44. Overview of CORBA Objects • CORBA Object • <identity, interface, implementation> • CORBA objects differ from typical programming language objects: • CORBA objects can be located anywhere on a network. • CORBA objects (like Java objects) can run on any platform. • CORBA objects can be written in any of several languages. • CORBA object developers need know nothing of where their clients will be, what hardware or OS they will run on, or what language they will be written in. • CORBA objects approach universal accessibility. Distributed Systems Frameworks

  45. Overview of CORBA Objects • An object implementation provides the semantics of the object, usually by defining data for the object instance and code for the object's methods. (called a “servant”) • A client of an object has access to an object reference for the object, and invokes operations on the object. • A client knows only the logical structure of the object according to its interface and experiences the behavior of the object through invocations. • Client code has no knowledge of the implementation of the object or which ORB is used to access the implementation. Distributed Systems Frameworks

  46. C C++ ORB Ada Role of OMG IDL Object Implementation Side Client Side COBOL C I D L I D L I D L I D L COBOL Ada I D L I D L ORB I D L Internet InterORB Protocol (IIOP) I D L Small talk I D L I D L I D L I D L Small talk C++ C++ JAVA JAVA Distributed Systems Frameworks

  47. OMG IDL • OMG Interface Definition Language (IDL): • mappings for many languages/compilers; • independent of any particular language/compiler; • multiple-inheritance, public interface-structured specification language; • not for implementation. • primary support for interoperability between static and dynamic requests mechanisms. Distributed Systems Frameworks

  48. OMG IDL • IDL Structure • Module • a namespace • Interface • abstract type • multiple inheritance • Struct • structured data Module auction { exception NotAllowed {}; struct Sale { int price; string item; } interface Auction { void bid (in long price) raises NotAllowed; } } Distributed Systems Frameworks

  49. A Request • A request consists of: • Target object (target object identified by a unique object reference) • Operation • Parameters (the input, output and in-out parameters defined for the operation; may be specified individually or as a list) • Optional request context Client Object Implementation Client Proxy (stub code) Skeleton code Request ORB Distributed Systems Frameworks

  50. CORBA Framework Elements • Object Request Broker (ORB) • This is the object manager in CORBA • Mechanisms for specifying interfaces • Interface Definition Language (IDL) - for static interface definitions • Dynamic Invocation Interface (DII) - lets clients access interfaces as first-class objects at run-time from an Interface Repository. • Internet Inter-Orb Protocol (IIOP) • A binary protocol for communication between ORBs. • Was added in CORBA 2.0 Distributed Systems Frameworks

More Related