1 martin 1.9 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.10 //
|
3 martin 1.9 // 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.10 //
|
10 martin 1.9 // 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.10 //
|
17 martin 1.9 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.10 //
|
20 martin 1.9 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.10 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.9 // 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.10 //
|
28 martin 1.9 //////////////////////////////////////////////////////////////////////////
|
29 r.kieninger 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_AssocClassCache_h
33 #define Pegasus_AssocClassCache_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/String.h>
|
37 kumpf 1.7 #include <Pegasus/Common/CIMName.h>
|
38 r.kieninger 1.1 #include <Pegasus/Common/ArrayInternal.h>
|
39 kumpf 1.7 #include <Pegasus/Common/HashTable.h>
40 #include <Pegasus/Repository/PersistentStoreData.h>
|
41 r.kieninger 1.1 #include <Pegasus/Repository/Linkage.h>
42
43 PEGASUS_NAMESPACE_BEGIN
44
|
45 kumpf 1.7 class AssocClassCache;
46
47 /** Maintains association class caches for all namespaces.
48 */
49 class PEGASUS_REPOSITORY_LINKAGE AssocClassCacheManager
50 {
51 public:
52
53 AssocClassCacheManager();
54 ~AssocClassCacheManager();
55
56 /** Retrieves the association class cache for the given namespace.
57 */
58 AssocClassCache* getAssocClassCache(const String& nameSpace);
59
60 private:
61
62 Array<AssocClassCache*> _assocClassCacheList;
63 };
64
65 /** Maintains a cache for all association classes in a namespace.
|
66 r.kieninger 1.1 */
67 class PEGASUS_REPOSITORY_LINKAGE AssocClassCache
68 {
69 public:
70
|
71 kumpf 1.7 AssocClassCache(const String& nameSpace);
72 ~AssocClassCache();
73
74 const String& getNameSpace()
75 {
76 return _nameSpace;
77 }
|
78 r.kieninger 1.1
79 /** Retrieve an entry for an association class through direct
|
80 kumpf 1.5 access via the from class name.
|
81 r.kieninger 1.1 */
|
82 kumpf 1.5 Boolean getAssocClassEntry(
|
83 kumpf 1.7 const CIMName& fromClassName,
84 Array<ClassAssociation>& entryList);
|
85 r.kieninger 1.1
|
86 kumpf 1.8 /** Gets the names of the association classes which reference the specified
87 classes. The results can be constrained by specifying a set of
88 resulting association classes and the property name that refers to the
89 specified class.
90 */
91 Boolean getReferenceNames(
92 const Array<CIMName>& classList,
93 const Array<CIMName>& resultClassList,
94 const String& role,
95 Array<String>& referenceNames);
96
|
97 r.kieninger 1.1 /** Add a new entry to the association cache.
98 */
|
99 kumpf 1.5 Boolean addRecord(
|
100 kumpf 1.7 const CIMName& fromClassName,
101 const ClassAssociation& assocClassEntry);
|
102 r.kieninger 1.1
|
103 kumpf 1.8 /** Remove an association record from the association cache specified by
104 the given from class name and association name.
|
105 r.kieninger 1.1 */
|
106 kumpf 1.8 Boolean removeRecord(
107 const CIMName& fromClassName,
108 const CIMName& assocClassName);
|
109 r.kieninger 1.1
|
110 kumpf 1.8 /** Remove association records from the association cache specified by the
111 association class name.
|
112 r.kieninger 1.1 */
|
113 kumpf 1.8 Boolean removeAssocClassRecords(
|
114 kumpf 1.7 const CIMName& assocClassName);
|
115 r.kieninger 1.1
116 /** Check if the cache is loaded with objects already.
117 */
118 Boolean isActive();
119 void setActive(Boolean flag);
120
121 private:
122 String _nameSpace;
123 Boolean _isInitialized;
124
|
125 kumpf 1.7 typedef HashTable<String, Array<ClassAssociation>,
|
126 kumpf 1.5 EqualNoCaseFunc, HashLowerCaseFunc > AssocClassCacheHashTableType;
|
127 r.kieninger 1.1
|
128 kumpf 1.7 AssocClassCacheHashTableType _assocTable;
|
129 r.kieninger 1.1 };
130
131 PEGASUS_NAMESPACE_END
132
133 #endif /* Pegasus_AssocClassCache_h */
|