1 //%/////////////////////////////////////////////////////////////////////////////
3 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
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:
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.
20 //==============================================================================
22 // Author: Mike Brasher (mbrasher@bmc.com)
26 //%/////////////////////////////////////////////////////////////////////////////
28 #ifndef PegasusRepository_Repository_h
29 #define PegasusRepository_Repository_h
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>
37 PEGASUS_NAMESPACE_BEGIN
39 class RepositoryDeclContext;
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:
46 CIMException(CIMException::NOT_SUPPORTED)
50 class PEGASUS_REPOSITORY_LINKAGE CIMRepository : public CIMOperations
55 CIMRepository(const String& path);
58 virtual ~CIMRepository();
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());
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());
79 virtual void deleteClass(
80 const String& nameSpace,
81 const String& className);
84 virtual void deleteInstance(
85 const String& nameSpace,
86 const CIMReference& instanceName);
89 virtual void createClass(
90 const String& nameSpace,
94 virtual void createInstance(
95 const String& nameSpace,
96 CIMInstance& newInstance);
99 virtual void modifyClass(
100 const String& nameSpace,
101 CIMClass& modifiedClass);
104 virtual void modifyInstance(
105 const String& nameSpace,
106 const CIMInstance& modifiedInstance);
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);
117 /// enumerateClassNames
118 virtual Array<String> enumerateClassNames(
119 const String& nameSpace,
120 const String& className = String::EMPTY,
121 Boolean deepInheritance = false);
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());
133 /// enumerateInstanceNames
134 virtual Array<CIMReference> enumerateInstanceNames(
135 const String& nameSpace,
136 const String& className);
139 virtual Array<CIMInstance> execQuery(
140 const String& queryLanguage,
141 const String& query) ;
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());
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);
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());
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);
182 virtual CIMValue getProperty(
183 const String& nameSpace,
184 const CIMReference& instanceName,
185 const String& propertyName);
188 virtual void setProperty(
189 const String& nameSpace,
190 const CIMReference& instanceName,
191 const String& propertyName,
192 const CIMValue& newValue = CIMValue());
195 virtual CIMQualifierDecl getQualifier(
196 const String& nameSpace,
197 const String& qualifierName);
200 virtual void setQualifier(
201 const String& nameSpace,
202 const CIMQualifierDecl& qualifierDecl);
204 /// virtual deleteQualifier
205 virtual void deleteQualifier(
206 const String& nameSpace,
207 const String& qualifierName);
209 /// enumerateQualifiers
210 virtual Array<CIMQualifierDecl> enumerateQualifiers(
211 const String& nameSpace);
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);
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
227 void createNameSpace(const String& nameSpace);
229 /** CIMMethod enumerateNameSpaces - Get all of the namespaces in the
230 repository. \Ref{NAMESPACE}
231 @return Array of strings with the namespaces
233 virtual Array<String> enumerateNameSpaces() const;
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);
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).
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.
256 void _createMetaQualifiers(const String& nameSpace);
260 RepositoryDeclContext* _context;
263 PEGASUS_NAMESPACE_END
265 #endif /* PegasusRepository_Repository_h */