application servers g22.3033-011 · 2008. 7. 30. · the model tools support multi-language...

35
1 1 Application Servers G22.3033-011 Session 10 - Sub-Topic 1 A COM+ Application Scenario Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences 2 Goals Show by example that COM+ makes it: As easy to develop Server Components as it is to develop Client Components As easy to deliver enterprise apps as it is to deliver workgroup apps!

Upload: others

Post on 26-Feb-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

1

1

Application ServersG22.3033-011

Session 10 - Sub-Topic 1A COM+ Application Scenario

Dr. Jean-Claude Franchitti

New York UniversityComputer Science Department

Courant Institute of Mathematical Sciences

2

Goals

Show by example that COM+ makes it:• As easy to develop Server Components as it

is to develop Client Components• As easy to deliver enterprise apps as it is to

deliver workgroup apps!

Page 2: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

2

3

COM+COM+ Services:EventsSecurityLoad Balancing Queued ComponentsIn Memory DatabaseCompensating Resource ManagerAdministration

MTS

MTS Services: Transactions Resource Pooling Security Administration

COMThe ModelTools SupportMulti-LanguageDiscovery (QI)

COM+The caring, sharing

environment for yourcomponents

Technology Scenario

4

Application Scenario

• Online service like MSN or AOL• User login causes two databases

to be updated– Customer Billing Log– Customer Login Status

• Total connect time is tracked• User is notified of various activities while they

are logged in(i.e. chat rooms)

Page 3: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

3

5

Web clients Web infrastructureLogon

Business applications

Logoff

Securitybilling

Real-timeProfile-directed

information

Content

Billing

ExistingBilling System

ExistingBilling SystemExistingBilling SystemCustomer

onlinesystem

ExistingBilling SystemExistingBilling SystemExistingbilling system

ExistingBilling SystemExistingBilling SystemExistingBilling SystemExistingbilling system Existing

Billing SystemExistingBilling System

Othersystems

Application Flow

6

Application Object Model

OnlineEventsLoginEventClass dbOnlineEvent

Update

IMDBdbCustomerPreferences

BusCustomerLogin

dbCustomerupdate

BillingDatabase

dbCustOnline CustomerDatabase

Page 4: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

4

7Many others…

Application Requirements

• Ultimate customerresponse andavailability

• Always accept Logon• No freebies! Always bill

for entiretime online

• Use existingbilling system

• Use existingdev resources

• Keep billing, CustomerOnline and othersystems consistent

• Real-time two way infoon who is on

• Real-time info on whatis going on

• Flexible administration• Maximize use of

platform, minimizedevelopment time

8

Tackling TheApplication Requirements

• Ultimate customerresponse and availability

• Always accept legitimatelogin

• No freebies! Always billfor entiretime online

• Use existingbilling system

• Use existingdev resources

• Others…

• Keep billing, CustomerOnline and other systemsconsistent

• Real-time two way info onwho is on

• Real-time info on what isgoing on

• Flexible Administration• Maximize use of platform,

minimize developmenttime

Page 5: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

5

9

Requirement: Simplify Server SideDevelopment

• Issues:

Appliances Applications

– Threading– Synchronization– Data Base Connection pooling– Communications - front and back ends

10

Applicationclient

COM+ Server process

ConcurrencySecurity

Services...Application

ComponentsIFoo

Requirement: Simplify Server SideDevelopment

• Solution: core COM+ Services– You write a “single user” component as though it were the

only user of DB resources– COM+ provides the rich service environment which makes

your component multi-user, multi-threaded and resourcepooled

Page 6: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

6

11

Core Application Services• COM+ provides:

– Administrator controlled process placement– The context– Sharing automatically managed by COM+– Auto Completion (or explicit

SetComplete, SetAbort)

• All you have to do:– Stick with the model (or be aware of consequences of

leaving model)– (Basic component walkthrough)

12

Tackling TheApplication Requirements

• Ultimate customerresponse and availability

• Always accept legitimatelogin

• No freebies! Always billfor entiretime online

• Use existingbilling system

• Use existingdev resources

• Others…

• Keep billing, CustomerOnline and other systemsconsistent

• Real-time two way info onwho is on

• Real-time info on what isgoing on

• Flexible administration• Maximize use of platform,

minimize developmenttime

Page 7: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

7

13

Flexible Administration

• Issues– Different Administration dimensions– Application Distribution– Connectivity

Now!

14

Flexible Administration

• Solution: COM+ Administration– Features: extends administration to all COM

Components, supports administration of new servicesand provides a complete programmatic interface forinstallation, configuration and deployment automation

Catalog Attributes

Page 8: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

