rent-now

Rent More, Save More! Use code: ECRENTAL

5% off 1 book, 7% off 2 books, 10% off 3+ books

9780130886743

COM+ Programming A Practical Guide Using Visual C++ and ATL

by Tapadiya, Pradeep
  • ISBN13:

    9780130886743

  • ISBN10:

    0130886742

  • Edition: CD
  • Format: Paperback
  • Copyright: 2000-09-15
  • Publisher: Prentice Hall
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $49.99

Summary

Introduction

Ever since software development became an engineering discipline, software development teams everywhere in the world have faced similar development and deployment problems. Among other things, developers today are concerned about:

  • Reusing code that has been tested and used in other applications
  • Developing flexible applications that can be customized to the users needs, but not at the expense of overburdening the development team
  • Addressing anomalies and add features after the application has been shipped, while avoiding a complete rewrite of the application
  • Improving application development time by leveraging against software code developed by third party software vendors
  • Developing distributed and non-distributed applications in a similar manner

All of these challenges and many more are addressed by a single technology: the Microsoft Component Object Model, better known as COM. COM is a framework for developing software components, small binary executables, that provide services to applications and other components.

The incredible explosion of the Internet has caused a revolution in the way information has to be made available to the users. In developing enterprise systems, the traditional client/server model has been replaced with a three-tier programming model, enhanced for Internet applications. Developing such enterprise systems is a time- and resource-consuming affair, as the system has to meet extra enterprise-level requirements such as scalability, robustness, security, transaction support, etc.

COM+ is an advanced run-time environment that provides services to meet many of the above-mentioned enterprise-level requirements. It is an integral part of the Windows 2000 Operating System. Developers can leverage the services provided by COM+, instead of building the services themselves.

This book focuses on understanding the COM+ architecture from a developer's perspective and building COM+ applications using Microsoft Visual C++ and the Active Template Library (ATL).

COM+ is not a radical departure from COM--it is just the next stage in the evolution of the COM programming model. As a matter of fact, it is very difficult to determine where COM ends and where COM+ begins. In order to understand the COM+ architecture and the services provided by COM+, it is necessary to understand the fundamental component model at the heart of COM+. To this end, the book is divided in two parts. The first part builds the foundation that is COM and the second part explains the services provided by COM+ version 1.0.

About This Book

The purpose of writing this book is twofold. To help you:

  1. Understand the COM/COM+ architecture, and
  2. Explore the services provided by COM+ 1.0.

In order to achieve the stated goals, I have presented the material from a developer's perspective. I have illustrated the key concepts by writing some simple applications using Microsoft Visual C++ 6.0, Platform SDK (January 2000), and ATL 3.0. This book provides enough C++ code and tools to enable the readers to be more productive and to carry out further research.

As we progress through unfolding the COM+ architecture and services, I first present one or more software-engineering problems at hand, and then discuss the solution that COM+ has to offer. Whenever applicable, code snippets are provided to illustrate and explain the concepts.

In an attempt to focus on COM+ 1.0 architecture and services, I have refrained from including material that is not of any practical importance. Consequently, I do not discuss the origin and history of COM, or even Microsoft Transaction Server (MTS), a precursor to COM+ 1.0. However, whenever possible, I have touched upon the new services that are being planned for the future release of COM+ (COM+ 1.x).

Choice of Language

COM+ is a specification. As such, it is language independent. However, most COM-based components are currently written in C++. This book uses C++ for almost all the server-side code. Client-side usage is shown in C++, VB, or in any other language that is appropriate for the given situation.

Prerequisites

The most important prerequisite for this book is your willingness to learn.

The book is written for intermediate to advanced developers. It is assumed that the readers have a working knowledge of the following:

  • Windows 2000 Operating System
  • C++ programming language
  • VB programming language
  • C++ templates. In particular, familiarity with C++ Standard Template Library (STL) is helpful
  • Developing programs using Win32 API
  • Windows 2000 security model

Strictly speaking, many of these assumptions can be relaxed. For example, knowledge of Win32 API or C++ templates is helpful but not mandatory. As we go through developing sample code, I am confident readers will automatically pick up the missing information.

Sample Code

All the examples provided in the book are concise and complete. For brevity, I sometimes show only the relevant code snippet in the book. However, complete source code is available on the companion CD. All the examples and tools have been compiled under Visual C++ 6.0 SP3 and Platform SDK (January 2000), and have been tested with the release version of Windows 2000 OS.

