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 /** Deletes the given namespace.
|
104 kumpf 1.31 @param nameSpaceName name of namespace to be deleted.
105 @exception CIMException(CIM_ERR_INVALID_NAMESPACE)
106 @exception NonEmptyNameSpace
107 @exception FailedToRemoveDirectory
|
108 mike 1.10 */
|
109 kumpf 1.17 void deleteNameSpace(const CIMNamespaceName& nameSpaceName);
|
110 mike 1.10
|
111 kumpf 1.31 Boolean isRemoteNameSpace(
112 const CIMNamespaceName& nameSpaceName,
113 String& remoteInfo);
|
114 schuur 1.24
|
115 mike 1.10 /** Gets array of all namespace names.
|
116 kumpf 1.31 @param nameSpaceNames filled with names of all namespaces.
|
117 mike 1.10 */
|
118 kumpf 1.17 void getNameSpaceNames(Array<CIMNamespaceName>& nameSpaceNames) const;
|
119 mike 1.10
|
120 kumpf 1.31 Boolean getNameSpaceAttributes(
121 const CIMNamespaceName& nameSpace,
|
122 kumpf 1.34 Boolean& shareable,
123 Boolean& updatesAllowed,
|
124 venkat.puvvada 1.38 String& parent,
|
125 mike 1.39 String& remoteInfo);
|
126 kumpf 1.34
127 void validateNameSpace(
128 const CIMNamespaceName& nameSpaceName) const;
129
130 /** Gets a list of names of namespaces that are directly dependent on the
131 specified namespace. The specified namespace is also included in the
132 list. The list contains all derived read-write namespaces (and
133 perhaps some read-only ones as well), but not necessarily all
134 derived read-only namespaces. This makes it insufficient to find all
135 instances of a given class in derived namespaces, as it is currently
136 being used.
137 @param nameSpaceName name of the origin namespace.
138 @return An Array of namespace names that depend on the origin namespace.
139 */
140 Array<CIMNamespaceName> getDependentSchemaNameSpaceNames(
141 const CIMNamespaceName& nameSpaceName) const;
142
143 /** Determines whether a specified namespace has one or more dependent
144 namespaces. If so, the name of one of the dependents is returned.
145 @param nameSpaceName Name of the namespace to check for dependents.
146 @param nameSpaceName (Output) Name of a dependent namespace, if found.
147 kumpf 1.34 @return A Boolean indicating whether the namespace has a dependent
148 namespace.
149 */
150 Boolean hasDependentNameSpace(
151 const CIMNamespaceName& nameSpaceName,
152 CIMNamespaceName& dependentNameSpaceName) const;
153
154 /** Lists the names of namespaces whose schema is accessible from the
155 specified namespace. The list contains all R/W parent namespaces
156 of the specified namespace, as well as the specified namespace if it
157 is R/W. Since a R/W namespace may depend only on a primary namespace,
158 the maximum length of the returned list is 2.
159 @param nameSpaceName name of the origin namespace.
160 @return An Array of namespace names whose schema is accessible from
161 the specified namespace.
162 */
163 Array<CIMNamespaceName> getSchemaNameSpaceNames(
164 const CIMNamespaceName& nameSpaceName) const;
165
166 /**
167 Validates that the specified class exists in the specified namespace
168 kumpf 1.34 (or one of its parent namespaces). It is intended for use on instance
169 operations.
170 @param nameSpaceName The name of the namespace to check for the class.
171 @param className The name of the class for which to validate existence.
172 @exception CIMException Error code CIM_ERR_INVALID_CLASS if the class
173 does not exist.
174 */
175 void validateClass(
176 const CIMNamespaceName& nameSpaceName,
177 const CIMName& className) const;
|
178 schuur 1.21
|
179 kumpf 1.34 CIMName getSuperClassName(
180 const CIMNamespaceName& nameSpaceName,
181 const CIMName& className) const;
|
182 schuur 1.21
|
183 kumpf 1.34 void locateClass(
|
184 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
185 const CIMName& className,
|
186 kumpf 1.34 CIMNamespaceName& actualNameSpaceName,
187 CIMName& superClassName) const;
|
188 mike 1.10
|
189 kumpf 1.34 /** Check whether the specified class may be deleted
190 @param nameSpaceName Namespace in which the class exists.
191 @param className Name of class to be deleted.
192 @exception CIMException If the class may not be deleted
|
193 mike 1.10 */
|
194 kumpf 1.34 void checkDeleteClass(
|
195 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
196 const CIMName& className) const;
|
197 mike 1.10
|
198 kumpf 1.34 /** Check whether the specified qualifier may be deleted
199 @param nameSpaceName Namespace in which the qualifier exists.
200 @param qualifierName Name of qualifier to be deleted.
201 @exception CIMException If the class may not be deleted
|
202 mike 1.10 */
|
203 kumpf 1.34 void checkSetOrDeleteQualifier(
204 const CIMNamespaceName& nameSpaceName,
205 const CIMName& qualifierName) const;
|
206 mike 1.10
207 /** Deletes the class file for the given class.
|
208 kumpf 1.31 @param nameSpaceName name of namespace.
209 @param className name of class.
210 @exception CIMException(CIM_ERR_INVALID_NAMESPACE)
211 @exception CIMException(CIM_ERR_INVALID_CLASS)
212 @exception CIMException(CIM_ERR_CLASS_HAS_CHILDREN)
|
213 mike 1.10 */
214 void deleteClass(
|
215 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
216 const CIMName& className) const;
|
217 mike 1.10
218 /** Print out the namespaces. */
219 void print(PEGASUS_STD(ostream)& os) const;
220
|
221 kumpf 1.34 /** Checks whether it is okay to create a new class.
222 @param nameSpaceName namespace to contain class.
223 @param className name of class
224 @param superClassName name of superClassName
225 */
226 void checkCreateClass(
227 const CIMNamespaceName& nameSpaceName,
228 const CIMName& className,
229 const CIMName& superClassName);
230
|
231 mike 1.10 /** Creates an entry for a new class.
|
232 kumpf 1.31 @param nameSpaceName namespace to contain class.
233 @param className name of class
234 @param superClassName name of superClassName
|
235 mike 1.10 */
236 void createClass(
|
237 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
238 const CIMName& className,
|
239 kumpf 1.34 const CIMName& superClassName);
|
240 mike 1.10
|
241 kumpf 1.34 /** Checks whether it is okay to modify this class.
|
242 kumpf 1.31 @param nameSpaceName namespace.
243 @param className name of class being modified.
244 @param superClassName superclass of class being modified.
|
245 kumpf 1.36 @param oldSuperClassName Output name of existing superclass of class
246 being modified.
|
247 kumpf 1.31 @exception CIMException(CIM_ERR_INVALID_CLASS)
248 @exception CIMException(CIM_ERR_FAILED) if there is an attempt
249 to change the superclass of this class.
250 @exception CIMException(CIM_ERR_CLASS_HAS_CHILDREN) if class
251 has any children.
|
252 mike 1.10 */
|
253 kumpf 1.34 void checkModifyClass(
|
254 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
255 const CIMName& className,
|
256 kumpf 1.36 const CIMName& superClassName,
257 CIMName& oldSuperClassName,
258 Boolean allowNonLeafModification);
|
259 mike 1.10
260 /** Get subclass names of the given class in the given namespace.
|
261 kumpf 1.31 @param nameSpaceName
262 @param className - class whose subclass names will be gotten. If
263 className is empty, all classnames are returned.
264 @param deepInheritance - if true all descendent classes of class
265 are returned. If className is empty, only root classes are returned.
266 @param subClassNames - output argument to hold subclass names.
267 @exception CIMException(CIM_ERR_INVALID_CLASS)
|
268 mike 1.10 */
269 void getSubClassNames(
|
270 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
271 const CIMName& className,
272 Boolean deepInheritance,
273 Array<CIMName>& subClassNames,
274 Boolean enm=false) const;
|
275 mike 1.10
276 /** Get the names of all superclasses (direct and indirect) of this
|
277 kumpf 1.31 class.
|
278 mike 1.10 */
279 void getSuperClassNames(
|
280 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
281 const CIMName& className,
282 Array<CIMName>& subClassNames) const;
|
283 mike 1.10
|
284 schuur 1.21 Boolean classExists(
|
285 kumpf 1.31 NameSpace* nameSpace,
286 const CIMName& className,
287 Boolean throwExcp=false) const;
|
288 schuur 1.21
|
289 kumpf 1.30 Boolean classExists(
|
290 kumpf 1.31 const CIMNamespaceName& nameSpaceName,
291 const CIMName& className) const;
|
292 kumpf 1.30
|
293 kumpf 1.34 private:
294
295 NameSpace* _getNameSpace(const CIMNamespaceName& ns) const;
296 NameSpace* _lookupNameSpace(const String& ns);
|
297 mike 1.33
|
298 mike 1.10 NameSpaceManagerRep* _rep;
299 };
300
301 /** This exception is thrown if one attempts to remove a namespace that still
302 contains classes, instances, or qualifier.
303 */
|
304 mike 1.29 class PEGASUS_REPOSITORY_LINKAGE NonEmptyNameSpace : public Exception
|
305 mike 1.10 {
306 public:
|
307 kumpf 1.31 NonEmptyNameSpace(const String& nameSpaceName)
308 : Exception(MessageLoaderParms(
309 "Repository.NameSpaceManager.ATTEMPT_DELETE_NONEMPTY_NAMESPACE",
310 "Attempt to delete a non-empty namespace: $0", nameSpaceName))
311 {
312 }
|
313 mike 1.10 };
314
315 PEGASUS_NAMESPACE_END
316
317 #endif /* Pegasus_NameSpaceManager_h */
|