(file) Return to FileBasedStore.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Repository

  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                        void deleteNameSpace(const CIMNamespaceName& nameSpace);
 75                        Boolean isNameSpaceEmpty(const CIMNamespaceName& nameSpace);
 76                    
 77                        Array<CIMQualifierDecl> enumerateQualifiers(
 78                            const CIMNamespaceName& nameSpace);
 79                        /**
 80                            Gets a qualifier declaration for a specified qualifier name in a
 81                            specified namespace.  Returns an uninitialized object if the qualifier
 82                            is not found.
 83                        */
 84                        CIMQualifierDecl getQualifier(
 85                            const CIMNamespaceName& nameSpace,
 86                            const CIMName& qualifierName);
 87                        void setQualifier(
 88                            const CIMNamespaceName& nameSpace,
 89                            const CIMQualifierDecl& qualifierDecl);
 90                        void deleteQualifier(
 91 kumpf          1.1         const CIMNamespaceName& nameSpace,
 92                            const CIMName& qualifierName);
 93                    
 94                        Array<Pair<String, String> > enumerateClassNames(
 95                            const CIMNamespaceName& nameSpace);
 96                        CIMClass getClass(
 97                            const CIMNamespaceName& nameSpace,
 98                            const CIMName& className,
 99                            const CIMName& superClassName);
