1 From Objects to Components joint lecture by Prof. Judith Bishop, University of Pretoria, South Africa Stephan Herrmann, TU Berlin.

Slides:



Advertisements
Similar presentations
Common Object Request Broker Architecture (CORBA) By: Sunil Gopinath David Watkins.
Advertisements

Remote Method Invocation
Remote Object Invocation Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
CORBA - Common Object Request Broker Architecture.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 2: Distributed Software Engineering Using CORBA Dr. Michael R. Lyu.
Seminarium on Component-based Software Engineering Jan Willem Klinkenberg CORBA.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 5: CORBA, COM and Java/RMI Dr. Michael R. Lyu Computer Science &
Netprog CORBA Intro1 CORBA Common Object Request Broker Architecture Based partially on Notes by D. Hollinger and Java Network Programming and Distributed.
Advanced Comm. between Distributed Objects 1 Advanced Communication Among Distributed Objects  Outline  Request synchronization  Request multiplicity.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
A brief look at CORBA. What is CORBA Common Object Request Broker Architecture developed by OMG Combine benefits of OO and distributed computing Distributed.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
Distributed Service Architectures Yitao Duan 03/19/2002.
1. Introducing Java Computing  What is Java Computing?  Why Java Computing?  Enterprise Java Computing  Java and Internet Web Server.
Software Engineering and Middleware: a Roadmap by Wolfgang Emmerich Ebru Dincel Sahitya Gupta.
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
II. Middleware for Distributed Systems
Communication in Distributed Systems –Part 2
JMS Java Message Service Instructor Professor: Charles Tappert By Student: Amr Fouda.
Software Engineering Module 1 -Components Teaching unit 3 – Advanced development Ernesto Damiani Free University of Bozen - Bolzano Lesson 2 – Components.
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
Beyond DHTML So far we have seen and used: CGI programs (using Perl ) and SSI on server side Java Script, VB Script, CSS and DOM on client side. For some.
1 J2EE Components. 2 Application Servers relieve the programming burden for business distributed components. They provide support for system level services.
Middleware-Based OS Distributed OS Networked OS 1MEIT Application Distributed Operating System Services Application Network OS.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Jaeki Song ISQS6337 JAVA Lecture 16 Other Issues in Java.
Chapter 3: Objects, Components, and the Web Textbook IT Architectures and Middleware, Second Edition Chris Britton and Peter Bye AIT 600 Jeff Schmitt September.
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
Information Management NTU Interprocess Communication and Middleware.
© 2003 Wolfgang Emmerich 1 Validating Distributed Object & Component Designs Wolfgang Emmerich and Nima Kaveh London Software Systems University College.
J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
New features for CORBA 3.0 by Steve Vinoski Presented by Ajay Tandon.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
CS551 - Lecture 16 1 CS551 Object Oriented Middleware (V) Advanced Communication between Distributed Objects (Chap. 7 of EDO) Yugi Lee STB #555 (816)
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Distribution and components. 2 What is the problem? Enterprise computing is Large scale & complex: It supports large scale and complex organisations Spanning.
Hwajung Lee.  Interprocess Communication (IPC) is at the heart of distributed computing.  Processes and Threads  Process is the execution of a program.
CS 501: Software Engineering Fall 1999 Lecture 12 System Architecture III Distributed Objects.
Objektorienteret Middleware (OOMI)
 Common Object Request Broker Architecture  An industry standard developed by OMG to help in distributed programming.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
