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

File: [Pegasus] / pegasus / src / Pegasus / Repository / NameSpaceManager.h (download)
Revision: 1.30, Fri Sep 22 17:53:57 2006 UTC (17 years, 9 months ago) by kumpf
Branch: MAIN
CVS Tags: TASK-TASK-BUG4011_WinLocalConnect-branch-New-root, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_to_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_from_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_to_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_from_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-branch, TASK-PEP268_SSLClientCertificatePropagation-root, TASK-PEP268_SSLClientCertificatePropagation-merged_out_to_branch, TASK-PEP268_SSLClientCertificatePropagation-merged_out_from_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_to_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_from_branch, TASK-PEP268_SSLClientCertificatePropagation-branch, TASK-PEP267_SLPReregistrationSupport-root, TASK-PEP267_SLPReregistrationSupport-merging_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merging_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merged_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_to_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_from_branch, TASK-PEP267_SLPReregistrationSupport-branch, TASK-Bugs5690_3913_RemoteCMPI-root, TASK-Bugs5690_3913_RemoteCMPI-merged_out_to_branch, TASK-Bugs5690_3913_RemoteCMPI-merged_out_from_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_to_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_from_branch, TASK-Bugs5690_3913_RemoteCMPI-branch, TASK-Bug2021_RemoteCMPIonWindows-root, TASK-Bug2021_RemoteCMPIonWindows-merged_out_to_branch, TASK-Bug2021_RemoteCMPIonWindows-merged_out_from_trunk, TASK-Bug2021_RemoteCMPIonWindows-merged_in_to_trunk, TASK-Bug2021_RemoteCMPIonWindows-merged_in_from_branch, TASK-Bug2021_RemoteCMPIonWindows-branch, TASK-Bug2021_RCMPIonWindows-root, TASK-Bug2021_RCMPIonWindows-merged_out_to_branch, TASK-Bug2021_RCMPIonWindows-merged_out_from_trunk, TASK-Bug2021_RCMPIonWindows-merged_in_to_trunk, TASK-Bug2021_RCMPIonWindows-merged_in_from_branch, TASK-Bug2021_RCMPIonWindows-branch, TASK-BUG4011_WinLocalConnect-branch-New, RELEASE_2_6_0-FC
Changes since 1.29: +4 -0 lines
BUG#: 5555
TITLE: CIMRepository getInstance() checks subclasses
DESCRIPTION: Only look for an instance of the specified class on a getInstance call rather than searching the class subtree.

//%2006////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation, The Open Group.
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; Symantec Corporation; The Open Group.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Mike Brasher (mbrasher@bmc.com)
//
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
//                  (carolann_graves@hp.com)
//              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
//              Amit K Arora, IBM (amita@in.ibm.com) for PEP#101
//              David Dillard, VERITAS Software Corp.
//                  (david.dillard@veritas.com)
//
//%/////////////////////////////////////////////////////////////////////////////

#ifndef Pegasus_NameSpaceManager_h
#define Pegasus_NameSpaceManager_h

#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/HashTable.h>
#include <Pegasus/Common/AutoPtr.h>
#include <Pegasus/Repository/InheritanceTree.h>
#include <Pegasus/Repository/Linkage.h>
#include <Pegasus/Common/MessageLoader.h> //l10n

PEGASUS_NAMESPACE_BEGIN

struct NameSpaceManagerRep;
class NameSpace;

enum NameSpaceIntendedOp {
   NameSpaceRead,
   NameSpaceWrite,
   NameSpaceDelete
};

/** The NameSpaceManager class manages a collection of NameSpace objects.
*/
class PEGASUS_REPOSITORY_LINKAGE NameSpaceManager
{
   friend class NameSpace;
public:

    /** Constructor.
	@param repositoryRoot path to directory called "repository".
	@exception NoSuchDirectory if repositoryRoot not a valid directory.
    */
    NameSpaceManager(const String& repositoryRoot);

    /** Destructor.
    */
    ~NameSpaceManager();

    /** Determines whether the given namespace exists:
	@param nameSpaceName name of namespace.
	@return true if namespace eixsts; false otherwise.
    */
    Boolean nameSpaceExists(const CIMNamespaceName& nameSpaceName) const;

    typedef HashTable <String, String, EqualNoCaseFunc, HashLowerCaseFunc>
        NameSpaceAttributes;

    /** Creates the given namespace.
	@param nameSpaceName name of namespace to be created.
	@exception CIMException(CIM_ERR_ALREADY_EXISTS)
	@exception CannotCreateDirectory
    */
    void createNameSpace(const CIMNamespaceName& nameSpaceName,
	 const NameSpaceAttributes &attributes);

    void modifyNameSpace(const CIMNamespaceName& nameSpaceName,
	 const NameSpaceAttributes &attributes);

    /** Deletes the given namespace.
	@param nameSpaceName name of namespace to be deleted.
	@exception CIMException(CIM_ERR_INVALID_NAMESPACE)
	@exception NonEmptyNameSpace
	@exception FailedToRemoveDirectory
    */
    void deleteNameSpace(const CIMNamespaceName& nameSpaceName);

    Boolean isRemoteNameSpace(const CIMNamespaceName& nameSpaceName,
        String & remoteInfo);