100 kumpf          1.2     /**
101                            Creates a class definition.  If the class is an association class,
102                            the class association entries are also added.
103                        */
104 kumpf          1.1     void createClass(
105                            const CIMNamespaceName& nameSpace,
106 kumpf          1.2         const CIMClass& newClass,
107                            const Array<ClassAssociation>& classAssocEntries);
108                        /**
109                            Modifies a class definition.  If the class is an association class,
110                            the class association entries are also updated to the specified set.
111                        */
112 kumpf          1.1     void modifyClass(
113                            const CIMNamespaceName& nameSpace,
114 kumpf          1.2         const CIMClass& modifiedClass,
115 kumpf          1.4         const CIMName& oldSuperClassName,
116 kumpf          1.2         Boolean isAssociation,
117                            const Array<ClassAssociation>& classAssocEntries);
118                        /**
119                            Deletes a class definition.  If the class is an association class,
120                            the class association entries are also deleted.  It is expected to
121                            have already been verified that no instances of this class exist.  A
122                            list of dependent namespace names is provided to allow appropriate
123                            clean-up of instance files, if necessary.
124                        */
125 kumpf          1.1     void deleteClass(
126                            const CIMNamespaceName& nameSpace,
127                            const CIMName& className,
128 kumpf          1.2         const CIMName& superClassName,
129                            Boolean isAssociation,
130                            const Array<CIMNamespaceName>& dependentNameSpaceNames);
131 kumpf          1.1 
132                        Array<CIMObjectPath> enumerateInstanceNamesForClass(
133                            const CIMNamespaceName& nameSpace,
134                            const CIMName& className);
135                        Array<CIMInstance> enumerateInstancesForClass(
136                            const CIMNamespaceName& nameSpace,
137                            const CIMName& className);
138                        CIMInstance getInstance(
139                            const CIMNamespaceName& nameSpace,
140                            const CIMObjectPath& instanceName);
141 kumpf          1.2     /**
142                            Creates an instance definition.  If it is an association instance,
143                            the instance association entries are also added.
144                        */
145 kumpf          1.1     void createInstance(
146                            const CIMNamespaceName& nameSpace,
147                            const CIMObjectPath& instanceName,
148 kumpf          1.2         const CIMInstance& cimInstance,
149                            const Array<InstanceAssociation>& instAssocEntries);
150 kumpf          1.1     void modifyInstance(
151                            const CIMNamespaceName& nameSpace,
152                            const CIMObjectPath& instanceName,
153                            const CIMInstance& cimInstance);
154 kumpf          1.2     /**
155                            Deletes an instance definition.  If it is an association instance,
156                            the instance association entries are also deleted.
157                        */
158 kumpf          1.1     void deleteInstance(
159                            const CIMNamespaceName& nameSpace,
160                            const CIMObjectPath& instanceName);
161                        Boolean instanceExists(
162                            const CIMNamespaceName& nameSpace,
163                            const CIMObjectPath& instanceName);
164                    
165                        void getClassAssociatorNames(
166                            const CIMNamespaceName& nameSpace,
167                            const Array<CIMName>& classList,
168                            const Array<CIMName>& assocClassList,
169                            const Array<CIMName>& resultClassList,
170                            const String& role,
171                            const String& resultRole,
172                            Array<String>& associatorNames);
173                        void getClassReferenceNames(
174                            const CIMNamespaceName& nameSpace,
175                            const Array<CIMName>& classList,
176                            const Array<CIMName>& resultClassList,
177                            const String& role,
178                            Array<String>& referenceNames);
179 kumpf          1.1 
180                        void getInstanceAssociatorNames(
181                            const CIMNamespaceName& nameSpace,
182                            const CIMObjectPath& instanceName,
183                            const Array<CIMName>& assocClassList,
184                            const Array<CIMName>& resultClassList,
185                            const String& role,
186                            const String& resultRole,
187                            Array<String>& associatorNames);
188                        void getInstanceReferenceNames(
189                            const CIMNamespaceName& nameSpace,
190                            const CIMObjectPath& instanceName,
191                            const Array<CIMName>& resultClassList,
192                            const String& role,
193                            Array<String>& referenceNames);
194                    
195                    private:
196                    
197                        void _rollbackIncompleteTransactions();
198                    
199 marek          1.9.10.1     /** 
200                                 Searches for state file in the "instance" directory of all
201                                 namespaces. 
202                                 i)   Removes the rollback files to void a begin operation.
203                                 ii)  Removes the rollback files to complete a commit operation. 
204                                 iii) Restores instance index and data files complete a
205                                      rollback operation.
206                                 If no state files are present, this method returns false
207                             */
208                             Boolean _completeTransactions();
209                         
210 kumpf          1.1          /**
211                                 Converts a namespace name into a directory path.  The specified
212                                 namespace name is not required to match the case of the namespace
213                                 name that was originally created.
214                         
215                                 @param nameSpace The namespace for which to determine the directory
216                                     path.
217                                 @return A string containing the directory path for the namespace.
218                              */
219                             String _getNameSpaceDirPath(const CIMNamespaceName& nameSpace) const;
220                         
221                             /** Returns the path of the qualifier file.
222                         
223                                 @param   nameSpace      the namespace of the qualifier
224                                 @param   qualifierName  the name of the qualifier
225                         
226                                 @return  a string containing the qualifier file path
227                              */
228                             String _getQualifierFilePath(
229                                 const CIMNamespaceName& nameSpace,
230                                 const CIMName& qualifierName) const;
231 kumpf          1.1      
232                             /** Returns the path of the class file.
233                         
234                                 @param   nameSpace  the namespace of the class
235                                 @param   className  the name of the class
236                         
237                                 @return  a string containing the class file path
238                              */
239                             String _getClassFilePath(
240                                 const CIMNamespaceName& nameSpace,
241                                 const CIMName& className,
242                                 const CIMName& superClassName) const;
243                         
244                             /** Returns the path of the instance index file.
245                         
246                                 @param   nameSpace      the namespace of the instance
247                                 @param   className      the name of the class
248                         
249                                 @return  a string containing the index file path
250                              */
251                             String _getInstanceIndexFilePath(
252 kumpf          1.1              const CIMNamespaceName& nameSpace,
253                                 const CIMName& className) const;
254                         
255                             /** Returns the path of the instance file.
256                         
257                                 @param   nameSpace      the namespace of the instance
258                                 @param   className      the name of the class
259                         
260                                 @return  a string containing the instance file path
261                              */
262                             String _getInstanceDataFilePath(
263                                 const CIMNamespaceName& nameSpace,
264                                 const CIMName& className) const;
265                         
266                             /** Returns the path of the class association file.
267                         
268                                 @param   nameSpace      the namespace of the associations
269                         
270                                 @return  a string containing the class association file path
271                              */
272                             String _getAssocClassPath(const CIMNamespaceName& nameSpace) const;
273 kumpf          1.1      
274                             /** Returns the path of the instance association file.
275                         
276                                 @param   nameSpace      the namespace of the associations
277                         
278                                 @return  a string containing the instance association file path
279                              */
280                             String _getAssocInstPath(const CIMNamespaceName& nameSpace) const;
281                         
282                             Boolean _loadInstance(
283                                 const String& path,
284                                 CIMInstance& object,
285                                 Uint32 index,
286                                 Uint32 size);
287                         
288                             /** loads all the instance objects from disk to memeory.  Returns true
289                                 on success.
290                         
291                                 @param   nameSpace      the namespace of the instances to be loaded
292                                 @param   className      the class of the instances to be loaded
293                                 @param   namedInstances an array of CIMInstance objects to which
294 kumpf          1.1                                      the loaded instances are appended
295                         
296                                 @return  true      if successful
297                                          false     if an error occurs in loading the instances
298                              */
299                             Boolean _loadAllInstances(
300                                 const CIMNamespaceName& nameSpace,
301                                 const CIMName& className,
302                                 Array<CIMInstance>& namedInstances);
303                         
304 kumpf          1.2          void _addClassAssociationEntries(
305                                 const CIMNamespaceName& nameSpace,
306                                 const Array<ClassAssociation>& classAssocEntries);
307                             void _removeClassAssociationEntries(
308                                 const CIMNamespaceName& nameSpace,
309                                 const CIMName& assocClassName);
310                         
311                             void _addInstanceAssociationEntries(
312                                 const CIMNamespaceName& nameSpace,
313                                 const Array<InstanceAssociation>& instanceAssocEntries);
314                             void _removeInstanceAssociationEntries(
315                                 const CIMNamespaceName& nameSpace,
316                                 const CIMObjectPath& assocInstanceName);
317                         
318 kumpf          1.1          String _repositoryPath;
319                             ObjectStreamer* _streamer;
320                             Boolean _compressMode;
321 kumpf          1.4          Boolean _storeCompleteClasses;
322 kumpf          1.1      
323                             /**
324                                 Maps namespace names to directory paths
325                             */
326                             HashTable<String, String, EqualNoCaseFunc, HashLowerCaseFunc>
327                                 _nameSpacePathTable;
328 kumpf          1.5      
329                             /**
330                                 This table must be managed dynamically per repository because it
331                                 caches class association data in addition to handling persistent
332                                 storage and lookup.
333                             */
334                             AssocClassTable _assocClassTable;
335 kumpf          1.1      };
336                         
337                         PEGASUS_NAMESPACE_END
338                         
339                         #endif /* Pegasus_FileBasedStore_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2