BUG#:4200
[tpot/pegasus/.git] / readme.cmpi
1 Common Management Programming Interface (CMPI) Providers in a nutshell
2 ============================
3
4 Aug 1st, 2005
5
6 Pegasus 2.5 *NEWS*
7 ------------------
8
9 The CMPI macro header files (cmpimacs.h) shipped is OpenPegasus specific. This 
10 will change once OpenGroup releases a specification with the macro definitions.
11
12 The CMPI Function Table (cmpift.h) file and CMPI Data Types (cmpidt.h) file are
13  composed from the CMPI v1.0 specification + Technical Corrigenda and are
14 binary compatible with the "historical implementations" and the 1.0 specification
15 augmented with the Technical Corrigenda.
16
17
18 Build CMPI from sources
19 -----------------------
20
21 The Common Manageability Programming Interface (CMPI) has been integrated into
22 Pegasus as a pluggable provider manager.
23
24 CMPI is by default enabled on Linux. For other platforms it must be enabled 
25 during Pegasus build.
26
27 For CMPI enablement, set the following environment variables prior to make:
28
29    PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER=1
30
31
32 Using CMPI
33 ----------
34 If you plan to write your own CMPI providers you are kindly referred to the
35 WBEMSource homepage where the draft specification document for CMPI resides.
36 You can find at http://www.wbemsource.org/doc.tpl?CALLER=index.tpl&gdid=3712 .
37 If you are looking for samples you should have a look at the SBLIM project.
38 The packages prefixed by the string sblim-cmpi contain CMPI providers for
39 various classes. See http://www-124.ibm.com/developerworks/projects/sblim .
40
41 Using CMPI with threads
42 -----------------------
43
44 CMPI provides API functions for low-level thread, mutex and conditional constructs.
45 Hence you can compile your provider without needing to link to pthread or other 
46 threading library. 
47
48 However, the developer is responsible for memory management of these constructs and
49 as well of exiting the threads before the cleanup function is exited. If this is not 
50 done, the thread will be forcefully terminated. This can have the nasty consequence of
51 hanging CIMServer, or bringing down the CIMServer, or just the Out-of-Process Provider 
52 Agent if you run OpenPegasus with 'run-as-requester' configuration flag turned on.
53 Please refer to the Admin Guide or the readme files for more details about this flag.
54
55 Using CQL with CMPI
56 -------------------
57
58  To use CQL support for indications and exec query you will have to use
59  the Pegasus/Provider/CMPI/cmpi_cql.h header file with one new function.
60  You also  you need to define PEGASUS_USE_EXPERIMENTAL in your 
61  code to take advantage of these CQL utility functions. The reason is that 
62  the CMPI standard 1.0 is unclear on one thing:
63  
64    - CMNewSelectExp. One of arguments passed is a 'projection' array. The
65      spec does not explain exactly what in such array. Implementation of
66      CMPI that also implemented WQL put a string representation of the 
67      properties, as "SystemName", "Hostname", etc. But that is not neccesarily
68      the case with CQL, where you can have chained identifiers such as
69      "CIM_OperatingSystem::SystemName". In other words, the CMPI standard
70      needs to clarify this and to make the existing providers backward 
71      supported, this utility function - CMPI_CQL_NewSelectExp is provided
72      until the CMPI standard comes up with a conclusion on this.
73
74   When the CMPI provides a resolution on these issues, this utility
75   interface will be gone and unsupported.
76
77   Questions and Answers:
78 Q1: Is the CMPI Specification really ambiguous or does it 
79 just not support CQL? If it's ambiguous should it be fixed 
80 before it goes final?
81
82 A1:. Page 96 of the CMPI review spec states (line 2899-2901): The *projection output argument is 
83 a pointer to a CMPIArray structure of CMPIString entries containing projection specification. 
84 It shall be set to NULL if no projection is defined.. To clarify any ambigiuity, an e-mail to the
85  CMPI review group was sent, which would add the following: The projection specification is query 
86 language specific. Hence the entries format of the projection output array CMPIString might be 
87 different depending on the query language. Be sure to check the lang argument for the query language your 
88 provider will support. . To guard the provider from DMTF's CQL possible ways it can be represented in 
89 a string format, and since the CQL is experimental, the CMNewSelectExp will NOT support CQL. 
90 The CMPI_CQL_NewSelect will support both CQL and WQL.
91
92
93 AQ:What happens if an existing Provider is passed a CQL 
94 statement and issues a newSelectExp call?  Does it return 
95 an error?
96
97 A2: The error code CMPI_RC_ERR_QUERY_LANGUAGE_NOT_SUPPORTED would be set.
98
99
100 Q3: Both CMNewSelectExp and CMPI_CQL_NewSelectExp return a 
101 CMPISelectExp. Is there anyway to determine whether the 
102 CMPISelectExp represents a CQL or WQL expression?
103
104 A3:Not from the scope of the CMPISelectExp structure. Please note that the routine
105  that would exercise the CMPISelectExp has a char *lang passed in as argument. 
106 This char *lang* can be used to easily determine what query language is used.
107
108
109
110 Registering CMPI providers with Pegasus
111 ---------------------------------------
112
113 Once you have a CMPI provider library you want to register it with Pegasus.
114 How? Well it's almost the same as for C++ providers. The only difference is
115 that the Provider.Interface property must be set to "CMPI".
116
117 Here's an excerpt from the SBLIM Linux Computer System provider registration
118
119 // ===================================================================
120 //      Linux_ComputerSystem
121 // ===================================================================
122
123
124 instance of PG_ProviderModule
125 {
126    Name = "OSBase_ComputerSystemProviderModule";
127    //The library name on disk
128    Location = "cmpiOSBase_ComputerSystemProvider";
129    Vendor = "SBLIM";
130    Version = "1.2.2";
131    InterfaceType = "CMPI";
132    InterfaceVersion = "0.86.0";
133 };
134
135 instance of PG_Provider
136 {
137    //The provider module as defined in PG_ProviderModule
138    ProviderModuleName = "OSBase_ComputerSystemProviderModule";
139    // The provider name as referenced in the code
140    Name = "OSBase_ComputerSystemProvider";
141 };
142
143 instance of PG_ProviderCapabilities
144 {
145    //The provider module as defined in PG_ProviderModule
146    ProviderModuleName = "OSBase_ComputerSystemProviderModule";
147    //The provider name as defined in PG_Provider
148    ProviderName = "OSBase_ComputerSystemProvider";
149    CapabilityID = "1";
150    //Name of the CIM class as defined in the mof
151    ClassName = "Linux_ComputerSystem";
152    Namespaces = {"root/cimv2"};
153    ProviderType = { 2,5 }; // Instance, Method
154    SupportedProperties = NULL; // All properties
155    SupportedMethods = NULL; // All methods
156 };
157