Objektorienteret Middleware (OOMI) - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

Objektorienteret Middleware (OOMI)

Description:

... the US, representatives in United Kingdom, Germany, Japan, India, and Australia ... Maps GIOP to TCP/IP. Provides operations to open and close TCP/IP connections ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 44
Provided by: finnoverga
Category:

less

Transcript and Presenter's Notes

Title: Objektorienteret Middleware (OOMI)


1
Objektorienteret Middleware (OOMI)
  • CORBA Introduction
  • CORBA Programming
  • (Emmerich chapter 45)

2
Outline
  • CORBA (part one)
  • Introduction
  • Architecture
  • CORBA Object Model
  • CORBA Interface Definition Language - IDL
  • CORBA programming (part two)

3
Who is the OMG?
  • OMG Object Management Group
  • Non-profit organization in the US,
    representatives in United Kingdom, Germany,
    Japan, India, and Australia
  • Founded April 1989
  • More than 800 members
  • Dedicated to creating and popularizing
    object-oriented industry standards for
    application integration, e.g.
  • CORBA 1.0 (1995) gt CORBA 3.0
  • UML 1.1 nov. 97.

4
Goal of CORBA
  • CORBA Common Object Request Broker Architecture
  • Support distributed and heterogeneous object
    request in a way transparent to users and
    application programmers (right)
  • Facilitate the integration of new components with
    legacy components
  • Open standard that can be used free of charge
  • Based on wide industry consensus

5
Object Management Architecture (OMA)
CORBAFacilities
DomainInterfaces
ApplicationObjects
Object Request Broker
CORBA Services(mandatory)
6
Architecture
7
Architecture 2
  • There are many different vendors and ORB types
  • OrbBacus from IONA produces both C and Java
  • Sun J2SE SDK has only Java
  • C ORB from IONA will work with SUN ORB
  • Many others
  • MicoORB
  • Janeva
  • TAO

8
CORBA Clients and Servers
Primary CORBA Server
TCP/IPNetwork
Backup CORBA Server
9
Interoperability Protocols
Applications
EnvironmentSpecific ..
CORBA 2.0
ESIOP
GIOP
........
........
IIOP
DOETalk
DCE-CIOP
Mandatory provides "out of the box"
interoperability
10
General Inter-ORB Protocol (GIOP)
  • Define seven messages
  • Request
  • Reply
  • Locate Request
  • Locate Reply
  • Cancel request
  • Close Connection
  • Message Error

11
Internet Inter-ORB Protocol (IIOP)
  • Maps GIOP to TCP/IP
  • Provides operations to open and close TCP/IP
    connections
  • Is required from ORBs for CORBA compliance

12
Common Data Representation (CDR)
  • Defined as part of GIOP
  • Presentation layer implementation to support
    heterogeneity
  • Mapping of IDL data types to transport byte
    stream
  • Encodings of
  • primitive types
  • constructed types
  • interoperable object references

13
Example Distributed Climate Control System
CORBA Java Climate Control Server
TCP/IPNetwork
Different ORBs from different vendors, on
different operating systems and written in
different languages Heterogenity
14
How? - motivation for an IDL
  • IDL Interface Definition Language
  • Components of distributed systems are written in
    different programming languages
  • Programming languages may or may not have their
    own object model
  • Object models largely vary
  • Differences need to be overcome in order to
    facilitate integration

15
Why do we use an IDL?
PL
PL
2
1
PL
PL
6
3
PL
PL
5
4
16
CORBA Programming Language Bindings
IDL
Common Object Model
Borlands Janeva
17
Heterogeneous OO Network
CORBA CobolDatabase Server
TCP/IPNetwork
DB
18
Purpose of Common Object Model
  • Meta-model for middlewares type system
  • Defines meaning of e.g.
  • object type
  • operation
  • attribute
  • request
  • exception
  • subtyping
  • Defined general enough for mappings to most
    programming languages

19
Interface Definition Language (IDL)
  • Language for expressing all concepts of the
    middlewares object model
  • Should be
  • programming-language independent
  • not computationally complete
  • Bindings to different programming languages are
    needed
  • language bindings are specified by CORBA

