(file) Return to NameSpaceManager.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Repository

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2