DCOM(Distributed COM) - PowerPoint PPT Presentation

1 / 56
About This Presentation
Title:

DCOM(Distributed COM)

Description:

DCOM(Distributed COM) Presenter: R89725009 R89725037 – PowerPoint PPT presentation

Number of Views:105
Avg rating:3.0/5.0
Slides: 57
Provided by: Alub
Category:

less

Transcript and Presenter's Notes

Title: DCOM(Distributed COM)


1
DCOM(Distributed COM)
  • Presenter
  • ???? R89725009 ???
  • ???? R89725037 ???

2
??
  • Component Object Model
  • Distributed COM
  • DCOM Example With MFC
  • SAP
  • DCOM Component Connector

3
Component Object Model
  • COM ???????????????
  • COM?????
  • ??COM?????????????
  • COM?????
  • COM??????????????API
  • ?????????????
  • ?????
  • ???? (in-process server)
  • ???? (out-of-process server, local server)
  • ???? (remote server)

4
COM ?????
  • ???? Componentware
  • COM ???
  • ????????????????
  • ?????
  • ?????

5
COM??
  • ???????????????????
  • ??COM??????????
  • ??????IID(Interface ID)
  • ???IUnknown??
  • ??????,??????
  • ?????????
  • ????????

6
IUnknown??
  • QueryInterface
  • ??????????????
  • AddRef?Release
  • ???????????,?????(Reference Count)???0?,???????
    ????????????,????????,

7
COM?????
  • ???????????????????
  • ??????????????,????
  • ???????
  • -???(In Process)
  • -??(Local)
  • -?? (Remote)

8
???(In-Process)
  • ?????????????????,?????????

9
???(In-Process)
  • In-Process ServerDLL??
  • ???,?DLL???????
  • ??????
  • ??????Process,??????

10
??(Local)
  • ??????????????????,????????????????

11
??(Local)
  • ????? EXE ??
  • ????,????????
  • Proxy-gt Marshaling-gtIPC (inter-process
    communication)-gtUn-marshaling-gtStub
  • ????? In-Process Server ?

12
??(Remote)
  • ??????????????,????????

13
??(Remote)
  • Client?? Server ?????????proxy/stub ?? marshaling
  • RPC(Remote Procedure Call) ??
  • Server??? DLL ??? EXE ??
  • (?? DLL,??? Server ?????,
  • ??? dllhost.exe)

14
COM?????(COM Library)
  • COM????????COM?????
  • ??COM????????????????DLL??,??DLL????COM????????
    ??
  • -???API??
  • -??????
  • -??????????
  • -????????

15
??????(Interface Definition Language)
  • ???????????
  • MIDL(Microsoft IDL???)
  • Proxy/Stub DLL
  • Proxy?stub??????proxy/stub DLL?,??DLL?????proxy
    ????stub???? ???????????????????,????proxy/stub
    DLL????????????? ?

16
COM?????????
  • ??(containment)

17
COM?????????
  • ??(aggregation)

18
??Visual Basic?? Excel
Dim obj Set obj CreateObject(Excel.Application
) obj.visible true obj.Workbooks.Add obj.Range(
"B3").Select obj.ActiveCell.FormulaR1C1
"12" obj.Range("B4").Select obj.ActiveCell.Formula
R1C1 "34
19
COM ???? Excel ????
  • ?? RegEdit.exe ?????
  • HKEY_CLASSES_ROOT CLSID 00024500-0000-000
    LocalServer32 excel.exe
  • Excel.Application CLSID
    00024500-0000-000
  • Excel.Application ProgID

20
COM Runtime
???????
COM Runtime
????(Monikers, Storage, Data Transfer,...)
DCOM
Registry
Pluggable Security(SSPI)
MS-RPC
NTLM
Pluggable Transports
DCE
Kerberos
ETC...
TCP
UDP
IPX
Tunneled TCP
ETC...
21
Core COM Services
  • Security
  • Lifecycle Management
  • Type Information (Interface Repository)
  • Monikers (Naming)
  • Automation (Dynamic Invocation)
  • Data Transfer
  • Component Categories
  • Registry