20
Running Example in Course Book
Player
-namestring -Numberint
book()
21
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

22
CORBA Object Model Types
  • typedef struct _Address
  • string street
  • string postcode
  • string city
  • Address
  • typedef sequenceltAddressgt AddressList
  • interface Team ...

23
CORBA Object Model Modules
module Soccer typedef struct _Address
string street string postcode string city
Address module People typedef struct
_Address string flat_number string
street string postcode string city
string country Address
24
CORBA Object Model Attributes
interface Player typedef sequenceltPlayergt
PlayerList interface Trainer typedef
sequenceltTrainergt TrainerList interface Team
readonly attribute string name attribute
TrainerList coached_by attribute Club
belongs_to attribute PlayerList players
...
25
CORBA Object Model Operations
  • interface Team
  • ...
  • void bookGoalies(in Date d)
  • string print()

26
CORBA Object Model Requests
  • Requests are defined by client objects
  • Request consist of
  • Reference of server object
  • Name of requested operation
  • Actual request parameters
  • Context information
  • Request is executed synchronously
  • Requests can be defined
  • statically
  • dynamically

27
CORBA Object Model Exceptions
  • Generic Exceptions (e.g. network down, invalid
    object reference, out of memory)
  • Type-specific Exceptions

exception PlayerBookedsequenceltDategt free
interface Team void bookGoalies(in Date d)
raises(PlayerBooked)
28
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
29
Local Proxy to Remote Object call
Server
Client
foo()
Servant
Objectreference
foo()
foo()
foo()
Skeletoninstance
Proxy
30
General CORBA Application Development Steps
  1. Determine your applications objects and define
    their interfaces in IDL
  2. Compile your IDL definitions into stubs and
    skeletons
  3. Declare and implement Javaservant classes
  4. Write a server main program
  5. Compile and link your server implementations
    files together with generated stubs and skeletons
  6. Write, compile and link your client code together
    with the generated stubs

31
Development Steps CORBA vs RMI SOAP
CORBA
AXISSOAP
Design
J2SE JDK
CORBA IDL
Java2WSDL
Interface Definition
SOAP WSDL
Start with Server Interface Coding JAVA
RMI JAVA interface
WSDL2JAVA
CORBA IDL
RMI rmic
RMI JAVA
C, Java
C, Java
ORB
rmiregistry
Server Registration
32
CORBA Client and Server Implementation
33
CORBA ProgrammingPresentation of a
simpleHello WorldCORBA client and Server
application
34
Hello World CORBA Example
Development PC
Clientapp.
Serverapp.
35
IDL Interface of Hello Servant
module HelloApp interface Hello void
sayHello()
36
Overview
  • http//java.sun.com/j2se/1.3/docs/guide/idl/GShome
    .html (deprecated)
  • http//www.orbacus.com/support/new_site/manual/ind
    ex.html (very good)

