First Java ORB Application

Download Report

Transcript First Java ORB Application

A First Java ORB Application
 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
A First Java ORB Application
1
CORBA Application Development Process
 Write IDL
 Compile IDL
 Identify the IDL compiler-generated interfaces and classes that
we need
 Write code to initialize the ORB and inform it of any CORBA
objects created
 Compile all the generated code and application code
 Run the application
A First Java ORB Application
2
Building CORBA Application
Hello world
A First Java ORB Application
3
Interface Specification
// idl file
module helloWorld{
interface GoodDay{
string hello();
};
};
 Compile the idl file, generate the following set of files:
GoodDay.java
GoodDayHolder.java
GoodDayHelper.java
_GoodDayStub.java
GoodDayPOA.java
GoodDayOperations.java
GoodDayPOATie.java
A First Java ORB Application
4
Generated Files
 GoodDay.java: java interface mapped from IDL interface
 GoodDayHolder: provide support to handle IDL inout and out
parameters
 GoodDayHelper: contains supporting methods, most used one is
narrow()
 _GoodDayStub.java: client side stub code
 GoodDayPOA.java: contains the skeleton code that is used with POA
 GoodDayOperations.java and GoodDayPOATie.java contain skeleton
code that are used with Tie approach
A First Java ORB Application
5
Client Side
 Initialize the CORBA environment: obtain a reference to the ORB
 Obtain an object reference for the object on which to invoke
operations
 Invoke operation and process the results
 Example
 Code from Ch. 4
A First Java ORB Application
6
Server Side





Initialize the CORBA environment, the ORB (the same as client side)
Create implementation object
Make the implementation object accessible by clients
Listens for events
Code
Ch4 server code
A First Java ORB Application
7
Holder Type for out and inout
parameters
shorterHolder minute;
Holder Object
public short value;
A First Java ORB Application
8
Extending the Hello Example
…
string hello(out short hour, out short minute);
};
…
};
A First Java ORB Application
9