References

This book frequently refers to other books, Microsoft's Knowledge Base articles, articles from various journals and from Microsoft's Developers Network (MSDN) Library. All the references for a particular chapter are listed at the end of the chapter. Each reference is indexed by a keyword that uses a combination of author's last name and year the reference was published. For example, Don Box's book Essential COM, which was published in 1998, is indexed as Box-98. In the book, each time I have to refer to an article, I use the keyword index of the reference.

Chapter Organization

The book is divided into two parts. The first part, The Foundation, consists of three chapters. It explains the fundamentals of Component Object Model and shows how to design and develop COM-based applications. Each chapter builds on the knowledge from the previous chapter.

The second part, The Extension, focuses on COM+ architecture and services provided by COM+ 1.0. Each chapter focuses on a specific aspect of COM+. These chapters are largely independent of each other. Chapter five, however, explains the COM+ programming model, and should be read before looking into any other COM+ chapter.

Companion CD

The companion CD contains the following:
  1. The source code for the C++ utility classes and tools developed in the book.
  2. The entire source code for all the examples arranged by chapters.

More information about the contents of the CD can be found in the read-me file on the CD.

Author Biography

PRADEEP TAPADIYA is a Program Manager and Lead Software Engineer for the OpenView ManageX Group of Hewlett-Packard in Roseville, CA. He started developing COM-based applications in 1996 and is currently involved with developing a suite of systems management applications for Windows NT and 2000 using DCOM. Tapadiya holds a doctoral degree in computer science from Texas A&M University.

Table of Contents

