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