Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Automate Component Registration Using MTXAdmin : Page 3

Leverage Microsoft Transaction Server's component model to register your components without breaking a sweat or leaving the IDE.


advertisement
Registering a component uses basically the same code you've already seen to locate the proper package object. Once the package is located, retrieve a reference to a "ComponentUtil" object, which will allow you to install a component.

Set oComponentUtil = oComponents.GetUtilInterface oComponentUtil.InstallComponent DLLFilename, "", ""

This Is How It Works
Now that you have the code necessary to remove and install components, you'll use an add-in to call those routines. The AutoRegister project (included) can be used as a starting point for your own add-in. Most of the code is the boilerplate code generated by VB when you chose to create an add-in project. Only the event handler for the Register button is discussed here.



 
Figure 2: AutoRegister in action.

Click the register button, and the AdminMTS component is instantiated on the specified server. If the RemoveComponents method is successful, the new DLL file copies to the appropriate location, and the InstallComponents method is called (see Figure 2). The file is copied using the Windows API SHFileOperation function. This gives you some additional features at no cost, such as prompting the user for additional authentication information if necessary, and a nice animation while the file copies.

Final Words
I have not mentioned security at all, because there are so many different ways security can be enforced. Some development environments use the same security for their development server as their production server. Some leave the development server nearly wide-open and only lock down the production boxes. Whatever your paradigm, be aware that your developers need sufficient rights to copy their new DLL files to the server. Also, the AdminMTS component should be configured to run using an account with sufficient permissions to remove and install MTS components.

With the introduction of Windows 2000 and COM+, Microsoft has created the COM+ 1.0 Admin Type Library to interact with the transaction server. Fortunately, some backward-compatibility was preserved and the code in this article should work on a Windows 2000 server or a Windows NT 4 server. However, if you are developing tools to automate MTS administration and are in a Windows 2000 only environment, I recommend that you use this new interface.

There are a hundred things you can do to integrate the add-in supplied here with your development process. At my place of employment, a list of servers is presented to the user rather than a freeform textbox. The package prefix is automatically chosen since we adhere to certain naming standards. And a record is written to a SQL table every time a component is registered. It is much easier to pin down compatibility issues when you know what components have changed recently. The possibilities are endless. If you customize the add-in in a way that significantly improves your development cycle, I would like to hear about your experiences via e-mail.



Larry Johnson has 15 years experience in the software development industry. He is currently a Programmer Analyst with Unum Provident in Chattanooga, TN. In his spare time, he enjoys working with graphics, scientific, and game programming. Reach him by e-mail at larryj@vei.net.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date