Académique Documents
Professionnel Documents
Culture Documents
Plan
Architecture CORBA Le langage IDL CORBA en Java : JavaIDL Le service de nommage CORBA en C++ : Mico
2
CORBA
Architecture
Contexte
Applications distribues Objets rpartis Autres technos :
Principe simplifi
Client Serveur
Objet
Objet
Middleware
Corba - Christophe Bouthier - Karim Baina - LORIA 5
- CORBA - UML
http://www.omg.org
Corba - Christophe Bouthier - Karim Baina - LORIA 6
Architecture de CORBA
Client Serveur Objet Java Objet C++ Skeleton Stub IIOP Object Adapter
ORB
Corba - Christophe Bouthier - Karim Baina - LORIA
ORB
7
Composants
Stub : partie cliente Skeleton : partie serveur gnrs automatiquement
Object Adapter : enregistrement des objets ORB : passage de message IIOP : Internet Inter-ORB Protocol
Corba - Christophe Bouthier - Karim Baina - LORIA 8
Objet CORBA
Serveur Objet CORBA Interoperable Object Reference Interface IDL Implmentation C++/Java Servant
Exemple dIOR
IOR:000000000000001049444c3a5472697669616c3 a312e300000000001000000000000007c00010200 0000000d3135322e38312e342e313130000004800 0000025abacab3131303033383632313336005f526 f6f74504f410000cafebabe3bd5b878000000000000 0000000001000000010000002c0000000000010001 00000004000100200001010900010100050100010 0010109000000020001010005010001
10
Exemple
module example { interface monExample { void methode1(); long methode2(); void methode3(in long param, out long result); }; };
Corba - Christophe Bouthier - Karim Baina - LORIA 12
Stub (souche)
Code client Interface entre objet et ORB Traduit les invocations sur lobjet serveur
- > marshalling
- unmarshalling
13
Skeleton (squelette)
Code serveur Interface entre implmentation et ORB Traduit les invocations client vers limplmentation
14
- GIOP (General Inter-ORB Protocol) - IIOP (Internet Inter-ORB Protocol) (GIOP on TCP/IP)
15
16
Architecture de CORBA
Client Objet C++ IDL Serveur Objet Java
ORB
Corba - Christophe Bouthier - Karim Baina - LORIA
ORB
17
CORBA
IDL
19
Exemple
module example { interface monExample { void methode1(); long methode2(); void methode3(in long param, out long result); }; };
Corba - Christophe Bouthier - Karim Baina - LORIA 20
Module
module monModule { }; espace de nom
Interface
interface monInterface { }; Classe
Mthode
void methode(in long param, out long result); Mthodes : comme en C++ et Java, sauf
- in - out - inout
: paramtre utilis en entre (lu, non modifi) : paramtre utilis en sortie (non lu, modifi) : paramtre utilis en entre et en sortie (lu et modifi)
23
Syntaxe
Commentaire : comme C++ et Java
Prprocesseurs : #define, #include, #ifdef, #endif Alias : typedef Possibilit de dfinir des attributs Constantes : const
24
Types primitifs
void short long long long float double boolean
25
Types complexes
string struct enum union any
Corba - Christophe Bouthier - Karim Baina - LORIA 26
Hritage
Hritage multiple Surcharge et redfinition interdites interface A { }; interface B : A { }; interface C : A { }; interface D : B, C { };
A B D
27
CORBA
JavaIDL
28
JavaIDL
ORB CORBA en Java de Sun Inclu au JDK idlj : compilateur idl vers java
orbd : ORB et serveur de nom indpendant orbd -ORBInitialPort <port> -ORBInitialHost localhost
Corba - Christophe Bouthier - Karim Baina - LORIA 29
Implmentation
Fichier MonObject.IDL : interface MonObjet { }; Classe qui implmente le contrat IDL Lancement client ou serveur :
- Doit driver de MonObjetPOA - MonObjetPOA est gnr par le compilateur IDL - java
<serveur/client> -ORBInitialPort <port> -ORBInitialHost localhost
30
Serveur / 1
Initialiser lORB : Objet CORBA :
- Mthode statique init(args, null) de la classe ORB - retourne un objet ORB - org.omg.CORBA.Object - Ne pas confondre avec java.lang.Object - Retourn par diffrentes mthodes - Cast avec mthode statique narrow de la classe MonTypeHelper
31
Serveur / 2
Utilisation dun POA :
- Mthode resolve_initial_references("RootPOA") de lobjet ORB - Retourne un objet CORBA caster en objet POA - Puis mthode the_POAManager().activate() de lobjet POA - Mthode servant_to_reference(servant) de lobjet POA - retourne un objet CORBA - Mthode run de lobjet ORB
Enregistrer le servant :
Client
Initialiser lORB :
- Mthode statique init(args, null) de la classe ORB - retourne un objet ORB - Mthode string_to_object(IOR) de lobjet ORB - Retourne un objet CORBA - Cast dans son vrai type avec la mthode statique narrow de la classe MonObjetHelper MonObjetHelper est gnr par le compilateur IDL
33
CORBA
Service de nommage
34
Services CORBA
Service de cycle de vie Service dvnements Service de concurrence Service de transaction Service de persistance Service dinterrogation Service de collection
35
Besoin du Naming
Rfrence dun objet : IOR
- Fichier partag,
Service la DNS :
- Service accessible par le bus ORB - Service standard entre ORBs - Un nom spcifique <-> un objet corba - Gre les contextes de nom
37
Utilisation du Naming
Module CosNaming Interface NamingContext Nouvelle interface NamingContextExt
- Cration dune association : bind, rebind - Rsoudre une association : resolve - Dtruire une association : unbind
Obtenir le Naming
Naming = objet CORBA
39
40
41
CORBA
Mico
42
Mico Is COrba
ORB CORBA en C++ Open-source et libre (GPL) Multi-plateforme :
- Linux/Unix - Windows
- MacOS X - Pocket PC
43
Client
idl : compilateur idl vers C++ Compilation :
Code client / 1
Initialisation ORB :
objet ORB_var
- Namespace CORBA - Fonction ORB_init(argc, argv, "mico-local-orb") retourne un - Namespace CosNaming - resolve_initial_references("NameService") de lobjet ORB - retourne un objet CORBA (CORBA::Object_var) - Cast avec mthode de classe _narrow(obj) de la classe
NamingContextExt
45
Name Service :
Code client / 2
Naming (suite)
- Cast retourne un objet NamingContextExt_var - Mthode resolve_str("Nom") de lobjet NamingContextExt_var - Retourne un objet CORBA - Cast avec la mthode de classe _narrow(obj) de la classe MonObjet Retourne un objet MonObjet_var
46
Conclusion
Solution non propritaire Standard Libre choix de limplmentation et du langage Solution fonctionnelle dinteroprabilit Plusieurs implmentations libres et open-source