69
EPU SI4 - 2008 1 Introduction : Applications réparties par objets Mireille Blay-Fornarino [email protected] http://www.polytech.unice.fr/~blay/ENSEIGNEMENT/AppRep/ http://www.polytech.unice.fr/~pinna/Sar/AppRep/ Voir les cours qui ont servi de référence dans la bibliographie

Introduction : Applications réparties par objets

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction : Applications réparties par objets

EPU SI4 - 2008 1

Introduction : Applications réparties par objets

Mireille [email protected]

http://www.polytech.unice.fr/~blay/ENSEIGNEMENT/AppRep/http://www.polytech.unice.fr/~pinna/Sar/AppRep/

Voir les cours qui ont servi de référence dans la bibliographie

Page 2: Introduction : Applications réparties par objets

EPU SI4 - 2008 2

Objectifs

Sensibilisation au besoin d’intégration des applications logicielles réparties en contexte industriel

Conception d’Architectures logicielles

Acquisition de connaissances sur les modèles existants pour les applications réparties

RMI, CORBA, JNDI, JMS, Puis dans le domaine de l’internet :

SOAP & Services web, Ajax,

Bases de l’approche IntergicielPrincipes directeurs, organisation, usageFonctionnement interne (“ au coeur de …”)

Page 3: Introduction : Applications réparties par objets

EPU SI4 - 2008 3

Entreprise virtuelle : illustration

( )ρ∂∂cρut

divKgradu F= +( )0

20

40

60

80

100

EstOuestNord

Est 20,4 27,4 90 20,4Ouest 30,6 38,6 34,6 31,6Nord 45,9 46,9 45 43,9

1er trim. 2e trim. 3e trim. 4e trim.

Mireille Blay-Fornarino

Assemblage de ressources de Stockage, Calculs, réseaux

=> B2B

Page 4: Introduction : Applications réparties par objets

EPU SI4 - 2008 4

Pourquoi utiliser des applications réparties ?

- Répartition des données géographiquement et topologiquement

- Redondance d’une application : diminuer le taux de panne, augmenter la fiabilité

- Gestion de la montée en charge

- Intégration d’applications existantes

Page 5: Introduction : Applications réparties par objets

EPU SI4 - 2008 5

Les 8 erreurs conceptuelles

1. Le réseau est fiable.2. La latence est nulle.3. La bande passante du réseau est infinie.4. Le réseau est sécurisé.5. La topologie de l’application est « éternelle »6. Il y a un seul administrateur du réseau7. Le coût du transport est nul.8. Le réseau est homogène.

Annick Fron

Page 6: Introduction : Applications réparties par objets

EPU SI4 - 2008 6

Propriétés à prendre en compte

DistributionEquilibrage de chargeParallélisationDécentralisationCouplage

Prise de décision Contrôle de l’accès concurrentServeurs parallèlesDonnées réparties synchronisation

de l'accès aux ressources, Gestion des transactions

HétérogénéitéHardwareLangagesRessourcesContexte d’usage

Désignation/localisationMigrationMobilitéUbiquitéEvolution

Mireille Blay-Fornarino

Page 7: Introduction : Applications réparties par objets

EPU SI4 - 2008 7

Propriétés à prendre en compteSécurité

authentification (certificats)sécurisation des communications (cryptage)contrôle d’accès (autorisation)

Dimensionnementcroissance du nombre de clients

« duplication des serveurs », « gestion de caches »gigantesque quantité de donnéesGrain des informations : plans de vol journalier ou pistes radar àla seconde ?

Tolérance aux fautessite en panne ou inaccessible« redondance des serveurs »« fonctionnement en mode dégradé »

Mireille Blay-Fornarino

Page 8: Introduction : Applications réparties par objets

EPU SI4 - 2008 8

Bus logiciel ?

Principes de base de l’architecture des intergicielsVia RMI et CORBA …

Page 9: Introduction : Applications réparties par objets

EPU SI4 - 2008 9

1. Au début était la socket

Service 1 : Hello worldUne méthode hello avec un paramètre de type chaîne et retourne une chaîne : ”hello, ” + paramètre

