1 //%LICENSE////////////////////////////////////////////////////////////////
3 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //////////////////////////////////////////////////////////////////////////
29 Common Management Programming Interface (CMPI) Providers in a nutshell
30 ============================
37 The CMPI macro header files (cmpimacs.h) shipped is OpenPegasus specific. This
38 will change once OpenGroup releases a specification with the macro definitions.
40 The CMPI Function Table (cmpift.h) file and CMPI Data Types (cmpidt.h) file are
41 composed from the CMPI v1.0 specification + Technical Corrigenda and are
42 binary compatible with the "historical implementations" and the 1.0 specification
43 augmented with the Technical Corrigenda.
46 Build CMPI from sources
47 -----------------------
49 The Common Manageability Programming Interface (CMPI) has been integrated into
50 Pegasus as a pluggable provider manager.
52 CMPI is by default enabled on Linux. For other platforms it must be enabled
55 For CMPI enablement, set the following environment variables prior to make:
57 PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER=1
62 If you plan to write your own CMPI providers you are kindly referred to the
63 WBEMSource homepage where the draft specification document for CMPI resides.
64 You can find at http://www.wbemsource.org/doc.tpl?CALLER=index.tpl&gdid=3712 .
65 If you are looking for samples you should have a look at the SBLIM project.
66 The packages prefixed by the string sblim-cmpi contain CMPI providers for
67 various classes. See http://www-124.ibm.com/developerworks/projects/sblim .
69 Using CMPI with threads
70 -----------------------
72 CMPI provides API functions for low-level thread, mutex and conditional constructs.
73 Hence you can compile your provider without needing to link to pthread or other
76 However, the developer is responsible for memory management of these constructs and
77 as well of exiting the threads before the cleanup function is exited. If this is not
78 done, the thread will be forcefully terminated. This can have the nasty consequence of
79 hanging CIMServer, or bringing down the CIMServer, or just the Out-of-Process Provider
80 Agent if you run OpenPegasus with 'run-as-requester' configuration flag turned on.
81 Please refer to the Admin Guide or the readme files for more details about this flag.
86 To use CQL support for indications and exec query you will have to use
87 the Pegasus/Provider/CMPI/cmpi_cql.h header file with one new function.
88 You also you need to define PEGASUS_USE_EXPERIMENTAL in your
89 code to take advantage of these CQL utility functions. The reason is that
90 the CMPI standard 1.0 is unclear on one thing:
92 - CMNewSelectExp. One of arguments passed is a 'projection' array. The
93 spec does not explain exactly what in such array. Implementation of
94 CMPI that also implemented WQL put a string representation of the
95 properties, as "SystemName", "Hostname", etc. But that is not neccesarily
96 the case with CQL, where you can have chained identifiers such as
97 "CIM_OperatingSystem::SystemName". In other words, the CMPI standard
98 needs to clarify this and to make the existing providers backward
99 supported, this utility function - CMPI_CQL_NewSelectExp is provided
100 until the CMPI standard comes up with a conclusion on this.
102 When the CMPI provides a resolution on these issues, this utility
103 interface will be gone and unsupported.
105 Questions and Answers:
106 Q1: Is the CMPI Specification really ambiguous or does it
107 just not support CQL? If it's ambiguous should it be fixed
108 before it goes final?
110 A1:. Page 96 of the CMPI review spec states (line 2899-2901): The *projection output argument is
111 a pointer to a CMPIArray structure of CMPIString entries containing projection specification.
112 It shall be set to NULL if no projection is defined.. To clarify any ambigiuity, an e-mail to the
113 CMPI review group was sent, which would add the following: The projection specification is query
114 language specific. Hence the entries format of the projection output array CMPIString might be
115 different depending on the query language. Be sure to check the lang argument for the query language your
116 provider will support. . To guard the provider from DMTF's CQL possible ways it can be represented in
117 a string format, and since the CQL is experimental, the CMNewSelectExp will NOT support CQL.
118 The CMPI_CQL_NewSelect will support both CQL and WQL.
121 AQ:What happens if an existing Provider is passed a CQL
122 statement and issues a newSelectExp call? Does it return
125 A2: The error code CMPI_RC_ERR_QUERY_LANGUAGE_NOT_SUPPORTED would be set.
128 Q3: Both CMNewSelectExp and CMPI_CQL_NewSelectExp return a
129 CMPISelectExp. Is there anyway to determine whether the
130 CMPISelectExp represents a CQL or WQL expression?
132 A3:Not from the scope of the CMPISelectExp structure. Please note that the routine
133 that would exercise the CMPISelectExp has a char *lang passed in as argument.
134 This char *lang* can be used to easily determine what query language is used.
138 Registering CMPI providers with Pegasus
139 ---------------------------------------
141 Once you have a CMPI provider library you want to register it with Pegasus.
142 How? Well it's almost the same as for C++ providers. The only difference is
143 that the Provider.Interface property must be set to "CMPI".
145 Here's an excerpt from the SBLIM Linux Computer System provider registration
147 // ===================================================================
148 // Linux_ComputerSystem
149 // ===================================================================
152 instance of PG_ProviderModule
154 Name = "OSBase_ComputerSystemProviderModule";
155 //The library name on disk
156 Location = "cmpiOSBase_ComputerSystemProvider";
159 InterfaceType = "CMPI";
160 InterfaceVersion = "0.86.0";
163 instance of PG_Provider
165 //The provider module as defined in PG_ProviderModule
166 ProviderModuleName = "OSBase_ComputerSystemProviderModule";
167 // The provider name as referenced in the code
168 Name = "OSBase_ComputerSystemProvider";
171 instance of PG_ProviderCapabilities
173 //The provider module as defined in PG_ProviderModule
174 ProviderModuleName = "OSBase_ComputerSystemProviderModule";
175 //The provider name as defined in PG_Provider
176 ProviderName = "OSBase_ComputerSystemProvider";
178 //Name of the CIM class as defined in the mof
179 ClassName = "Linux_ComputerSystem";
180 Namespaces = {"root/cimv2"};
181 ProviderType = { 2,5 }; // Instance, Method
182 SupportedProperties = NULL; // All properties
183 SupportedMethods = NULL; // All methods