Introduction xv
PART I The Foundation
The Component Model
3(52)
Component Reusability
4(1)
Traditional Software Reusability
5(1)
Reference Hardware Components
6(1)
Simulation Program
7(2)
Role of the Linker and the OS Loader
9(2)
Dynamic Link Library
11(2)
Fixing a Defect
13(1)
Hardware Component Model
14(1)
Separating Interface from Implementation
15(4)
Common Aspects of C++ Language
19(1)
Virtual Methods in C++ and Memory Layout
20(6)
Interface as an Abstract Base Class
26(4)
Dynamic Selection of a Component
30(3)
Extending the Interface Functionality
33(5)
Managing the Lifetime of an Object
38(5)
Optimizations
43(2)
Error Reporting
45(6)
The Essence of COM
51(2)
Summary
53(1)
References
54(1)
Designing Interfaces
55(90)
Why a New Language?
55(2)
Programming Language Independence
56(1)
Remote Transparency
57(1)
Interface Definition Language (IDL)
57(2)
IDL Attributes
58(1)
IDL Design Goals
59(17)
Remote Transparency
59(3)
Programming Language Independence
62(1)
Semantic Information
63(1)
Standardized Calling Conventions
64(7)
Memory Management
71(2)
Identification
73(2)
Compiled Type Information
75(1)
Component Identification
76(1)
Processing IDL Files
76(3)
IDL File Structure
79(3)
The Preprocessor Section
80(1)
The Interface Section
81(1)
The Type Library Section
81(1)
IDL Syntax
82(37)
Defining Interface Methods
82(30)
Defining IDL Interfaces
112(4)
Defining COM Classes
116(1)
Defining IDL Libraries
117(2)
Automation
119(15)
Basic Data Types
119(1)
Strings
120(4)
Booleans
124(1)
Variants
124(3)
Safe Arrays
127(1)
Automation-Compatible Interfaces
128(4)
Collections and Enumerations
132(2)
Interfaces and Marshaling
134(1)
Memory Management
135(2)
Organizing Multiple IDL Files
137(1)
Putting It All Together
138(4)
Summary
142(1)
References
143(2)
Components
145(84)
From C++ to COM---A Quick Tour
145(14)
Implementing Interfaces
145(3)
Method Implementation
148(3)
Instantiation Logic
151(3)
The TV Client
154(3)
The COM+ Catalog
157(2)
Revisiting C++ Code
159(24)
Multiple Classes in a Server
159(1)
Multiple Instances of a Class
160(7)
Storing Configuration Information
167(4)
Memory Cleanup
171(12)
Implementing COM Objects
183(17)
Using Multiple Inheritance
183(1)
Implementing the Root Interface
184(9)
ATL is Our Friend
193(7)
Tear-Off Interfaces
200(1)
Reusing Components
200(16)
Containment
201(4)
Aggregation
205(11)
Error Reporting
216(8)
Summary
224(1)
References
225(4)
PART II The Extension
Essence of COM+
229(14)
Enterprise Systems
230(2)
Security
230(1)
Scalability
230(1)
Sharing Resources
231(1)
Transactions
231(1)
Three-Tier Architecture
232(2)
Windows DNA
233(1)
COM+ = Simplified Development
234(7)
Administrative Control
235(1)
Transaction Services
235(1)
Security Services
235(1)
Synchronization Services
236(1)
Queued Components
237(1)
Event Service
238(1)
Object Pooling
239(1)
Just-In-Time (JIT) Activation
240(1)
Remote Deployment
240(1)
Summary
241(1)
References
241(2)
COM+ Programming Model
243(32)
Attribute-Based Programming
243(11)
The COM+ Catalog
245(1)
Configuring a Component
246(4)
Component Initialization
250(2)
Developer-Specified Attributes
252(2)
COM+ Context
254(6)
Contexts and Interception
256(3)
Interception and Performance
259(1)
Object Context
260(4)
Default Context
262(2)
Call Context
264(1)
Object Activation
265(8)
In-Process Activation
265(2)
Out-of-Process Activation (Local Host)
267(1)
Remote Activation (Distributed Computing)
267(2)
Executing in a Different Context
269(4)
Summary
273(1)
References
273(2)
Concurrency
275(46)
Multithread Programming
275(9)
A Simple Example
276(4)
Multithreading Issues
280(4)
Apartments
284(4)
Single-Threaded Apartments (STA)
286(1)
Multithreaded Apartments (MTA)
287(1)
Thread-Neutral Apartments (TNA)
287(1)
Configuration Settings
288(7)
Activities
291(4)
Apartments and Standard Marshaling
295(4)
Dispatching Calls to an STA
296(2)
Dispatching Calls to an MTA
298(1)
Dispatching Calls to a TNA
298(1)
Cross-Context Access
299(5)
Developing Thread-Safe COM Code
304(14)
Shared Data Conflicts
304(9)
Waiting for an Event
313(1)
Sharing State Across Multiple Objects
314(4)
Summary
318(1)
References
319(2)
Security
321(42)
The COM+ Security Model
321(12)
Windows NT Security System Basics
322(3)
Security Issues Under COM
325(4)
Security Service Providers (SSPs)
329(3)
Security Blankets
332(1)
Declarative Security
333(6)
Default Settings
333(3)
Application-Specific Settings
336(3)
Server-Side Security Programming
339(6)
Client-Side Security Programming
345(17)
Impersonation Levels
348(5)
Identity and Authentication Services
353(3)
Client Acting as a Server
356(4)
Adjusting Security for a Proxy
360(2)
Summary
362(1)
References
362(1)
Transactions
363(38)
The Stock Trader
363(9)
The Database Layer
364(2)
The Business Logic
366(5)
The Simulation
371(1)
Transaction Theory
372(1)
COM+ Support for Transactions
373(6)
Configuring Transactions
374(2)
Programmatic Voting
376(3)
The Architecture
379(9)
Resource Managers
379(1)
The Distributed Transaction Coordinator
380(2)
Automatic Transactions through COM+
382(5)
Manual Transactions
387(1)
Compensating Resource Manager
388(10)
Summary
398(1)
References
398(3)
Message Queuing
401(38)
Message-Based Queuing
401(3)
The Need for Queuing
402(1)
Why Use MSMQ?
403(1)
MSMQ Overview
404(7)
MSMQ Servers
406(1)
MSMQ Clients
406(1)
Queue Types
407(2)
Queue Naming
409(2)
MSMQ COM Components
411(14)
Sending and Receiving Messages
412(3)
Guaranteed Delivery
415(1)
Responding to a Message
416(1)
Sending Objects in the Message Body
417(2)
Transactions
419(6)
Queued Components
425(12)
A Simple Phone Book Example
426(6)
Queued Component Architecture
432(2)
Getting a Response
434(2)
Transaction Support
436(1)
Summary
437(1)
References
438(1)
Events
439(34)
Introduction
439(2)
Tightly Coupled Events (TCEs)
441(7)
Connection Points
442(3)
Receiving Messages with MSMQ Events
445(3)
Loosely Coupled Events (LCEs)
448(23)
COM+ Events Architecture
449(3)
A Simple Event Example
452(8)
Transient Subscriptions
460(2)
Events and Queued Components
462(2)
Events and Filtering
464(7)
Summary
471(1)
References
471(2)
Scalability
473(32)
Introduction
473(1)
Resource Dispensers
474(2)
Just-in-Time (JIT) Activation
476(5)
Object Pooling
481(4)
Requirements for Poolable Objects
483(2)
Asynchronous Method Calls
485(15)
Asynchronous Clients
488(7)
Asynchronous Servers
495(5)
Canceling a Synchronous Call
500(1)
COM+ Pipes
500(2)
Summary
502(1)
References
503(2)
Administration
505(22)
Overview
505(3)
COM+ Administration Object Model
508(6)
COMAdminCatalog Object
509(2)
COMAdminCatalogCollection Object
511(2)
COMAdminCatalogObject Object
513(1)
Programming Considerations
514(4)
Error Handling
514(2)
Administrative Tasks and Transactions
516(2)
Some Common Administrative Tasks
518(5)
Uninstalling an Application
518(1)
Installing an Application
519(2)
Deploying an Application
521(2)
Future Enhancements
523(1)
Summary
524(1)
References
525(2)
Index 527

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Excerpts

