OW_CIMRepository.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2002-2004 Vintela, Inc. All rights reserved.
00003 *
00004 * Redistribution and use in source and binary forms, with or without
00005 * modification, are permitted provided that the following conditions are met:
00006 *
00007 *  - Redistributions of source code must retain the above copyright notice,
00008 *    this list of conditions and the following disclaimer.
00009 *
00010 *  - Redistributions in binary form must reproduce the above copyright notice,
00011 *    this list of conditions and the following disclaimer in the documentation
00012 *    and/or other materials provided with the distribution.
00013 *
00014 *  - Neither the name of Vintela, Inc. nor the names of its
00015 *    contributors may be used to endorse or promote products derived from this
00016 *    software without specific prior written permission.
00017 *
00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
00022 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028 * POSSIBILITY OF SUCH DAMAGE.
00029 *******************************************************************************/
00030 
00036 #ifndef OW_CIM_REPOSITORY_HPP_INCLUDE_GUARD_
00037 #define OW_CIM_REPOSITORY_HPP_INCLUDE_GUARD_
00038 #include "OW_config.h"
00039 #include "OW_RepositoryIFC.hpp"
00040 #include "OW_ServiceEnvironmentIFC.hpp"
00041 #include "OW_MetaRepository.hpp"
00042 #include "OW_InstanceRepository.hpp"
00043 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00044 #include "OW_AssocDb.hpp"
00045 #endif
00046 #include "OW_RWLocker.hpp"
00047 
00048 namespace OW_NAMESPACE
00049 {
00050 
00051 namespace CIMRepositoryImpl
00052 {
00053    class instEnumerator;
00054 }
00055 
00056 // This class is responsible for storing/retrieving the static CIM data.
00057 class OW_HDB_API CIMRepository : public RepositoryIFC
00058 {
00059 public:
00060    static const char* const INST_REPOS_NAME;
00061    static const char* const META_REPOS_NAME;
00062    static const char* const NS_REPOS_NAME;
00063 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00064    static const char* const CLASS_ASSOC_REPOS_NAME;
00065    static const char* const INST_ASSOC_REPOS_NAME;
00066 #endif
00067 
00070    CIMRepository();
00074    virtual ~CIMRepository();
00079    virtual void open(const String& path);
00080    virtual void close();
00081 
00082    virtual String getName() const;
00083    virtual void init(const ServiceEnvironmentIFCRef& env);
00084    virtual void shutdown();
00085 #if !defined(OW_DISABLE_INSTANCE_MANIPULATION) && !defined(OW_DISABLE_NAMESPACE_MANIPULATION)
00086 
00092    virtual void createNameSpace(const String& ns, OperationContext& context);
00099    virtual void deleteNameSpace(const String& ns, OperationContext& context);
00100 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00101 
00108    virtual void enumNameSpace(StringResultHandlerIFC& result,
00109       OperationContext& context);
00119    virtual CIMQualifierType getQualifierType(const String& ns,
00120       const String& qualifierName,
00121       OperationContext& context);
00122 #ifndef OW_DISABLE_QUALIFIER_DECLARATION
00123 
00130    virtual void enumQualifierTypes(
00131       const String& ns,
00132       CIMQualifierTypeResultHandlerIFC& result,
00133       OperationContext& context);
00141    virtual void deleteQualifierType(const String& ns, const String& qualName,
00142       OperationContext& context);
00152    virtual void setQualifierType(const String& ns,
00153       const CIMQualifierType& qt, OperationContext& context);
00154 #endif // #ifndef OW_DISABLE_QUALIFIER_DECLARATION
00155 
00173    virtual CIMClass getClass(
00174       const String& ns,
00175       const String& className,
00176       WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00177       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00178       OperationContext& context);
00179 #ifndef OW_DISABLE_SCHEMA_MANIPULATION
00180 
00197    virtual CIMClass deleteClass(const String& ns, const String& className,
00198       OperationContext& context);
00214    virtual void createClass(const String& ns, const CIMClass& cimClass,
00215       OperationContext& context);
00236    virtual CIMClass modifyClass(
00237       const String& ns,
00238       const CIMClass& cc,
00239       OperationContext& context);
00240 #endif // #ifndef OW_DISABLE_SCHEMA_MANIPULATION
00241 
00263    virtual void enumClasses(const String& ns,
00264       const String& className,
00265       CIMClassResultHandlerIFC& result,
00266       WBEMFlags::EDeepFlag deep, WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00267       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, OperationContext& context);
00287    virtual void enumClassNames(const String& ns,
00288       const String& className,
00289       StringResultHandlerIFC& result,
00290       WBEMFlags::EDeepFlag deep, OperationContext& context);
00317    virtual void enumInstances(
00318       const String& ns,
00319       const String& className,
00320       CIMInstanceResultHandlerIFC& result,
00321       WBEMFlags::EDeepFlag deep, WBEMFlags::ELocalOnlyFlag localOnly,
00322       WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00323       const StringArray* propertyList,
00324       WBEMFlags::EEnumSubclassesFlag enumSubclasses,
00325       OperationContext& context);
00346    virtual void enumInstanceNames(
00347       const String& ns,
00348       const String& className,
00349       CIMObjectPathResultHandlerIFC& result,
00350       WBEMFlags::EDeepFlag deep, OperationContext& context);
00374    virtual CIMInstance getInstance(
00375       const String& ns,
00376       const CIMObjectPath& instanceName,
00377       WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00378       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00379       OperationContext& context);
00380    virtual CIMInstance getInstance(
00381       const String& ns,
00382       const CIMObjectPath& instanceName,
00383       WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00384       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00385       CIMClass* pOutClass, OperationContext& context);
00386 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00387 
00401    virtual CIMInstance deleteInstance(const String& ns, const CIMObjectPath& cop,
00402       OperationContext& context);
00418    virtual CIMObjectPath createInstance(const String& ns,
00419       const CIMInstance& ci,
00420       OperationContext& context);
00439    virtual CIMInstance modifyInstance(
00440       const String& ns,
00441       const CIMInstance& modifiedInstance,
00442       WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00443       const StringArray* propertyList,
00444       OperationContext& context);
00445 #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00446 
00454    virtual void setProperty(
00455       const String& ns,
00456       const CIMObjectPath& name, const String& propertyName,
00457       const CIMValue& cv, OperationContext& context);
00458 #endif // #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00459 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00460    
00461 #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00462 
00471    virtual CIMValue getProperty(
00472       const String& ns,
00473       const CIMObjectPath& name,
00474       const String& propertyName, OperationContext& context);
00475 #endif // #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00476 
00489    virtual CIMValue invokeMethod(
00490       const String& ns,
00491       const CIMObjectPath& path,
00492       const String& methodName, const CIMParamValueArray& inParams,
00493       CIMParamValueArray& outParams, OperationContext& context);
00494 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00495    virtual void associatorNames(
00496       const String& ns,
00497       const CIMObjectPath& path,
00498       CIMObjectPathResultHandlerIFC& result,
00499       const String& assocClass,
00500       const String& resultClass, const String& role,
00501       const String& resultRole, OperationContext& context);
00502    virtual void associators(
00503       const String& ns,
00504       const CIMObjectPath& path,
00505       CIMInstanceResultHandlerIFC& result,
00506       const String& assocClass,
00507       const String& resultClass, const String& role,
00508       const String& resultRole,  WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00509       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00510       OperationContext& context);
00511    virtual void associatorsClasses(
00512       const String& ns,
00513       const CIMObjectPath& path,
00514       CIMClassResultHandlerIFC& result,
00515       const String& assocClass,
00516       const String& resultClass, const String& role,
00517       const String& resultRole,  WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00518       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00519       OperationContext& context);
00520    virtual void referenceNames(
00521       const String& ns,
00522       const CIMObjectPath& path,
00523       CIMObjectPathResultHandlerIFC& result,
00524       const String& resultClass,
00525       const String& role, OperationContext& context);
00526    virtual void references(
00527       const String& ns,
00528       const CIMObjectPath& path,
00529       CIMInstanceResultHandlerIFC& result,
00530       const String& resultClass,
00531       const String& role, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00532       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00533       OperationContext& context);
00534    
00535    virtual void referencesClasses(
00536       const String& ns,
00537       const CIMObjectPath& path,
00538       CIMClassResultHandlerIFC& result,
00539       const String& resultClass,
00540       const String& role, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00541       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00542       OperationContext& context);
00543 #endif // #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00544 
00556    virtual void execQuery(
00557       const String& ns,
00558       CIMInstanceResultHandlerIFC& result,
00559       const String &query, const String& queryLanguage,
00560       OperationContext& context);
00561    
00562    virtual void beginOperation(WBEMFlags::EOperationFlag op, OperationContext& context);
00563    virtual void endOperation(WBEMFlags::EOperationFlag op, OperationContext& context, WBEMFlags::EOperationResultFlag result);
00564 
00565    ServiceEnvironmentIFCRef getEnvironment() const { return m_env; }
00566 
00567 private:
00568    CIMClass _getClass(const String& ns, const CIMName& className);
00569    CIMClass _instGetClass(const String& ns, const CIMName& className);
00570    void checkGetClassRvalAndThrow(CIMException::ErrNoType rval,
00571       const String& ns, const CIMName& className);
00572    void checkGetClassRvalAndThrowInst(CIMException::ErrNoType rval,
00573       const String& ns, const CIMName& className);
00574 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00575    void _commonAssociators(
00576       const String& ns,
00577       const CIMObjectPath& path_,
00578       const CIMName& assocClassName, const CIMName& resultClass,
00579       const CIMName& role, const CIMName& resultRole,
00580       WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00581       WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00582       const StringArray* propertyList,
00583       CIMInstanceResultHandlerIFC* piresult,
00584       CIMObjectPathResultHandlerIFC* popresult,
00585       CIMClassResultHandlerIFC* pcresult,
00586       OperationContext& context);
00587    void _commonReferences(
00588       const String& ns,
00589       const CIMObjectPath& path_,
00590       const CIMName& resultClass, const CIMName& role,
00591       WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00592       const StringArray* propertyList, CIMInstanceResultHandlerIFC* piresult,
00593       CIMObjectPathResultHandlerIFC* popresult,
00594       CIMClassResultHandlerIFC* pcresult, OperationContext& context);
00595    
00596    void _getAssociationClasses(const String& ns,
00597       const CIMName& assocClassName, const CIMName& className,
00598       CIMClassResultHandlerIFC& result, const CIMName& role,
00599       OperationContext& context);
00600    void _staticReferences(const CIMObjectPath& path,
00601       const SortedVectorSet<CIMName>* refClasses, const CIMName& role,
00602       WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00603       const StringArray* propertyList, CIMInstanceResultHandlerIFC& result,
00604       OperationContext& context);
00605    
00606    void _staticReferenceNames(const CIMObjectPath& path,
00607       const SortedVectorSet<CIMName>* refClasses, const CIMName& role,
00608       CIMObjectPathResultHandlerIFC& result);
00609    void _staticReferencesClass(const CIMObjectPath& path,
00610       const SortedVectorSet<CIMName>* resultClasses,
00611       const CIMName& role,
00612       WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00613       const StringArray* propertyList,
00614       CIMObjectPathResultHandlerIFC* popresult,
00615       CIMClassResultHandlerIFC* pcresult,
00616       OperationContext& context);
00617    void _staticAssociators(const CIMObjectPath& path,
00618       const SortedVectorSet<CIMName>* passocClasses,
00619       const SortedVectorSet<CIMName>* presultClasses,
00620       const CIMName& role, const CIMName& resultRole,
00621       WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00622       const StringArray* propertyList, CIMInstanceResultHandlerIFC& result,
00623       OperationContext& context);
00624    void _staticAssociatorNames(const CIMObjectPath& path,
00625       const SortedVectorSet<CIMName>* passocClasses,
00626       const SortedVectorSet<CIMName>* presultClasses,
00627       const CIMName& role, const CIMName& resultRole,
00628       CIMObjectPathResultHandlerIFC& result);
00629    void _staticAssociatorsClass(
00630       const CIMObjectPath& path,
00631       const SortedVectorSet<CIMName>* assocClassNames,
00632       const SortedVectorSet<CIMName>* resultClasses,
00633       const CIMName& role, const CIMName& resultRole,
00634       WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00635       const StringArray* propertyList, CIMObjectPathResultHandlerIFC* popresult,
00636       CIMClassResultHandlerIFC* pcresult,
00637       OperationContext& context);
00638 #endif // #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00639    void _validatePropagatedKeys(OperationContext& context, const String& ns,
00640       const CIMInstance& ci, const CIMClass& theClass);
00641 
00642 private:
00643    GenericHDBRepository m_nStore;
00644    InstanceRepository m_iStore;
00645    MetaRepository m_mStore;
00646 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00647    AssocDb m_classAssocDb;
00648    AssocDb m_instAssocDb;
00649 #endif
00650 
00651 #ifdef OW_WIN32
00652 #pragma warning (push)
00653 #pragma warning (disable: 4251)
00654 #endif
00655 
00656    ServiceEnvironmentIFCRef m_env;
00657    LoggerRef m_logger;
00658    bool m_checkReferentialIntegrity;
00659    RWLocker m_schemaLock;
00660    RWLocker m_instanceLock;
00661 
00662 #ifdef OW_WIN32
00663 #pragma warning (pop)
00664 #endif
00665 
00666    friend class CIMServer;
00667    friend class CIMRepositoryImpl::instEnumerator;
00668 };
00669 
00670 } // end namespace OW_NAMESPACE
00671 
00672 #endif

Generated on Thu Feb 9 08:47:55 2006 for openwbem by  doxygen 1.4.6