corba - Auburn University
Download
Report
Transcript corba - Auburn University
CORBA
Missam Momin
Auburn University
What is Corba ?
Corba is an acronym for common object broker
architecture.
This architecture is meant to provide flexible and
interoperable objects .
structured to allow integration of a wide variety of object
systems.
Corba was designed to allow intelligent components to
discover each other and interoperate on an object bus.
OMG OBJECT MANAGEMENT GROUP A CONSORTIUM OF 800
COMPANIES FOUNDED IN APRIL1989 PREVIOUSLY 11 COMPANIES
WERE MEMBER OF THE CONSORTIUM 3COM CORPORATION,
AMERICAN AIRLINES CANON INC, DATA GENERAL, H.P., PHILIPS
TELECOMMUNICATIONS N.V. , SUN UNISYSTEMS
WHAT CORBA DOES ?
CORBA ALLOWS INTELLIGENT COMPONENTS TO DISCOVER EACH OTHER
AND INTEROPERATE ON AN OBJECT BUS .
SPECIFIC BUS RELATED SERVICES FOR CREATING AND DELETING OBJECTS
ACCESS BY NAME AND PERSISTENT STORAGE EXTERNALIZING STATES AND
DEFINES RELATIONSHIPS BETWEEN DIFFERENT OBJECTS EITHER LOCALLY OR
REMOTELY.
CORBA CREATES INTERFACE SPECIFICATIONS AND NOT CODE INTERFACES
DEFINED ARE DERIEVED FROM DEMONSTRATED TECHNOLOGIES SUBMITTED
BY MEMBER COMPANIES.
WHAT IS A DISTRIBUTED CORBA OBJECT ?
CORBA OBJECTS ARE BLOBS OF INTELLIGENCE THAT CN LIVE ANYWHERE ON A
NETWORK
OBJECTS ARE PACKED AS BINARY COMPONENTS THAT REMOTE CLIENTS CAN
ACCESS THRU METHOD INVOCATION LANGUAGE AND COMPILER USED TO CREATE
SERVER OBJECTS ARE TRANSPARENT TO CLIENT.
ALSO THE ISSUE OF IMPLEMENTATION OF THE SERVER OBJECT IS TRANSERANT
CLIENT JUST HAS TO KNOW THE INTERFACE THE SERVER OBJECT PUBLISHES
INTERFACE SERVES AS A CONTRACT BETWEEN THE CLIENT AND THE SERVER
THIS CONTRACT IS TERMED AS IDL TO SPECIFY A COMPONENT’S BOUNDARIES AND
ITS CONTRACTUAL INTERFACES WITH THE POTENTIAL CLIENTS.
c
C++
ada
Smalltalk
Cobol
Java
Smalltalk
Cobol
c
id
idl
C++
ada
java
id
id
idl
Client stubs
Server skeletons
CORBA IIOP ORB
id
OMG’S CORBA ARCHITECTURE
ORB: OBJECT REQUEST BROKER : This object bus provides mechanisms required to find the object
implementation for the request made by the client prepare the implementation and communicate
the data to client who has made the request the this is done with the help of interfaces.
Client idl stubs : provides static interface to object services these are precompiled stubs to define
how clients invoke corresponding services on servers acts as a local call and is a local proxy
object for the remote server object.
DII :discovers methods to be invoked at run times corba defines API for looking in to the metadata
that defines the server’s interface parameter generation and issues remote calls and gets the
results
Interface repository: run time distributed data base containing machine readable versions of the id
defined interfaces
ORB Interface :API's to conver a object reference to a string and vice versa useful for storage and
communication.
SERVER IDL STUBS OR SKELETON: Provice static interfaces to each service exported by the server
DSI :Provides run time mechanism for server that need to handle incoming method calls for
components that don’t have id based compiled skeletons
Object Adapter accepts requests for service passes request for server objects assign object id’s
implementation repository run time repository of information about class a server supports
Application
objects
Common facilities (corba facilities)
ORB
Common object services
Facilities of corba architecture
Corba facilities
vertical facilities
horizontal facilities
examples:
distributed doc
information management
systems management
task management
Corba services
naming
persistence
lifecycle
properties
concurrency
collection
security
trader
licensing
startup
time
relationships
query
transactions
events
externalization
Life cycle service create copy move and delete objects
persistence storage issue ODBMS and RDBMS SERVERS
naming service discover components on object bus by name
event service register and unregistered events events channel works as a broker to
collect a and distribute events amongst components even if they don’t know each
other
concurrency: provides lock manager
transaction 2 phase commit coordination amongst persistent objects
relationship: dynamic associations among components that are unknown to each other
query service :query for objects
licensing service meter for the use of components
properties association with the component state like title date ,etc
time service: important issue in distributed computing environment synchronization
security framework for authentication access control lists etc
trader service yellow pages for objects
collection service generically create and manipulate common collections
Java meets corba
Corba/java ORB; CORBA IIOP WRITTEN ENTIRELY IN JAVA
E.G. JAVA APPLET ON THE BROWSER INVOKES METHODS
DIRECTLY ON CROBA OIBJECT USIGN IIOP PROTOCOL
ADVANTAGES :IT BY PASSES HTTP AND CGI SO THE
STATELESSNESS OF THE THE CGI PARADIGM IS NOT THERE AND
OBJECT STATE AND NAME ARE MAINTAINED .
CORBA JAVA STANDARDS
IDL TO JAVA MAPS CORBA IDL TO JAVA
JAVA TO IDL: CORBA/RMI CONVERGENCE STANDARD SPECIFIES REMOTE
INTERFACES USING RMI SEMANTICS OF CORBA IDL
ENTERPRISE JAVA BEANS CORBA MAPPING SPECS BASED ON RMI/IDL
SUBSET AND CORBA TRANSACTIONS ALSO MAPS JNDI TO CORBA
NAMING SERVICE
STEPS TO CREATE SERVER CLASSES
LOAD
2
1
3
7
8
4
9
5
6
STEPS 1: CREATE IDL DEFINATIONS OBJECTS TELL THE POTENTIAL CLIENTS
OPERATIONS AND METHODS AND INVOCATIONS MEANS SO TYPES ATTRIBUTES
PARAMETERS ETC ARE DEF INED
EXAMPLE: MODULE Counter
{ interface Count
{ attribute long sum;
long increment() ;
};
};
this file is named as count.idl contains idl for the interface Count
need idl2java compiler for understanding between java clients and
servers
step 2 load it into the interface repository for run times access
Step3: pre compile the idl using the idl2java
compiler
idl2java count.old -options
note options are for inheritance based and
delegation based
pre compiler has created 5 different classes and
one interface
1) Counter._CountImplBase : this implements server side skeleton for
Count
2) Counter._St_Count :client side stub implementation
3) Counter.CountHELPER cast Corba objects to Count type
4) Counter.CountHolder holder for public instance member of the type
Count
5)Counter.Count : interface mapping depending on the language
6)Counter._example_Count: example class for Count object
implementation
Counter.Count
package Counter;
public interface Count extends org.omg.CORBA.Object
{
public int sum();
public void sum (int x);
public int increment();
}
Counter._example_Count
Package Counter;
public class_example_Count extends Counter._CountImplBase
{
public _example_Count (java.lang.String name) {
super (name);
}
public _example_Count() {
super();
}
public int increment()
{
}
public void sum(int sum){
}
public int sum() {
}
}
// count impl.java this is the Count implementation
class CountImpl extends Counter._CountImplBase
{
private int sum;
//constructor
CountImpl(String name)
{ super (name);
System.out.println(“Count Object Created”);
sum =0;
}
//accessor method for attribute
public int sum()
{ return sum;
}
public void sum(int x)
{
sum =x;
}
public int increment()
{
sum++
return sum;
}
}
//Count server provides main function on the server
class CountServer
{static public void main(String [] args)
{
try
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, null );
org.omg.CORBA.BOA boa = orb.BOA_init ();
CountImpl count = new CountImpl (“my count” );
boa.obj_is_ready() (count); //export to the orb the new object count
boa.Impl_is_ready();
}
catch (org.omg.CORBA.SystemException e)
{ System.err.println(e);
}
}
}
COUNT
SERVER
ORB
ORB.init
BOA_init
New Count
Impl
Obj_is_ready
Impl_is_ready
BOA
//Count client
class CountClient
{
public static void main (String [] args)
{ try
{ System.out.println (“initializing the ORB”);
org.omg.CORBA.ORB orb = org.omg.CORBA.init (args, null );
// bind to the count object
System.out.println (“ Binding to Count Object” );
Counter.Count counter = Counter.CountHelper.bind (orb, “My Count”);
System.out.println (“setting sum to 0”);
count .sum((int) 0);
long startTime = System.currentTimeMillis();
System.out.println (“incrementing”);
for (int i=0; i< 1000; I++)
{counter.increment();
}
long stopTime = System.currentTimeMills();
System.out.println (“ Avg Ping =“ + ((stopTime - startTime) / 1000f ) +
“msecs”);
System.out.println (“Sum = “ + counter.sum());
}
catch (org.omg.CORBA.SystemException e)
{
System.err.println (“SystemException “);
System.err.println (e);
}
}
}