This chapter provides an artificial example to show how providers are written using one particular WBEM server, openPegasus. The code in this chapter was written to work with version 2.2 of the openPegasus software but it is general enough that it should work correctly with later releases. Because of the lack of standards surrounding the provider interface, it would not work without modification with other WBEM servers but the basic structure is common to all WBEM server implementations .
Installing openPegasus is remarkably easy and, if you want to follow along with this example on your own computer, then I suggest that you install itsee Appendix F for a detailed description of its retrieval and installation process.
This is not a book about programming in C++ and I have assumed that you will not need me to write out header files and the complete programs for every example. Instead I give the code snippets which handle the interaction with the WBEM server and leave the rest to your imagination and experience.
Some of the code in this chapter has been adapted from the examples released with openPegasus and may therefore be subject to the licencing terms described in Appendix H.
As an example I intend to take one of the classes which I developed in Chapter 9. ACNE_PBXTelephoneModule's origin and raison d'tre are described on page 177 and its properties and extrinsic methods on page 184. To save you from having to (re)read that chapter I briefly recap here the underlying logical device (telephone interface card) which the ACNE_PBXTelephoneModule represents. You should, however, refer to Figure 9.2 on page 169:
Up to eight telephone interface cards may be present in a PBX.
Each interface card supports connections to eight telephones.
Interface cards may be inserted into slots 3 to 10 of the PBX shelf.
An operator may enquire about the number of telephone interfaces present (but may not create an instance of the classinstances are created only by an appropriate card being inserted into the PBX), may invoke the reset(), saveProperties(), restoreProperties() and setIndicator() extrinsic functions and read all properties.