1 karl 1.26 //%2005////////////////////////////////////////////////////////////////////////
|
2 mike 1.10 //
|
3 karl 1.25 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.20 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.25 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.26 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 mike 1.10 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
13 kumpf 1.14 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
16 mike 1.10 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
|
18 david.dillard 1.27 //
|
19 kumpf 1.14 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
20 mike 1.10 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
22 kumpf 1.14 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
25 mike 1.10 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Author: Mike Brasher (mbrasher@bmc.com)
31 //
|
32 kumpf 1.17 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
|
33 david.dillard 1.27 // (carolann_graves@hp.com)
|
34 kumpf 1.19 // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
35 a.arora 1.23 // Amit K Arora, IBM (amita@in.ibm.com) for PEP#101
|
36 david.dillard 1.27 // David Dillard, VERITAS Software Corp.
37 // (david.dillard@veritas.com)
|
38 mike 1.10 //
39 //%/////////////////////////////////////////////////////////////////////////////
40
41 #ifndef Pegasus_NameSpaceManager_h
|
42 kumpf 1.15 #define Pegasus_NameSpaceManager_h
|
43 mike 1.10
44 #include <Pegasus/Common/Config.h>
|
45 schuur 1.21 #include <Pegasus/Common/HashTable.h>
|
46 a.arora 1.23 #include <Pegasus/Common/AutoPtr.h>
|
47 mike 1.10 #include <Pegasus/Repository/InheritanceTree.h>
|
48 kumpf 1.16 #include <Pegasus/Repository/Linkage.h>
|
49 humberto 1.18 #include <Pegasus/Common/MessageLoader.h> //l10n
|
50 mike 1.10
51 PEGASUS_NAMESPACE_BEGIN
52
53 struct NameSpaceManagerRep;
54 class NameSpace;
55
|
56 schuur 1.21 enum NameSpaceIntendedOp {
57 NameSpaceRead,
58 NameSpaceWrite,
|
59 kumpf 1.22 NameSpaceDelete
|
60 schuur 1.21 };
|
61 mike 1.10
62 /** The NameSpaceManager class manages a collection of NameSpace objects.
63 */
64 class PEGASUS_REPOSITORY_LINKAGE NameSpaceManager
65 {
|
66 schuur 1.21 friend class NameSpace;
|
67 mike 1.10 public:
68
69 /** Constructor.
70 @param repositoryRoot path to directory called "repository".
71 @exception NoSuchDirectory if repositoryRoot not a valid directory.
72 */
73 NameSpaceManager(const String& repositoryRoot);
74
75 /** Destructor.
76 */
77 ~NameSpaceManager();
78
79 /** Determines whether the given namespace exists:
80 @param nameSpaceName name of namespace.
81 @return true if namespace eixsts; false otherwise.
82 */
|
83 kumpf 1.17 Boolean nameSpaceExists(const CIMNamespaceName& nameSpaceName) const;
|
84 mike 1.10
|
85 schuur 1.21 typedef HashTable <String, String, EqualNoCaseFunc, HashLowerCaseFunc>
86 NameSpaceAttributes;
87
|
88 mike 1.10 /** Creates the given namespace.
89 @param nameSpaceName name of namespace to be created.
90 @exception CIMException(CIM_ERR_ALREADY_EXISTS)
91 @exception CannotCreateDirectory
92 */
|
93 schuur 1.21 void createNameSpace(const CIMNamespaceName& nameSpaceName,
94 const NameSpaceAttributes &attributes);
95
96 void modifyNameSpace(const CIMNamespaceName& nameSpaceName,
97 const NameSpaceAttributes &attributes);
|
98 mike 1.10
99 /** Deletes the given namespace.
100 @param nameSpaceName name of namespace to be deleted.
101 @exception CIMException(CIM_ERR_INVALID_NAMESPACE)
102 @exception NonEmptyNameSpace
103 @exception FailedToRemoveDirectory
104 */
|
105 kumpf 1.17 void deleteNameSpace(const CIMNamespaceName& nameSpaceName);
|
106 mike 1.10
|
107 schuur 1.24 Boolean isRemoteNameSpace(const CIMNamespaceName& nameSpaceName,
108 String & remoteInfo);
109
|
110 mike 1.10 /** Gets array of all namespace names.
111 @param nameSpaceNames filled with names of all namespaces.
112 */
|
113 kumpf 1.17 void getNameSpaceNames(Array<CIMNamespaceName>& nameSpaceNames) const;
|
114 mike 1.10
|
115 schuur 1.21 Boolean getNameSpaceAttributes(const CIMNamespaceName& nameSpace, NameSpaceAttributes &attributes);
116
|
117 david.dillard 1.27 /** Get path to the class file for the given class.
|
118 mike 1.10 @param nameSpaceName name of the namespace.
119 @param className name of class.
120 @exception CIMException(CIM_ERR_INVALID_NAMESPACE)
121 @exception CIMException(CIM_ERR_INVALID_CLASS)
122 */
123 String getClassFilePath(
|
124 schuur 1.21 NameSpace *nameSpace,
125 const CIMName& className,
126 NameSpaceIntendedOp op) const;
127
128 String getClassFilePath(
|
129 kumpf 1.17 const CIMNamespaceName& nameSpaceName,
|
130 schuur 1.21 const CIMName& className,
131 NameSpaceIntendedOp op) const;
|
132 mike 1.10
|
133 david.dillard 1.27 /** Get path to the qualifier file for the given class.
|
134 mike 1.10 @param nameSpaceName name of the namespace.
135 @param qualifierName name of qualifier.
136 @exception CIMException(CIM_ERR_INVALID_NAMESPACE)
137 @exception CIMException(CIM_ERR_NOT_FOUND)
138 */
139 String getQualifierFilePath(
|
140 kumpf 1.17 const CIMNamespaceName& nameSpaceName,
|
141 schuur 1.21 const CIMName& qualifierName,
142 NameSpaceIntendedOp op) const;
|
143 mike 1.10
|
144 mike 1.11 String getInstanceDataFileBase(
|
145 kumpf 1.17 const CIMNamespaceName& nameSpaceName,
146 const CIMName& className) const;
|
147 mike 1.10
|
148 kumpf 1.22 String getInstanceDataFileBase(
|
149 schuur 1.21 const NameSpace *nameSpace,
150 const CIMName& className) const;
151
|
152 mike 1.10 /** Get path to the directory containing qualifiers:
153 @param nameSpaceName name of the namespace.
154 */
|
155 kumpf 1.17 String getQualifiersRoot(const CIMNamespaceName& nameSpaceName) const;
|
156 kumpf 1.19
157 /** Get path to the file containing association classes:
158 @param nameSpaceName name of the namespace.
159 */
|
160 schuur 1.21 Array<String> getAssocClassPath(const CIMNamespaceName& nameSpaceName,
161 NameSpaceIntendedOp op) const;
|
162 kumpf 1.19
163 /** Get path to the file containing association instances:
164 @param nameSpaceName name of the namespace.
165 */
166 String getAssocInstPath(const CIMNamespaceName& nameSpaceName) const;
|
167 mike 1.10
168 /** Deletes the class file for the given class.
169 @param nameSpaceName name of namespace.
170 @param className name of class.
171 @exception CIMException(CIM_ERR_INVALID_NAMESPACE)
172 @exception CIMException(CIM_ERR_INVALID_CLASS)
173 @exception CIMException(CIM_ERR_CLASS_HAS_CHILDREN)
174 */
175 void deleteClass(
|
176 kumpf 1.17 const CIMNamespaceName& nameSpaceName,
177 const CIMName& className) const;
|
178 mike 1.10
179 /** Print out the namespaces. */
180 void print(PEGASUS_STD(ostream)& os) const;
181
182 /** Creates an entry for a new class.
183 @param nameSpaceName namespace to contain class.
184 @param className name of class
185 @param superClassName name of superClassName
186 @param classFilePath path of file to contain class itself.
187 */
188 void createClass(
|
189 kumpf 1.17 const CIMNamespaceName& nameSpaceName,
190 const CIMName& className,
191 const CIMName& superClassName,
|
192 mike 1.10 String& classFilePath);
193
194 /** Checks if it is okay to modify this class.
195 @param nameSpaceName namespace.
196 @param className name of class being modified.
197 @param superClassName superclass of class being modified.
198 @param classFilePath full path to file containing class.
199 @exception CIMException(CIM_ERR_INVALID_CLASS)
200 @exception CIMException(CIM_ERR_FAILED) if there is an attempt
201 to change the superclass of this class.
202 @exception CIMException(CIM_ERR_CLASS_HAS_CHILDREN) if class
203 has any children.
204 */
205 void checkModify(
|
206 kumpf 1.17 const CIMNamespaceName& nameSpaceName,
207 const CIMName& className,
208 const CIMName& superClassName,
|
209 mike 1.10 String& classFilePath);
210
211 /** Get subclass names of the given class in the given namespace.
212 @param nameSpaceName
213 @param className - class whose subclass names will be gotten. If
214 className is empty, all classnames are returned.
215 @param deepInheritance - if true all descendent classes of class
216 are returned. If className is empty, only root classes are returned.
217 @param subClassNames - output argument to hold subclass names.
218 @exception CIMException(CIM_ERR_INVALID_CLASS)
219 */
220 void getSubClassNames(
|
221 kumpf 1.17 const CIMNamespaceName& nameSpaceName,
222 const CIMName& className,
|
223 mike 1.10 Boolean deepInheritance,
|
224 schuur 1.21 Array<CIMName>& subClassNames,
|
225 david.dillard 1.27 Boolean enm=false) const;
|
226 mike 1.10
227 /** Get the names of all superclasses (direct and indirect) of this
228 class.
229 */
230 void getSuperClassNames(
|
231 kumpf 1.17 const CIMNamespaceName& nameSpaceName,
232 const CIMName& className,
233 Array<CIMName>& subClassNames) const;
|
234 mike 1.10
|
235 schuur 1.21 Boolean classHasInstances(
236 NameSpace *nameSpace,
237 const CIMName& className,
238 Boolean throwExcp=false) const;
239
240 Boolean classHasInstances(
241 const CIMNamespaceName& nameSpaceName,
242 const CIMName& className,
243 Boolean throwExcp=false) const;
244
245 Boolean classExists(
246 NameSpace *nameSpace,
247 const CIMName& className,
248 Boolean throwExcp=false) const;
249
|
250 mike 1.10 private:
|
251 schuur 1.21 NameSpace *lookupNameSpace(String&);
|
252 mike 1.10 String _repositoryRoot;
253 NameSpaceManagerRep* _rep;
254 };
255
256 /** This exception is thrown if one attempts to remove a namespace that still
257 contains classes, instances, or qualifier.
258 */
259 class NonEmptyNameSpace : public Exception
260 {
261 public:
|
262 david.dillard 1.27 //l10n
|
263 humberto 1.18 //NonEmptyNameSpace(const String& nameSpaceName) : Exception(
264 //"Attempt to delete a non-empty namespace: " + nameSpaceName) { }
|
265 david.dillard 1.27 NonEmptyNameSpace(const String& nameSpaceName) :
|
266 humberto 1.18 Exception(MessageLoaderParms(
267 "Repository.NameSpaceManager.ATTEMPT_DELETE_NONEMPTY_NAMESPACE",
268 "Attempt to delete a non-empty namespace: $0", nameSpaceName)) { }
|
269 david.dillard 1.27
270
|
271 humberto 1.18 //l10n end
|
272 mike 1.10 };
273
274 PEGASUS_NAMESPACE_END
275
276 #endif /* Pegasus_NameSpaceManager_h */
|