g22 3033 011 c101 - nyu.edu...web-enabling facilities (continued) java web start (jws) com / dcom...

69
1 Application Servers G22.3033-011 Session 10 - Main Theme .Net/COM+ Component-Based Computing Environments Dr. Jean - C l aude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences 2 Agenda Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message Queuing .Net/COM+ Integrated Services Enterprise Component Development with .Net/COM+ Designing .Net/COM+ Component-Based Architectures Summary Readings Assignment #7 (continued)

Upload: others

Post on 21-May-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

1

1

Application Servers G22.3033-011

Session 10 - Main Theme.Net/COM+ Component-Based

Computing Environments

Dr. Jean- Claude Franchitti

New York UniversityComputer Science Department

Courant Institute of Mathematical Sciences

2

Agenda

Web-Enabling Facilities (continued)Java Web Start (JWS)

COM / DCOM Component Model and OLECOM+ MTS Services: Transactions and SecurityCOM+ Message Queuing.Net/COM+ Integrated ServicesEnterprise Component Development with .Net/COM+Designing .Net/COM+ Component-Based ArchitecturesSummaryReadingsAssignment #7 (continued)

Page 2: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

2

3

Summary of Previous Session

J2EE Client Component Infrastructures (continued)CORBA 3 OMA ServicesCORBA 3 CCMCORBA 3 EnvironmentsEnterprise Component Development with CORBA 3Designing CORBA 3 Component-Based ArchitecturesSummaryReadingsAssignment #7

4

Application Servers ArchitecturesApplication Servers for Enhanced HTML (traditional)

a.k.a., Page-Based Application ServersMostly Used to Support Standalone Web Applications

New Generation Page-Based Script-Oriented App. ServersFirst Generation Extensions (e.g., Microsoft IIS with COM+/ASP)Servlet/JSP EnvironmentsXSP EnvironmentCan now be used as front-end to enterprise applications Hybrid development environments

Distributed Object Computing PlatformsProvide an infrastructure for distributed communications enabling Still need to merge traditional web-oriented computing with object computing

Object Management ArchitecturesDOC Platform + APIs to reusable services and facilities

OMAs+Client/Server Component Models -> J2EE, CCM, DNA

Page 3: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

3

5

CORBA 3 References

OpenCCM Documentationhttp://openccm.objectweb.org/doc/index.htmlGetting started with OpenCCM Tutorial

http://openccm.objectweb.org/doc/0.5/tutorial_Getting_Started_with_OpenCCM.ppt

OpenCCM Installation Guidehttp://openccm.objectweb.org/doc/0.8/install_guide.html

OpenCCM 0.8 Downloadhttp://openccm.objectweb.org/download/index.html

6

Part I

Microsoft Platform Architectures(includes slides covered in previous sessions)

Also See:

“http://www.execpc.com/~gopalan/misc/compare.html”“http://www.javacoffeebreak.com/articles/rmi_corba/”

“http://www.quoininc.com/articles.html”

Page 4: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

4

7

Microsoft Active Platform(Logical Architecture)

8

Microsoft Active Platform(Features)

Logically centralized architecturePhysically de-centralized architectureScripting

Client-Side: Improved user interface and data validationServer-Side: Business rules and data accessVBScript and JavaScript built-in supportPerlScript support via ActiveX scripting engine (e.g., ActiveState’s)Ability to mix scripting languages

Active Server ComponentsProvide OS services to ASPsEncapsulate business rules to ease programminge.g., TextStream Component (FileSystem object)

Page 5: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

5

9

Microsoft Active Platform(Physical Architecture)

10

Microsoft Component Object Model(Logical Architecture)

Page 6: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

6

11

12

Page 7: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

7

13

14

Page 8: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

8

15

16

COM IDL(stockMarket.idl)

Example:[uuid(7371a240-2e51-11d0-b4c1-444553540000),version(1.0)]library SimpleStocks{importlib("stdole32.tlb");[uuid(BC4C0AB0-5A45-11d2-99C5-00A02414C655),dual]interface IStockMarket : IDispatch{HRESULT get_price([in] BSTR p1, [out, retval] float * rtn);}

Page 9: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

9

17

COM IDL(continued)

Example:[

uuid(BC4C0AB3-5A45-11d2-99C5-00A02414C655),]coclass StockMarket{interface IStockMarket;};};

18

Page 10: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

10

19

20

DCOM Architecture Review

