1 //%2006////////////////////////////////////////////////////////////////////////
3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //==============================================================================
31 Common Management Programming Interface (CMPI) Providers in a nutshell
32 ============================
39 The CMPI macro header files (cmpimacs.h) shipped is OpenPegasus specific. This
40 will change once OpenGroup releases a specification with the macro definitions.
42 The CMPI Function Table (cmpift.h) file and CMPI Data Types (cmpidt.h) file are
43 composed from the CMPI v1.0 specification + Technical Corrigenda and are
44 binary compatible with the "historical implementations" and the 1.0 specification
45 augmented with the Technical Corrigenda.
48 Build CMPI from sources
49 -----------------------
51 The Common Manageability Programming Interface (CMPI) has been integrated into
52 Pegasus as a pluggable provider manager.
54 CMPI is by default enabled on Linux. For other platforms it must be enabled
57 For CMPI enablement, set the following environment variables prior to make:
59 PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER=1
64 If you plan to write your own CMPI providers you are kindly referred to the
65 WBEMSource homepage where the draft specification document for CMPI resides.
66 You can find at http://www.wbemsource.org/doc.tpl?CALLER=index.tpl&gdid=3712 .
67 If you are looking for samples you should have a look at the SBLIM project.
68 The packages prefixed by the string sblim-cmpi contain CMPI providers for
69 various classes. See http://www-124.ibm.com/developerworks/projects/sblim .
71 Using CMPI with threads
72 -----------------------
74 CMPI provides API functions for low-level thread, mutex and conditional constructs.
75 Hence you can compile your provider without needing to link to pthread or other
78 However, the developer is responsible for memory management of these constructs and
79 as well of exiting the threads before the cleanup function is exited. If this is not
80 done, the thread will be forcefully terminated. This can have the nasty consequence of
81 hanging CIMServer, or bringing down the CIMServer, or just the Out-of-Process Provider
82 Agent if you run OpenPegasus with 'run-as-requester' configuration flag turned on.
83 Please refer to the Admin Guide or the readme files for more details about this flag.
88 To use CQL support for indications and exec query you will have to use
89 the Pegasus/Provider/CMPI/cmpi_cql.h header file with one new function.
90 You also you need to define PEGASUS_USE_EXPERIMENTAL in your
91 code to take advantage of these CQL utility functions. The reason is that
92 the CMPI standard 1.0 is unclear on one thing:
94 - CMNewSelectExp. One of arguments passed is a 'projection' array. The
95 spec does not explain exactly what in such array. Implementation of
96 CMPI that also implemented WQL put a string representation of the
97 properties, as "SystemName", "Hostname", etc. But that is not neccesarily
98 the case with CQL, where you can have chained identifiers such as
99 "CIM_OperatingSystem::SystemName". In other words, the CMPI standard
100 needs to clarify this and to make the existing providers backward
101 supported, this utility function - CMPI_CQL_NewSelectExp is provided
102 until the CMPI standard comes up with a conclusion on this.
104 When the CMPI provides a resolution on these issues, this utility
105 interface will be gone and unsupported.
107 Questions and Answers:
108 Q1: Is the CMPI Specification really ambiguous or does it
109 just not support CQL? If it's ambiguous should it be fixed
110 before it goes final?
112 A1:. Page 96 of the CMPI review spec states (line 2899-2901): The *projection output argument is
113 a pointer to a CMPIArray structure of CMPIString entries containing projection specification.
114 It shall be set to NULL if no projection is defined.. To clarify any ambigiuity, an e-mail to the
115 CMPI review group was sent, which would add the following: The projection specification is query
116 language specific. Hence the entries format of the projection output array CMPIString might be
117 different depending on the query language. Be sure to check the lang argument for the query language your
118 provider will support. . To guard the provider from DMTF's CQL possible ways it can be represented in
119 a string format, and since the CQL is experimental, the CMNewSelectExp will NOT support CQL.
120 The CMPI_CQL_NewSelect will support both CQL and WQL.
123 AQ:What happens if an existing Provider is passed a CQL
124 statement and issues a newSelectExp call? Does it return
127 A2: The error code CMPI_RC_ERR_QUERY_LANGUAGE_NOT_SUPPORTED would be set.
130 Q3: Both CMNewSelectExp and CMPI_CQL_NewSelectExp return a
131 CMPISelectExp. Is there anyway to determine whether the
132 CMPISelectExp represents a CQL or WQL expression?
134 A3:Not from the scope of the CMPISelectExp structure. Please note that the routine
135 that would exercise the CMPISelectExp has a char *lang passed in as argument.
136 This char *lang* can be used to easily determine what query language is used.
140 Registering CMPI providers with Pegasus
141 ---------------------------------------
143 Once you have a CMPI provider library you want to register it with Pegasus.
144 How? Well it's almost the same as for C++ providers. The only difference is
145 that the Provider.Interface property must be set to "CMPI".
147 Here's an excerpt from the SBLIM Linux Computer System provider registration
149 // ===================================================================
150 // Linux_ComputerSystem
151 // ===================================================================
154 instance of PG_ProviderModule
156 Name = "OSBase_ComputerSystemProviderModule";
157 //The library name on disk
158 Location = "cmpiOSBase_ComputerSystemProvider";
161 InterfaceType = "CMPI";
162 InterfaceVersion = "0.86.0";
165 instance of PG_Provider
167 //The provider module as defined in PG_ProviderModule
168 ProviderModuleName = "OSBase_ComputerSystemProviderModule";
169 // The provider name as referenced in the code
170 Name = "OSBase_ComputerSystemProvider";
173 instance of PG_ProviderCapabilities
175 //The provider module as defined in PG_ProviderModule
176 ProviderModuleName = "OSBase_ComputerSystemProviderModule";
177 //The provider name as defined in PG_Provider
178 ProviderName = "OSBase_ComputerSystemProvider";
180 //Name of the CIM class as defined in the mof
181 ClassName = "Linux_ComputerSystem";
182 Namespaces = {"root/cimv2"};
183 ProviderType = { 2,5 }; // Instance, Method
184 SupportedProperties = NULL; // All properties
185 SupportedMethods = NULL; // All methods