stéphane frenot - département télécommunication - sid - [email protected] ii - corba...

37
Stéphane Frenot - Département Télécommunication - S ID - [email protected] II - Corba 1 CORBA

Upload: aristide-joly

Post on 04-Apr-2015

114 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 1

CORBA

Page 2: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 2

Objectifs des approches distribuéesVue macroscopique

• Développer des applications dont les services sont répartis sur plusieurs machines interconnectées par un réseau

• Contraintes– Développement similaire à une approche centralisée

• Moyens : masquer les "détails"– "Détails" du réseau => On ne connaît pas la localisation

– "Détails" des langages utilisés => On ne connaît pas l'implantation

Page 3: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 3

Quelques architectures

• OSF (Open Software Foundation)

– Distributed Computing Environnement

• Microsoft

– Distributed Component Object Model

• OMG (Object Management Group)

– Common Object Request Broker Architecture (CORBA)

• Sun

– EJB (Enterprise Java Beans)

Page 4: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 4

CORBA

• Fondé sur le modèle client/serveur s'échangeant des valeurs

• Une architecture

– OMA : Object Management Architecture

• Un langage de description des services offerts

– IDL : Interface Definition Language

• Un modèle d'échange d'informations– Valeurs atomiques, Valeurs Contruites et Références d'objet

• Mais surtout une spécification papier de l'ORB et des services

Page 5: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 5

Objet clientObjet serveur

Etat ?

Service ?

Problématique Vue microscopique

• Service ==> appel des méthodes

• Etat ==> accès aux attributs

Espace 1 Espace 2

Page 6: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 6

Principe des échanges

• Fournir des objets de service qui vont servir d'intermédiaires pour le client et le serveur

Objet client Objet serveur

Espace 1Espace 2

Echange neutre

Appel spécifiqueAppel spécifique

Page 7: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 7

Client

SystèmeIntermédiaire Client

Serveur

Fonctionnement

Espace 1 Espace 2

SystèmeIntermédiaire Serveur

Mandataireserveur

(skeleton)

Mandataire client(stub)

Page 8: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 8

ORB Serveur

Client

ORB Client

Demandede service

Référentiel des

Services

Recherche du service

Lanceur

Appel du lanceur

Lancement du mandataire

Mandataireserveur

Mandataire client

Fonctionnement lancement

Espace 1 Espace 2

ServeurInstanciation du serveur

le service est prêt

le mandataire est prêt

Le client peut invoquer les méthodes du service

Page 9: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 9

Développement

1) Définition de l'interface IDL du composant (objet serveur)– mandataires client (client stubs) – mandataires serveurs (serveur skeleton)

2) Développement du serveur qui implante les services

3) Développement d'un lanceur capable d'instancier le serveur et de le rendre disponible sur le bus corba (création du skeleton)

4) Inscription du lanceur sur le bus(ajout dans le référentiel)

-------------------------

5) Insertion dans le client des appels au serveur (connexion sur le serveur via le stub et invocation des méthodes distantes)

Page 10: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 10

Un exemple

• Un composant Requête sur une base de données

– Le composant maintient une connexion sur une base

– Il contient une méthode d'invocation

• Chaine [] executerRequete (Chaine commandeSQL);

Page 11: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 11

OMG-IDL : Définition• Langage de spécification des interfaces

– Orienté Objet

– Opérations et Attributs

– Héritage simple et multiple

– Exceptions

• Conçu pour être mappé sur de nombreux langages de

programmation

– Java, C, C++ , Smalltalk, Ada, Cobol, Modula3

• OMG-IDL <=> «Interfaces» Java, «Classes Abstraites» du C++

Page 12: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 12

1 IDL

typedef sequence<string> tableaux_resultat;

interface REQUETE {

tableaux_resultat executer_req_array(in string req);

};

--> Compilation : idl -jPacces_bd requete.idl (sous OrbixWeb)

Mandataire client : REQUETE.java

Service client pour demander un proxy : REQUETEHelper.java

Mandataire serveur : _tie_REQUETE.java

Interface de développement du serveur : _REQUETEOperations

Page 13: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 13

Développement du serveur

• Garantit que toutes les fonctions sont implantées

• N'importe quel langage sur lequel est défini un mapping

------------- Implante REQUETE_Operationspackage acces_bd;

public interface _REQUETEOperations {

public String[] executer_req_array(String req);

}

Page 14: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 14

2 Développement du serveurpackage acces_bd;

import java.sql.*;

