COM+ Unleashed provides a complete understanding of how to build and implement COM components, focusing on using COM+. This book shows you how to build COM objects and encapsulate their functionality, use distributed COM to build client/server and Web-based enterprise applications, and enhance applications with distributed services (MTS, MSMQ). You'll also see how to fully utilize the COM+ model to enhance productivity and to create highly flexible and powerful applications and encapsulate business logic into COM objects. You'll learn how to apply the COM+ model creatively and effectively to solve everyday programming problems, enhance the efficiency and functionality of your enterprise applications and build sophisticated distributed applications. The examples and programs in this book are written in C++.
I. WINDOWS DNA AND COM+.1. COM+: The Glue for Windows DNA.
Windows DNA. Internet Spoken Here: HTML and XML.
A Stateless Environment.
The Windows DNA Services.
The Windows DNA Services: COM and COM+. The Windows DNA Services: The DNA Core. The Windows DNA Services: Tools.
DNA: A Functional Overview.
The Browser. IIS. ASP. MTS. MSMQ and SQL Server. Visual Studio 6.0. Visual Basic. Visual C++.
Summary.2. Multitiered Component Architectures.
Ad-Hoc Design. Fundamental Application Boundaries: Presentation, Logic, and Data. Services.
Loosely Coupled Versus Tightly Coupled Tiers.
Three-Tiered Design. Keeping Tiers Balanced. Multitiered Design. Local or Distributed? Good Design Techniques.
Abstract the Application into Tiers. Identify Components. Create Interfaces. Implement the Components. Design Constraints. Design Goals.
Design Tools. Summary.
II. ADVANCED COMPROGRAMMING TECHNIQUES.3. COM+ Architecture and Administration.
The Evolution of COM+. MTS Shortcomings. COM+ Architecture.
Creating COM+ Objects. Parameterized Object Construction. Monikers. The Neutral-Threaded Apartment. Object Pooling. Dynamic Load Balancing.
COM+ Deployment Services. Resource Management with COM+.
Compensating Resource Managers.
Developing COM+ Applications. (d)Designing COM+ Components. Queued Components.
Queued Transactions. Administering Queued Components.
Loosely Coupled Events.
Using Loosely Coupled Events (LCE).
Accessing Data with COM+. COM+ Security. Base COM Features.
Structured Storage. Canceling Outstanding COM Calls.
Summary.4. Persistent Storage.
The IPersist Interfaces.
IPersistStorage. IPersistFile. IPersistStreamInit.
The IStream Interface.
IStream:: Write(). IStream::Read(). IStream::Seek().
Creating an ATL Object That Implements IPersistStreamInit.
Creating Simple ATL Controls.
Using an Object with Persistence. Simplify Persistent Object Creation. Simplify Persistent Object Use. Summary.5. Monikers.
COM+ Objects and Monikers.
Exploring Moniker Types.
File Monikers. Running Object Table. Item Monikers. Composite Monikers. Class Monikers. Pointer Monikers.
Summary.6. Connectable Objects.
Connection Points. Connection Point Container. Connection Point Example.
The Event Sink.
Events and Visual Basic.
Rewriting the Event Source. The ATL Proxy Generator. Writing the Visual Basic Client.
How Different Tools Implement Events.
Events and Visual Basic. Events and C++Builder.
Summary.7. COM+ Threading.
The Evolution of PC Threading. COM+ Thread Types.
Worker Threads. Message Queue Threads. Window Threads. Apartment Threads. Thread Pools.
COM+ Threading Models.
The Single-Threaded Server. The Apartment-Threaded Server. The Neutral-Threaded Server. The Free-Threaded Server.
Thread Local Storage. Eliminating Concurrency Problems.
Summary.8. COM and the Registry.
Registry API. Regedit and Regedt32.
Importing and Exporting Registration Files.
COM Registry Structure.
File Extensions. ProgIDs. AppIDs. CLSIDs. Interfaces. TypeLibs.
Enabling and Disabling DCOM. Default Permissions. Legacy Security.
Registering a COM+ Server.
Regsvr32. Self-Registering Out-of-Process Servers. Frameworks.
Summary.9. COM+ Optimization, Inheritance, and Aggregation.
Speed of DCOM.
Object Location. Network Cycles. Mixed Threading Models.
Remote Activation. Remote Reference Counting.
Pinging the Client.
Summary.10. Using NT Services.
main() and WinMain(). ServiceMain(). ServiceCtrlHandle().
ATL and Services.
Utilities for Working with Services.
Administrative Tools Services Applet. Diagnostic Utility. Service Controller. Event Viewer.
Service Handles. Manipulating Services.
Installing Services via the Registry. Using the Event Log.
Message Compiler (MC). RegisterEventSource(), DeregisterEventSource(), and Report Event(). Event Log Viewer.
Debugging Your Services.
The System Account. Task Manager: Debug. Start the Debugger with the AT Command.
Understanding Marshaling. Type Library Marshaling. Standard Marshaling.
Define the DLL Entry Points. The Class Definition. Defining the IID, TypeLib GUID, and CLSID. The Proxy and Stub Definitions. The Registration File. Converting the MIDL Output Files.
Declaring the Object Class. Defining the Object Class. Defining the Proxy Class. The Client.
Summary.12. COM Security.
COM Versus DCOM Security.
COM Security and SSPI.
Developing Security with Domains. Security Descriptors. Authentication.
Cloaking. CoImpersonateClient() and CoRevertToSelf(). Cloaking.
Declarative Security. Programmatic Security.
Security Blankets. IClientSecurity. Access and Launch Security.
Summary.13. Configuration and Error Handling.
Configuring a COM+ Object with DCOMCNFG.
Legacy COM Servers. Creating an Automation Server. Default Properties. Default Security. Configuring a COM+ Server. Server Location. Server Security. Server Identity.
Using the OLE2View Program.
Disadvantages of OLE2View. Configuring a COM+ Object with OLE2View. Specifying the Surrogate for Remote In-Process Servers. Access Permissions.
Error-Handling Strategies. Passing Information with ISupportErrorInfo.
Summary.14. COM Internet Services.
A New COM+ Transport Protocol.
Limitations of the Tunneling TCP Protocol.
Tunneling TCP Protocol Overview.
Configuring the Tunneling TCP Protocol. Client Configuration for Windows 95 and Windows 98. Client Configuration for Windows NT 4.0 SP4 and Windows 2000. Client Machine Proxy Configuration. Server Configuration on Windows NT Server 4.0. Configuring the RPC Proxy on Windows 2000 Server.
Enabling CIS. Proxy Server Configuration.
Configuring Microsoft Proxy Server. Firewall Configuration.
Configuration Tips and Known Issues.
Incorrect Proxy Server Settings on the CIS Client. Issue with a Multihomed CIS Server. MTS Use of Callbacks. Issue with HTTP Caching Devices. Registry Keys Affecting CIS.
Knowing When To Use CIS.
Necessary Programming Changes. Summary.15. MTS.
Coordinating Transactions. Transactions and COM.
What Is MTS? Benefits of Using MTS.
Surrogate Process for Components. Role-Based Security. Just-In-Time Activation. MTS Explorer. Transaction Coordination. MTS Integration with Microsoft Internet Information Server. MTS Integration with Microsoft Message Queuing Services.
Packages. Activities. Roles.
Administering Your MTS Server Programmatically.
Developing Objects for MTS. Adding Objects to a Package. Package Properties. Object Properties. Deploying MTS-Based Objects. Exporting a Package. Importing a Package.
Advanced MTS Techniques.
Making Security Available for a Package and a Component. Creating a Role for a Package. Assigning a Role to a Component or an Interface. Affecting Security Programmatically. Direct Caller Versus Original Caller. Load Balancing.
Creating MTS-Based Applications.
Designing with MTS. Scaling Applications with MTS. Remote Administration.
III. COMPONENT MANAGEMENT AND TRANSACTIONS.16. COM+ as a Component Manager.
Programming COM+ and Other Component-Based Services. COM+ Scalability Features. COM+ and Standard COM Components.
A Standard COM Component. Using Standard COM Components with COM+. COM+ Benefits for Standard COM Components.
The Road to COM+ Components.
Software Reuse. Performance, Scalability, and Robustness.
COM+ and State.
Types of State. State Storage.
COM+ Component Requirements. Building COM+ Components.
Context Objects. Object Control. Using ATL to Build COM+ Components. The Shared Property Manager. Referencing Objects Within COM+. Creating Objects Within COM+.
Summary.17. COM+ as a Transaction Coordinator.
The Need for Transactions.
Transactions Defined. ACID.
Microsoft Distributed Transaction Coordinator (MS DTC).
A Simple Transaction Example. Transaction Protocols.
OLE Transactions. XA Transactions. CICS and IMS Transactions.
The COM+ Transaction Programming Model.
Creating Transactions. Completing Transactions.
Travel Agency Example. Monitoring Transactions. Design Considerations.
Prefer Fine-Grained Components. Locate Components Close to Their Data Source. Put Components Using the Same Resources Together in the Same. Application.
Summary.18. COM+ Security.
COM+ Security Concepts.
Roles. Security Responsibilities.
SSPI. Declarative COM+ Security.
Creating Roles. Adding Roles to Components and Interfaces. Enabling Security. Authentication.
Procedural COM+ Security.
Identifying Users. Authorizing Users.
Summary.19. The COM Transaction Integrator.
COMTI Requirements. Mainframes and Windows DNA.
SNA Server. Before COMTI. COMTI. COMTI Caveats.
CICS and CICS-LINK. The COMTI Component Builder.
The Component Builder COBOL Wizard. CICS TP. CICS-LINK.
The COMTI Management Console. The COMTI Runtime. Summary.20. Component Load Balancing.
Component Load Balancing Defined. The Need for Component Load Balancing.
Scalability. Availability. Flexibility.
Parallelism and Granularity.
The Dynamic Load-Balancing Algorithm. Component Load-Balanced Component Design. Component Load-Balanced Client Design. The Bad News. Component Load Balancing Without AppCenter Server.
Working with the SCM. The Problem with CoCreateInstance. Creating an Envelope. Algorithms. Timing Methods. The Method-Timing Algorithm. Making It Real. Other Balancing and Clustering Technologies. JIT Activation.
Summary.21. Optimizing Windows DNA Applications.
Assessing Your Needs. Optimization Tips.
Implement User or System DSN instead of File DSN. Optimize Algorithms, Especially Iterative Loops. Avoid Registry Access. Use Just-in-Time Activation Whenever Possible. Fix Resource Leaks. Balance Object-Oriented Component Architecture with Practicality. The Right Language for the Job. Avoid Middle Tier State. Avoid Data Access in the Middle Tier.
Using the Microsoft Windows DNA Performance Kit.
Getting Ready to Use the Kit.
Viewing the Results of a Test. Summary.
IV. ASYNCHRONOUS COMPONENT PROGRAMMING.22. Programming Loosely Coupled Systems.
What Is Messaging? Messaging Strengths.
Enhancing Large-Scale Application Development with Messaging. Utilizing Communication Resources with Messaging. Unifying Dissimilar Systems with Messaging.
Extended Processing Time. Asynchronous Execution.
Synchronous Versus Asynchronous Programming. Scalability. Message-Oriented Middleware.
MOM APIs. MOM System Software. Administrative Tools.
AMicrosoft Message Queue Server (MSMQ).
MSMQ Connector. MSMQ and Other APIs. MSMQ and Email.
Summary.23. MSMQ Administration and Architecture.
MSMQ Objects and Properties. Messages.
Queue Types. The MQIS-Message Queue Information Service. Local Queue Storage (LQS). Queue Properties. Priorities. Transactional Queues. Identifying Queues. Private Queues.
The MSMQ Enterprise.
Site Links. Connected Networks. MSMQ Controllers.
MSMQ Clients. MSMQ Administration. Summary.24. Programming the MSMQ.
The MSMQ Library API. Building an MSMQ Application with the MSMQ Library API.
Format Names. Pathnames. Looking Up Format Names. Working with Properties. Creating a Queue. Destroying a Queue. Opening a Queue. Sending a Message. Receiving a Message. Closing a Queue.
The MSMQ ActiveX Control API.
MSMQ ActiveX Classes.
Building an MSMQ Application with Raw COM+ Interfaces.
Defining Interfaces and GUIDs. Initializing COM. Creating a Queue. Destroying a Queue. Opening a Queue. Sending a Message. Receiving a Message. Closing a Queue.
Building an MSMQ Application with Smart Pointers.
Defining Interfaces and GUIDs. .tli Files. ATL Dependencies. Creating a Queue. Destroying a Queue. Opening a Queue. Sending a Message. Receiving a Message. Closing a Queue.
Building an MSMQ Application with VBScript. Summary.25. Advanced MSMQ Programming.
MSMQ API Cursors. MSMQ ActiveX Component Cursors.
Message Acknowledgment, Response, and Journals.
Administration Queues. Response Queues. Message IDs. Journals.
Messaging Transactions. ITransaction. Creating Transactional Queues. Types of Transactions. External Transactions.
MSMQ Email API. Asynchronous Operations.
Automation Events. System Event Objects. Callback Functions. Completion Ports.
Summary.26. Loosely Coupled Events.
Some Basic Terminology Defined.
Design Patterns. Publisher. Subscriber. COM+ Event Service.
Comparing the Options for Publish-Subscribe.
Polling. Tightly Coupled Events. Too Tightly Coupled. Need for Concurrent Lifetimes. Inability to Filter Noise. Loosely Coupled Events.
COM+ Event Service. Event Service Demo. Advanced COM+ Event Service Issues.
Subscriptions and the IEventSubscription Interface. Working with Transient Subscriptions.
Creating a Filter String Administratively. Creating a Filter String Programmatically. Summary.27. Queued Components.
Queued Components Overview. Distributed Computing and Queued Components.
Confirmation of Data Received. Server Requests More Data. Confirmation of Work Performed. Need for Lookup Data. To Queue or Not to Queue.
Queued Component Architecture.
Creating and Defining a Component as Queued. The Client Side of Queued Components. The Server Side of Queued Components.
Writing a Queued Components Demo Application.
Writing a Queued Component with Visual C++ and ATL. Installing a Queued Component. Writing a Client Application in Visual C++.
Testing the Component and Client Code. Exporting the COM+ Application. Summary.Index.