[email protected]’après et Sacha KrakowiakEt (cf. références en bas des pages)

Page 10: Introduction : Applications réparties par objets

EPU SI4 - 2008 10

Principe

Deux programmes écrits en deux classes Java

Une pour le serveur Server.javaUne pour le client Client.java

Dans chaque classe est implémentéLe code fonctionnel : manipulation des chaînesLe code technique : construction / analyse des messages réseau

Page 11: Introduction : Applications réparties par objets

EPU SI4 - 2008 11

Architecture version « socket »

Client

Réseau

Serveur

Page 12: Introduction : Applications réparties par objets

EPU SI4 - 2008 12

Modélisation des Interactions

Page 13: Introduction : Applications réparties par objets

EPU SI4 - 2008 13

Côté serveur

Initialisation du réseauInstanciation d’une socket serveur

Gestion des requêtesAttente de connexion (accept)Initialisation des flux d’entrée et de sortieEvaluation des requêtes

Lecture de la requête sur le flux d’entréeCréation de la chaîne à retournerEcriture de la réponse sur le flux de sortie

Page 14: Introduction : Applications réparties par objets

EPU SI4 - 2008 14

Code serveur (i)

package step1 ;import java.io.* ;import java.net.* ;public class Server {

private ServerSocket asock ;public Server () throws Exception {

this.asock = new ServerSocket (12345) ;}

public static void main (String args[]) {Server s = new Server () ;s.run () ;

}

Page 15: Introduction : Applications réparties par objets

EPU SI4 - 2008 15

Code serveur (ii)

public void run () throws Exception {while (true) {

Socket sock = this.asock.accept () ;BufferedReader in = new BufferedReader

(new InputStreamReader(sock.getInputStream ()));DataOutputStream out =

new DataOutputStream (sock.getOutputStream ());String msg = in.readLine () ;String res = "Hello, " + msg + "\n" ; // fonctionnelout.writeBytes (res) ;

}}

Page 16: Introduction : Applications réparties par objets

EPU SI4 - 2008 16

Côté client

Initialisation du réseauInstanciation d’une socket de communication (connexion implicite)

Gestion de l’échange réseauInitialisation des flux d’entrée et de sortieDemande de service

Ecriture de la requête sur le flux de sortieLecture de la réponse sur le flux entréeAffichage de la chaîne retournée

Fermeture de la connexion

Page 17: Introduction : Applications réparties par objets

EPU SI4 - 2008 17

Code client (i)

package step1 ;import java.io.* ;import java.net.* ;public class Client {

private Socket sock ;public Client () throws Exception {

this.sock = new Socket ("localhost", 12345) ;}

public static void main (String args[]) throws Exception {Client c = new Client () ;c.run (args[0]) ;

}

Page 18: Introduction : Applications réparties par objets

EPU SI4 - 2008 18

Code client (ii)

public void run (String msg) throws Exception {BufferedReader in = new BufferedReader

(new InputStreamReader(this.sock.getInputStream ()));DataOutputStream out =

new DataOutputStream (this.sock.getOutputStream ());out.writeBytes (msg + "\n") ;String res = in.readLine () ;System.out.println ("Server replied: " + res) ;this.sock.close();}

}

Page 19: Introduction : Applications réparties par objets

EPU SI4 - 2008 19

Bénéfices et limitations

BénéficesInvocation d’un service distant (hello world)Permet de réaliser des applications client / serveur

Parmi les limitationsUne seule connexion cliente à la foisUn seul service cibléBeaucoup de code très technique / peu de code métier (40 lignes de code technique pour une ligne de code métier)Un beau plat de spaghettis, difficilement évolutif

Page 20: Introduction : Applications réparties par objets

EPU SI4 - 2008 20

… et il y eut lesApplications à base d’objets répartis

Comparaison RMI et CORBAApplications RépartiesAM Dery & M. Blay-Fornarino

Merci à Rémi Vankeisbelck, Michel Riveill, Annick Fron, etc

Page 21: Introduction : Applications réparties par objets

EPU SI4 - 2008 21

Objectifs des objets répartis : RAPPELS1) « utiliser » un objet distant (OD), sans savoir où il se