22
COM Runtime ArchitectureFlexible and extensible
Pluggable Transports
Server Machine
Client Machine
TCP, UDP
COMClient
SPX,IPX
COM Runtime
COM Runtime
Net BUI
HTTP
Falcon
Other Component
23
COM Runtime ArchitectureFlexible and extensible
Pluggable Security Providers
Server Machine
Client Machine
NTLM
COMClient
SSL, Certs.
COM Runtime
COM Runtime
NT Kerberos
DCE
Other Component
24
COM ??????
?????
?????
OLE32.DLL
Service Control manager (RPCSS.EXE)
25
COM ??????
?????
?????
OLE32.DLL
Service Control manager (RPCSS.EXE)
26
COM ??????
????
?????
?????
OLE32.DLL
OLE32.DLL
Service Control manager (RPCSS.EXE)
27
COM ??????
????
?????
?????
OLE32.DLL
OLE32.DLL
Service Control manager (RPCSS.EXE)
28
COM ??????
????
?????
?????
COM ?????
OLE32.DLL
OLE32.DLL
Service Control manager (RPCSS.EXE)
29
Distributed COM
  • Just COM with a longer wire
  • All COM components communicate in the same way
  • on the same machine
  • In-process, Out-of-process
  • across a Local Area Network
  • across a Wide Area Network
  • across the Internet
  • Same tools, knowledge, code

30
Distributed COM
  • Wire Protocol
  • Based on DCE RPC Specification
  • Interoperable with OSF DCE RPC implementations
  • We call it ORPC
  • ???????????
  • CreateObject(ProgID, Jacky)
  • DCOMCNFG.EXE

31
COM???????????????
  • ?? RegEdit.exe!
  • HKEY_CLASSES_ROOT
  • AppID
  • 00024500-0000-000
  • RemoteServerName jacky

32
DCOM ?????
????
?????
?????
OLE32.DLL
OLE32.DLL
SCM
SCM
33
COM???????
  • ????
  • ???????????????
  • (registry)???
  • ??????????????????
  • ???????
  • ????(default security)???????????????????
  • ????(component security)????????????????

34
To implement a class using MFCs interface maps
follows these steps
Implementation With MFC(1)
  • 1.Use Derive a class either directly or
    indirectly from
  • CCmdTarget.
  •   2.Use the DECLARE_INTERFACE_MAP function
    in
  • the derived class definition.
  • 3.For each interface you wish to support,
    use the
  • BEGIN_INTERFACE_PART?
  • END_INTERFACE_PART
  • macros in the class definition.

35
Implementation With MFC(2)
4.In the implementation file, use the
BEGIN_INTERFACE_MAP and END_INTERFACE_MAP
macros to define the class's interface
map. 5.For each IID supported, use the
INTERFACE_PART macro between the
BEGIN_INTERFACE_MAP and END_INTERFACE_MAP
macros to map that IID to a specific "part"
of your class.
36
Implementation With MFC(3)
6.Implement each of the nested classes that
represent the interfaces you support.
7.Use the METHOD_PROLOGUE macro to access the
parent, CcmdTarget-derived object.
8.AddRef, Release, and QueryInterface can
delegate to the CcmdTarget implementation
of these functions ExternalAddRef,
ExternalRelease, and ExternalQueryInterfac
e.
37
Macro of MFC Implementation(1)
  • BEGIN_INTERFACE_PART(localClass, iface)
  • END_INTERFACE_PART(localClass)
  • localClass?? interface ? class
  • ifaceclass ??? interface
  • ????????,???X??????????,????????

38
Macro of MFC Implementation(2)
  • DECLARE_INTERFACE_MAP
  • ?????????,????????????????
  • BEGIN_INTERFACE_MAP(theClass, baseClass)
  • END_INTERFACE_MAP
  • theClass ??? interface ? class
  • baseClass? class??????
  • ?implement?,???? interface map?

39
Macro of MFC Implementation(3)
  • STDMETHOD_
  • ?????(.h file)?,??method?
  • STDMETHODIMP_
  • ?implement?(.cpp),??method?
  • ?????????????????

40
Macro of MFC Implementation(4)
  • STDMETHOD
  • ?????(.h file)?,??method?
  • STDMETHODIMP
  • ?implement?(.cpp),??method?
  • ?????????HRESULT?????
  • METHOD_PROLOGUE
  • ????????,???pThis??????