37
IDL Compiler Example C (OrBacus)
Hello.java (Both Client Server) contains the
Java version of the IDL interface.
HelloOperations.java contains the methods
here only sayHello(). All the operations in the
IDL interface are placed in the operations file.
_HelloStub.java is the client stub.
HelloPOA.java is the skeleton class you should
extend from. It implements dynamic invocation
functions. HelloHelper.java (Both Client
Server) provides auxiliary functionality, notably
the narrow() method required to cast CORBA object
references to their proper types.
HelloHolder.java Whenever the IDL type is an
out or an inout parameter, the Holder class is
used.
Hello.idlfile
Generates
Input
38
// HelloServer.java, stringified object reference
version // Stefan Wagner, 2003 import
org.omg.CosNaming. import org.omg.CosNaming.Nami
ngContextPackage. import org.omg.CORBA. import
org.omg.PortableServer. import
org.omg.PortableServer.POA import
HelloApp. //This is the servant - implementing
the methods from the IDL class HelloServant
extends HelloPOA private ORB orb
public HelloServant(ORB orb) this.orb
orb public String sayHello()
return "\nHello world !!\n"
HelloServant The server object (Part 1)
Constructor taking ORB a parameter
The CORBA operation implemented
39
//This is the HelloServer - the server running
the HelloServant - Servant //This could have been
placed in another file - but was not public class
HelloServer public static void main(String
args) try // create and
initialize the ORB org.omg.CORBA.ORB orb
org.omg.CORBA.ORB.init(args, null) //
create servant and register it with the ORB
HelloServant helloRef new HelloServant(orb)
// get reference to rootpoa and activate the
POAManager POA rootpoa POAHelper.narrow(or
b.resolve_initial_references("RootPOA"))
rootpoa.the_POAManager().activate() // get
object reference from the servant
org.omg.CORBA.Object ref rootpoa.servant_to_refe
rence(helloRef) Hello href
HelloHelper.narrow(ref) // stringify the
helloRef and dump it in a file String oir
orb.object_to_string(href)
java.io.PrintWriter out new java.io.PrintWriter(
new java.io.FileOutputStream("object.ref"))
out.println(oir) out.close() // wait
for invocations from clients orb.run()
catch (Exception e) System.err.println("ERROR
" e) e.printStackTrace(System.out)
HelloServant The server object (Part 2)
Init ORB and register servant with ORB
Activate rootPOA
The POA produces the reference
Narrow the call (CORBA type cast)
Object reference stringified and Sent to file
object.ref
40
// HelloClientSOR.java, stringified object
reference version import java.io. import
org.omg.CORBA. import HelloApp.HelloHelper impo
rt HelloApp. public class HelloClientSOR
public static void main(String args)
try // create and initialize the ORB
org.omg.CORBA.ORB orb org.omg.CORBA.ORB.ini
t(args, null) // Get the stringified
object reference and destringify it.
java.io.BufferedReader in new
java.io.BufferedReader(new java.io.FileReader("o
bject.ref")) String ref
in.readLine() org.omg.CORBA.Object obj
orb.string_to_object(ref) Hello
helloRef HelloHelper.narrow(obj) //
call the Hello server object and print results
String Hello helloRef.sayHello()
System.out.println(Hello) catch (Exception
e) System.out.println("ERROR " e)
e.printStackTrace(System.out)
HelloClientSOR The Client program
Init ORB
Object reference Read from file
Narrow the call (CORBA type cast)
Call via Proxy
41
What is this?
  • IOR Interoperable Object Reference
  • Includes info on Repository ID (standard),
    Endpoint Info (standard) - including IP and port
    number, Object Key (proprietary)
  • Can be written into a file
  • Not really nice with a file-based reference or
    what?
  • May employ a naming service instead
  • This we shall look at later
  • File-based may be necessary due to firewall
    problems
  • Possible to use a HTTP or FTP server for
    distributing the references

IOR000000000000001749444c3a48656c6c6f4170702f4865
6c6c6f3a312e30000000000001000000000000006c00010200
0000000e3139322e3136382e312e3130300011b600000021af
abcb0000000020a80a25030000000100000000000000000000
0004000000000a000000000000010000000100000020000000
00000100010000000205010001000100200001010900000001
00010100
42
include ltOB/CORBA.hgt include ltHello.hgt
include ltfstream.hgt int run(CORBAORB_ptr)
int main(int argc, char argv) int status
EXIT_SUCCESS CORBAORB_var orb try
orb CORBAORB_init(argc, argv) status
run(orb) catch(const CORBAException)
status EXIT_FAILURE
if(!CORBAis_nil(orb)) try
orb -gt destroy() catch(const
CORBAException) status EXIT_FAILURE
return status
HelloCorba C Client Part 1
Init ORB
Destroy ORB
43
int run(CORBAORB_ptr orb) const
char refFile "object.ref" ifstream
in(refFile) char s2048 in gtgt s
CORBAObject_var obj orb -gt
string_to_object(s) HelloAppHello_var hello
HelloAppHello_narrow(obj) cout ltlt
hello-gtsayHello() ltlt endl return 0
HelloCorba C Client Part 2
Object reference Read from file
Narrow the call (CORBA type cast)
Call via Proxy and print
Write a Comment
User Comments (0)
About PowerShow.com