import java.util.Vector;

class REQUETEImplementation implements _REQUETEOperations {

Connection con=null;

public REQUETEImplementation() {

try {

DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver ());

} catch (Exception raison1) {

System.out.println("pb pendant new oracle.jdbc.driver.....");

}

try {

con = DriverManager.getConnection ("jdbc:oracle:thin:@lisiaix0.insa-lyon.fr:1526:INSA", "bcb", "bcb");

} catch (Exception raison2) {

System.out.println("pb pendant get connection jdbc.....");

}

}

Page 15: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 15

2 Développement du serveur

public String[] executer_req_array(String req){

String resultat[]; Vector resultvector=new Vector();

Statement stmt=null; ResultSet rs=null; int ncols=0;

try { // Lancement de la requête

stmt = con.createStatement();

rs = stmt.executeQuery(req);

ncols= rs.getMetaData().getColumnCount();

}catch (Exception ex) {//code d'erreur}

try {

while (rs.next) {

for (int i=1; i<=ncols; i++)

resultvector.addElement(rs.getString(i));}

}catch (Exception ex) { }

resultat =new String[resultvector.size()];

resultvector.copyInto(resultat);

return resultat;}

Page 16: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 16

Développement du lanceur (adapteur d'objet)

• Enregistre les classes d’implantation des serveurs

• Active / désactive les serveurs

• Génération / interprétation des références sur les

objets

• Plusieurs types en fonction de la nature du serveur

Page 17: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 17

3 Développement du lanceurpackage acces_bd;

public class composantserv {

public static void main (String args []) {

REQUETE REQUETEImpl=null; //Nom du mandataire

REQUETEImplementation tmp=null; //Nom du serveur

try {

tmp=new REQUETEImplementation();

REQUETEImpl = new _tie_REQUETE(tmp);

}catch(SystemException se1) { }

try {

IE.Iona.OrbixWeb._CORBA.Orbix.impl_is_ready("SERVICEREQUETES");}

catch(SystemException se) {}

}

}

Page 18: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 18

4 Inscription du lanceur putit -j LAREQUETE acces_bd.composantserv

• Implantation sur le système de fichiers du serveur

• Annuaire des objets du système distribué (Interface

Repository)

– Banque d’objets métiers de l’entreprise

– Accessible à l’ORB et aux développeurs

• Possibilité de fédération d’IR

Page 19: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 19

Liste des services

Page 20: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 20

Le fichier de définition

Page 21: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 21

Développement du client

• Se connecte sur le service d'intermédiation

• Demande l'accès à un service particulier

• Reçoit une référence sur le mandataire du serveur

• Peut invoquer des méthodes sur les mandataires

serveurs pour récupérer des valeurs.

• Aussi simple que si l'objet serveur est local

Page 22: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 22

5 Développement du client

package acces_bd;public class composantcli { public static void main(String args[]) { REQUETE myreq = null; String [] reponse=new String [0]; ORB.init(); //Initialisation de l'accès à l'ORB try {

myreq = REQUETEHelper.bind(":LAREQUETE","lisisun1.insa-lyon.fr); } catch (Exception raison) { // } String req= "select * from tab"; try {

reponse=myreq.executer_req(req); }catch (Exception raison){ } for (int i=0; i<reponse.length; i++) { System.out.println(reponse[i]);}}}

Page 23: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 23

Classes impliquées sur le clientacces_bd

COMPOSANTCLI

Main()

omg.org.CORBA

REQUETEHelper

static bind()...

ORB

init()...

Object

REQUETE

classe

Classe statique

interface héritage

Classe Abstraite PackagePackage

Page 24: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 24

Classes impliquées sur le serveur

acces_bd omg.org.CORBA

ORB

init()connect()disconnect()

IE.Iona.OrbixWeb._CORBA

Orbix

impl_is_ready()...

REQUETEImplementation

_REQUETEOperationspublic String[] executer_req_array(String req)

_tie_REQUETE

Object

REQUETE

_REQUETESkeletons

ComposantServ

Page 25: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 25

Schéma général de développement

Description d’interface

en IDL

Souches

IDL

Code des clients

+Applications clientes

(5) Implantation des clients(1)

Compilation IDL

Squelettes

IDL

(2)Implantation des interfaces IDL

Code des classes

+(3) Implantation des serveurs

Référentiel des

Implantation

(4) Installation Configuration des serveurs

Référentiel des

Interfaces

Page 26: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 26

Les Services CORBA

La Plomberie CORBA

Les Canevas CORBA

OMA : Object Management Architecture

Page 27: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 27

OMG Services

Objets DéveloppésSpécifiques et non standardisés

Utilitaires CommunsServices orientés utilisateurs

Santé Finance Télécomverticaux

horizontaux IUGestion

informationAdministration

SystèmeGestion

des tâches

Nommage

Externalisation

Persistance

Cycle de vie Evénement

Transactions

Propriétés

Relations

Collections Temps

Sécurité d’accès

Versions

Négociateurs Licences

Service Objet CommunsServices orientés systèmes

Concurrence d’accès

Common Object Request Broker Architecture (CORBA)

Page 28: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 28

Un autre exemple : Médicamentstypedef sequence<string> liste_chaine;

interface Medicaments {

attribute string code_cip;

attribute string nom_medicament;

liste_chaine donner_indications(in string code_cip);

liste_chaine donner_contre_indications(in string code_cip);

liste_chaine donner_effets_indesirable(in string code_cip);

struct_interac donner_interactions(in string code_cip1,in string code_cip2);};

struct resultat_interactions {

string principe_actif1; string principe_actif2;

string nom_pa1; string nom_pa2;

string libelle_gravite;

string libelle_message;

string type_interaction; };

typedef sequence<resultat_interactions> struct_interac;

Page 29: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 29

Canevas de composants

Client

ORB

Descriptiondes

médicaments

Espace 1 Espace 2

Service de requêtage

Espace 3

ORB ORB

Page 30: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 30

Architecture fonctionnelle de l’ORB

Invocation Dynamique

Souches IDL

Interface

de l’ORB

Squelettes IDL

(statique)

Squelettes Dynamique

Adaptateur d’objets

Noyau de l’ORB

Référentiel desImplantations

Référentieldes Interfaces

Client Implantation Objet : serveur

Interface standard des ORB

Une interface par classe d’objet

Spécifique à l’ORB

Page 31: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 31

Composants de Corba (Spec. V2.0)• ORB : Négociateur de requêtes objet

• BOA : Adaptateur d’objets

• IDL : Langage de définition des interfaces

• SII : Interface d’invocation statique

• IR : Entrepôt des interfaces et implantations

• Mise en correspondance vers langages hôtes java, c, c++ ...

• IIOP : Communication inter-ORB

• DII : Interface d’invocation dynamique

• DSI : Squelette d’interface dynamique

Page 32: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 32

CORBA, c’est :

• Une architecture complète d’objets distribués

• Des spécifications techniques qui font partie

d’un tout : l’OMA

• Séparation entre la couche service (IDL) et la

plomberie (ORB)

Page 33: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 33

Limitation des fonctionnalité• Pas de réponse par rapport aux problèmes classiques

des applications distribuées :– Délais d’attente

– Tolérance aux pannes

– Ordonnancement des événements

– Verrou Mortel

• De plus– Pas de transmission d'objets

– Pas de traitements groupés

– Problème des objets à granularité fine

Page 34: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 34

Limitation des performances• Plus lent qu’une application spécifique

– Surcoût lié à la résolution de noms

– Traitement des paramètres

– Recopie de données

– Gestion de la mémoire

– Démultiplexage

• Probleme classique :– Trouver l’équilibre entre extensibilité, solidité, maintenabilité et

efficacité des couches de bas niveau

• Un bon ORB devrait être capable d’optimiser les fonctionnalités supérieures

Page 35: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 35

Marché des objets distribués• Architectes de canevas de composants• Développeurs de composants• Intégrateurs de composants

-------------------------------------------------

Biblio ?

ORB public : HORB, MICO, Jonathan

Manuels de Iona, Visigenic...

http://www.iona.com,

http://www.visigenic.com

http://www.omg.org

Page 36: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 36

Modes d'invocation transparent

• objetDistant.methode( );

• objetDisant=ServicedeRecherche.recherche("UnObjet");

• resultat=objetLocal.methode(objetDistant);

• resultat=objetDistant.methode(objetDistant2);

• ObjetDistant=new ObjetDistant( );

Page 37: Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr II - Corba 120 CORBA

Stéphane Frenot - Département Télécommunication - SID - [email protected]

II - Corba 37

Compléments

• Krakowiak http://sirac.imag.fr/

• J.M. Geib, C. Gransart, Ph.Merle CORBA, des concepts à la pratique

• Douglas Schmidt http://www.cs.wustl.edu/~shmidt