1 martin 1.81 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.82 //
|
3 martin 1.81 // 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
8 // License.
|
9 martin 1.82 //
|
10 martin 1.81 // 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:
|
16 martin 1.82 //
|
17 martin 1.81 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.82 //
|
20 martin 1.81 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.82 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.81 // 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.
|
27 martin 1.82 //
|
28 martin 1.81 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.25 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
|
32 kumpf 1.72 #ifndef Pegasus_Repository_h
33 #define Pegasus_Repository_h
|
34 mike 1.25
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/CIMClass.h>
|
37 mike 1.27 #include <Pegasus/Common/CIMObject.h>
|
38 mike 1.25 #include <Pegasus/Common/CIMInstance.h>
|
39 mike 1.27 #include <Pegasus/Common/CIMPropertyList.h>
|
40 mike 1.25 #include <Pegasus/Common/CIMQualifierDecl.h>
|
41 thilo.boehm 1.84 #include <Pegasus/Common/ReadWriteSem.h>
42
|
43 mike 1.27 #include <Pegasus/Config/ConfigManager.h>
|
44 thilo.boehm 1.84
45 #include <Pegasus/Repository/Linkage.h>
|
46 mike 1.25 #include <Pegasus/Repository/NameSpaceManager.h>
|
47 thilo.boehm 1.84 #include <Pegasus/Repository/ObjectStreamer.h>
|
48 schuur 1.54
|
49 mike 1.25 PEGASUS_NAMESPACE_BEGIN
50
51 class RepositoryDeclContext;
|
52 kumpf 1.51 class compilerDeclContext;
|
53 mike 1.25
|
54 mike 1.27 /** This class provides a simple implementation of a CIM repository.
|
55 kumpf 1.50 Concurrent access is controlled by an internal lock.
|
56 mike 1.25 */
|
57 kumpf 1.72 class PEGASUS_REPOSITORY_LINKAGE CIMRepository
|
58 mike 1.25 {
59 public:
60
|
61 kumpf 1.69 enum CIMRepositoryMode
62 {
63 MODE_DEFAULT = 0,
64 MODE_XML = 1,
65 MODE_BIN = 2,
66 MODE_COMPRESSED = 4
67 };
68
|
69 mike 1.25 /// Constructor
|
70 kumpf 1.69 CIMRepository(
71 const String& repositoryRoot,
|
72 dmitry.mikulin 1.75 Uint32 mode = CIMRepository::MODE_DEFAULT,
73 RepositoryDeclContext* declContext = 0);
|
74 mike 1.25
75 /// Descructor
|
76 mike 1.76 ~CIMRepository();
|
77 mike 1.25
|
78 kumpf 1.50 /// getClass
|
79 mike 1.76 CIMClass getClass(
|
80 kumpf 1.41 const CIMNamespaceName& nameSpace,
81 const CIMName& className,
|
82 mike 1.27 Boolean localOnly = true,
83 Boolean includeQualifiers = true,
84 Boolean includeClassOrigin = false,
85 const CIMPropertyList& propertyList = CIMPropertyList());
|
86 mike 1.25
|
87 mike 1.80 // getFullConstClass
88 CIMConstClass getFullConstClass(
89 const CIMNamespaceName& nameSpace,
90 const CIMName& className);
91
|
92 mike 1.25 /// getInstance
|
93 mike 1.76 CIMInstance getInstance(
|
94 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
95 kumpf 1.34 const CIMObjectPath& instanceName,
|
96 mike 1.27 Boolean includeQualifiers = false,
97 Boolean includeClassOrigin = false,
|
98 mike 1.31 const CIMPropertyList& propertyList = CIMPropertyList());
|
99 mike 1.25
100 /// deleteClass
|
101 mike 1.76 void deleteClass(
|
102 kumpf 1.41 const CIMNamespaceName& nameSpace,
103 const CIMName& className);
|
104 mike 1.25
105 /// deleteInstance
|
106 mike 1.76 void deleteInstance(
|
107 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
108 kumpf 1.34 const CIMObjectPath& instanceName);
|
109 mike 1.25
110 /// createClass
|
111 mike 1.76 void createClass(
|
112 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
113 kumpf 1.79 const CIMClass& newClass);
|
114 mike 1.25
115 /// createInstance
|
116 mike 1.76 CIMObjectPath createInstance(
|
117 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
118 kumpf 1.79 const CIMInstance& newInstance);
|
119 mike 1.25
120 /// modifyClass
|
121 mike 1.76 void modifyClass(
|
122 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
123 kumpf 1.79 const CIMClass& modifiedClass);
|
124 mike 1.25
125 /// modifyInstance
|
126 mike 1.76 void modifyInstance(
|
127 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
128 kumpf 1.36 const CIMInstance& modifiedInstance,
|
129 mike 1.27 Boolean includeQualifiers = true,
|
130 kumpf 1.79 const CIMPropertyList& propertyList = CIMPropertyList());
|
131 mike 1.25
132 /// enumerateClasses
|
133 mike 1.76 Array<CIMClass> enumerateClasses(
|
134 kumpf 1.41 const CIMNamespaceName& nameSpace,
135 const CIMName& className = CIMName(),
|
136 mike 1.27 Boolean deepInheritance = false,
137 Boolean localOnly = true,
138 Boolean includeQualifiers = true,
139 Boolean includeClassOrigin = false);
|
140 mike 1.25
141 /// enumerateClassNames
|
142 mike 1.76 Array<CIMName> enumerateClassNames(
|
143 kumpf 1.41 const CIMNamespaceName& nameSpace,
144 const CIMName& className = CIMName(),
|
145 mike 1.27 Boolean deepInheritance = false);
|
146 mike 1.25
|
147 kumpf 1.68 /**
148 Enumerates the instances of the specified class and its subclasses.
149 This method mimics the client behavior for the EnumerateInstances
150 operation, but of course it can only return the instances that reside
151 in the repository. This method does not perform deepInheritance
152 filtering regardless of the value given for that parameter.
153
154 This method is useful mainly for testing purposes, and should not be
155 relied upon for complete results in a CIM Server environment.
156 */
|
157 mike 1.76 Array<CIMInstance> enumerateInstancesForSubtree(
|
158 kumpf 1.41 const CIMNamespaceName& nameSpace,
159 const CIMName& className,
|
160 mike 1.27 Boolean deepInheritance = true,
161 Boolean includeQualifiers = false,
162 Boolean includeClassOrigin = false,
|
163 kumpf 1.71 const CIMPropertyList& propertyList = CIMPropertyList());
|
164 mike 1.25
|
165 kumpf 1.68 /**
166 Enumerates the instances of just the specified class.
167 This method mimics the provider behavior for the EnumerateInstances
168 operation.
|
169 karl 1.35 */
|
170 mike 1.76 Array<CIMInstance> enumerateInstancesForClass(
|
171 kumpf 1.41 const CIMNamespaceName& nameSpace,
172 const CIMName& className,
|
173 karl 1.35 Boolean includeQualifiers = false,
174 Boolean includeClassOrigin = false,
175 const CIMPropertyList& propertyList = CIMPropertyList());
176
177
|
178 kumpf 1.68 /**
179 Enumerates the names of the instances of the specified class and its
180 subclasses. This method mimics the client behavior for the
181 EnumerateInstanceNames operation, but of course it can only return
182 the names of the instances that reside in the repository.
183
184 This method is useful mainly for testing purposes, and should not be
185 relied upon for complete results in a CIM Server environment.
186
187 @param nameSpace The namespace in which className resides.
188 @param className The name the class for which to retrieve the instance
189 names.
190 @return An Array of CIMObjectPath objects containing the names of the
191 instances of the specified class in the specified namespace.
|
192 karl 1.42 */
|
193 mike 1.76 Array<CIMObjectPath> enumerateInstanceNamesForSubtree(
|
194 kumpf 1.41 const CIMNamespaceName& nameSpace,
195 const CIMName& className);
|
196 karl 1.35
|
197 kumpf 1.68 /**
198 Enumerates the names of the instances of just the specified class.
199 This method mimics the provider behavior for the EnumerateInstanceNames
200 operation.
201
202 @param nameSpace The namespace in which className resides.
203 @param className The name the class for which to retrieve the instance
204 names.
205 @return An Array of CIMObjectPath objects containing the names of the
206 instances of the specified class in the specified namespace.
|
207 karl 1.35 */
|
208 mike 1.76 Array<CIMObjectPath> enumerateInstanceNamesForClass(
|
209 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
210 kumpf 1.68 const CIMName& className);
|
211 karl 1.35
|
212 mike 1.25
213 /// associators
|
214 mike 1.76 Array<CIMObject> associators(
|
215 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
216 kumpf 1.34 const CIMObjectPath& objectName,
|
217 kumpf 1.41 const CIMName& assocClass = CIMName(),
218 const CIMName& resultClass = CIMName(),
|
219 mike 1.27 const String& role = String::EMPTY,
220 const String& resultRole = String::EMPTY,
221 Boolean includeQualifiers = false,
222 Boolean includeClassOrigin = false,
223 const CIMPropertyList& propertyList = CIMPropertyList());
|
224 mike 1.25
|
225 kumpf 1.50 /// associatorNames
|
226 mike 1.76 Array<CIMObjectPath> associatorNames(
|
227 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
228 kumpf 1.34 const CIMObjectPath& objectName,
|
229 kumpf 1.41 const CIMName& assocClass = CIMName(),
230 const CIMName& resultClass = CIMName(),
|
231 mike 1.27 const String& role = String::EMPTY,
232 const String& resultRole = String::EMPTY);
|
233 mike 1.25
234 /// references
|
235 mike 1.76 Array<CIMObject> references(
|
236 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
237 kumpf 1.34 const CIMObjectPath& objectName,
|
238 kumpf 1.41 const CIMName& resultClass = CIMName(),
|
239 mike 1.27 const String& role = String::EMPTY,
240 Boolean includeQualifiers = false,
241 Boolean includeClassOrigin = false,
242 const CIMPropertyList& propertyList = CIMPropertyList());
|
243 mike 1.25
244 /// referenceNames
|
245 mike 1.76 Array<CIMObjectPath> referenceNames(
|
246 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
247 kumpf 1.34 const CIMObjectPath& objectName,
|
248 karl 1.42 const CIMName& resultClass = CIMName(),
249 const String& role = String::EMPTY);
250
|
251 mike 1.25 /// getProperty
|
252 mike 1.76 CIMValue getProperty(
|
253 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
254 kumpf 1.34 const CIMObjectPath& instanceName,
|
255 kumpf 1.41 const CIMName& propertyName);
|
256 mike 1.25
257 /// setProperty
|
258 mike 1.76 void setProperty(
|
259 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
260 kumpf 1.34 const CIMObjectPath& instanceName,
|
261 kumpf 1.41 const CIMName& propertyName,
|
262 kumpf 1.79 const CIMValue& newValue = CIMValue());
|
263 mike 1.25
264 /// getQualifier
|
265 mike 1.76 CIMQualifierDecl getQualifier(
|
266 kumpf 1.41 const CIMNamespaceName& nameSpace,
267 const CIMName& qualifierName);
|
268 mike 1.25
269 /// setQualifier
|
270 mike 1.76 void setQualifier(
|
271 kumpf 1.41 const CIMNamespaceName& nameSpace,
|
272 kumpf 1.79 const CIMQualifierDecl& qualifierDecl);
|
273 mike 1.25
|
274 kumpf 1.50 /// deleteQualifier
|
275 mike 1.76 void deleteQualifier(
|
276 kumpf 1.41 const CIMNamespaceName& nameSpace,
277 const CIMName& qualifierName);
|
278 mike 1.25
279 /// enumerateQualifiers
|
280 mike 1.76 Array<CIMQualifierDecl> enumerateQualifiers(
|
281 kumpf 1.71 const CIMNamespaceName& nameSpace);
|
282 mike 1.25
|
283 kumpf 1.72 typedef HashTable <String, String, EqualNoCaseFunc, HashLowerCaseFunc>
284 NameSpaceAttributes;
285
|
286 mike 1.76 void createNameSpace(const CIMNamespaceName& nameSpace,
|
287 kumpf 1.71 const NameSpaceAttributes& attributes = NameSpaceAttributes());
|
288 schuur 1.53
|
289 mike 1.76 void modifyNameSpace(const CIMNamespaceName& nameSpace,
|
290 kumpf 1.71 const NameSpaceAttributes& attributes = NameSpaceAttributes());
|
291 mike 1.25
|
292 mike 1.76 Array<CIMNamespaceName> enumerateNameSpaces() const;
|
293 mike 1.25
|
294 kumpf 1.77 /** Deletes a namespace in the repository.
|
295 mike 1.27 The deleteNameSpace method will only delete a namespace if there are
296 no classed defined in the namespace. Today this is a Pegasus
297 characteristics and not defined as part of the DMTF standards.
298 @param String with the name of the namespace
299 @exception - Throws NoSuchDirectory if the Namespace does not exist.
|
300 mike 1.25 */
|
301 mike 1.76 void deleteNameSpace(const CIMNamespaceName& nameSpace);
|
302 mike 1.31
|
303 mike 1.76 Boolean getNameSpaceAttributes(
|
304 kumpf 1.71 const CIMNamespaceName& nameSpace,
305 NameSpaceAttributes& attributes);
|
306 schuur 1.53
|
307 sahana.prabhakar 1.85 Boolean nameSpaceExists(const CIMNamespaceName& nameSpaceName);
308
|
309 mike 1.31 ////////////////////////////////////////////////////////////////////////////
|
310 mike 1.25
|
311 mike 1.27 /** Indicates whether instance operations that do not have a provider
312 registered should be served by this repository.
313 */
|
314 mike 1.76 Boolean isDefaultInstanceProvider();
|
315 mike 1.27
|
316 mike 1.31 /** Get subclass names of the given class in the given namespace.
|
317 sage 1.28 @param nameSpaceName
318 @param className - class whose subclass names will be gotten. If
319 className is empty, all classnames are returned.
320 @param deepInheritance - if true all descendent classes of class
|
321 karl 1.33 are returned. If className is empty, only root classes are returned.
322 @param subClassNames - output argument to hold subclass names.
|
323 sage 1.28 @exception CIMException(CIM_ERR_INVALID_CLASS)
324 */
|
325 mike 1.76 void getSubClassNames(
|
326 kumpf 1.41 const CIMNamespaceName& nameSpaceName,
327 const CIMName& className,
|
328 sage 1.28 Boolean deepInheritance,
|
329 mike 1.76 Array<CIMName>& subClassNames) const;
|
330 sage 1.28
331 /** Get the names of all superclasses (direct and indirect) of this
332 class.
333 */
|
334 mike 1.76 void getSuperClassNames(
|
335 kumpf 1.41 const CIMNamespaceName& nameSpaceName,
336 const CIMName& className,
|
337 mike 1.76 Array<CIMName>& subClassNames) const;
|
338 sage 1.28
|
339 mike 1.76 Boolean isRemoteNameSpace(
|
340 schuur 1.55 const CIMNamespaceName& nameSpaceName,
|
341 kumpf 1.71 String& remoteInfo);
|
342 dave.sudlik 1.61
343 #ifdef PEGASUS_DEBUG
|
344 kumpf 1.71 void DisplayCacheStatistics();
|
345 dave.sudlik 1.61 #endif
346
|
347 kumpf 1.50 protected:
348
349 // Internal getClass implementation that does not do access control
|
350 mike 1.80 // If readOnlyClass is true, then the caller ensures that the returned
351 // class, will never be modified, which allows returning a reference to
352 // the one that is in the cache.
|
353 kumpf 1.50 CIMClass _getClass(
354 const CIMNamespaceName& nameSpace,
355 const CIMName& className,
356 Boolean localOnly,
357 Boolean includeQualifiers,
358 Boolean includeClassOrigin,
|
359 mike 1.80 const CIMPropertyList& propertyList,
360 Boolean clone = true);
|
361 kumpf 1.50
362 /// Internal getInstance implementation that does not do access control
363 CIMInstance _getInstance(
364 const CIMNamespaceName& nameSpace,
365 const CIMObjectPath& instanceName,
366 Boolean includeQualifiers,
367 Boolean includeClassOrigin,
|
368 kumpf 1.78 const CIMPropertyList& propertyList,
369 Boolean resolveInstance);
|
370 kumpf 1.50
371 /// Internal createClass implementation that does not do access control
372 void _createClass(
373 const CIMNamespaceName& nameSpace,
374 const CIMClass& newClass);
375
376 /// Internal createInstance implementation that does not do access control
377 CIMObjectPath _createInstance(
378 const CIMNamespaceName& nameSpace,
379 const CIMInstance& newInstance);
380
381 /// Internal modifyClass implementation that does not do access control
382 void _modifyClass(
383 const CIMNamespaceName& nameSpace,
384 const CIMClass& modifiedClass);
385
386 /// Internal associatorNames implementation that does not do access control
387 Array<CIMObjectPath> _associatorNames(
388 const CIMNamespaceName& nameSpace,
389 const CIMObjectPath& objectName,
390 const CIMName& assocClass,
391 kumpf 1.50 const CIMName& resultClass,
392 const String& role,
393 const String& resultRole);
394
395 /// Internal referenceNames implementation that does not do access control
396 Array<CIMObjectPath> _referenceNames(
397 const CIMNamespaceName& nameSpace,
398 const CIMObjectPath& objectName,
399 const CIMName& resultClass,
400 const String& role);
401
402 /// Internal getQualifier implementation that does not do access control
403 CIMQualifierDecl _getQualifier(
404 const CIMNamespaceName& nameSpace,
405 const CIMName& qualifierName);
406
407 /// Internal setQualifier implementation that does not do access control
408 void _setQualifier(
409 const CIMNamespaceName& nameSpace,
410 const CIMQualifierDecl& qualifierDecl);
411
|
412 mike 1.25 private:
413
|
414 mike 1.76 class CIMRepositoryRep* _rep;
|
415 kumpf 1.50 friend class compilerDeclContext;
416 friend class RepositoryDeclContext;
|
417 mike 1.25 };
418
419 PEGASUS_NAMESPACE_END
420
|
421 kumpf 1.72 #endif /* Pegasus_Repository_h */
|