Summary


This chapter introduces the Notification Services Management Objects (NMO) API, which provides programmatic access to most SQL-NS management operations. Using the NMO API, you can write code that creates new SQL-NS instances, administers existing instances, and reflects over the entities they contain. The capabilities of the NMO API are most useful for defining new SQL-NS instances dynamically and writing generic management tools that adapt to the structure of any SQL-NS instance.

The first part of this chapter looks at the classes in the NMO API. These classes are organized into a hierarchical structure, based on parent-child relationships. The classes in the API encapsulate the same information that can be specified in XML ICFs and ADFs.

To create a new SQL-NS instance using the NMO API, you construct the instance definition by instantiating NMO classes, filling in their properties, and linking them in the appropriate parent-child relationships. When the instance is completely defined, you call the Create method on its Instance object to invoke the SQL-NS compiler. If the instance definition is valid, the compiler creates the corresponding instance and application database objects. In this chapter, we used NMO to create a new SQL-NS instance called StockBrokerNMO. This new instance is essentially the same as the StockBroker instance from Chapter 3, except that it is created programmatically with the NMO API, rather than from an ICF and ADF.

Many SQL-NS administration tasks can be invoked programmatically, via methods on the NMO Instance class. This chapter covers the methods used to register, enable, disable, update, unregister, and delete a SQL-NS instance with the NMO API. The code examples in this chapter show these methods used in the context of the StockBrokerNMO sample instance.

The final section of this chapter looks at the use of the NMO API to reflect over existing instances. Using reflection, the complete definition of an instance can be obtained programmatically. Reflection code uses the same classes that are used to define new instances. Starting from the Instance object that represents an existing instance, the instance definition is obtained by navigating the various properties and child objects. The code examples in this chapter illustrate how the NMO API's reflection capabilities are used in the SubscriptionLoader tool, introduced in Chapter 6.




Microsoft SQL Server 2005 Notification Services
Microsoft SQL Server 2005 Notification Services
ISBN: 0672327791
EAN: 2147483647
Year: 2006
Pages: 166
Authors: Shyam Pather

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net