41
CLASS FACTORY(1)
  • A COM object that implements the IClassFactory
    interface and that creates one or more instances
    of an object?

42
CLASS FACTORY(2)
  • IClassFactory??
  • ???IUnknow??,??member function
  • ?
  • virtual BOOL CreateInstance(int nlid,
  • void ppvObj)
  • 0

43
CLASS FACTORY(3)
  • Why Class Factory ?
  • ??????call target class?constructor,?object??????
    ???Class Factory
  • ???

44
???? Interface.h
  • struct Isum public IUnknown
  • STDMETHOD_(void, Sum) (int x,int y,
  • int revtal) 0

45
?CcmdTarget??derived??? ???? test.h
  • class CTest public CCmdTarget
  • ???
  • protected
  • ???
  • BEGIN_INTERFACE_PART(Sum, ISum)
  • STDMETHOD_(void, Sum) (int x,int y,int
    revtal)
  • END_INTERFACE_PART(Sum)
  • DECLARE_INTERFACE_MAP()


46
??implement test.cpp(1)
  • include "Interface.h"
  • include "test.h
  • ???
  • static const IID IID_ISum
  • 0x692d03a4, 0xc689, 0x11ce,
  • 0xb3, 0x37, 0x88, 0xea, 0x36, 0xde, 0x9e,
    0x4e
  • BEGIN_INTERFACE_MAP(CTest, CCmdTarget)
  • INTERFACE_PART(CTest, IID_ISum, Sum)
  • END_INTERFACE_MAP()

47
??implement test.cpp(2)
  • STDMETHODIMP_(ULONG) CTestXSumAddRef()
  • METHOD_PROLOGUE(CTest, Sum)
  • return pThis-gtExternalAddRef()
  • STDMETHODIMP_(ULONG) CTestXSumRelease()
  • METHOD_PROLOGUE(CTest, Sum)
  • return pThis-gtExternalRelease()

48
??implement test.cpp(3)
  • STDMETHODIMP CTestXSumQueryInterface(
  • REFIID iid, LPVOID ppvObj)
  • METHOD_PROLOGUE(CTest, Sum)
  • return pThis-gtExternalQueryInterface(iid,
    ppvObj)
  •  STDMETHODIMP_(void) CTestXSumSum(int x,int
    y,int revtal)
  • revtalxy
  • return

49
?????(1)
  • LPCLASSFACTORY pClf
  • LPUNKNOWN pUnk
  • ISum pSum
  • Imultilpy pMul
  • HRESULT hr
  • CLSID clsid
  •  
  • if ((hr CLSIDFromProgID(L"Test", clsid))
    ! NOERROR)
  • return

50
?????(2)
  • if((hrCoGetClassObject(clsid,CLSCTX_REMOTE_SERV
    ER, NULL, IID_IClassFactory, (void ) pClf)) !
    NOERROR)
  • return
  •  
  • pClf-gtCreateInstance(NULL, IID_IUnknown, (void)
    pUnk)
  • pUnk-gtQueryInterface(IID_ISum, (void) pSum)

51
?????(3)
  • int sum
  • pSum-gtSum(4,5,sum)
  •  
  • pClf-gtRelease()
  • pUnk-gtRelease()
  • pSum-gtRelease()

52
  • DCOM Component Connector
  • ?SAP?Microsoft????DCOM???????,????SAP?????
    ????components?????????????????????,?????????????
    ?(component),?????????????

53
  • ??DCOM Component Connector???(1)
  • A new dimension of openness
  • ??????? interface ?????????
  • Leverage existing programming skills
  • ?????????SAP tools?COM tools???
  • ??

54
  • ??DCOM Component Connector???(1)
  • Eased integration
  • ?????DCOM,????????????
  • ???????????DataBases
  • Evolutionary approach
  • ??????scalability,??????????
  • ???????

55
  • ????
  • SAP??DCOM Component Connector ???Business
    Framework,????component-based?integrated?open
    application software solution????SAP???collaborati
    ve e-business??mySAP.com ???Business
    Framework????????

56
  • Thank you!
Write a Comment
User Comments (0)
About PowerShow.com