Principles of Object-Oriented Software Development Hello (CORBA) Universe.

Slides:



Advertisements
Similar presentations
Software Engineering Implementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004.
Advertisements

15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
Principles of Object-Oriented Software Development The language DLP.
Shlomo Hershkop1 Introduction to java Class 1 Fall 2003 Shlomo Hershkop.
A brief look at CORBA. What is CORBA Common Object Request Broker Architecture developed by OMG Combine benefits of OO and distributed computing Distributed.
Principles of Object-Oriented Software Development The language Java.
Principles of Object-Oriented Software Development Introduction.
Principles of Object-Oriented Software Development Interface Definition Language.
Principles of Object-Oriented Software Development Software Development Projects.
By Dr. Jiang B. Liu 11. Java IDL and CORBA  Generic ORB Core  idltojava development tool  CORBA Object Service (COS) name service - nameserv  Java.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
16-Aug-15 Java Puzzlers From the book Java Puzzlers by Joshua Bloch and Neal Gafter.
1 Aniruddha Gokhale Vanderbilt University, Spring 2003 Intro to TAO Programming Study the Hello example in ACE_wrappers/TAO/tests –Show IDL definition,
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
CSC3170 Introduction to Database Systems
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
Java and C++, The Difference An introduction Unit - 00.
Introduction to Object-oriented programming and software development Lecture 1.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 8: Distributed.
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
Slide 1 CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application ITONK1.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Abhishek Bachchan Vishal Patangia
CORBA – Command Line CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
RMI-IIOP.  RMI-IIOP combines RMI-style ease of use with CORBA cross-language interoperability  Java™ Remote Method Invocation (RMI) provides a simple.
MSc Course in Advanced Distributed Systems Session 2.2: Practical CORBA Programming
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
CORBA Details Three Tier Architecture CORBA API Holders and Helpers COS Naming and Naming Contexts Transient and Persistent Objects Properties Callbacks.
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
Vakgroep Informatietechnologie - IBCN CORBA & RMI Design of Distributed Software.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
CORBA – Eclipse CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Server-Side Java Mapping Copyright © ZeroC, Inc. Ice Programming with Java 6. Server-Side Java Mapping.
Salman Marvasti Sharif University of Technology Winter 2015.
Remote Method Invocation with Java-RMI
Java and C++ Transitioning. A simple example public class HelloWorldApp { public static void main(String[] args) { //Display the string. System.out.println("Hello.
DISTRIBUTED OBJECTS AND REMOTE INVOCATION 1. 2 Topics  Middleware  Remote Method Invocation  Remote Procedure Call.
Slide 1 of 15 © Ingeniørhøjskolen i Århus CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application.
StarBuzz Coffee Recipe Boil some water Brew coffee in boiling water Pour coffee in cup Add sugar and milk Tea Recipe Boil some water Steep tea in boiling.
// messenger.idl interface Messenger { boolean send_message ( in string user_name, in string subject, inout string message ); };
Distributed Computing in Life Science Research -Presenter: Yijian Yang
IDL Models The Inheritance Model: Using the Inheritance Model, you implement the IDL interface using an implementation class that also extends the compiler-generated.
Presentation 24 Ultra Simple.NET Remoting to CORBA bridge.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Introduction to Java Programming by Laurie Murphy Revised 09/08/2016.
JLink Linking Mathematica with Java and the other way round…
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
CORBA Barış COŞKUN Çağatay DİKİCİ. INTRODUCTION Computer networks are heterogenous In 1989 OMG(Object Management Group) was formed to address the problems.
Remote Method Invocation Internet Computing Workshop Lecture 17.
Pseudocode FORTRAN (original) INPUT number
Only small steps in CORBA programming – much complexity
Chapter No. : 1 Introduction to Java.
Broker in practice: Middleware
Interface Definition Language
Remote Method Invocation
null, true, and false are also reserved.
Introduction to Java Programming
An Introduction to Java – Part I, language basics
Instructor: Alexander Stoytchev
Units with – James tedder
Instructor: Alexander Stoytchev
Instructor: Alexander Stoytchev
Enabling Application Delivery Via the Web
Copyright 1999 B.Ramamurthy
Presentation transcript:

Principles of Object-Oriented Software Development Hello (CORBA) Universe

Introduction Interface The broker abstraction C++ Realization Java Realization Prolog Realization Configuration Conclusions

Hello (CORBA) Universe platform-independent language-independent server -- C++, Java, Prolog,... client -- C++, Java, Prolog,... 9 combinations -- test.sh

The Interface - IDL module universe { universe.idl interface world { world void hello(); void ask(in string x); string tell(); oneway void halt(); };

C++ Realization broker -- access to ORB and BOA client -- needs ORB only server -- needs access to BOA implementation -- world-srv.h world-srv.c

C++ broker -- class class broker { broker.h public: broker(); void init(int& argc, char**& argv, int fl=0); 1 = client int operator()(); to run the server char* ref(corba::object* x); object_to_string corba::object* ref(const char* s); string_to object corba::object* object(const char* file); get object IOR file void refout(const char* f, corba::object* x); IOR to file };

C++ broker -- implementation broker::broker() { } broker.c void broker::init(int& argc, char**& argv, int fl=0) { _orb = CORBA_ORB_init(argc, argv); if (!fl) _boa = _orb -> BOA_init(argc, argv); } int broker::operator()() { _boa -> impl_is_ready(CORBA_ImplementationDef::_nil()); }

int main(int argc, char* argv[], char*[]) { client.c broker* _broker = new broker(); get yourself a broker try { _broker->init(argc,argv); initialize broker corba::object* obj = _broker->object("world.ref"); universe_world_var world = universe_world::_narrow(obj); { some object invocations world -> hello(); world -> ask("How are Clinton's affairs?"); cout tell() << endl; } } catch(corba::exception ex) {... } }

int main(int argc, char* argv[], char*[]) server.c { broker* _broker = new broker(); get yourself a broker try { _broker->init(argc,argv); initialize orb and boa universe_world_var p = new universe_world_srv; _broker->refout("world.ref", p); write identity _broker->operator()(); run the the world } catch(corba::exception& ex) {... } }

void universe_world_srv::hello() { world_srv.c cout << "Hello World!" << endl; } void universe_world_srv::ask(const char* s) { cout << "Asking: " << s << endl; } char* universe_world_srv::tell() { char result[] = "ok"; CORBA_String_var s = (const char*) result; return s._retn(); } void universe_world_srv::halt() { exit(0); }

Java Realization broker -- contact ORB and BOA client -- connect to server server -- announce server object implementation -- world_srv.java

import org.omg.CORBA.*; broker.java import java.io.*; public class broker { boolean _fl = false; java.applet.Applet _applet = null; public broker() { } public broker(boolean fl) { _fl = fl; } public broker(java.applet.Applet x) { _applet = x; init(null); }

public void init(String[] args) { if (_applet == null) { _orb = ORB.init(args,new java.util.Properties()); if (!_fl) _boa = _orb.BOA_init(args,new java.util.Properties()); } else _orb = ORB.init(_applet, null); } public int operator() { run -- server-only if (!_fl) _boa.impl_is_ready(null); return 0; // OK }.... }; Java -- broker

package universe; import org.omg.CORBA.*; client.java import java.io.*; import hush.broker; see broker.java public class client { public static void main(String args[]) { broker _broker = new broker(true); // true means client only try { _broker.init(args); init orb org.omg.CORBA.Object obj = _broker.object("world.ref"); world world = worldHelper.narrow(obj); if (world == null) throw new RuntimeException(); System.out.println("Enter 'h' for hello or 'x' for exit:");... // do some requests to the world } catch(...) {... } } };

package universe; server.java import org.omg.CORBA.*; import java.io.*; import hush.broker; // see broker.java public class server { public static void main(String args[]) { broker _broker = new broker(); try { _broker.init(args); create orb en boa; world_srv p = new world_srv(); create impl object _broker.refout("world.ref",p); write ref

// create world.htm _broker.html("world.htm",p, " code=universe/applet.class " + "width=500 height=300"); _broker.operator(); // run == boa.impl_is_ready(null); } catch(SystemException ex) { _broker.print(ex); System.exit(1); } System.exit(0); } Java -- server

package universe; world_srv.java import org.omg.CORBA.*; public class world_srv extends _worldImplBase { public void hello() { System.out.println("Hello World!"); } public void ask(String msg) { System.out.println(msg); } public String tell() { String s = new String("ok"); return s; } public void halt() { System.exit(0); }

Prolog Realization broker -- mediating service client -- get object reference server -- provide implementation implementation -- universe.pl

broker(client(M:F)) :- broker.pl... corba_initialize_orb([], _), factory(F). gives a handle to the server object

broker(server(M:I)) :-... corba_initialize_server([server,server(test), timeout(infinite)],Server),... create server object G =.. [_Create,_Server,Self], call(G), corba_object_to_string(Self,IOR), open(IORFile,write,Fd), write reference to file format(Fd,'string',[IOR]), close(Fd), corba_main_loop(Server). enter main loop Prolog -- broker

client.pl :- use_module(universe). see universe.pl :- [broker]. include broker main :- broker(client(universe:F)), initialize the broker assert(client(factory(F))), run. run :- h, ask('What is the state of Clinton s affairs?'), write('Type h to say hallo, x to quit.'),nl.

ask(X) :- client(factory(F)), write(client(ask(X))),nl, world_ask(F,X), world_tell(F,R), write(client(ans(R))),nl. h :- client(factory(F)), world_hello(F). q :- client(factory(F)), world_halt(F), halt. x :- halt. Prolog -- client

:- [broker]. server.pl main :- broker(server(universe:world)). Prolog -- server

:- module('universe',[]). universe.pl world_hello(_Self) :- write('Hello World'),nl. world_ask(_Self, X) :- write(asking(X)), nl. world_tell(_Self,Y) :- Y = 'logically, ok', write(telling(Y)),nl. world_halt(_Self) :- halt. Prolog -- implementation

Configure, make and test Makefile corba.cfg test.sh

Conclusions CORBA is ripe to be exploited in OO -- the practicum the broker is a useful abstraction forget about the wiring - concentrate on application logic

Idioms and Patterns Introduction Polymorphism Idioms in hush A catalogue of design patterns Event-driven computation Summary Q/A Literature

Summary

Questions 1.How would you characterize OOP and what, in your opinion, is the motivation underlying the introduction of OOP? 2.Characterize the most important features of OOP. 3.Explain the meaning of the phrase "object orientation reduces the complexity of programming." 4.How would you characterize contracts? Why are contracts important? 5.How is OOP related to programming languages? 6.What classes of languages support OOP features? Explain. 7.What influence is an object-oriented approach said to have on the software life-cycle? What is your own opinion? Discuss the problem of maintenance. 8.How would you characterize software quality? 9.Mention a number of object-oriented programming languages, and give a brief characterization. 10.What do you see as the major challenges for research in object- orientation?

Further reading Nowadays there are many books that may serve as a starting point for reading about OO. Dependent on your interest, you may look at [Surviving], which treats issues of OO project management, [Meyer97], which gives an extensive introduction to design by contract and programming in Eiffel, or [Fowler97], which gives a succinct introduction to UML. Alternatively, you may take one of the introductory programming books for Java, from which you will almost certainly learn something about OO as well.