Page 11: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

11

21

DCOM Object Activation/Method Invocation(top layer - basic programming architecture)

22

DCOM Object Activation/Method Invocation(middle layer - remoting architecture)

Page 12: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

12

23

DCOM Object Activation/Method Invocation(bottom layer - wire protocol architecture)

24

Page 13: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

13

25

COM+

See Session 4:Sub-Topic 3 Presentation on Introduction to CORBA, DCOM, and RMI

See Session 5:Sub-Topic 3 on Introduction to .Net/C#Sub-Topic 4 on Building COM+ Applications

26

COM+ = DCOM/COM + MTS

Page 14: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

14

27

DNA Web Architectures

FORM+ = Merger of Win32 GUI and Web APIs (~DHTML)STORAGE+ = OLE DBCOM+ = COM + MTS

28

Distributed InterNetApplications Architecture (DNA)

Page 15: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

15

29

Microsoft DNA Environment(summary)

See comparison of EJB and MTS models:http://members.tripod.com/gsraj/misc/ejbmts/ejbmtscomp.html

Environment combinesCOM+ (DCOM+MTS) Component ModelWin32/SCM and DCOM/COM+ ServicesVisual Studio Development Environment

30

Microsoft IIS with COM+/ASP FeaturesIDE:

Visual InterDev (ASP)Management of site development processScripting

Alternative IDEsMacromedia Drumbeat, Ultradev, DreamweaverNetObjects FusionMicrosoft FrontPage 2000Adobe GoLive