What is Java? Object Oriented Programming Language Sun Microsystems “Write Once, Run Everywhere” Bytecode and Virtual Machine Java Platform (Java VM and.
Today: Distributed Objects and Components 1. Me Greg Paperin MSci Computer Science href= 2.
CS551 - Lecture 10 1 CS551 Object Oriented Middleware (II) (Chap. 4 of EDO) Yugi Lee STB #555 (816)
Objektorienteret Netværkskommunikation (ITONK1) CORBA Introduction.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Enterprise Computing Distribution and components.
Remote Method Invocation A Client Server Approach.
(C) 2003 University of ManchesterCS31010 Lecture 14: CORBA.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
CEN6502, Spring Understanding the ORB: Client Side Structure of ORB (fig 4.1) Client requests may be passed to ORB via either SII or DII SII decide.
Remote Method Invocation
Object-Oriented Network Communication (OOMI)
CORBA Alegria Baquero.
Inventory of Distributed Computing Concepts and Web services
Interpreter Style Examples
CORBA Alegria Baquero.
Inventory of Distributed Computing Concepts
Chapter 40 Remote Method Invocation
Chapter 46 Remote Method Invocation
Chapter 46 Remote Method Invocation
Java Remote Method Invocation
Presentation transcript:

1 From Objects to Components joint lecture by Prof. Judith Bishop, University of Pretoria, South Africa Stephan Herrmann, TU Berlin

2 Pretoria

3 Distributed Objects Need a connection between processes  e.g. sockets Need memory independent object identifiers  e.g. #1, #2, #3 Need remote method calls  send (“#4 print_yourself”) Need to encode parameters (and return value..) Need to receive return value  result = read () Implement all this for every single method call??

4 Encapsulate Communication class AccountImpl implements Account extends RemoteObject { private String id; public int deposit(int amount) { String amount_str = encode_int(amount); send(id + “ deposit ” + amount_str); String new_balance = readString(); return decode_int(new_balance); } public int get_balance () {... } } Account a = new AccountImpl(“#15”); int nb = a.deposit( );

5 Proxy Pattern Client does not see difference between `real impl´ and proxy Superclass RemoteObject provides basic functions for  socket handling  value conversion (includes creation of proxies for referenced objects) Handcode proxies?? What about the receiving side??  decode messages  assign object IDs Client AccountProxyAccountImpl AccountRemoteObject

6 Java Remote Interface Example package soccer; interface Team extends Remote { public: String name() throws RemoteException; Trainer[] coached_by() throws RemoteException; Club belongs_to() throws RemoteException; Players[] players() throws RemoteException; void bookGoalies(Date d) throws RemoteException; void print() throws RemoteException; }; package soccer; interface Team extends Remote { public: String name() throws RemoteException; Trainer[] coached_by() throws RemoteException; Club belongs_to() throws RemoteException; Players[] players() throws RemoteException; void bookGoalies(Date d) throws RemoteException; void print() throws RemoteException; }; Remote operations Interface name Declare it as remote Package name Wolfgang Emmerich 2000©

7 Architecture Server Client Stub Registry Interfaces Skeleton Activation Interfaces RMI Runtime ( rmid,rmiregistry ) ) Wolfgang Emmerich 2000©

8 Activation in Java Client Host Stub Faulting Reference Live ref Hostwww.bvb.de Activa- tion ID Activator Activation Descriptors: ActGroup ClassName URL Init AG 1 Teamwww.bvb.de/… AG 2 Playerwww.bvb.de/… AG 2 Playerwww.bvb.de/… AG 2 Playerwww.bvb.de/… Java VM 1 2 AG 1 2 1: activate 2: create object in VM 3: pass object ref 4: update live ref Wolfgang Emmerich 2000©

9 Java Interfaces and Remote Objects  Java already includes the concept of interfaces  RMI does not have a separate interface definition language  Pre-defined interface Remote  Remote interfaces extend Remote  Remote classes implement remote interfaces  Remote objects are instances of remote classes Wolfgang Emmerich 2000©

10 Goals of RMI  In Java 1.0 object communication confined to objects in one Virtual Machine  Remote Method Invocation (RMI) supports communication between different VMs, potentially across the network  Provide tight integration with Java  Minimize changes to Java language/VM  Work in homogeneous environment Wolfgang Emmerich 2000©

11 Programming Languages RMI is fine for Java, but  What if I want to implement my objects in different programming languages?

12 OMG Interface Definition Language  Language for expressing all concepts of the CORBA object model  OMG/IDL is programming-language independent orientated towards C++ not computationally complete  Different programming language bindings are available  Explanation of Model and Language by Example Wolfgang Emmerich 2000©

13 Object Model and Interface Definition  Objects  Types  Modules  Attributes  Operations  Requests  Exceptions  Subtypes Wolfgang Emmerich 2000©

14 CORBA Object Model: Objects  Each object has one identifier that is unique within an ORB  Multiple references to objects  References support location transparency  Object references are persistent Wolfgang Emmerich 2000©

15 CORBA Object Model: Subtypes interface Organization { readonly attribute string name; }; interface Club : Organization { exception NotInClub{}; readonly attribute short noOfMembers; readonly attribute Address location; attribute TeamList teams; attribute TrainerList trainers; void transfer(in Player p) raises NotInClub; }; interface Organization { readonly attribute string name; }; interface Club : Organization { exception NotInClub{}; readonly attribute short noOfMembers; readonly attribute Address location; attribute TeamList teams; attribute TrainerList trainers; void transfer(in Player p) raises NotInClub; }; Inherited by Club Supertype Implicit supertype: Object Implicit supertype: Object Wolfgang Emmerich 2000©

16 One standardised interface One interface per object operation ORB-dependent interface One interface per object adapter Dynamic Invocation Dynamic Invocation Client Stubs Client Stubs ORB Interface ORB Interface Implementation Skeletons Implementation Skeletons Client Object Implementation ORB Core Object Adapter Object Adapter Architecture Wolfgang Emmerich 2000©

17 Goal of CORBA  Support distributed and heterogeneous object request in a way transparent to users and application programmers  Facilitate the integration of new components with legacy components  Open standard that can be used free of charge  Based on wide industry consensus Wolfgang Emmerich 2000©

18 Key Points  CORBA, RMI and other middleware (like COM) –enable objects to request operation execution from server objects on remote hosts –identify server objects by object references –distinguish between interface and implementation –treat attributes as operations –provide mechanisms to deal with failures –have statically typed object models –compile stubs from their IDLs –support on-demand activation Wolfgang Emmerich 2000©

19 Wait?  This int deposit(int) method was silly.  Why should I wait for a result??

20 Request Synchronization  Synchronous requests might block clients unnecessarily. Examples: User Interface Components Concurrent Requests from different servers OO-Middleware: synchronous requests. :Server:Server :Client:Client Op() Wolfgang Emmerich 2000©

21 Oneway Requests  Return control to client as soon as request has been taken by middleware  Client and server are not synchronized  Use if Server does not produce a result Failures of operation can be ignored by client :Server:Server :Client:Client oneway() Wolfgang Emmerich 2000©

22 Oneway using Java Threads class PrintSquad { static void main(String[] args) { Team team; Date date; // initializations of team and date omitted... OnewayReqPrintSquad a=new OnewayReqPrintSquad(team,date); a.start(); // continue to do work while request thread is blocked... } // thread that invokes remote method class OnewayReqPrintSquad extends Thread { Team team; Date date; OnewayReqPrintSquad(Team t, Date d) { team=t; date=d; } public void run() { team.print(date); // call remote method and then die } Wolfgang Emmerich 2000©

23 Oneway requests in CORBA  Declared statically in the interface definition of the server object  IDL compiler validates that operation has a void return type does not have any out or inout parameters does not raise type specific exceptions  Example: interface Team { oneway void mail_timetable(in string tt); }; Wolfgang Emmerich 2000©

24 r:Request :Server :Client send() r=create_request() delete() Oneway requests in CORBA  If oneway declarations cannot be used: Use dynamic invocation interface Op() Wolfgang Emmerich 2000©

25 :Server:Server:Client:Client:Request:Request Deferred Synchronous Requests  Return control to client as soon as request has been taken by middleware  Client initiates synchronization  Use if Requests take long time Client should not be blocked Clients can bear overhead of synchronization send() op() get_result() Wolfgang Emmerich 2000©

26 Deferred Synchronous Requests with Threads class PrintSquad { public void print(Team t, Date d) { DefSyncReqPrintSquad a=new DefSyncReqPrintSquad(t,d); // do something else here. a.join(this); // wait for request thread to die. System.out.println(a.getResult()); //get result and print } // thread that invokes remote method class DefSyncReqPrintSquad extends Thread { String s; Team team; Date date; DefSyncReqPrintSquad(Team t, Date d) {team=t; date=d;} public String getResult() {return s;} public void run() { String s; s=team.asString(date);// call remote method and die } Wolfgang Emmerich 2000©

27 CORBA Deferred Synchronous Requests  Determined at run-time with using DII  By invoking send() from a Request object  And using get_response() to obtain result :Server:Server:Client:Client r:Requestr:Request op() get_response() r=create_request(“op”) send() Wolfgang Emmerich 2000©

28 Asynchronous Requests  Return control to client as soon as request has been taken by middleware  Server initiates synchronization  Use if Requests take long time Client should not be blocked Server can bear overhead of synchronization :Server:Server :Client:Client op() Wolfgang Emmerich 2000©

29 Asynchronous Requests with Threads  Client has interface for callback  Perform request in a newly created thread  Client continues in main thread  New thread is blocked  Requested operation invokes callback to pass result  New thread dies when request is complete Wolfgang Emmerich 2000©

30 Asynchronous Requests with Threads interface Callback { public void result(String s); } class PrintSquad implements Callback { public void Print(Team team, Date date){ A=new AsyncReqPrintSquad(team,date,this); A.start(); // and then do something else } public void result(String s){ System.out.print(s); } class AsyncReqPrintSquad extends Thread { Team team; Date date; Callback call; AsyncReqPrintSquad(Team t, Date d, Callback c) { team=t;date=d;call=c; } public void run() { String s=team.AsString(date); call.result(s); } Wolfgang Emmerich 2000©

31 Asynchronous Requests using Message Queues  Messaging is starting to be provided by object-oriented middleware Microsoft Message Queue CORBA Notification Service Java Messaging Service  Request and reply explicitly as messages  Using two message queues  Asynchronous requests can be achieved Wolfgang Emmerich 2000©

32 Asynchronous Requests using Message Queues Client Server Request Queue Reply Queue enter remove enter Wolfgang Emmerich 2000©

33 Difference between Thread and MQs Threads  Communication is immediate  Do not achieve guaranteed delivery of request  Can be achieved using language/OS primitives Message Queues  Buffer Request and Reply messages  Persistent storage may achieve guaranteed delivery  Imply additional licensing costs for Messaging Wolfgang Emmerich 2000©

34 Request Multiplicity  OO Middleware: unicast requests Two components: client and server One operation execution Non-anonymous  Other forms: multicast requests More than two components (group requests) More than one operation (multiple requests) Wolfgang Emmerich 2000©

35:Trader:Trader:Channel:Channel:Ticker:Ticker:Ticker:Ticker:Ticker:Ticker Group Requests  Example: Stock Exchange Ticker connect() push() disconnect() connect() push() Wolfgang Emmerich 2000©

36 Group Communication Principles  Group communication informs a group of components about a particular event.  Two roles: Event producer Event consumer  Producers and consumers do not know each other.  Two forms of request: push-type: producer initiates communication pull-type: consumer initiates communication Wolfgang Emmerich 2000©

37 Some Architecture  Can’t we use some style of Model-View-Control for distributed applications? business logic client pure model view&control e.g. as servlet e.g. as applet... and we need a DB for connected via http within a web server persistency  Wow, just invented a 3-tier-architecture!

38 EJB Roles and Deployment

39 Developer Roles EJB Technology divides naturally into five developer roles:  server provider,  container provider,  Enterprise Beans (component!!) provider,  application assemblers, and  deployers.

40 Enterprise JavaBeans Components  Application Servers (42)  Authoring Tools (5)  Charts&Graphs (4)  Database Connectivity (21)  Database Servers (6)  Development Tools (47)  EJB Components (34)  EJB-based Applications (49)  Electronic Commerce (38)  Electronic Publishing (5)  Entertainment (1)  Financial Services (20)  Legacy Support (10)  Manufacturing (4)  Multimedia (3)  Network Administration (1)  Object Transaction Monitors (1)  Productivity/Groupware (18)  Report Generation (5)  Retail (6)  System Administration (4)  Telecommunications (15)  Transaction Servers (5)  UI Elements (1)  Utilities&Services (13)  Web Servers (9)  Workflow (6)

41 What is a component? "Reusable software components are self contained, clearly identifiable pieces that describe and/or perform specific functions, have clear interfaces, appropriate documentation and a defined reuse status".

42 Cross platform  An Enterprise Bean executes in a container  An EJB can be taken from one environment to another without recoding.  Communication via RMI as default  EJBs can also be accessed via Corba-IIOP  Corba details are hidden from the EJB developer

43 Writing an EJB  The bean provider adheres to two contracts: –the client’s view, and –the component’s view as seen from the container.  The bean provider therefore produces: –EJB remote interface class file –EJB home interface class file –EJB class file  An EJB can be developed provide the EJB and JNDI classes are installed.  JNDI stands for Java Naming Directory Interface

44  When talking about components, don’t only say “functionality” but pay for properties like  persistence  performance  security  availability  portability ... Naming and Trading  Know the instance? Object ID (exact reference)  Know the provider (who)?Naming (white pages)  Know the service (what)?Trading (yellow pages) based on the declaration of properties like: fee, bandwidth, availability... “Quality of Service” (QoS) attention to  Some of these are implemented e.g. as CORBA services

45 Provide, deploy and use  Provide –the remote interface for all the visible business methods of the bean –the home interface to install instances of a bean on a client –the bean class with the implementation of the business methods  EJB provider tool will set up a descriptor and details of EJB deployment to a runtime container.  Package it all up in an ejb-jar file  Set up RMI in client to use the new service

46 Packaging A Component can be more than just compiled binary code:  Help files  Images  Prototypes (Design Pattern Prototype) (cf. prototype based languages)  provide pre-configured values.  Localisation  etc.  use cloning for creation 

47 todays lesson:  Dispite differences of size function services style ... component development through all phases is the future.

48 References  Wolfgang Emmerich: „Engineering Distributed Objects“ Wileys,   Clemens Szyperski: „Component Software - Beyond Object- Oriented Programming“ Addison Wesley, 1998  See also nmsampat/research/subject/reuse/components/index.htm