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