Server PlatformsWindows 2000/NTUse ChiliSoft for other platforms (http://www.chilisoft.net/)

Platforms: Solaris, Linux, AIX, HP-UX, WindowsImmunity from current IIS attacks (e.g., code red worms on Win 2000)Web Server: Apache, iPlanetChili!Beans support for Java (similar to Microsoft with COM+ and ASP for C++)

Page 16: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

16

31

Microsoft IIS with COM+/ASP FeaturesSee “Microsoft IIS, COM+, and ASP” in “Web Server Brains”COM+ / ASP

Equivalent to J2EE EJB / JSPIncluded in Microsoft Windows 2000 Advanced Server

COM+Attributes (declare what runtime services are needed by the component)Threads and database connection pools (access via Active Data Object API)

ASP Object Model sub-systemsHTTP requestCOM+ transactionExternal COM+ components

Other solution components:Visual Studio 6.0Internet Security and Acceleration Server (ISA)

static content caching, fault tolerance, load balancing, request handling

32

Microsoft .NET PlatformSmart Devices + Windows XP + Web Services

http://www.microsoft.com/netFirst set of Microsoft Web Services

http://www.microsoft.com/net/hailstorm.asp

Page 17: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

17

33

Part II

Win32 and COM+ Services(includes slides covered in previous session and new ones)

“http://members.tripod.com/gsraj/misc/ejbmts/ejbmtscomp.html and related archives”

and Session 10 Sub-Topic 1 Presentation on “A COM+ Application Scenario”

34

DNA OMA Services

Activation ServicesDCOM Activation Framework

Naming and Directory ServiceDCOM Class and Object Naming (i.e., CLSIDs, ProgIDs, and Monikers)

Trading ServiceMicrosoft Active Directory

Transaction ServiceCOM+ MTS

Messaging ServiceCOM+ MSMQ

Page 18: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

18

35

Win32 Services

Win32 executable that satisfy several propertiesLifetime is controlled by the Service Control Mgr (SCM)

Service is registered with SCM, and understands and obeys SCM commands

Service has its own login session or shares one with another service

Service runs as a user or local system and abides to applicable security

Service implements a set of service-specific functions:Starting up, message handler, communication back to SCM

36

COM+ Services

COM+ Catalog (v.s. Windows Registry)COM+ Load BalancingCOM+ In-Memory Database (IMDB)COM+ Object PoolingCOM+ Queued ComponentsCOM+ EventsC++ Compiler Changes

Page 19: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

19

37

DCOM Class and Object Naming(file moniker file: bind)

38

DCOM Class and Object Naming(url moniker http:, ftp:, gopher: bind)

Page 20: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

20

39

DCOM Class and Object Naming(class moniker clsid: bind)

Display name for class monikers:display-name = "CLSID:" string-clsid-no-curly-braces *[";" clsid-options] ":"clsid-options = clsid-param "=" valueclsid-param = none currently defined

C++ example (tell moniker to use an object that can read a document instead of the document itself):ProgIDFromCLSID( &clsid, "xyz.activator.1")CreateClassMoniker( clsid, &pmkClass )MkParseDisplayName( pcb, "\\northamerica\central\employee.doc", &dwEaten, pmkFile )pmkFile->BindToObject( pcb, pmkClass, IID_IDispatch, &pDisp )

40

COM+ Catalog v.s. Windows Registry

Stores COM+ application attributes, class attributes, and computer-level attributesGuarantees consistency among attributesProvide common operations on top of attributesTwo different stores

COM+ registration databaseMicrosoft Windows Registry (HKEY_CLASSES_ROOT)

COM components that do not require new COM+ servicesType libraryInterface proxy/stub registration

Unified logical view via COM+ Admin Library

Page 21: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

21

41

Microsoft Active Directory

Maintains user, security, and network resourceinformation used on a Windows 2000 networkDCOM components can store their activationand connection information in the ADSCOM objects can be exposed as APIs to ADS

42

Trading Service - Active Directoryhttp://www.microsoft.com/windows2000/server/evaluation/features/dirlist.asp

Page 22: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

22

43

COM+ Load Balancing

44

COM+ IMDB

Page 23: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

23

45

MSMQ MessagingUpon queued component instantiation

Local recorder proxy object is created

As the client makes method callsLocal recorder object serializes the calls into MSMQ messages

Client commits the object by releasing all references to itMessage is passed to the server via MSQMSpecial service running on the server de-queues messages and instantiate the component using a player proxy

Upon failureA message is placed back on the queue

Getting back to the clientNo response neededResponse queues (asynchronous reporting)Pass by value interface references

46

COM+ Queued Components

Page 24: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

24

47

Using COM+ Queued Components Svc.Example:

IOrder* pOrder = 0;CoCreateInstance( CLSID_Order,

...IID_IOrder,(void**) &pOrder );

pOrder->put_Customer( 2000 );pOrder->put_Quantity( 2 );CComBSTR bstrSKU( "3535-2334" );pOrder->put_SKU( bstrSKU );

long lOrderNumber;pOrder->Submit( &lOrderNumber );pOrder->Release();

48

COM Event Handling Mechanisms

Events/Callbacks via client interfaceClient implements an interface defined by the componentUses Advise/Unadvise methods (see example in later slide)Events/notifications are handled via calls through the client interface

Connectable Objects via COM Events modelUses standard COM IConnect-ionPoint interfacesIncludes runtime recovery and minimal multi-casting capabilitiesObjects play the role of publishers/subscribersNo support for persistent connectionOverall complex Event model to use

COM+ Events modelIntroduces an event class object to decouple publisher and subscriber

Page 25: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

25

49

COM+ Events

50

Using COM+ EventsCOM Event Model:

// Our event interfaceinterface IMyEvents : IUnknown{ HRESULT SomethingHappened( BSTR

bstrWhat );}// An interface on our componentinterface ISomeInterface : IUnknown{ ...

HRESULT Advise( IMyEvents* pIEvents );HRESULT Unadvise();

}

COM+ Event Model:interface IEventClass : public IDispatch{

HRESULT put_EventClassID( BSTR bstrEventClassID );HRESULT put_EventClassName( BSTR

bstrEventClassName );HRESULT put_FiringInterfaceID( BSTR

bstrFiringInterfaceID );...

};

Page 26: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

26

51

C++ Compiler Changes

Sample Attributes:in/out direction of parameter in a methodthreading modelcomponent housing (i.e., DLL or EXE)

52

Creating an MTS ComponentExample:

try {

// create the MTS componentbank.IChecking server=

(bank.IChecking) new bank.Checking ();

// invoke business methods on the componentserver.createAccount (1234, "Athul", 1000671.54d);

}catch (Exception ex) {ex.printStackTrace ();

}

Page 27: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

27

53

.NET Framework

Common Language Runtime (CLR)Accessible to any compiler that produced Microsoft Intermediate Language (IL) code

Runtime ClassesVisual Studio.Net (VS.Net)