    /** Gets array of all namespace names.
	@param nameSpaceNames filled with names of all namespaces.
    */
    void getNameSpaceNames(Array<CIMNamespaceName>& nameSpaceNames) const;

    Boolean getNameSpaceAttributes(const CIMNamespaceName& nameSpace, NameSpaceAttributes &attributes);

    /** Get path to the class file for the given class.
	@param nameSpaceName name of the namespace.
	@param className name of class.
	@exception CIMException(CIM_ERR_INVALID_NAMESPACE)
	@exception CIMException(CIM_ERR_INVALID_CLASS)
    */
    String getClassFilePath(
	NameSpace *nameSpace,
	const CIMName& className,
        NameSpaceIntendedOp op) const;

    String getClassFilePath(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className,
        NameSpaceIntendedOp op) const;

    /** Get path to the qualifier file for the given class.
	@param nameSpaceName name of the namespace.
	@param qualifierName name of qualifier.
	@exception CIMException(CIM_ERR_INVALID_NAMESPACE)
	@exception CIMException(CIM_ERR_NOT_FOUND)
    */
    String getQualifierFilePath(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& qualifierName,
        NameSpaceIntendedOp op) const;

    String getInstanceDataFileBase(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className) const;

    String getInstanceDataFileBase(
        const NameSpace *nameSpace,
        const CIMName& className) const;

    /** Get path to the directory containing qualifiers:
	@param nameSpaceName name of the namespace.
    */
    String getQualifiersRoot(const CIMNamespaceName& nameSpaceName) const;

    /** Get path to the file containing association classes:
	@param nameSpaceName name of the namespace.
    */
    Array<String> getAssocClassPath(const CIMNamespaceName& nameSpaceName,
        NameSpaceIntendedOp op) const;

    /** Get path to the file containing association instances:
	@param nameSpaceName name of the namespace.
    */
    String getAssocInstPath(const CIMNamespaceName& nameSpaceName) const;

    /** Deletes the class file for the given class.
	@param nameSpaceName name of namespace.
	@param className name of class.
	@exception CIMException(CIM_ERR_INVALID_NAMESPACE)
	@exception CIMException(CIM_ERR_INVALID_CLASS)
	@exception CIMException(CIM_ERR_CLASS_HAS_CHILDREN)
    */
    void deleteClass(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className) const;

    /** Print out the namespaces. */
    void print(PEGASUS_STD(ostream)& os) const;

    /** Creates an entry for a new class.
	@param nameSpaceName namespace to contain class.
	@param className name of class
	@param superClassName name of superClassName
	@param classFilePath path of file to contain class itself.
    */
    void createClass(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className,
	const CIMName& superClassName,
	String& classFilePath);

    /** Checks if it is okay to modify this class.
	@param nameSpaceName namespace.
	@param className name of class being modified.
	@param superClassName superclass of class being modified.
	@param classFilePath full path to file containing class.
	@exception CIMException(CIM_ERR_INVALID_CLASS)
	@exception CIMException(CIM_ERR_FAILED) if there is an attempt
	    to change the superclass of this class.
	@exception CIMException(CIM_ERR_CLASS_HAS_CHILDREN) if class
	    has any children.
    */
    void checkModify(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className,
	const CIMName& superClassName,
	String& classFilePath);

    /** Get subclass names of the given class in the given namespace.
	@param nameSpaceName
	@param className - class whose subclass names will be gotten. If
	    className is empty, all classnames are returned.
	@param deepInheritance - if true all descendent classes of class
	    are returned. If className is empty, only root classes are returned.
	@param subClassNames - output argument to hold subclass names.
	@exception CIMException(CIM_ERR_INVALID_CLASS)
    */
    void getSubClassNames(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className,
	Boolean deepInheritance,
	Array<CIMName>& subClassNames,
	Boolean enm=false) const;

    /** Get the names of all superclasses (direct and indirect) of this
	class.
    */
    void getSuperClassNames(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className,
	Array<CIMName>& subClassNames) const;

    Boolean classHasInstances(
	NameSpace *nameSpace,
	const CIMName& className,
	Boolean throwExcp=false) const;

    Boolean classHasInstances(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className,
	Boolean throwExcp=false) const;

    Boolean classExists(
	NameSpace *nameSpace,
	const CIMName& className,
	Boolean throwExcp=false) const;

    Boolean classExists(
	const CIMNamespaceName& nameSpaceName,
	const CIMName& className) const;

private:
    NameSpace *lookupNameSpace(String&);
    String _repositoryRoot;
    NameSpaceManagerRep* _rep;
};

/** This exception is thrown if one attempts to remove a namespace that still
    contains classes, instances, or qualifier.
*/
class PEGASUS_REPOSITORY_LINKAGE NonEmptyNameSpace : public Exception
{
public:
	//l10n
    //NonEmptyNameSpace(const String& nameSpaceName) : Exception(
	//"Attempt to delete a non-empty namespace: " + nameSpaceName) { }
	NonEmptyNameSpace(const String& nameSpaceName) :
								Exception(MessageLoaderParms(
								"Repository.NameSpaceManager.ATTEMPT_DELETE_NONEMPTY_NAMESPACE",
								"Attempt to delete a non-empty namespace: $0", nameSpaceName)) { }


	//l10n end
};

PEGASUS_NAMESPACE_END

#endif /* Pegasus_NameSpaceManager_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2