stéphane frenot - département télécommunication - sid - stephane.frenot@insa- lyon.fr ii - dcom...
Post on 03-Apr-2015
110 Views
Preview:
TRANSCRIPT
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 1
De DCOM à .Net
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 2
DCOM : Solution microsoft
• Propriétaire– Intégrée avec d'autres produits Microsoft (architecture DNA :
Distributed Network Architecture)• COM
• ActiveX
• MTS
• MQS
– Fonctionne sur plusieurs plates-formes• NT/95
• Unix
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 3
Le document
• DDE : Dynamic Data Exchange– Service de transmission de messages pour faire communiquer
deux applications (1992)– Complexe uniquement implanté sur Excel
• OLE1 : Object Linking & Embedding– Repose sur DDE– Copier/coller
• OLE2 (1993)– Activation In-Situ
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 4
DCOM : Motivations
• Développement et évolution d'applications réparties sur des machines hétérogènes– Mécanismes "transparents" d'appel à distance
• Réutilisation de code– Réutilisation de composants binaires exécutables
• Pas d'accès au code source• Association d'interfaces multiple à un composant binaire
– Mécanisme de composition• Construction de composants à partir de composants existants
• Evolution dynamique– Remplacement de composants (sans recompilation ou édition de liens)
– Association de nouvelles interfaces
– Capacité d'auto-description
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 5
DCOM: Distributed Component Object Model
• DCE : Architecture distribuée
• COM (Component Object Model) le modèle d'objet composant (1996)
• Active-X: élément graphique actif que l'on peut assembler ou inclure
dans des documents
• DCOM: utilisation d’un modèle RPC de DCE pour les communications
entre objets (1997)
• (Ms)IDL: langage de définition d'interfaces
• .net / DNA / Hailstorm
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 6
COM
• Approche binaire des objets
• Un objet COM :– publie une et une série d'interfaces
– possède au moins une interface IUnknown• qui possède une méthode QueryInterface
• qui possède des méthode de gestion du cycle de vie (Addref(), Release())
– chaque interface présente un GUID
• 3 familles de composants– in-process, local, distant
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 7
COM est une fondation simple
• Instanciation / Publication• Appels RPC• Contrôle de fonctionnement mémoire
+• Nommage (moniker)• Stockage persistant• Transfert uniforme de données (flux)• Automation
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 8
La bibliothèque COM
• Elle fournit une API pour la gestion des composants– Initialisation et terminaison– Allocation et libération de la mémoire– Génération des GUID (identificateurs uniques)– Accès à la base de registres (GUID <--> Noms)– Création des composants– Enregistrement des fabriques de classes– Bibliothèque pour emballage et déballage des paramètres
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 9
La base de registre
• Base de donées permettant d'associer noms et GUID– CLSID -> Nom de fichier contenant le code d'implantation
• {0003DF…098} --> C:\ProgramFiles\Internet\iexplore.exe
– Nom familier(Progid)-->CLSID• Explorer.Appli_2-->{0003DF…098}
• Autres fonctions de désignation et recherche– Informations sur configuration, usagers, etc…– Informations utiles pour la répartition (cf. DCOM)
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 10
COM, ActiveX et OLE
Documents
Contrôles
Mise en script
Activation in situ
Liaison
Incorporation
Glisserrelâcher
Transfert uniformede données
Stockage persistant
Monikers
Automation
Modèle d'objet composant
COM
ActiveX
OLE
Documentscomposites
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 11
DCOM
ApplicationCliente
Proxy objetCOM distant
Proxy objetCOM local
SoucheCOM
ComposantCOM
SoucheCOM
ComposantCOM
Exécutable COM
Composant
Sécurité
DCERPC
Protocole de comm
CLIENT SERVEUR
Processus Client
Processus serveur
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 12
CInsideDCOM
•AddRef
•Release
•QueryInterface
•Sum
Cfactory
ISum
IClassFactory
IUnknown
Sum
CreateInstanceLockServer
AddRefReleaseQueryInterface
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 13
Exemple de code
import "unknwn.idl";
[object, uuid(10000001-0000-0000-0000-000000000001]
interface Isum:Iunknown{
HRESULT Sum([in] int x, [in] int y, [out, retval]int * retval);
};
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 14
Les étapes d'appel d'un service
• 1) Créer un composant (CLSID)
• 2) Obtenir un pointeur d'interface (IID)
• 3) Appel d'une méthode – fonction de l'interface
• 4) Terminer– Gestion de la mémoire
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 15
Exemple de code client
void main(){ Iunknown * pUnknown; Isum * pISum; HRESULT hr=CoInitialize(NULL); if(FAILED(hr)) cout << "CoInitialize failed."<<endl; const CLSID CLSID_InsideDCOM= {0x10000002,0x0000,0x0000,{0x00,0x00,0x00, 0x00,0x00,0x00,0x01}}; /*1*/ hr=CoCreateInstance(CLSID_InsideDCOM, NULL, CLSCTX_INPROC_SERVER, IID_Iunknown, (void**)&pUnknown); if (FAILED(hr)) cout << "CoCreateInstance failed."<<endl; /*2*/ hr=pUnknown->QueryInterface(IID_Isum, (void**)&pSum); if (FAILED(hr)) cout << "IID_Isum not supported."<<endl; pUnknown->Released(); int sum; /*3*/ hr=pSum->Sum(2,3,&sum); if(SUCCEED(hr)) cout << "Client: Calling Sum(2,3)= » << sum << endl; /*4*/ pSum->Released(); CoUninitialize();}
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 16
Conclusion sur DCOM
• Produit "propriétaire"– Lié à l'environnent Microsoft
• Environnement de développement spécifique (Visual…)
• Intégration aux autres outils– Office, Serveur Web IIS, IE, etc…
• Interconnexion possible sur CORBA
– Outil puissant, mais concepts difficiles à appréhender• Spécifications opaques
• Héritage d'OLE
– Nombreux composants diffusés• Windows / VB ...
Stéphane Frenot - Département Télécommunication - SID - stephane.frenot@insa-lyon.fr
II - Dcom 17
Références
• G. Eddon, H. Eddon, Au cœur de Distributed COM, Microsoft Press France, 1998
• R. Grimes, Professional DCOM Programming, Wrox Press, Canada, 1997
• Pointeurs– Microsoft
– http://www.sente.ch/cetus/OO_ole.html
– http://research.microsoft.com/~ymwang/papers/HTML/DCOMnCORBA/S.html
– http://www.execpc.com/~gopalan/misc/compare.html
top related