Includes VB.Net, VC.Net (C#), and Visual C++.Net

54

.NET, Win32, COM, and COM+

.Net applications can call functions that reside in Win32 DLLs via the DllImport attribute of System.Runtime.InteropServices’ platform invocation (PInvoke) services.Net applications can call traditional COM components using Runtime Callable Wrappers (RCWs) which uses interop assemblies (i.e., .Net components) created via COM Interop using the TLBIMP utilityCOM+ services (transactions, object pooling, JIT activation) can be used from .Net (via System.EnterpriseServices namespace).Net runtime uses COM+ to support some of its services (e.g., transactions for managed classes)

Page 28: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

28

55

.Net Remoting(http://www.dotnetremoting.cc/)

Native .Net Remote Object InvocationAllows Object Invocation and Communications Across Processes and MachinesWire Protocol and Format IndependentExtensible via Custom Formatters (SOAP, Binary, etc.), Channels (HTTP, TCP, etc.), and Sink Chain (i.e., Channels + Formatters) StepsFlexible as Configuration can be Changed after Deployment with Little or no Code ChangesFlexible (IIS not required on server) but more Complex than Web Services

56

.Net Remoting Vs. DCOM

Not as Transparent as DCOMHas no COM Interop InvolvedOffers More Deployment OptionsNot Tied to a Specific Wire Protocol or FormatFirewall FriendlyAllows you to Specify which Objects are Remoted

Page 29: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

29

57

.Net CLR and COM+CLR Introduces a Newer and Easier Programming Model for COM+The COM+ Services are still Available only at the OS/Unmanaged WorldTransitions Between Managed/Unmanaged Layers are Taken Care of by “System.EnterpriseServices” Namespace

System.EnterpriseServices.ContextUtil class provides access to contexts (as did CoGetObjectContext)

Services are Made Available to Components Using Attributes

58

ContextUtil ClassUseful Static Members

ActivityIdIsSecurityEnabledTransactionIdDesactivateOnReturnMyTransactionVote

Rich Set of Member FunctionsSetCompleteSetAbortEnableCommitDisableCommitIsCallerInRoleGetNamedProperty

Page 30: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

30

59

.Net and ServicedComponent

COM+ Class Derives from “ServicedComponent”[ComVisible(true)][ObjectPooling(MinPoolSize=2, MaxPoolSize=5)][Guid(“57F01F20-9C0C-4e63-9588-720D5D537E66)][Transaction(TransactionOption.Required)]public class SVCCompClass : ServicedComponent

In COM+ 1.0, the List of Services Are not ChangedIn COM+ 1.5 (Microsoft Windows XP Professional and .Net server), Newer Services are Available to Leverage CLR Features

60

Component Layers in .Net Applications/Services(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/distapp.asp)

Page 31: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

31

61

Security Policies in .Net Applications/Services

62

Operational Mgmt Policies in .Net Applications/Services

Page 32: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

32

63

Communication Policies in .Net Applications/Services

64

.Net Applications Support Technologies/Services(continued)

Security, Operational Management, Communication provided by Microsoft Windows OS Services

Active Directory ServiceMessage QueuingWindows Management Instrumentation (WMI)etc.

Page 33: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

33

65

.Net Applications Support Technologies/Services

66

Part III

COM+ Application Scenario

See Session 4 Sub-Topic 1 on “Distributed Communications Enabling”

Page 34: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

34

67

Part IV

Enterprise Component Development with .Net/COM+

(See Intro to C# at: http://www.ecma-international.org/activities/Languages/Introduction%20to%20Csharp.ppt,

overview of .Net athttp://www.enterprise-component.com/docs/WebServWs.ppt and

http://www.enterprise-component.com/docs/WebServWs.ppt)

68

Standard Library

Application Platforms Today

Operating System

Runtime Environment

BrowserApps

Web ServicesApps

OtherApps

LocalApps

GUI Services

Transaction Services

Web Scripting

Data Access

MoreRemote Access

Page 35: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

35

69

Component development with COM and CORBA

Component “Bus”

Servercomponent

Clientcomponent

IDL Stub

70

IDL spec

module Reservation{interface Flight_booking {Price ticket_price

(in Date day, in Flight number)raises (invalid_date, invalid_number);

exception invalid_date {Date when; };readonly attribute string name;

...}};

Page 36: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

36

71

The role of IDL

• Provide language-neutral interface description of a module’s operations

• As a result, enable clients and suppliers written in different implementation languages

72

The trouble with IDL

• Programmers must write IDL interface in addition to actual software

• If from an O-O language, IDL duplicates information present in the code, e.g. C++ header file

• Perils of duplication• IDL compiler goes the wrong way!• However: some tools ease the process.

Page 37: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

37

73

Pre-.NET approaches: summary

• Object technology is best known basis• Information hiding is key• O-O sufficient by itself: need for

autonomous components• Current approaches too heavy: extra work

to turn module (e.g. class) into component• IDL is a killer

74

.NET Framework Design Goals

• Dramatically simplifies development and deployment

• Unifies programming models• Provides robust and secure execution

environment• Supports multiple programming languages

Page 38: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

38

75

Framework, Languages, And Tools

Operating System

Common Language Runtime

Base Class Library

ADO.NET and XML

ASP.NETWeb Forms Web Services

Mobile Internet Toolkit

WindowsForms

Common Language Specification

VB C++ C# JScript J#Visual Studio.N

ET

76

Framework, Languages, And Tools

Operating System

Common Language Runtime

Base Class Library

ADO.NET and XML

ASP.NETWeb Forms Web Services

Mobile Internet Toolkit

WindowsForms

Common Language Specification

VB C++ C# JScript J#

Visual Studio.NET

Page 39: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

39

77

The .NET Evolution

Before COM, applications were completely separate entities with little or no integration

Application

Code and data structures

78

The .NET Evolution

COM provides a way for components to integrate; However, each component must provide the “plumbing” and objects cannot directly interact

Page 40: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

40

79

The .NET Evolution

With the .NET Framework common language runtime, components are built on a common substrate; No “plumbing” is needed and objects can directly interact

80

Assembly

Compilation And Execution

Source Code

Language Compiler

Compilation

At installation or the first time each

method is calledExecution

JIT Compiler

NativeCode

Code (IL)

Metadata

Page 41: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

41

81

Simplify Development

• Completely eliminates COM plumbing• No more…

– Registration– GUIDs– .IDL files– HRESULTs– IUnknown– AddRef/Release– CoCreateInstance

=>self described apps

=>hierarchical namespaces

=>unified object model

=>structured exceptions

=>common root object

=>garbage collector

=>”new” operator

82

Simplify Development

• Common Type System– Common instance and type definition

• Enables clean OO programming– Classes and interfaces– Constructors, properties, methods, events– Cross language inheritance

• Built-in interoperability– With COM– With native (Win32® style) DLLs

Page 42: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

42

83

Robust Environment

• Automatic lifetime management– All objects are garbage collected

• Exception handling– Error handling first class and mandatory

• Type-safety– No buffer overruns, No unsafe casts, Uninitialized

variables

84

Secure Environment

• Security designed-in • Code access security enforcement

– Security based on the identity of code – Administratively configurable via policy

• ASP.NET integrated authentication of user – Windows identity, Passport®, forms-based, …

• Cryptography library with XML DSIG support – Digital signature for XML (www.w3.org/signature)

Page 43: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

43

85

Simplify Deployment And Management

• Zero-impact install– Applications and components can be shared or

private• Side-by-side execution

– Multiple versions of the same component can co-exist on a system

• Assemblies – Contain dependency information

86Operating System

Common Language Runtime

Base Class Library

ADO.NET and XML

ASP.NETWeb Forms Web Services

Mobile Internet Toolkit

WindowsForms

Common Language Specification

VB C++ C# JScript J#

Visual Studio.NET

Framework, Languages, And Tools

Page 44: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

44

87

Unify Programming Models

Windows API

.NET Framework

Consistent API availability regardless oflanguage and programming model

ASP

Stateless,Code embeddedin HTML pages

MFC/ATL

Subclassing,Power,

Expressiveness

VB Forms

RAD,Composition,

Delegation

88

How Much Simpler?

Windows APIHWND hwndMain = CreateWindowEx(

0, "MainWClass", "Main Window",WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT,(HWND)NULL, (HMENU)NULL, hInstance, NULL);

ShowWindow(hwndMain, SW_SHOWDEFAULT); UpdateWindow(hwndMain);

.NET FrameworkDim form As New Form()form.Text = "Main Window"form.Show()

Page 45: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

45

89

Factored And Extensible

• The Framework is not a “black box”• Any .NET class is available for you to extend

through inheritance– Gives developers much more head room

• Plug and Play components and subsystems

90

The .NET Framework Library

Base Class Library

ADO.NET and XML

Web Forms Web ServicesMobile Internet Toolkit

WindowsForms

ASP.NET

Page 46: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

46

91

System

System.Data System.Xml

System.Web

GlobalizationDiagnosticsConfigurationCollections

ResourcesReflectionNetIO

ThreadingTextServiceProcessSecurity

CommonOleDb

SQLTypesSqlClient

XPathXSLT

RuntimeInteropServicesRemotingSerialization

Serialization

Configuration SessionStateCaching Security

ServicesDescriptionDiscoveryProtocols

UIHtmlControlsWebControls

System.Drawing

ImagingDrawing2D

TextPrinting

System.Windows.FormsDesign ComponentModel

The .NET Framework Library

92

Base Framework

System

ThreadingTextServiceProcessSecurity

ResourcesReflectionNetIOGlobalizationDiagnosticsConfigurationCollections

Runtime

SerializationRemotingInteropServices

Page 47: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

47

93

Data And XML

System.Data

System.Xml

SQLTypesSQLClient

CommonOleDb

SerializationXPathXSLT

94

System.Web

CachingConfiguration

Services UI

SessionState

HtmlControlsWebControls

DescriptionDiscovery

Security

Protocols

Page 48: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

48

95

Windows® Forms

System.DrawingDrawing2DImaging

PrintingText

System.Windows.FormsDesign ComponentModel

96Operating System

Common Language Runtime

Base Class Library

ADO.NET and XML

ASP.NETWeb Forms Web Services

Mobile Internet Toolkit

WindowsForms

Common Language Specification

VB C++ C# JScript J#

Visual Studio.NET

Framework, Languages, And Tools

Page 49: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

49

97

Languages

• The .NET Platform is language neutral– All .NET languages are first class players– You can leverage your existing skills

• Common language specification– Set of features guaranteed to be in all languages

• We are providing– Visual Basic®, C++, C#, J#, JScript®

• Third-parties are building– APL, COBOL, Delphi, Pascal, Eiffel, Haskell, ML,

Oberon, Perl, Python, Scheme, Smalltalk…

98

Standardization

• A subset of the .NET Framework and C# submitted to ECMA– Adopted as International standards in

Dec. 2001– In the ISO fast-track process now– Co-sponsored with Intel, Hewlett-Packard

• Common language infrastructure– Based on common language runtime and base

framework– Layered into increasing levels

of functionality

Page 50: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

50

99

Summary

• The .NET Framework– Dramatically simplifies development and

deployment– Unifies programming models– Provides robust and secure execution

environment– Supports multiple programming languages

100

Execution scheme under .NET

IL code(plus

metadata)

Loader

Managed code

Unjittedroutine call

Execution

Language compilers

JIT + verifier

EiffelVB C++C# .NET languages

Page 51: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

51

101

The basic .NET component unit

Result of compilation is an assemblyAssembly is a set of classesUnit of:• Delivery and deployment• Naming (through namespaces)• Security (level for granting permissions)• Versioning & side-by-side execution

Self-documenting through “manifest”

102

The Single Product Principle

• There is one product: SOFTWARE

e.g., Eiffel: use single, seamless notation throughout the development cycle

Rely on tools to produce documentationMaintain just one product!

Page 52: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

52

103

Single Product Principle in .NET

• It’s all in the metadata!

Definition:• Metadata is information about a module’s

external properties, not necessarily needed for executing the module, but retained after compilation along with the binary code

104

Examining an assembly with ildasm

Page 53: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

53

105

How is the metadata stored?

• Stuffed into PE (Portable Executable) format

• To Windows, result of compiling an assembly looks like ordinary binary(*.dll or *.exe), but contains all kindsof supplementary information

• Will execute on .NET only

106

The Portable Executable (PE) format

Page 54: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

54

107

Execution model: the role of metadata

IL code(plus

metadata)

Loader

Managed code

Unjittedroutine call

Execution

Language compilers

JIT + verifier

EiffelVB C++C# .NET languages

108

Metadata contents• Manifest: assembly description

– Name, version, culture– Security properties: Needed permissions– Public key if present– Dependencies on other assemblies

• List of classes• For each class:

– Features: methods, fields, properties, events– Signatures (argument and result types) of each– Interfaces it implements

• Custom attributes (see next)

Page 55: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

55

109

Working with metadata

Letting a program access metadata:• Use System.ReflectionExamining metadata interactively:• Use ILDasmCan convert metadata to:• XML• COM type libraries (regasm)To produce metadata:• Use System.Reflection.Emit

110

.NET component model

• Single product principle: full reflectivity; assemblies are self-documenting

• (Groups of) classes directly yield components• No extra plumbing• No IDL• Full application of Object-Oriented principles• Multi-language interoperability

Page 56: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

56

111

Part V

Designing .Net/COM+ Component-Based Architectures

(See: Architecture Driven Development at http://www.wildetechnologies.com/video/WildeVSLaunch2003.ppt,

business process modeling at http://www.enterprise-component.com/docs/WebServWs.ppt

Web Services Software Development Lifecycle athttp://www.enterprise-component.com/docs/WebServWs.ppt,

and .Net vs. J2EE inhttp://www.disi.unige.it/person/ReggioG/ISII01/DotNet.ppt)

112

Component-based software development

• Creating re-usable language-neutral software components that conform to a binary component standard

• Removes many of the problems faced in trying to develop re-usable pieces of software

• Many standards exist – COM, CORBA, Java Beans, .Net• 2 MS standards – COM (Component Object Model) and

.NET

Page 57: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

57

113

Problems with traditional development

Lack of binary compatibility• XYZ Corp markets a C++ library containing a class

MyClass• MyClass is extremely useful so ABC Software Company

creates a dozen of applications that use MyClass• XYZ Corp decides to fix some bugs in MyClass. In doing

so, they add another private class member.• The new class is not binary- compatible with old one –

ABC Software will have to recompile all its applications

114

Problems with traditional development

Language compatibility• Without COM, software developed in one language cannot

be easily used from another• C/C++ and Visual Basic example:• VB can use C-functions but only in a limited manner• VB cannot use C++ classes• C/C++ cannot use functions/procedures/classes developed

in VB• Result: headache for library vendors and users alike

Page 58: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

58

115

Problems with traditional development

Location dependence• Without COM, the code using a library is locked into

having the library at a particular location, e.g. in a DLL sitting in a system directory

116

COM to the rescue

• Complete binary compatibility – new versions of a library can simply replace the old version. It’s not necessary to recompile the code that uses that library

• Language independence:

VB / C / C++ / FORTRAN / JavaScript / ….

C++ VB C Fortran

COM components

Page 59: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

59

117

Conventional solution

• “Portable” base class library developed in C++ using only ANSI C++ features

• COM wrappers for the classes to make them accessible from other languages

118Base library (ANSI C++ only, portable)

CArray1D CArray2D CWave1D

CInternal1 CInternal2

CWave2D

COM wrappers (C++, tied to Windows)

User desktop application in VB

FORTRAN program

Server-side script - JScript

IArray1D IArray2D IWave1D IWave2D

Page 60: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

60

119

Pros and Cons

• Library can be used from a variety of languages

• Binary compatibility is maintained across versions

• Base class library is portable to all platforms supporting C++

• Library has to be developed in a single language – C++/C

• Difficult to develop portable code

• Portability not complete due to differences in compilers

• Source code has to be distributed

• Base library cannot access rich functionality provided by the platform in runs on

120

The .Net solution

What is .Net?

• Execution environment with managed memory• Rich class library - .Net Framework• Common Language Specification / Runtime that allows for

seamless interoperability between different programming languages

Page 61: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

61

121

How it works

VB Source File

C# Source File

C++ Source File

Fortran Source File

Intermediate Language

VB.netcompiler

C#compiler

C++ .Netcompiler

Fortran .Netcompiler

Executable code in memory

Just-In-Time Compiler

OS / CPU independent

122

.Net solution

Rich functionality provided by the .Net Framework:

•Essential classes: collections, string manipulation, math etc.•Security•User interface•Networking•Graphics•Database access•Etc.

Base class library

C# FortranVB

CobolOthers C++

Application VB

Web PageJScript

Page 62: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

62

123

Pros and Cons

• Seamless interoperability between different languages

• Binary compatibility across all CPUs and operating systems

• Effortless portability to all platforms supporting .Net

• Full interoperability with COM• Rich platform functionality can be

used in the base library• Possibly reduced development time

and increased robustness due to services provided by .Net e.g. memory management

• Possible portability problems: • A lot less platforms will be

supported• Cost of .Net implementations

for non-Windows platforms is unknown

• Time of availability of non-Windows implementations is unknown

• Exactly which platforms will be supported is unknown

• Considerable performance penalty

124

Towards Web Services(http://msdn.microsoft.com/webservices/building/wse/default.aspx)

Web Services Enhancements (WSE 2.0) http://msdn.microsoft.com/webservices/building/wse/default.aspxAdd-on to Microsoft Visual Studio .Net and the Microsoft .Net Framework

policy framework, enhanced security model, message-based

programming model, and support for multiple hosting environments

Plateaus of adoption Integration as an afterthoughtWeb services façadesManaged Web services and, finallyParadigm shift

Industry currently focuses on the second plateau

Page 63: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

63

125

Integration as an Afterthought

The current enterprise conjecture consists of a collection of self-contained custom or packaged applicationsPackaged applications may expose functions via an API allowing some level of point-to-point integration

126

Web Services Façades

Adopting Web services first requires "wrapping" existing applications with a Web services façadeThe resulting architecture resembles early EAI implementations, but provides the added benefit of standard protocols

Page 64: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

64

127

Managed Web Services

In most cases, package applications are not designed to enable the replacement of underlying servicesAs a result, the resulting Web architecture remains a hybrid inwhich some applications leverage common infrastructure services while others access their own internal services

128

Paradigm Shift

In a true service-oriented architecture, all business services use a common set of business-neutral services for logging, notification and security

Page 65: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

65

129

Challenges

Evolving standards Immature tools Semantic mapping Network reliability Performance Application ownership Learning curves

130

“Agile” Methodologies

See Session 8 Sub-Topic 2 Presentation:Sample Project Development Methodology

http://www.thoughtworks.com/library/agileEAIMethods.pdfhttp://www.thoughtworks.com/library/newMethodology.pdf

Page 66: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

66

131

Part VI

Conclusion

132

SummaryJWS provides the convenience of desktop applications for downloaded applications with Zero Client AdministrationMicrosoft’s DOC platforms implement the OMA architecture

Provide platform specific support for servicesSupport an integrated set of horizontal and vertical facilitiesCapabilities are bundled with the Operating System

COM+ introduces a new naming service technologyDNA provide transactions and messaging servicesDNA support web-enabling which is being extended with trading capabilities via Web Services.Net/COM+ simplifies application development

Server Components v.s. Client ComponentsEnterprise apps & Web Services v.s. workgroup apps

Page 67: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

67

133

Show by example that .Net/COM+ makes it:As easy to develop Server Components as it is to develop Client ComponentsAs easy to deliver enterprise applications and Web Services as it is to deliver workgroup apps!

Goals

134

Readings

ReadingsMicrosoft .NET Distributed Applications: Building Application Servers

Chapters on .Net Remoting and COM+ ServicesHandouts posted on the course web siteExplore .Net/COM+ EnvironmentRead related white papers/documentation on the .Net/COM+ environments

Page 68: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

68

135

Project FrameworksProject Frameworks Setup (ongoing)

Apache Web Server (version 1.3.28/2.0.47, www.apache.org)Perl (version 5.8.0, www.perl.com)Microsoft IIS with COM+/.Net and ASPSun One Active Server Pages 4.0 http://wwws.sun.com/software/chilisoft/index.htmlApache TomcatMacromedia JRun4Apache Cocoon 2/XSPVisibroker, OrbacusRMI-IIOPWebLogic 8.1, WebSphere 5.0, JBossInprise AppServer, Sun ONE, Sybase EAServer, Oracle 9i, IONA iPortal, XoologyConcerto, Aligo M-1, Advanced Network Systems WebIxGOAL Group OpenCCM, ExoLab.org OpenCCM, iCMG K2-CCM (C++), MICO/E (Eiffel ORB), JavaCCM, TAO Group, IONA iPortal (no CCM), Borland AppServer(no CCM), Sourceforge MI-3 (“Mission Impossible 3”) and CIF projectsVisual Studio .Net 2003 / .Net Framework SDK

136

Assignment

Explore the references to .Net/DNA Application Server technologyHomework #6 due date is 11/12/03Homework #7: due date is 11/26/01

Page 69: g22 3033 011 c101 - nyu.edu...Web-Enabling Facilities (continued) Java Web Start (JWS) COM / DCOM Component Model and OLE COM+ MTS Services: Transactions and Security COM+ Message

69

137

Next Session:XML-Based Capabilities

in Component-Based Environments

.Net Environment (continued)EAI EnvironmentsB2Bi EnvironmentsBPM EnvironmentsChannel Independence and Pervasive Devices