corba by paul m. pse 2010 better
TRANSCRIPT
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
1/26
Paul I. Muntean CORBA 1
CORBA
Common Object Request Broker
Architecture
by Paul I. Muntean
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
2/26
Paul I. Muntean CORBA 2
CORBA Overview
What is CORBA? Common Object Request Broker Architecture
Communication infrastructure for distributed objects
Allows a heterogeneous, distributed collection of objects tocollaborate transparently
What is CORBA good for?
Developing distributed applications
Locating remote objects on a network
Sending messages to those objects
Common interface for transactions, security, etc.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
3/26
Paul I. Muntean CORBA 3
CORBA Overview
Motivation for CORBA Computation is distributed
Scalability: multiprocessing
Take computation to data
Heterogeneous architectures
Users are distributed Multiple users interacting and communicating via distributed applications
Data are distributed
Administrative and ownership reasons
Heterogeneous systems
Shared by multiple applications Scalability
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
4/26
Paul I. Muntean CORBA 4
Outline
Main Components of CORBA architecture
Broker Pattern short review
Get started with a basic CORBA application Exercises
Conclusion
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
5/26
Paul I. Muntean CORBA 5
Main Components of CORBA
ORB Core
CORBA Objects
OMG Interface Definition Language (OMG IDL)
Stubs and Skeletons Dynamic Invocation Interface, Dynamic Skeleton Int.
Object Adapter (Portable Object Adapter)
Interface Repository
ORB Interoperability
Servant
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
6/26
Paul I. Muntean CORBA 6
Common Object Request Broker Architecture
The ORB allows client
applications to find objects
and invoke methods on themlocally or across a network. It
handles passing requests,
responses and exceptions
between a client object and a
server object.
CORBA Objects avirtual entitycapable of beinglocated byan ORB and havingclient requestsdelivered to it.Can be instantiatedby one or moreServants.
Servants areprogramming
language entitythat exists in thecontext of a serverand containingcode that
implements aCORBA object.
The compiler used toobtain the IDL stubs fromthe IDL file
The client applicationis starting the requestto the server
Generated by the IDLCompiler.Stub handles themarshalling of a request,that is converting datastructure into wireformat.
Skeleton codetranslates wireformat datainto memorydata format
(unmarshaling)
The DII defines a requestso that clients who knowthe object reference andinterface type can buildrequests without having torely on the IDL generatedstub code.
Serves as the glue between CORBAObject implementation and the ORBitself. Request Demultiplexing
,Operation Dispatching , Activation anddeactivation , Generating ObjectReferences
Provides a dynamic mechanismfor CORBA-based applicationsto access OMD IDL type system
when it is executing.
Common Protocols to facilitatetransmission of CORBArequests and replies between
ORBs. GIOP, IIOP, ESIOP ,IOR.
The DSI deals with requests sentby clients in a generic manner.
Looks at the requested operationand its arguments and interpretingthe semantics dynamically.
IIOP is a high-level protocol that takes care of
many of the services associated with the levelsabove the transport layer, including data
translation, memory buffer management, dead-
locks and communication management. It is
also responsible for directing requests to the
correct object instance within an ORB.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
7/26
Paul I. Muntean CORBA 7
Outline
Main Components of CORBA architecture
Broker Pattern short review
Get started with a basic CORBA application Exercises
Conclusion
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
8/26
Paul I. Muntean CORBA 8
Broker Pattern
Example taken from : Slide no. 48 of the lecture Architectural patterns 2 of prof. B Bruegge
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
9/26
Paul I. Muntean CORBA 9
CORBA Architecture based on Broker PatternThe Stub receives callsfrom the client. It hasthe role of marshaling
parameters.
POA or Portable Object Adapter.Passes calls to requested object andmethod. It contains persistent or
transient Skeletons .
Diagram adapted from the lecture Architectural patterns 2 of prof B. Bruegge.
The Naming Service provides the principal mechanism through which most
clients of an ORB-based system locate objects that they intend to use (make
requests of). It is located in the ORB box as one of the services of it.
ORB Core it is like the bridge inthe Broker Pattern .It has the roleof communication with ORB slocated on other machines.
ORB or Object RequestBroker. Used for
communication betweenclient and server.
Th
e skeleton is responsiblefor calling methods on theServant and Unmarshals
parameters for the Servant.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
10/26
Paul I. Muntean CORBA 10
Outline
Main Components of CORBA architecture
Broker Pattern Short review
Get started with a basic CORBA application Exercises
Conclusion
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
11/26
Paul I. Muntean CORBA 11
Communication between the Client and Server
Communication between the Client and Server
1. Th
e client calls th
e service sayh
ello of th
e server.2. The ORB transmits the call to the servant-object, he must be activated.
3. The service say hello of the server will be started and delivers an string as a parameter.
4. The ORB transmits this string back to the client.
5. The clients prints this string on his console.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
12/26
Paul I. Muntean CORBA 12
Steps needed for creating and running a CORBA
application
1. Writing of the IDL file.
2. Write the client application.
3.W
rite th
e server application.4. Compile the two applications and start the server.
5. Run the client.
Example taken from :http://www.nt.fh-koeln.de/fachgebiete/inf/diplom/corba/html/kompilieren.html
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
13/26
Paul I. Muntean CORBA 13
Writing the IDL file
Step 1:Descriptio
n of theCORBA
IDL-Module
Start a text editor and save afterwards the file with the followingname Hello.idl.
Write in the file :module HelloApp {//code };
Save the file.
Step 2:Interfacedeclaratio
n
Here we write our own interface. Replace the text //code from theprevious example with the following.interface Hello{//code 2};
Save again the file
After using the IDLJ compiler the result will be a bunch of java fileswhich will be implemented by the client and server.
Step 3:Method
declaration
The methods describe the behavior of the services which theserver is offering. We have in our example the service sayHello().Insert in your code: string sayHello(); instead of //code2
Hello.idl file is now complete.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
14/26
Paul I. Muntean CORBA 14
Running the IDLJcompiler
1.1 Be sure that the path where you have theIDLJcompiler is inthe CLASSPATHelse add it.
1.1.1 Edit the IDL file in order to fit the requirements.
1.2 Open a console/shell, navigate to the folder where you have
th
e idl file.1.3Write to the Console the command:IDLJ-fall Hello.idl
1.4 The result will be a bunch of java files which will beautomatically generated.
1.5 Th
e java files will be needed afterwards.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
15/26
Paul I. Muntean CORBA 15
Steps needed for creating and running a CORBA
application
1. Writing of the IDL file.
2. Write the client application.
3. Write the server application.4. Compile the two applications and start the server.
5. Run the client.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
16/26
Paul I. Muntean CORBA 16
Write the client application Notice: For running from Eclipse first
the command tnameserv ~/NS_Refmust be given in the console window ,
before starting the server.
In Unix machines you have to beadministrator and use the command
sudo tnameserv ORBInitialPortvalue to set the initial port.
javac Client_hello.java written in theconsole window will compile the javafile.
java Client_hello -ORBInitialHostnameserverhost-ORBInitialPortnameserverportto start the application
The fourth command can be usedwhen we want to set the port and hostwhich we want to use.
Default port for Unix andWindows is900.
public class Client_hello {
public static void main(String args[]) {String name_service = "Hello_server";
Properties properties = new Properties();properties.put("org.omg.CORBA.ORBInitialHost",localhost");properties.put( "org.omg.CORBA.ORBInitialPort",+ 900);
try {System.out.println("Client>Creating and initializing the ORB");ORB orb = ORB.init(args, null);System.out.println("Client>getting the root naming context");
org.omg.CORBA.Object objRef=orb.resolve_initial_references("NameService");// it uses NamingConetExt Interoperable Naming Service
NamingContextExt ncRef =NamingContextExtHelper.narrow(objRef);Resolving the object reference inNameComponent nc = new NameComponent(name_service,"");NameComponent path[] = { nc };Interface_Hello hello =Interface_HelloHelper.narrow(ncRef.resolve(path));calling the Hello service...");String msg_received = hello.get_msg();server returned the following message: "+ msg_received
}catch (Exception e) {System.out.println("Exception:\n" + e);
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
17/26
Paul I. Muntean CORBA 17
Steps needed for creating and running a CORBA
application
1. Writing of the IDL file.
2. Write the Client application.
3. Write the Server application.4. Compile the two applications and start the Server.
5. Run the Client.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
18/26
Paul I. Muntean CORBA 18
Notice: For running from Eclipse first the
command tnameserv ~/NS_Refmust begiven in the console window , beforestarting the server.
In Unix machines you have to beadministrator and use the command sudotnameserv ORBInitialPort value to setthe initial port.
javac Client_hello.java written in theconsole window will compile the javafile.
java Client_hello -ORBInitialHostnameserverhost-ORBInitialPortnameserverportto start the application
The fourth command can be used whenwe want to set the port and host which wewant to use.
Default port for Unix andWindows is900.
Write the server application
public class Server_hello {public static void main(String args[]) {
String name_service = "Hello_server";Properties properties = System.getProperties();try {
System.out.println("Server>starting server...");System.out.println("Server>creating and initializing the ORB");ORB orb = ORB.init(args, properties);System.out.println("Server>getting reference to rootpoa");......System.out.println("Server>activating the POA Manager");.......System.out.println("Server>Creating the servant");.......
Hello_service hello_service = new Hello_service();System.out.println("Server>obtain the reference from the servant");......
System.out.println("Server>getting the root naming context");org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");NameComponent nc = new NameComponent(name_service, "");NameComponent path[] = { nc };ncRef.rebind(path, service_href);while (!msg_kbd.equals("quit") && !msg_kbd.equals("QUIT")) {msg_kbd= data_reader.readLine();if (msg_kbd.equals("quit") || msg_kbd.equals("QUIT")) {
}}
} catch (Exception e) {System.out.println("Exception in server...\nException:\n" + e);
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
19/26
Paul I. Muntean CORBA 19
Steps needed for Creating and running a
application which uses CORBA
1. Writing of the IDL file.
2. Write the client application.
3. Write the server application.4. Compile the two applications and start the server.
5. Run the client.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
20/26
Paul I. Muntean CORBA 20
Get started with a basic CORBA application
4.Compile the two applications and start t
he Server
4.1 Start the Naming Server
4.2 Run the hello server.
5. Run the hello client and observe
the outputted message. The application
can run as a distributed application but
also as stand alone.
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
21/26
Paul I. Muntean CORBA 21
Outline
Main Components of CORBA architecture
Broker pattern short review
Get started with a basic CORBA application Exercises
Conclusion
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
22/26
Paul I. Muntean CORBA 22
Exercises
Task1: Learn how to use the IDLJ compiler. Download the Eclipse Application 1from the web site(5 minutes)
Easy. Generate Java Code from a IDL file supplied together with the project observe if thefiles match with the ones given.(15 minutes)
Medium. Implement your own hello service.
HomeworkTask2:Writing the required services for the server. Download the Idl file
Math.IDL and the two java files for the Client and Server .
Easy. Generate the java files from the idl files. Hard.Write a Service class used by the server where services like: addition, subtraction,
multiplication, transpose and quit(will stop the server) operations are implemented for basicmatrix operations
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
23/26
Paul I. Muntean CORBA 23
Outline
Main Components of CORBA Architecture
Broker pattern short review
Get started with a basic CORBA application Exercises
Conclusion
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
24/26
Paul I. Muntean CORBA 24
Conclusions
Wide language support
Open Standard
Wide Platform Support
Usage of the Broker Pattern
Advantages of using the Broker Pattern
Others in File
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
25/26
Paul I. Muntean CORBA 25
Questions
-
8/3/2019 CORBA by Paul M. PSE 2010 Better
26/26
Paul I. Muntean CORBA 26
References:
Books: CORBA Networking with Java, George M. Doss,Wordware Publishing INC CORBA 3 Fundamentals and Programming Sec Ed. John Siegel ,John Wilesy & Sons, INC.
CORBA A Guide to Common Object Request Broker Architecture, Ron Ben-Natan, McGraw-Hill
Links: CORBA EXPLAINED SIMPLY, Ciaran McHale http://www.ciaranmchale.com/corba-explained-simply/development-of-
corba-applications.html
CORBA Programming with J2SE 1.4 ,http://java.sun.com/developer/technicalArticles/releases/corba/
JavaTM IDL FAQ http://download.oracle.com/javase/1.3/docs/guide/idl/jidlFAQ.html#where%20can%20I%20download
A Short Guide To Learning CORBA,Michael Le and Jun Suzukihttp://netresearch.ics.uci.edu/bionet/resources/platform/corba/
What is CORBA? Tutorial ,http://www-cdfonline.fnal.gov/daq/CORBAXXX/tutorial.html
Introduction to CORBA ,By jGuru.com http://java.sun.com/developer/onlineTraining/corba/corba.html#co5
Catalog of OMG IDL / Language Mappings Specificationshttp://www.omg.org/technology/documents/idl2x_spec_catalog.htm#Java2IDL
Indroducing to IDL , by Jim Inscore,
http://www.csse.uwa.edu.au/programming/javatut/idl/index.html Java and CORBA - a smooth blend,by David Reilly
http://www.javacoffeebreak.com/articles/javaidl/javaidl.html#code
Einfhrung und Beschreibung der unterschiedlichen Client-Server Anwendungen mittels CORBA, basierend auf derProgrammiersprache Java, Cihan zkalfa,http://www.nt.fh-koeln.de/fachgebiete/inf/diplom/corba/html/kompilieren.html
IIOP: Internet Inter-ORB Protocol,http://panuganty.tripod.com/articles/iiop.htm