trouve:ObjetDistant = ServiceDeNoms.recherche("monObjet");

2) invoquer des méthodes comme en local :objetDistant.nomMethode(Parametres);

3) « passer » un OD en paramètre d’appel à une méthoderesultat = objetLocal.nomMethode(objetDistant);resultat = objetDistant.nomMethode(autreObjetDistant);

4) récupérer le « résultat » d’un appel distant sous forme d’un nouvel objet qui aurait été créé sur la machine distante :ObjetDistant1 = ObjetDistant2.methode() ;

Page 22: Introduction : Applications réparties par objets

EPU SI4 - 2008 22

Des technologies

RMI (Remote Method Invocation)Système d’objets distribués performant destiné au développement

d’applications distribuées entièrement en Java

CORBA (Common Object Request Broker Architecture)Plate-forme client/serveur orientée objets qui permet de faire communiquer des applications écrites dans des langages différents (C++, Lisp, Smalltalk, Python…) et sur des plateformes (Interopérabilité Langage et Plateformes)

Page 23: Introduction : Applications réparties par objets

EPU SI4 - 2008 23

2. Bus mono-langage : RMIRemote Method Invocation

Oui oui… vous savez déjà.Mais un petit rappel… !

Remote/serialisable

Page 24: Introduction : Applications réparties par objets

EPU SI4 - 2008 24

Principe

Deux programmes écrits en deux classes Java

Une pour le serveur Server.javaUne pour le client Client.javaMais cette fois-ci :

Des objets « Hello »Un contrat

Page 25: Introduction : Applications réparties par objets

EPU SI4 - 2008 25

Architecture version « RMI »

Squelette

ServiceServant

Stub

Réseau

Client

Contrat/Interface

ServiceServant

Squelette

NommageServant

SqueletteRMISystem

http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html

Stub=Proxy/TalonSquelette = Proxy/Talon Serveur

Page 26: Introduction : Applications réparties par objets

EPU SI4 - 2008 26

Architecture RMI

Java Remote Method Protocol (JRMP)

Client

Stub

Remote reference layer

Serveur

Skeleton

Remote reference layer

TCP/IP, Unicast

Pinna -2007

Page 27: Introduction : Applications réparties par objets

EPU SI4 - 2008 27

Contrat : Interface Java

import java.rmi.Remote;

public interface HelloService extends Remote {

public String hello (String msg) throws Exception ;

public HelloService getClone(String InitialMessage) throws Exception ;

}

MBF -2007

Page 28: Introduction : Applications réparties par objets

EPU SI4 - 2008 28

Côté Serveur : Implémentations : Objets Remote

public class HelloServiceRemote extends UnicastRemoteObjectimplements HelloService {

int counter = 0;String initialMessage = "";

…private HelloServiceRemote(int count, String message) throws RemoteException

initialMessage = message;counter = count;

}

public String hello(String msg) throws Exception {counter++;return initialMessage + "Hello " + msg + " : tu es le " + counter;

}public HelloService getClone(String initialMessage) throws Exception {

return new HelloServiceRemote(this.counter,initialMessage);}

MBF -2007

Page 29: Introduction : Applications réparties par objets

EPU SI4 - 2008 29

Côté Serveur : Implémentations : Objets Sérialisable

import java.io.Serializable;public class HelloServiceSerializable

implements HelloService, Serializable {int counter = 0;private String initialMessage = "";private HelloServiceSerializable(int count, String message) throws RemoteException {

…}protected HelloServiceSerializable() throws RemoteException {

…}

public String hello(String msg) throws Exception {…

}

public HelloService getClone(String initialMessage) throws Exception {…

}}

MBF -2007

Page 30: Introduction : Applications réparties par objets

EPU SI4 - 2008 30

Code du serveur