IntroductionEver since software development became an engineering discipline, software development teams everywhere in the world have faced similar development and deployment problems. Among other things, developers today are concerned about: Reusing code that has been tested and used in other applications Developing flexible applications that can be customized to the users needs, but not at the expense of overburdening the development team Addressing anomalies and add features after the application has been shipped, while avoiding a complete rewrite of the application Improving application development time by leveraging against software code developed by third party software vendors Developing distributed and non-distributed applications in a similar mannerAll of these challenges and many more are addressed by a single technology: the Microsoft Component Object Model, better known as COM. COM is a framework for developing software components, small binary executables, that provide services to applications and other components.The incredible explosion of the Internet has caused a revolution in the way information has to be made available to the users. In developing enterprise systems, the traditional client/server model has been replaced with a three-tier programming model, enhanced for Internet applications. Developing such enterprise systems is a time- and resource-consuming affair, as the system has to meet extra enterprise-level requirements such as scalability, robustness, security, transaction support, etc.COM+ is an advanced run-time environment that provides services to meet many of the above-mentioned enterprise-level requirements. It is an integral part of the Windows 2000 Operating System. Developers can leverage the services provided by COM+, instead of building the services themselves.This book focuses on understanding the COM+ architecture from a developer's perspective and building COM+ applications using Microsoft Visual C++ and the Active Template Library (ATL).COM+ is not a radical departure from COM--it is just the next stage in the evolution of the COM programming model. As a matter of fact, it is very difficult to determine where COM ends and where COM+ begins. In order to understand the COM+ architecture and the services provided by COM+, it is necessary to understand the fundamental component model at the heart of COM+. To this end, the book is divided in two parts. The first part builds the foundation that is COM and the second part explains the services provided by COM+ version 1.0. About This BookThe purpose of writing this book is twofold. To help you: Understand the COM/COM+ architecture, and Explore the services provided by COM+ 1.0.In order to achieve the stated goals, I have presented the material from a developer's perspective. I have illustrated the key concepts by writing some simple applications using Microsoft Visual C++ 6.0, Platform SDK (January 2000), and ATL 3.0. This book provides enough C++ code and tools to enable the readers to be more productive and to carry out further research.As we progress through unfolding the COM+ architecture and services, I first present one or more software-engineering problems at hand, and then discuss the solution that COM+ has to offer. Whenever applicable, code snippets are provided to illustrate and explain the concepts.In an attempt to focus on COM+ 1.0 architecture and services, I have refrained from including material that is not of any practical importance. Consequently, I do not discuss the origin and history of COM, or even Microsoft Transaction Server (MTS), a precursor to COM+ 1.0. However, whenever possible, I have touched upon the new services that are being planned for the future release of COM+ (COM+ 1.x). Choice of LanguageCOM+ is a specification. As such, it is la

Rewards Program