Added new hash table implementation.
[tpot/pegasus/.git] / src / Pegasus / Repository / CIMRepository.h
1 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 // DEALINGS IN THE SOFTWARE.
19 //
20 //==============================================================================
21 //
22 // Author: Mike Brasher (mbrasher@bmc.com)
23 //
24 // Modified By:
25 //
26 //%/////////////////////////////////////////////////////////////////////////////
27
28 #ifndef PegasusRepository_Repository_h
29 #define PegasusRepository_Repository_h
30
31 #include <Pegasus/Common/Config.h>
32 #include <Pegasus/Common/CIMClass.h>
33 #include <Pegasus/Common/CIMInstance.h>
34 #include <Pegasus/Common/CIMQualifierDecl.h>
35 #include <Pegasus/Common/CIMOperations.h>
36
37 PEGASUS_NAMESPACE_BEGIN
38
39 class RepositoryDeclContext;
40
41 /** This class derives from the CIMOperations class and provides a simple
42     implementation of a CIM repository. It only implements the methods
43     for manipulating classes and instances. The others throw this exception:
44
45     <pre>
46         CIMException(CIMException::NOT_SUPPORTED)
47     </pre>
48 */
49
50 class PEGASUS_REPOSITORY_LINKAGE CIMRepository : public CIMOperations
51 {
52 public:
53
54     /// Constructor
55     CIMRepository(const String& path);
56
57     /// Descructor
58     virtual ~CIMRepository();
59
60     /// virtual class CIMClass. From the operations class
61     virtual CIMClass getClass(
62         const String& nameSpace,
63         const String& className,
64         Boolean localOnly = true,
65         Boolean includeQualifiers = true,
66         Boolean includeClassOrigin = false,
67         const Array<String>& propertyList = StringArray());
68
69     /// getInstance
70     virtual CIMInstance getInstance(
71         const String& nameSpace,
72         const CIMReference& instanceName,
73         Boolean localOnly = true,
74         Boolean includeQualifiers = false,
75         Boolean includeClassOrigin = false,
76         const Array<String>& propertyList = StringArray());
77
78     /// deleteClass
79     virtual void deleteClass(
80         const String& nameSpace,
81         const String& className);
82
83     /// deleteInstance
84     virtual void deleteInstance(
85         const String& nameSpace,
86         const CIMReference& instanceName);
87
88     /// createClass
89     virtual void createClass(
90         const String& nameSpace,
91         CIMClass& newClass);
92
93     /// createInstance
94     virtual void createInstance(
95         const String& nameSpace,
96         CIMInstance& newInstance);
97
98     /// modifyClass
99     virtual void modifyClass(
100         const String& nameSpace,
101         CIMClass& modifiedClass);
102
103     /// modifyInstance
104     virtual void modifyInstance(
105         const String& nameSpace,
106         const CIMInstance& modifiedInstance);
107
108     /// enumerateClasses
109     virtual Array<CIMClass> enumerateClasses(
110         const String& nameSpace,
111         const String& className = String::EMPTY,
112         Boolean deepInheritance = false,
113         Boolean localOnly = true,
114         Boolean includeQualifiers  = true,
115         Boolean includeClassOrigin = false);
116
117     /// enumerateClassNames
118     virtual Array<String> enumerateClassNames(
119         const String& nameSpace,
120         const String& className = String::EMPTY,
121         Boolean deepInheritance = false);
122
123     /// enumerateInstances
124     virtual Array<CIMInstance> enumerateInstances(
125         const String& nameSpace,
126         const String& className,
127         Boolean deepInheritance = true,
128         Boolean localOnly = true,
129         Boolean includeQualifiers = false,
130         Boolean includeClassOrigin = false,
131         const Array<String>& propertyList = StringArray());
132
133     /// enumerateInstanceNames
134     virtual Array<CIMReference> enumerateInstanceNames(
135         const String& nameSpace,
136         const String& className);
137
138     /// execQuery
139     virtual Array<CIMInstance> execQuery(
140         const String& queryLanguage,
141         const String& query) ;
142
143     /// associators
144     virtual Array<CIMInstance> associators(
145         const String& nameSpace,
146         const CIMReference& objectName,
147         const String& assocClass = String::EMPTY,
148         const String& resultClass = String::EMPTY,
149         const String& role = String::EMPTY,
150         const String& resultRole = String::EMPTY,
151         Boolean includeQualifiers = false,
152         Boolean includeClassOrigin = false,
153         const Array<String>& propertyList = StringArray());
154
155     /// associateNames
156     virtual Array<CIMReference> associatorNames(
157         const String& nameSpace,
158         const CIMReference& objectName,
159         const String& assocClass = String::EMPTY,
160         const String& resultClass = String::EMPTY,
161         const String& role = String::EMPTY,
162         const String& resultRole = String::EMPTY);
163
164     /// references
165     virtual Array<CIMInstance> references(
166         const String& nameSpace,
167         const CIMReference& objectName,
168         const String& resultClass = String::EMPTY,
169         const String& role = String::EMPTY,
170         Boolean includeQualifiers = false,
171         Boolean includeClassOrigin = false,
172         const Array<String>& propertyList = StringArray());
173
174     /// referenceNames
175     virtual Array<CIMReference> referenceNames(
176         const String& nameSpace,
177         const CIMReference& objectName,
178         const String& resultClass = String::EMPTY,
179         const String& role = String::EMPTY);
180
181     /// getProperty
182     virtual CIMValue getProperty(
183         const String& nameSpace,
184         const CIMReference& instanceName,
185         const String& propertyName);
186
187     /// setProperty
188     virtual void setProperty(
189         const String& nameSpace,
190         const CIMReference& instanceName,
191         const String& propertyName,
192         const CIMValue& newValue = CIMValue());
193
194     /// getQualifier
195     virtual CIMQualifierDecl getQualifier(
196         const String& nameSpace,
197         const String& qualifierName);
198
199     /// setQualifier
200     virtual void setQualifier(
201         const String& nameSpace,
202         const CIMQualifierDecl& qualifierDecl);
203
204     /// virtual deleteQualifier
205     virtual void deleteQualifier(
206         const String& nameSpace,
207         const String& qualifierName);
208
209     /// enumerateQualifiers
210     virtual Array<CIMQualifierDecl> enumerateQualifiers(
211         const String& nameSpace);
212
213     /// invokeMethod
214     virtual CIMValue invokeMethod(
215         const String& nameSpace,
216         const CIMReference& instanceName,
217         const String& methodName,
218         const Array<CIMValue>& inParameters,
219         Array<CIMValue>& outParameters);
220
221     /** CIMMethod createNameSpace - Creates a new namespace in the repository
222         @param String with the name of the namespace
223         @exception - Throws "Already_Exists if the Namespace exits.
224         Throws "CannotCreateDirectory" if there are problems in the
225         creation.
226     */
227     void createNameSpace(const String& nameSpace);
228
229     /** CIMMethod enumerateNameSpaces - Get all of the namespaces in the
230         repository. \Ref{NAMESPACE}
231         @return Array of strings with the namespaces
232     */
233     virtual Array<String> enumerateNameSpaces() const;
234
235     /** CIMMethod deleteNameSpace - Deletes a namespace in the repository.
236         The deleteNameSpace method will only delete a namespace if there are 
237         no classed defined in the namespace.  Today this is a Pegasus characteristics 
238         and not defined as part of the DMTF standards.
239         @param String with the name of the namespace 
240         @exception - Throws NoSuchDirectory if the Namespace does not exist. */
241     void deleteNameSpace(const String& nameSpace);
242
243
244 private:
245
246     /*  CIMMethod createMetaQualifiers - ATTN:
247         This method must be invoked to create the appropriate meta-qualifiers
248         required by CIM (they are not part of the CIM schema; rather they are
249         part of the meta-schema).
250
251         ATTN-C: This method has been deprecated. It was necessary prior to the
252         advent of the MOF compiler/loader. The XML Schema had no qualifiers
253         included in it so the XML loader needed a way to create them.
254     */
255 #if 0
256     void _createMetaQualifiers(const String& nameSpace);
257 #endif
258
259     String _root;
260     RepositoryDeclContext* _context;
261 };
262
263 PEGASUS_NAMESPACE_END
264
265 #endif /* PegasusRepository_Repository_h */
266