first experiences with corba
DESCRIPTION
First experiences with CORBA. Niko Neufeld. The task. Prepare a ring display for the RICH reconstruction/simulation Want to use JAVA 2D toolkit. Possible strategies. Dump data to file (from C++, read with Java) clumsy(!), ugly(!!), synchronization(!!!) Link together Java and C++ - PowerPoint PPT PresentationTRANSCRIPT
April 20, 2023
First experiences with CORBAFirst experiences with CORBA
Niko NeufeldNiko Neufeld
April 20, 2023 Niko Neufeld
The taskThe task
Prepare a ring display for the RICH Prepare a ring display for the RICH reconstruction/simulationreconstruction/simulation
Want to use JAVA 2D toolkitWant to use JAVA 2D toolkit
April 20, 2023 Niko Neufeld
Possible strategiesPossible strategies
Dump data to file (from C++, read with Java)Dump data to file (from C++, read with Java) clumsy(!), ugly(!!), synchronization(!!!)
Link together Java and C++Link together Java and C++ difficult, huge executable, always same client
Use a TCP socketUse a TCP socket elegant, client - server, standard (C) only primitive data types (basically bytes),
must provide your own protocol
CORBACORBA standardized, Java and C++ fully supported free implementations available
April 20, 2023 Niko Neufeld
CORBA / OMGCORBA / OMG
OMG (Object Management Group)OMG (Object Management Group) comprises all major vendors except Microsoft defines and develops the standard the standard and most OMG document are available for public
download http://www.omg.org
Microsoft has a similar approach COM/OLEMicrosoft has a similar approach COM/OLE Interoperability is under wayInteroperability is under way
April 20, 2023 Niko Neufeld
CORBA introCORBA intro CORBA stands for Common Object Request CORBA stands for Common Object Request
Broker ArchitectureBroker Architecture It is a standard for object/component It is a standard for object/component
cooperationcooperation A component is usually a (collection of) A component is usually a (collection of)
object(s) which performs a well defined object(s) which performs a well defined task e.g. display a histogram. It is (ideally):task e.g. display a histogram. It is (ideally):
standalone, “plug and play”able across networks and platforms
It defines “services” for objects:It defines “services” for objects: naming, persistency, transactions etc.
It is language/platform independentIt is language/platform independent
April 20, 2023 Niko Neufeld
CORBA - ORBCORBA - ORB
All requests from objects to objects are All requests from objects to objects are handled by the Object Request Broker (ORB)handled by the Object Request Broker (ORB)
April 20, 2023 Niko Neufeld
Interface Definition Interface Definition Language (IDL)Language (IDL)
IDL describes the interfaces which objects IDL describes the interfaces which objects show to the ORBshow to the ORB
It contains:It contains: modules = namespaces in C++ interfaces = abstract base classes in C++ operations = methods data types = standardized types
basic:compatible to double, int, long, etc. constructed: struct, sequence, string, any, union, enum
These are mapped to the respective These are mapped to the respective language types by the precompilers (idl, jidl) language types by the precompilers (idl, jidl)
April 20, 2023 Niko Neufeld
IDL (trivial example)IDL (trivial example)
interface Y2K { const short y2k=2000 ; attribute short currentyear ; exception Y2Kbug {string yeah; }; void print(in short year) raises (Y2Kbug); };
idl y2k.idl produces y2k_skel.cpp and y2k.cpp and the header filesNot shown here (lengthy - but no need to look into them)y2k_skel is used for the implementation of the server part and y2k.h for a possible client.
April 20, 2023 Niko Neufeld
Generated IDL fileGenerated IDL file
//## Module: Photon//## Subsystem: Rich::Detector//## Source file: C:\Program Files\Rational\Rational Rose 98 Evaluation Edition\Rich\Detector\Photon.idl#ifndef Photon_idl#define Photon_idl
#include "Rich\Detector\Pixel.idl"
interface Photon : Trajectory { //##begin Photon.initialDeclarations preserve=yes //##end Photon.initialDeclarations
// Attributes attribute double energy; attribute double thetaCherenkov;
// Operations
void absorbed(); void scattered(in const HepPoint3D &position, in const HepPoint3D &direction);};
#endif
April 20, 2023 Niko Neufeld
Working with CORBAWorking with CORBA
April 20, 2023 Niko Neufeld
How to use itHow to use it
Server must be running somewhere Server must be running somewhere It produces a unique(!) Object reference for It produces a unique(!) Object reference for
the object whose service it offersthe object whose service it offers This reference can e.g. be stored as a string This reference can e.g. be stored as a string
and passed to a possible clientand passed to a possible client The client initializes the ORB, obtains the The client initializes the ORB, obtains the
object reference and gets a reference to the object reference and gets a reference to the object and can then call its methodsobject and can then call its methods
And it really works!And it really works!
April 20, 2023 Niko Neufeld
What did I use?What did I use?
JAVA 1.2 on Linux JAVA 1.2 on Linux www.blackdown.org/java-linux fully compliant SUN certified port of 1.2
ORBacus 3.1.2 for C++ and JavaORBacus 3.1.2 for C++ and Java www.ooc.com/ob/ commercial software free for non-commercial use full CORBA IDL support, IDL to C++/Java mapping
Linux 2.0.35 (dual P2)Linux 2.0.35 (dual P2) gcc/egcs, java
April 20, 2023 Niko Neufeld
Some final remarksSome final remarks
I started out looking for a simple solution I started out looking for a simple solution for C++ and Java interoperabilityfor C++ and Java interoperability
CORBA works very nicely, it is a very high CORBA works very nicely, it is a very high level way of communicationlevel way of communication
I did not check performance issuesI did not check performance issues One gets distribution, client-server, multi One gets distribution, client-server, multi
language (almost) for freelanguage (almost) for free There seem to be a lot more interesting There seem to be a lot more interesting
possibilities possibilities