public class HelloServer {

public static void main(String[] args) throws RemoteException, MalformedURLException {

HelloService serializedObject = new HelloServiceSerializable();HelloService remoteObject = new HelloServiceRemote();Naming.rebind("aSerializedHello", serializedObject);Naming.rebind("aremoteHello", remoteObject);

System.out.println("Hellos bound in registry");}

} Démarrage du serveurOn lance le rmiregistryOn lance le serveur

Page 31: Introduction : Applications réparties par objets

EPU SI4 - 2008 31

Côté client

public class HelloClient {public static void main(String[] args) {

HelloService objLocal = null; HelloService objRemote = null;

try {objLocal = (HelloService)

Naming.lookup("aSerializedHello");

System.out.println(objLocal.hello("Premier ")); System.out.println(objLocal.hello("deuxieme "));objLocal = (HelloService)

Naming.lookup("aSerializedHello"); System.out.println(objLocal.hello("troisieme "));

MBF -2007

Page 32: Introduction : Applications réparties par objets

EPU SI4 - 2008 32

Côté client

public class HelloClient {public static void main(String[] args) {

HelloService objLocal = null; HelloService objRemote = null;

try {objRemote = (HelloService)

Naming.lookup("aremoteHello");System.out.println(objRemote.hello("Premier "));System.out.println(objRemote.hello("deuxieme "));objRemote = (HelloService)

Naming.lookup("aremoteHello"); System.out.println(objRemote.hello("troisieme "));

Page 33: Introduction : Applications réparties par objets

EPU SI4 - 2008 33

Côté client

Suite du précédent

HelloService copieObjRemote = objRemote.getClone("Remote copy : ");

System.out.println(copieObjRemote.hello("Premiere copie"));

System.out.println(objRemote.hello("l'original"));

}

MBF -2007

Page 34: Introduction : Applications réparties par objets

EPU SI4 - 2008 34

Bénéfices et limitations

BénéficesInvocation de plusieurs services distants Quasiment pas de code technique Création à distance des objets accessibles

LimitationsUn seul langagePas de persistance des référencesGestion des Pool d’objetsPas d’Assemblage dynamique

Page 35: Introduction : Applications réparties par objets

EPU SI4 - 2008 35

3. "Bus" multi-langages : CORBACommon Object Request Broker Architecture

Juste un premier exemple…Introduction à CORBA par comparaison

Page 36: Introduction : Applications réparties par objets

EPU SI4 - 2008 36

I.5. OMAORBSpécificité Corba => ORB

la localisation d’objetla désignation des objetsl’empaquetage des paramètres (marshalling)le dépaquetage des paramètres (unmarshalling)l’invocation des méthodes

De plus, il fournit des caractéristiques telles que :la gestion des exceptionsl ’activation automatique et transparente des objetsla liaison avec « tous » les langages de programmationun système auto-descriptifl ’interopérabilité entre les bus

Page 37: Introduction : Applications réparties par objets

EPU SI4 - 2008 37

Architecture version « CORBA»

Squelette

ServiceServant

Stub

orb

NommageServant

Client

Contrat/Interface IDL

ServiceServant

Squelette SqueletteCORBASystem

http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html

Stub=Proxy/TalonSquelette = Proxy/Talon Serveur

POA

Réseau

Page 38: Introduction : Applications réparties par objets

EPU SI4 - 2008 38

CORBA par comparaison

GIOP/IIOP

Client

Stub

Object request broker

Serveur

Skeleton

Object request broker

TCP/IP, UnicastInterface IDL

Page 39: Introduction : Applications réparties par objets

EPU SI4 - 2008 39

Points communs et interopérabilité

Utilisent les socketsDes Protocoles

Un propriétaire : JRMP (Remote Method Protocol)Un protocole normalisé par l’OMG: GIOP/IIOP

Il existe des implémentations RMI basées sur le protocole RMI-IIOP

Page 40: Introduction : Applications réparties par objets

EPU SI4 - 2008 40

Modèle de référence OMAC

OR

BA

Bus d’objets répartis (O.R.B.)

Licences

Transactions PersistancePropriétés ChangementsEvents

Nommage Vendeur Sécurité Relations Collections Temps Externalisation

InterrogationsCyclede vie Concurrence

Services objet communs (CORBA Services)

Workflow

DataWare IHM

Administration

Utilitaires communs

Finance

Télécom

Santé

Interfacesde domaine

Objetsapplicatifs

Spécifiques

Page 41: Introduction : Applications réparties par objets

EPU SI4 - 2008 41

Rappel processus RMI

InterfaceHelloWorld

Interface HelloWorld

Classe d’implémentationHelloWorldImpl

Utilisation du registry

Code du client

Code du serveur

Page 42: Introduction : Applications réparties par objets

EPU SI4 - 2008 42

Étapes de mise en œuvre Corba

Spécification interface IDL

Compilation interface IDL

Implantation des objets Corba

Implantation du serveur

Enregistrement du serveur

Implantation du client

Côté clientCôté serveur

Utilisation du service Nommage

Page 43: Introduction : Applications réparties par objets

EPU SI4 - 2008 43

Contrat : IDL CORBA

interface HelloService{

string hello (in string msg);HelloService getClone(in string InitialMessage);

};

Page 44: Introduction : Applications réparties par objets

EPU SI4 - 2008 44

Corba : Interface décrite avec IDLDes projections multi-langages

ContratIDL

Bus CORBA SqueletteIDL

StubIDL

Fournisseurd ’objets

Clientd’objets

Objets Corba

Page 45: Introduction : Applications réparties par objets

EPU SI4 - 2008 45

Compilation interface IDL vers Java

HelloService.java

_HelloServiceStub.java HelloServicePOA.java

HelloService_Impl.javaClient.java

Serveur.java

Hello.idl

HelloServiceHelper.java

HelloServiceHolder.java

HelloServiceOperations.java

jidl

GénéréÀ implémenter

ServeurClient

Utile seulement si utilisation des modes in/inoutdans l’idl

Page 46: Introduction : Applications réparties par objets

EPU SI4 - 2008 46

Côté Serveur : Implémentationpublic class HelloServiceImpl extends HelloServicePOA{ private org.omg.CORBA.ORB orb_;

int counter = 0;String initialMessage = "";

public HelloServiceImpl(org.omg.CORBA.ORB orb) {orb_=orb;

}public HelloServiceImpl(org.omg.CORBA.ORB orb, int count, String message) {

this(orb); initialMessage = message; counter = count;}

public String hello(String msg) {counter++; return initialMessage + "Hello " + msg + " : tu es le " +

counter;}

public HelloService getClone(String InitialMessage){ return (new

HelloServiceImpl(orb_,this.counter,initialMessage))._this(orb_);

}}

Page 47: Introduction : Applications réparties par objets

EPU SI4 - 2008 47

Code serveur

public class Server{

static int run(org.omg.CORBA.ORB orb, String[] args) throws org.omg.CORBA.UserException{ org.omg.PortableServer.POA rootPOA =

org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

org.omg.PortableServer.POAManager manager = rootPOA.the_POAManager();

HelloServiceImpl helloRemoteImp = new HelloServiceImpl(orb);HelloService helloRemote = helloRemoteImp._this(orb);

try {String ref = orb.object_to_string(helloRemote);String refFile = "helloRemote.ref";FileOutputStream file = new FileOutputStream(refFile);PrintWriter out = new PrintWriter(file);out.println(ref);out.flush();file.close();

Page 48: Introduction : Applications réparties par objets

EPU SI4 - 2008 48

Côté client

public class Client { static int run(org.omg.CORBA.ORB orb, String[] args) throwsorg.omg.CORBA.UserException

{ String ref = null;try {String refFile = "helloRemote.ref";FileInputStream file = new FileInputStream(refFile);BufferedReader in = new BufferedReader(new InputStreamReader(file));ref = in.readLine();file.close();org.omg.CORBA.Object obj = orb.string_to_object(ref);…HelloService hello = HelloServiceHelper.narrow(obj);

System.out.println(hello.hello("premier"));System.out.println(hello.hello("deuxieme"));HelloService helloBis = hello.getClone("copie ");System.out.println(helloBis.hello("copie 1"));return 0;

}

Page 49: Introduction : Applications réparties par objets

EPU SI4 - 2008 49

Compilation interface IDL vers C++

Hello.idl

Compilateur idl

Client Hello_Impl

Compilateur C++ Compilateur C++

FichiersSouche

FichiersSquelette

Client(.exe)

Serveur(.exe)

Server

Page 50: Introduction : Applications réparties par objets

EPU SI4 - 2008 50

Côté Serveur : Implémentation(1)

char* Hello_impl::hello(const char* msg)throw(::CORBA::SystemException)

{CORBA::String_var message = ::CORBA::string_dup("Hello");message += msg;count++;message += count;return message._retn ();

}

Page 51: Introduction : Applications réparties par objets

EPU SI4 - 2008 51

Côté Serveur : Implémentation(2)

::Hello_ptr Hello_impl::getClone(const char* InitialMessage)throw(::CORBA::SystemException){

Hello_impl* helloImpl = new Hello_impl(orb_, poa_);helloImpl->count = this->count;…Hello_var hello = helloImpl -> _this();return hello._retn();

…}

Page 52: Introduction : Applications réparties par objets

EPU SI4 - 2008 52

Le programme Server#include <OB/CORBA.h>

#include <Hello_impl.h>

#include <fstream>

using namespace std;

int run(CORBA::ORB_ptr);

int main(int argc, char* argv[])

{ int status = EXIT_SUCCESS;

CORBA::ORB_var orb;

try{orb = CORBA::ORB_init(argc, argv);status = run(orb, argc, argv);

}

Page 53: Introduction : Applications réparties par objets

EPU SI4 - 2008 53

Le programme Server…PortableServer::POA_var rootPOA = PortableServer::POA::_narrow( CORBA::Object_var(orb ->

resolve_initial_references("RootPOA")));…Hello_impl* helloImpl = new Hello_impl(orb, rootPOA); Hello_var hello = helloImpl -> _this();

CORBA::String_var s = orb -> object_to_string(hello);const char* refFile = "Hello.ref";FILE* f = fopen(refFile, "w");fputs(s.in(), f);fclose(f);

…….

Page 54: Introduction : Applications réparties par objets

EPU SI4 - 2008 54

Le programme Client#include <OB/CORBA.h>#include <Hello.h>#include <fstream>using namespace std;int run(CORBA::ORB_ptr);int main(int argc, char* argv[]){ int status = EXIT_SUCCESS;

CORBA::ORB_var orb;try{ orb = CORBA::ORB_init(argc, argv);

status = run(orb);}

Page 55: Introduction : Applications réparties par objets

EPU SI4 - 2008 55

Le programme Client (suite)run(CORBA::ORB_ptr orb, int /* argc */, char* argv[]){CORBA::Object_var obj = orb ->

string_to_object("relfile:/Hello.ref");Hello_var hello = Hello::_narrow(obj);CORBA::String_var reply = CORBA::string_dup("");reply = hello -> say_hello("Premier");std::cout << reply << std::endl;Hello_var helloCopy=hello -> getClone("copie");reply = helloCopy -> say_hello("copie");std::cout << reply << std::endl;

}

Page 56: Introduction : Applications réparties par objets

EPU SI4 - 2008 56

Bus logiciel : …. Communications …

MOM (Message Oriented Middleware) ou RPC (Remote Procedure Call)

Page 57: Introduction : Applications réparties par objets

EPU SI4 - 2008 57

Echanges de messages

JMS

Principe :Production de messagesConsommation des messagesTous clients du « bus »!

Page 58: Introduction : Applications réparties par objets

EPU SI4 - 2008 58

Appel de procédure à distance

RMI,CORBA,.NET remoting, SOAP, …

Principe :Invocation d’un service (contexte d’appel)Attente bloquante* des résultats

Page 59: Introduction : Applications réparties par objets

EPU SI4 - 2008 59

Bus logiciel en résumé

Un bus logiciel repose essentiellement sur deux conceptsLa désignation d’un service (les références)La liaison avec un service distant (établir une connexion)

Un intergiciel (middleware) est un « programme » qui permet de faire communiquer des machines entre-elles, indépendamment de la nature du processeur, du SE, voire du langage.

Page 60: Introduction : Applications réparties par objets

EPU SI4 - 2008 60

Classes d’intergiciels

Objets répartisJava RMI, CORBA, DCOM, .NET

Composants répartisJava Beans, Enterprise Java Beans, CCM

Message-Oriented Middleware (MOM)Message Queues, Publish-Subscribe

Intégration d’applicationsWeb Services

CoordinationAccès aux données, persistanceSupport d’applications mobiles

Page 61: Introduction : Applications réparties par objets

EPU SI4 - 2008 61

Architecture générale d’un bus logiciel

Page 62: Introduction : Applications réparties par objets

EPU SI4 - 2008 62

Définitions d’interfaces

Partie “opérationnelle”Interface Definition Language (IDL)Pas de standard indépendant

IDL CORBAJava et C# définissent leur propre IDLWSDL…

Partie “contractuelle”Plusieurs niveaux de contrats

Sur la forme : spécification de types -> conformitésyntaxiqueSur le comportement (1 méthode) : assertions -> conformitésémantiqueSur les interactions entre méthodes : synchronisationSur les aspects non fonctionnels (performances, etc.) : contrats de QoS

C 2003 - Sacha Krakowiak

Page 63: Introduction : Applications réparties par objets

EPU SI4 - 2008 63

L ’amorce client (stub)

Représentant local de l ’OD qui implémente ses méthodes « exportées »Transmet l ’invocation distante à la couche inférieure Remote Reference Layer / ORBIl réalise le pliage (« marshalling ») des arguments des méthodes distantesDans l ’autre sens, il réalise le dépliage (« demarshalling ») des valeurs de retour

Page 64: Introduction : Applications réparties par objets

EPU SI4 - 2008 64

L ’amorce serveur (Skeleton)

Réalise le dépliage des arguments reçus par le flux de pliageFait un appel à la méthode de l ’objet distantRéalise le pliage de la valeur de retour

Page 65: Introduction : Applications réparties par objets

EPU SI4 - 2008 65

La couche des références distantes

Permet l ’obtention d ’une référence d ’objet distant à partir de la référence locale au Stub : un service d’annuaire

Rmiregistry en RMIService de nommage Naming en CorbaJNDI Interface d’annuaire

Page 66: Introduction : Applications réparties par objets

EPU SI4 - 2008 66

La couche de transport

Connecte les 2 espaces d ’adressage (JVM pour Java)Suit les connexions en coursEcoute et répond aux invocationsConstruit une table des OD disponiblesRéalise l ’aiguillage des invocationsSécurité ?

Page 67: Introduction : Applications réparties par objets

EPU SI4 - 2008 67

Diagramme d ’interaction

Stub Skeleton Implementation

invoke

Marshal paramSend req.

Unmarshal paramInvoke impl.

Return resultReturn return or exc.Marshal return or exc.Send replyUnmarshal reply

Return value or exc

Page 68: Introduction : Applications réparties par objets

EPU SI4 - 2008 68

Bibliographie

École d’été sur les Intergiciels et sur la Construction d’Applications Réparties : Patrons et Canevas pour l’IntergicielSacha Krakowiak, ICAR 2003

Dis papa, c’est quoi un bus logiciel réparti [email protected] – IRCICAEquipe GOALDécembre 2003

Page 69: Introduction : Applications réparties par objets

EPU SI4 - 2008 69

Quelques livres...

Core Java Volume 2Par Cay S. Horstmann & Gary CornellEditions CampusPressUne référence pour les développeurs JavaBonne section sur RMI, servi de base pour ce cours

Java Distributed ComputingPar Jim FarleyEditions O'ReillyTout sur les applications reparties avec JavaPlus technique...

Architectures réparties en JavaPar Annick Fron (2007)Edition DunodRMI, CORBA, JMS, Sockets, SOAP, services web