8

15

Administrative Model• Applications are defined and components are

installed in the applications that they are to run in• Attributes are set declaratively

on the components• Transactions• Security roles• Activation properties

• SDK - complete automation capabilities

16

Administration Example

• Walkthrough of Billing system deployment• Billing components are updated

on the dev machine• The Application can be exported manually:

– Application information and the DLLs to be moved to theaccounting server and…

– ActiveX® Control is downloaded to the client using theCODEBASE tag and a CLSID

– Or…• Auto download of components on demand

• Requires Windows 2000 Directory Service

Page 9: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

9

17

Tackling TheApplication Requirements

• Ultimate customerresponse and availability

• Always accept legitimatelogin

• No freebies! Always billfor entiretime online

• Use existingbilling system

• Use existingdev resources

• Other…

• Keep billing, CustomerOnline and other systemsconsistent

• Real-time two way info onwho is on

• Real-time info on what isgoing on

• Flexible administration• Maximize use of platform,

minimize developmenttime

18

Database Consistency• Issues:

– Updating multiple Resource Managers• (DB, IMDB, MSMQ)

– Avoiding conflicts– Multiple simultaneous users– Indeterminate numbers of users

Other DataSources

BillingDatabase

CustomerDatabase

BusCustomerLogin

dbCustomerupdate

dbCustomerOnline

Page 10: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

10

19

IFoo

Applicationcomponents

COM+ Server Process

ApplicationcomponentsApplication

Clients

Applicationclients

Transactionservices

Database Consistency

• Solution: COM+ Transaction Services– Features:

• System provided transactions on activation, commit on deactivation,abort on errors

• System enforced serialization• Manual (SetComplete, SetAbort)

or Auto completion

20

Consistency Example

• COM+ Transaction Services– Transaction code and attribute walkthrough– Bus_Customer calls db

_CustomerBilling and db_CustOnlineStatus– Distributed transaction occurs (transparently) when user logs

on– Without Transactions customer could be billed for time even

if they failed to complete the logon or…– They might not get billed even though they successfully

logged on– Auto Completion (not in the Preview)– Transaction code and attribute walkthrough

Page 11: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

11

21

Tackling TheApplication Requirements

• Ultimate customerresponse and availability

• Always accept legitimatelogon

• No freebies! Always billfor entiretime online

• Use existingbilling system

• Use existingdev resources

• Other…

• Keep billing, CustomerOnline and other systemsconsistent

• Real-time two way info onwho is on

• Real-time info on what isgoing on

• Flexible administration• Maximize use of platform,

minimize developmenttime

22

Application Security• Issues:

– Security Dimensions– Distributed application– Components being Compounded

Customerlogin

dbCustomerUpdate

dbCustomerOnline

Page 12: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

12

23

COM+ Server process

Applicationclient

Securityservice IFoo

ApplicationServer

Application Security• Solution: COM+ Security Services:

– Role-based access control on classes, interfaces andMETHODS,

– mapping roles to Windows 2000domain accounts

24

Security Example• Application context

– Customer billing information needsto be protected

– When a user logs on the bus_Customer componentrunning on the Web server will call the accounting server

– Using roles the Web server will be allowed to call theaccounting server but you may not call the componentdirectly

– Roles established in package definition– Roles established in the IDE– Code and Attribute walkthrough

Page 13: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

13

25

Tackling The Application Requirements -The Story So Far

• Ultimate customerresponse and availability

• Always accept legitimatelogon

• No freebies! Always billfor entiretime online

• Use existingbilling system

• Use existingdev resources

• Other…

• Keep billing, CustomerOnline and other systemsconsistent

• Real-time two way info onwho is on

• Real-time info on what isgoing on

• Flexible administration• Maximize use of platform,

minimize developmenttime

26

Tackling Other Application Requirements

• Ultimate customerresponse and availability

• Always accept legitimatelogon

• No freebies! Always billfor entiretime online

• Use existingbilling system

• Use existingdev resources

• Other…

• Keep billing, CustomerOnline and other systemsconsistent

• Real-time two way info onwho is on

• Real-time info on what isgoing on

• Flexible administration• Maximize use of platform,

minimize developmenttime

Page 14: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

14

27

Even Easier!• Coming soon

– Direct manipulation of attributes from IDE– Direct manipulation of COM+ administration from

IDE• The COM+ Wizardo

28

Conclusion

COM+ makes it:• As easy to develop Server Components as it

is to develop Client Components• As easy to deliver enterprise apps as it is to

deliver workgroup apps!

Page 15: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

15

29

Call To Action• Architecting, designing, developing:

– Assume COM+ level of service and use Windows2000 now

