1 martin 1.40 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.41 //
|
3 martin 1.40 // 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.41 //
|
10 martin 1.40 // 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.41 //
|
17 martin 1.40 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.41 //
|
20 martin 1.40 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.41 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.40 // 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.41 //
|
28 martin 1.40 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.10 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_NameSpaceManager_h
|
33 kumpf 1.15 #define Pegasus_NameSpaceManager_h
|
34 mike 1.10
35 #include <Pegasus/Common/Config.h>
|
36 kumpf 1.37 #include <Pegasus/Common/Pair.h>
|
37 mike 1.10 #include <Pegasus/Repository/InheritanceTree.h>
|
38 kumpf 1.37 #include <Pegasus/Repository/PersistentStoreData.h>
|
39 kumpf 1.16 #include <Pegasus/Repository/Linkage.h>
|
40 kumpf 1.34
|
41 mike 1.10 PEGASUS_NAMESPACE_BEGIN
42
43 struct NameSpaceManagerRep;
44 class NameSpace;
45
|
46 kumpf 1.34 /** The NameSpaceManager class manages a collection of NameSpace objects.
47
48 The shared schema support is based on these tenets:
|
49 mike 1.10
|
50 kumpf 1.34 1. A primary namespace is a namespace with no parent namespace.
51 2. A secondary namespace is a namespace with a parent namespace.
52 3. A secondary namespace derives all the schema from its parent namespace.
53 4. A primary namespace is not read-only.
54 5. A read-only namespace contains no schema of its own, but it may
55 contain instances.
56 6. The parent of a secondary read-write namespace must be a primary
57 namespace.
|
58 mike 1.10 */
59 class PEGASUS_REPOSITORY_LINKAGE NameSpaceManager
60 {
61 public:
62
|
63 kumpf 1.35 /** Constructor.
64 */
65 NameSpaceManager();
|
66 mike 1.10
67 /** Destructor.
68 */
69 ~NameSpaceManager();
70
|
71 kumpf 1.35 /** Initializes the namespace definition in the NameSpaceManager. If the
72 namespace has a parent namespace, the the caller MUST ensure that the
73 parent namespace is already initialized.
74 @param nameSpace The namespace definition to initialize.
75 @param classList An Array of class names and superclass names that are
76 defined in the namespace.
77 */
78 void initializeNameSpace(
79 const NamespaceDefinition& nameSpace,
80 const Array<Pair<String, String> >& classList);
81
82 /** Indicates whether the specified namespace exists.
|
83 kumpf 1.31 @param nameSpaceName name of namespace.
|
84 kumpf 1.35 @return true if namespace exists; false otherwise.
|
85 mike 1.10 */
|
86 kumpf 1.17 Boolean nameSpaceExists(const CIMNamespaceName& nameSpaceName) const;
|
87 mike 1.10
88 /** Creates the given namespace.
|
89 kumpf 1.31 @param nameSpaceName name of namespace to be created.
|
90 mike 1.10 */
|
91 kumpf 1.34 void createNameSpace(
92 const CIMNamespaceName& nameSpaceName,
93 Boolean shareable,
94 Boolean updatesAllowed,
|
95 venkat.puvvada 1.38 const String& parent,
96 const String& remoteInfo = String::EMPTY);
|
97 schuur 1.21
|
98 kumpf 1.34 void modifyNameSpace(
99 const CIMNamespaceName& nameSpaceName,
100 Boolean shareable,
101 Boolean updatesAllowed);
|
102 mike 1.10
|
103 rohini.deshpande 1.43 void modifyNameSpaceName(
104 const CIMNamespaceName& nameSpaceName,
105 const CIMNamespaceName& newNameSpaceName);
106
|
107 mike 1.10 /** Deletes the given namespace.
|
108 kumpf 1.31 @param nameSpaceName name of namespace to be deleted.
109 @exception CIMException(CIM_ERR_INVALID_NAMESPACE)
110 @exception NonEmptyNameSpace
111 @exception FailedToRemoveDirectory
|
112 mike 1.10 */
|
113 kumpf 1.17 void deleteNameSpace(const CIMNamespaceName& nameSpaceName);
|
114 mike 1.10
|
115 kumpf 1.31 Boolean isRemoteNameSpace(
116 const CIMNamespaceName& nameSpaceName,
117 String& remoteInfo);
|
118 schuur 1.24
|
119 mike 1.10 /** Gets array of all namespace names.
|
120 kumpf 1.31 @param nameSpaceNames filled with names of all namespaces.
|
121 mike 1.10 */
|
122 kumpf 1.17 void getNameSpaceNames(Array<CIMNamespaceName>& nameSpaceNames) const;
|
123 mike 1.10
|
124 kumpf 1.31 Boolean getNameSpaceAttributes(
125 const CIMNamespaceName& nameSpace,
|
126 kumpf 1.34 Boolean& shareable,
127 Boolean& updatesAllowed,
|
128 venkat.puvvada 1.38 String& parent,
|
129 mike 1.39 String& remoteInfo);
|
130 kumpf 1.34
131 void validateNameSpace(
132 const CIMNamespaceName& nameSpaceName) const;
133
134 /** Gets a list of names of namespaces that are directly dependent on the
135 specified namespace. The specified namespace is also included in the
136 list. The list contains all derived read-write namespaces (and
137 perhaps some read-only ones as well), but not necessarily all
138 derived read-only namespaces. This makes it insufficient to find all
139 instances of a given class in derived namespaces, as it is currently
140 being used.
141 @param nameSpaceName name of the origin namespace.
142 @return An Array of namespace names that depend on the origin namespace.
143 */
144 Array<CIMNamespaceName> getDependentSchemaNameSpaceNames(
145 const CIMNamespaceName& nameSpaceName) const;
146
147 /** Determines whether a specified namespace has one or more dependent
148 namespaces. If so, the name of one of the dependents is returned.
149 @param nameSpaceName Name of the namespace to check for dependents.
150 @param nameSpaceName (Output) Name of a dependent namespace, if found.
151 kumpf 1.34 @return A Boolean indicating whether the namespace has a dependent
152 namespace.
153 */
154 Boolean hasDependentNameSpace(
155 const CIMNamespaceName& nameSpaceName,
156 CIMNamespaceName& dependentNameSpaceName) const;
157
158 /** Lists the names of namespaces whose schema is accessible from the
159 specified namespace. The list contains all R/W parent namespaces
160 of the specified namespace, as well as the specified namespace if it
161 is R/W. Since a R/W namespace may depend only on a primary namespace,
162 the maximum length of the returned list is 2.
163 @param nameSpaceName name of the origin namespace.
164 @return An Array of namespace names whose schema is accessible from
165 the specified namespace.
166 */
167 Array<CIMNamespaceName> getSchemaNameSpaceNames(
168 const CIMNamespaceName& nameSpaceName) const;
169
170 /**
171 Validates that the specified class exists in the specified namespace
172 kumpf 1.34 (or one of its parent namespaces). It is intended for use on instance
173 operations.
174 @param nameSpaceName The name of the namespace to check for the class.
175 @param className The name of the class for which to validate existence.
176 @exception CIMException Error code CIM_ERR_INVALID_CLASS if the class
177 does not exist.
178 */
179 void validateClass(
180 const CIMNamespaceName& nameSpaceName,
181 const CIMName& className) const;
|
182 schuur 1.21
|
183 kumpf 1.34 CIMName getSuperClassName(
184 const CIMNamespaceName& nameSpaceName,
185 const CIMName& className) const;
|
186 schuur 1.21
|
187 kumpf 1.34 void locateClass(
|
188 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
189 const CIMName& className,
|
190 kumpf 1.34 CIMNamespaceName& actualNameSpaceName,
191 CIMName& superClassName) const;
|
192 mike 1.10
|
193 kumpf 1.34 /** Check whether the specified class may be deleted
194 @param nameSpaceName Namespace in which the class exists.
195 @param className Name of class to be deleted.
196 @exception CIMException If the class may not be deleted
|
197 mike 1.10 */
|
198 kumpf 1.34 void checkDeleteClass(
|
199 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
200 const CIMName& className) const;
|
201 mike 1.10
|
202 karl 1.42 /** Check whether update to namespace allowed.
|
203 kumpf 1.34 @param nameSpaceName Namespace in which the qualifier exists.
|
204 karl 1.42 @exception CIMException If the updates not allowed
|
205 mike 1.10 */
|
206 karl 1.42 void checkNameSpaceUpdateAllowed(
207 const CIMNamespaceName& nameSpaceName) const;
|
208 mike 1.10
209 /** Deletes the class file for the given class.
|
210 kumpf 1.31 @param nameSpaceName name of namespace.
211 @param className name of class.
212 @exception CIMException(CIM_ERR_INVALID_NAMESPACE)
213 @exception CIMException(CIM_ERR_INVALID_CLASS)
214 @exception CIMException(CIM_ERR_CLASS_HAS_CHILDREN)
|
215 mike 1.10 */
216 void deleteClass(
|
217 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
218 const CIMName& className) const;
|
219 mike 1.10
220 /** Print out the namespaces. */
221 void print(PEGASUS_STD(ostream)& os) const;
222
|
223 kumpf 1.34 /** Checks whether it is okay to create a new class.
224 @param nameSpaceName namespace to contain class.
225 @param className name of class
226 @param superClassName name of superClassName
227 */
228 void checkCreateClass(
229 const CIMNamespaceName& nameSpaceName,
230 const CIMName& className,
231 const CIMName& superClassName);
232
|
233 mike 1.10 /** Creates an entry for a new class.
|
234 kumpf 1.31 @param nameSpaceName namespace to contain class.
235 @param className name of class
236 @param superClassName name of superClassName
|
237 mike 1.10 */
238 void createClass(
|
239 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
240 const CIMName& className,
|
241 kumpf 1.34 const CIMName& superClassName);
|
242 mike 1.10
|
243 kumpf 1.34 /** Checks whether it is okay to modify this class.
|
244 kumpf 1.31 @param nameSpaceName namespace.
245 @param className name of class being modified.
246 @param superClassName superclass of class being modified.
|
247 kumpf 1.36 @param oldSuperClassName Output name of existing superclass of class
248 being modified.
|
249 kumpf 1.31 @exception CIMException(CIM_ERR_INVALID_CLASS)
250 @exception CIMException(CIM_ERR_FAILED) if there is an attempt
251 to change the superclass of this class.
252 @exception CIMException(CIM_ERR_CLASS_HAS_CHILDREN) if class
253 has any children.
|
254 mike 1.10 */
|
255 kumpf 1.34 void checkModifyClass(
|
256 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
257 const CIMName& className,
|
258 kumpf 1.36 const CIMName& superClassName,
259 CIMName& oldSuperClassName,
260 Boolean allowNonLeafModification);
|
261 mike 1.10
262 /** Get subclass names of the given class in the given namespace.
|
263 kumpf 1.31 @param nameSpaceName
264 @param className - class whose subclass names will be gotten. If
265 className is empty, all classnames are returned.
266 @param deepInheritance - if true all descendent classes of class
267 are returned. If className is empty, only root classes are returned.
268 @param subClassNames - output argument to hold subclass names.
269 @exception CIMException(CIM_ERR_INVALID_CLASS)
|
270 mike 1.10 */
271 void getSubClassNames(
|
272 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
273 const CIMName& className,
274 Boolean deepInheritance,
275 Array<CIMName>& subClassNames,
276 Boolean enm=false) const;
|
277 mike 1.10
278 /** Get the names of all superclasses (direct and indirect) of this
|
279 kumpf 1.31 class.
|
280 mike 1.10 */
281 void getSuperClassNames(
|
282 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
283 const CIMName& className,
284 Array<CIMName>& subClassNames) const;
|
285 mike 1.10
|
286 schuur 1.21 Boolean classExists(
|
287 kumpf 1.31 NameSpace* nameSpace,
288 const CIMName& className,
289 Boolean throwExcp=false) const;
|
290 schuur 1.21
|
291 kumpf 1.30 Boolean classExists(
|
292 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
293 const CIMName& className) const;
|
294 kumpf 1.30
|
295 kumpf 1.34 private:
296
297 NameSpace* _getNameSpace(const CIMNamespaceName& ns) const;
298 NameSpace* _lookupNameSpace(const String& ns);
|
299 mike 1.33
|
300 mike 1.10 NameSpaceManagerRep* _rep;
301 };
302
303 /** This exception is thrown if one attempts to remove a namespace that still
304 contains classes, instances, or qualifier.
305 */
|
306 mike 1.29 class PEGASUS_REPOSITORY_LINKAGE NonEmptyNameSpace : public Exception
|
307 mike 1.10 {
308 public:
|
309 kumpf 1.31 NonEmptyNameSpace(const String& nameSpaceName)
310 : Exception(MessageLoaderParms(
311 "Repository.NameSpaceManager.ATTEMPT_DELETE_NONEMPTY_NAMESPACE",
312 "Attempt to delete a non-empty namespace: $0", nameSpaceName))
313 {
314 }
|
315 mike 1.10 };
316
317 PEGASUS_NAMESPACE_END
318
319 #endif /* Pegasus_NameSpaceManager_h */
|