1 martin 1.8 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.9 //
|
3 martin 1.8 // 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.9 //
|
10 martin 1.8 // 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.9 //
|
17 martin 1.8 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.9 //
|
20 martin 1.8 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.9 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.8 // 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.9 //
|
28 martin 1.8 //////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_FileBasedStore_h
33 #define Pegasus_FileBasedStore_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/HashTable.h>
|
37 kumpf 1.6 #include <Pegasus/Repository/PersistentStore.h>
|
38 kumpf 1.5 #include <Pegasus/Repository/PersistentStoreData.h>
39 #include <Pegasus/Repository/AssocClassTable.h>
|
40 kumpf 1.6 #include <Pegasus/Repository/Linkage.h>
|
41 kumpf 1.1
42 PEGASUS_NAMESPACE_BEGIN
43
|
44 kumpf 1.6 class PEGASUS_REPOSITORY_LINKAGE FileBasedStore : public PersistentStore
|
45 kumpf 1.1 {
46 public:
|
47 kumpf 1.6
48 static Boolean isExistingRepository(const String& repositoryRoot);
49
|
50 kumpf 1.1 FileBasedStore(
51 const String& repositoryPath,
52 ObjectStreamer* streamer,
53 Boolean compressMode);
54
55 ~FileBasedStore();
56
|
57 kumpf 1.4 Boolean storeCompleteClassDefinitions()
58 {
59 return _storeCompleteClasses;
60 }
61
|
62 kumpf 1.1 Array<NamespaceDefinition> enumerateNameSpaces();
63 void createNameSpace(
64 const CIMNamespaceName& nameSpace,
65 Boolean shareable,
66 Boolean updatesAllowed,
|
67 venkat.puvvada 1.7 const String& parent,
68 const String& remoteInfo);
69
|
70 kumpf 1.1 void modifyNameSpace(
71 const CIMNamespaceName& nameSpace,
72 Boolean shareable,
73 Boolean updatesAllowed);
|
74 rohini.deshpande 1.13
75 void modifyNameSpaceName(
76 const CIMNamespaceName& nameSpace,
77 const CIMNamespaceName& newNameSpaceName);
78
|
79 kumpf 1.1 void deleteNameSpace(const CIMNamespaceName& nameSpace);
80 Boolean isNameSpaceEmpty(const CIMNamespaceName& nameSpace);
81
82 Array<CIMQualifierDecl> enumerateQualifiers(
83 const CIMNamespaceName& nameSpace);
84 /**
85 Gets a qualifier declaration for a specified qualifier name in a
86 specified namespace. Returns an uninitialized object if the qualifier
87 is not found.
88 */
89 CIMQualifierDecl getQualifier(
90 const CIMNamespaceName& nameSpace,
91 const CIMName& qualifierName);
92 void setQualifier(
93 const CIMNamespaceName& nameSpace,
94 const CIMQualifierDecl& qualifierDecl);
95 void deleteQualifier(
96 const CIMNamespaceName& nameSpace,
97 const CIMName& qualifierName);
98
99 Array<Pair<String, String> > enumerateClassNames(
100 kumpf 1.1 const CIMNamespaceName& nameSpace);
101 CIMClass getClass(
102 const CIMNamespaceName& nameSpace,
103 const CIMName& className,
104 const CIMName& superClassName);
|
105 kumpf 1.2 /**
106 Creates a class definition. If the class is an association class,
107 the class association entries are also added.
108 */
|
109 kumpf 1.1 void createClass(
110 const CIMNamespaceName& nameSpace,
|
111 kumpf 1.2 const CIMClass& newClass,
112 const Array<ClassAssociation>& classAssocEntries);
113 /**
114 Modifies a class definition. If the class is an association class,
115 the class association entries are also updated to the specified set.
116 */
|
117 kumpf 1.1 void modifyClass(
118 const CIMNamespaceName& nameSpace,
|
119 kumpf 1.2 const CIMClass& modifiedClass,
|
120 kumpf 1.4 const CIMName& oldSuperClassName,
|
121 kumpf 1.2 Boolean isAssociation,
122 const Array<ClassAssociation>& classAssocEntries);
123 /**
124 Deletes a class definition. If the class is an association class,
125 the class association entries are also deleted. It is expected to
126 have already been verified that no instances of this class exist. A
127 list of dependent namespace names is provided to allow appropriate
128 clean-up of instance files, if necessary.
129 */
|
130 kumpf 1.1 void deleteClass(
131 const CIMNamespaceName& nameSpace,
132 const CIMName& className,
|
133 kumpf 1.2 const CIMName& superClassName,
134 Boolean isAssociation,
135 const Array<CIMNamespaceName>& dependentNameSpaceNames);
|
136 kumpf 1.1
137 Array<CIMObjectPath> enumerateInstanceNamesForClass(
138 const CIMNamespaceName& nameSpace,
139 const CIMName& className);
140 Array<CIMInstance> enumerateInstancesForClass(
141 const CIMNamespaceName& nameSpace,
142 const CIMName& className);
143 CIMInstance getInstance(
144 const CIMNamespaceName& nameSpace,
145 const CIMObjectPath& instanceName);
|
146 kumpf 1.2 /**
147 Creates an instance definition. If it is an association instance,
148 the instance association entries are also added.
149 */
|
150 kumpf 1.1 void createInstance(
151 const CIMNamespaceName& nameSpace,
152 const CIMObjectPath& instanceName,
|
153 kumpf 1.2 const CIMInstance& cimInstance,
154 const Array<InstanceAssociation>& instAssocEntries);
|
155 kumpf 1.1 void modifyInstance(
156 const CIMNamespaceName& nameSpace,
157 const CIMObjectPath& instanceName,
158 const CIMInstance& cimInstance);
|
159 kumpf 1.2 /**
160 Deletes an instance definition. If it is an association instance,
161 the instance association entries are also deleted.
162 */
|
163 kumpf 1.1 void deleteInstance(
164 const CIMNamespaceName& nameSpace,
165 const CIMObjectPath& instanceName);
166 Boolean instanceExists(
167 const CIMNamespaceName& nameSpace,
168 const CIMObjectPath& instanceName);
169
170 void getClassAssociatorNames(
171 const CIMNamespaceName& nameSpace,
172 const Array<CIMName>& classList,
173 const Array<CIMName>& assocClassList,
174 const Array<CIMName>& resultClassList,
175 const String& role,
176 const String& resultRole,
177 Array<String>& associatorNames);
178 void getClassReferenceNames(
179 const CIMNamespaceName& nameSpace,
180 const Array<CIMName>& classList,
181 const Array<CIMName>& resultClassList,
182 const String& role,
183 Array<String>& referenceNames);
184 kumpf 1.1
185 void getInstanceAssociatorNames(
186 const CIMNamespaceName& nameSpace,
187 const CIMObjectPath& instanceName,
188 const Array<CIMName>& assocClassList,
189 const Array<CIMName>& resultClassList,
190 const String& role,
191 const String& resultRole,
192 Array<String>& associatorNames);
193 void getInstanceReferenceNames(
194 const CIMNamespaceName& nameSpace,
195 const CIMObjectPath& instanceName,
196 const Array<CIMName>& resultClassList,
197 const String& role,
198 Array<String>& referenceNames);
199
200 private:
201
202 void _rollbackIncompleteTransactions();
203
|
204 karl 1.11 /**
|
205 marek 1.10 Searches for state file in the "instance" directory of all
|
206 karl 1.11 namespaces.
|
207 marek 1.10 i) Removes the rollback files to void a begin operation.
|
208 karl 1.11 ii) Removes the rollback files to complete a commit operation.
|
209 marek 1.10 iii) Restores instance index and data files complete a
210 rollback operation.
211 If no state files are present, this method returns false
212 */
213 Boolean _completeTransactions();
214
|
215 kumpf 1.1 /**
216 Converts a namespace name into a directory path. The specified
217 namespace name is not required to match the case of the namespace
218 name that was originally created.
219
220 @param nameSpace The namespace for which to determine the directory
221 path.
222 @return A string containing the directory path for the namespace.
223 */
224 String _getNameSpaceDirPath(const CIMNamespaceName& nameSpace) const;
225
226 /** Returns the path of the qualifier file.
227
228 @param nameSpace the namespace of the qualifier
229 @param qualifierName the name of the qualifier
230
231 @return a string containing the qualifier file path
232 */
233 String _getQualifierFilePath(
234 const CIMNamespaceName& nameSpace,
235 const CIMName& qualifierName) const;
236 kumpf 1.1
237 /** Returns the path of the class file.
238
239 @param nameSpace the namespace of the class
240 @param className the name of the class
241
242 @return a string containing the class file path
243 */
244 String _getClassFilePath(
245 const CIMNamespaceName& nameSpace,
246 const CIMName& className,
247 const CIMName& superClassName) const;
248
249 /** Returns the path of the instance index file.
250
251 @param nameSpace the namespace of the instance
252 @param className the name of the class
253
254 @return a string containing the index file path
255 */
256 String _getInstanceIndexFilePath(
257 kumpf 1.1 const CIMNamespaceName& nameSpace,
258 const CIMName& className) const;
259
260 /** Returns the path of the instance file.
261
262 @param nameSpace the namespace of the instance
263 @param className the name of the class
264
265 @return a string containing the instance file path
266 */
267 String _getInstanceDataFilePath(
268 const CIMNamespaceName& nameSpace,
269 const CIMName& className) const;
270
271 /** Returns the path of the class association file.
272
273 @param nameSpace the namespace of the associations
274
275 @return a string containing the class association file path
276 */
277 String _getAssocClassPath(const CIMNamespaceName& nameSpace) const;
278 kumpf 1.1
279 /** Returns the path of the instance association file.
280
281 @param nameSpace the namespace of the associations
282
283 @return a string containing the instance association file path
284 */
285 String _getAssocInstPath(const CIMNamespaceName& nameSpace) const;
286
287 Boolean _loadInstance(
288 const String& path,
289 CIMInstance& object,
290 Uint32 index,
291 Uint32 size);
292
293 /** loads all the instance objects from disk to memeory. Returns true
294 on success.
295
296 @param nameSpace the namespace of the instances to be loaded
297 @param className the class of the instances to be loaded
298 @param namedInstances an array of CIMInstance objects to which
299 kumpf 1.1 the loaded instances are appended
300
301 @return true if successful
302 false if an error occurs in loading the instances
303 */
304 Boolean _loadAllInstances(
305 const CIMNamespaceName& nameSpace,
306 const CIMName& className,
307 Array<CIMInstance>& namedInstances);
308
|
309 kumpf 1.2 void _addClassAssociationEntries(
310 const CIMNamespaceName& nameSpace,
311 const Array<ClassAssociation>& classAssocEntries);
312 void _removeClassAssociationEntries(
313 const CIMNamespaceName& nameSpace,
314 const CIMName& assocClassName);
315
316 void _addInstanceAssociationEntries(
317 const CIMNamespaceName& nameSpace,
318 const Array<InstanceAssociation>& instanceAssocEntries);
319 void _removeInstanceAssociationEntries(
320 const CIMNamespaceName& nameSpace,
321 const CIMObjectPath& assocInstanceName);
|
322 karl 1.11 void _SaveObject(const String& path,
323 Buffer& objectXml);
|
324 kumpf 1.2
|
325 kumpf 1.1 String _repositoryPath;
326 ObjectStreamer* _streamer;
|
327 dl.meetei 1.12 #ifdef PEGASUS_ENABLE_COMPRESSED_REPOSITORY
|
328 kumpf 1.1 Boolean _compressMode;
|
329 dl.meetei 1.12 #endif
|
330 kumpf 1.4 Boolean _storeCompleteClasses;
|
331 kumpf 1.1
332 /**
333 Maps namespace names to directory paths
334 */
335 HashTable<String, String, EqualNoCaseFunc, HashLowerCaseFunc>
336 _nameSpacePathTable;
|
337 kumpf 1.5
338 /**
339 This table must be managed dynamically per repository because it
340 caches class association data in addition to handling persistent
341 storage and lookup.
342 */
343 AssocClassTable _assocClassTable;
|
344 kumpf 1.1 };
345
346 PEGASUS_NAMESPACE_END
347
348 #endif /* Pegasus_FileBasedStore_h */
|