• Deploying and in production:– Use Microsoft Transaction Server now - your

components will be uplifted when COM+ is installed• Everything discussed is a standard feature of

Windows 2000

30

References on COM+

• Books– Chappell. Understanding ActiveX and OLE– Eddon. Inside DCOM– Grimes. Professional DCOM– Box. Essential COM

• COM Home Page– http://www.microsoft.com/com/

• Windows 2000 Platform SDK– NT 5.0 Beta 2 or later

Page 16: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

16

31

Questions?

32

AddendumCOM+ Technology

Page 17: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

17

33

More Details on COM+

• Review: COM and MTS Today• COM+ Architecture

34

ReviewCOM Architecture

• Object Creation– In-process– Remote

• Calling an Interface Method

Page 18: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

18

35

ScenarioCOM Architecture

main() { IAS15Demo* pInt; CoInitialize(NULL); CoCreateInstance(CLSID_AS15Demo, NULL, CLSCTX_SERVER, IID_IAS15Demo, &pInt); pInt->DoSomething(); …}

36

Client Process

Client

COM Runtime

1

SCM2

Registry{CLSID} Server.DLL

Component

3

5

object 4

Object CreationIn-Process

Page 19: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

19

37

Surrogate ProcessComponent

5

ISurrogate

Client

COM Runtime

1

SCM2

Registry{AppID} RemoteServerName

3 4

COM Runtime

SCM

7

{CLSID} Server.DLL

Registry{AppID} DllSurrogate

object 6

Object Creation (Remote)

38

Client Process

COM

ClientApp

In-ProcessServer

In-ProcessObject

RPC

Local Server Process

LocalObjectProxy

Local Server

LocalObject

COM

Stub

Remote Server MachineRemoteObjectProxy

RPC

Remote Server Process

Remote Server

RemoteObject

COM

Stub

Calling An Interface Method

Page 20: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

20

39

ReviewMTS Architecture

• Object Creation– From base client– From component

• Calling an Interface Method

40

Scenario: MTS ArchitectureBase Client

Main() { IAS15Demo* pInt; CoInitialize(NULL); CoCreateInstance(CLSID_AS15Demo, NULL, CLSCTX_SERVER, IID_IAS15Demo, &pInt); pInt->CreateSubObject(); …}

Page 21: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

21

41

Scenario: MTS ArchitectureComponent

CAS15DemoImpl::CreateSubObject() { IObjectContext* pCtx; IAS15DemoSub* pSub; GetObjectContext(&pCtx); pCtx->CreateInstance(CLSID_AS15DemoSub, IID_IAS15DemoSub, &pSub); pSub->DoSomethingElse(); …}

42

MTS Surrogate

3

MTS Executive

4Client

7

Component

5

Context wrapper

Objectcontext8

9

COM Runtime

1

SCM2 Registry{CLSID} MTX {package}

Object CreationFrom Base Client

Classfactory

wrapper

6 Class object

Page 22: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

22

43

MTS Surrogate

MTS Executive Component

Class object

Context wrapper

Classfactory

wrapper

Objectcontext

Object context

MTS Catalog

Creator IDActivity

TransactionSecurity Properties

Object CreationMore about Context

44

MTS Surrogate ProcessMTS Executive Sub Component

Class objectClass factory

wrapper

Component

Object

Object Context

1

MTS Catalog

2

Context wrapper

Objectcontext

3

4

Object CreationFrom Component

Page 23: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

23

45

MTS Surrogate ProcessMTS Executive Component

Class object

Context wrapper

Objectcontext

Client1

2

Object3

Calling An Interface Method

46

COM+ Architecture• What is COM+?• Concepts• Activation• Interception• Services

Page 24: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

24

47

What Is COM+?• Unification of COM and MTS• Plus...

– Extensions to base COM– Extensions to MTS services– New Services

• Minimal impact on how youwrite components

• Remoting architecture doesn’tchange (DCOM)

48

Applications And Classes

• COM+ Applications– Evolution of MTS Packages– Library applications run in-process– Server applications run in COM+ surrogate

• COM+ Classes– Configured classes

• Installed in application• Can use COM+ Services

– Unconfigured classes• Everything else...

Page 25: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

25

49

COM+ Thread Types

• Single-Threaded Apartment (STA)– Synchronized using windows messages– Call that leaves thread causes message loop to

execute• Multi-Threaded Apartment (MTA)

– No synchronization– Call leaving thread blocks further execution on

thread– RPC worker threads are this type

50

COM+ Apartment Types• Apartment

– Collection of objects and their contexts• Single-Threaded

– Objects execute on STA thread where they werecreated

• Multi-Threaded– Objects execute on any MTA thread

• Neutral (New!)– Objects execute on caller’s thread type

Page 26: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

26

51

COM+ Domains• Independent aspects of an

execution environment• Objects with same aspect

share a domain• Locality (machine, process, apartment)• Service specific (e.g. transaction T1,…)

• Arbitrarily intersect and nest

52

COM+ Context• An intersection of domains

– Boundary around objects sharing the same properties• Every object lives in a context

– Non-default context• Objects from configured classes

– Default context• Objects from unconfigured classes

• The basis for COM+ Services

Page 27: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

27

53

Domains And Contexts

Process

Apartment

Context

Domain

54

Scenario: COM+ ClassBase Client

Main() { IAS15Demo* pInt; CoInitialize(NULL); CoCreateInstance(CLSID_AS15Demo, NULL, CLSCTX_SERVER, IID_IAS15Demo, &pInt); pInt->CreateSubObject(); …}

Page 28: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

28

55

No special creation APIrequired. Context flows

automatically

Scenario: COM+ ClassComponent

CAS15DemoImpl::CreateSubObject() { // IObjectContext* pCtx; IAS15DemoSub* pSub; // GetObjectContext(&pCtx); // pCtx->CreateInstance(CLSID_AS15DemoSub, // IID_IAS15DemoSub, &pSub); CoCreateInstance(CLSID_AS15DemoSub, NULL, CLSCTX_SERVER, IID_IAS15DemoSub, &pSub); pSub->DoSomethingElse(); …}

56

Client Process

Client

COM+ Runtime

1

2Activator

3CatalogRegistry RegDB

4

Context

Component

5

object

6

ActivationFrom Base Client, In-Process

Page 29: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

29

57

COM+ Runtime

Catalog

Activator

COM+ Runtime

Catalog

Activator3

Client

1

4

6

Activation (Remote)Surrogate Process

Component

object

5

ISurrogate

2

58

COM+ Catalog

• Unifies and extends COM,MTS registration

• Activator queries Catalog• Catalog supports two data stores

– Registry (HKCR) for unconfigured classes– RegDB for configured classes

• RegDB populated from…– Meta-data in self-describing components– Administrative tools

Page 30: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

30

59

Self-Describing Component

• Type library (TLB)– Class, interface, method signatures

• Component Library (CLB)– Attributes and registration information

• Transaction, Synchronization, Queueable,Loadbalanceable, Roles

• ThreadingModel, Component Categories, FileExt

• Requires Developer Tool Support– IMetaDataEmit/IMetaDataImport

60

Activators

• Extensible architecture forobject creation

• Activator chain determines...– Object location– Context properties

• COM+ provides system activators and defineschain order

Page 31: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

31

61

ContextActivators

ProcessActivators

MachineActivators

ServerProcess

ServerContext

ClientProcess

AB

Activator Chain

62

Context Revisited

• Context contains a set ofcontext properties

• Context properties can flow from client tonew object’s context

• Once initialized, context is immutable

Page 32: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

32

63

Component

Object

COM+ Runtime

1 Activator2

Catalog

4

Context Properties

PrototypeContext

Properties

3

ActivationFrom Component

64

Component

Object

Context Properties

1

COM+ Runtime

Catalog

Activator2

34

ContextIdentical

Sub Component

Sub Object

5a

6a

ActivationFrom Component

Page 33: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

33

65

5bContext Properties

Component

ObjectContext Properties

1

COM+ Runtime

Catalog

Activator2

34

Sub Component

Sub Object

ContextDifferent

6b

ActivationFrom Component

66

Context C1 Context C2

ClientSide

Policies

ServerSide Policies

Call,Return

Enter,Leave

Pass Buffer

Pass Buffer

Proxy Stub(Cross Apartment or Process)

(Same Apartment)A B

InterceptionCalling an interface method

Page 34: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

34

67

COM+ Services• Build on unified architecture• Lots of PDC talks on Services…

– AS12, AS13 -- Services Overview– AS09 -- Security– AS16 -- Object Pooling– AS07 -- Events– AS08 -- Load Balancing– AS10 -- Queued Components– AS11 -- In-Memory Database– AS06 -- Deployment, Administration

68

Summary

• COM+ unifies COM and MTS– Extensible activation architecture– Extensible interception architecture

• COM+ extends COM and MTS– Services build on unified architecture– Additional calling models available

Page 35: Application Servers G22.3033-011 · 2008. 7. 30. · The Model Tools Support Multi-Language Discovery (QI) COM+ The caring, sharing ... client COM+ Server process Concurrency Security

35

69

Questions?