00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef OW_CIM_REPOSITORY2_HPP_INCLUDE_GUARD_
00031 #define OW_CIM_REPOSITORY2_HPP_INCLUDE_GUARD_
00032 #include "OW_config.h"
00033 #include "OW_RepositoryIFC.hpp"
00034 #include "OW_ServiceEnvironmentIFC.hpp"
00035 #include "OW_MetaRepository2.hpp"
00036 #include "OW_InstanceRepository2.hpp"
00037 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00038 #include "OW_AssocDb2.hpp"
00039 #endif
00040 #include "OW_Exception.hpp"
00041
00042 #include <db.h>
00043
00044 namespace OW_NAMESPACE
00045 {
00046
00047 OW_DECLARE_EXCEPTION(CIMRepository2);
00048
00049
00050 class CIMRepository2 : public RepositoryIFC
00051 {
00052 public:
00056 CIMRepository2(ServiceEnvironmentIFCRef env);
00060 virtual ~CIMRepository2();
00065 virtual void open(const String& path);
00066 virtual void close();
00067 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00068
00074 virtual void createNameSpace(const String& ns, OperationContext& context);
00081 virtual void deleteNameSpace(const String& ns, OperationContext& context);
00082 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00083
00090 virtual void enumNameSpace(StringResultHandlerIFC& result,
00091 OperationContext& context);
00101 virtual CIMQualifierType getQualifierType(const String& ns,
00102 const String& qualifierName,
00103 OperationContext& context);
00104 #ifndef OW_DISABLE_QUALIFIER_DECLARATION
00105
00112 virtual void enumQualifierTypes(
00113 const String& ns,
00114 CIMQualifierTypeResultHandlerIFC& result,
00115 OperationContext& context);
00123 virtual void deleteQualifierType(const String& ns, const String& qualName,
00124 OperationContext& context);
00134 virtual void setQualifierType(const String& ns,
00135 const CIMQualifierType& qt, OperationContext& context);
00136 #endif // #ifndef OW_DISABLE_QUALIFIER_DECLARATION
00137
00155 virtual CIMClass getClass(
00156 const String& ns,
00157 const String& className,
00158 WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00159 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00160 OperationContext& context);
00161 #ifndef OW_DISABLE_SCHEMA_MANIPULATION
00162
00179 virtual CIMClass deleteClass(const String& ns, const String& className,
00180 OperationContext& context);
00196 virtual void createClass(const String& ns, const CIMClass& cimClass,
00197 OperationContext& context);
00218 virtual CIMClass modifyClass(
00219 const String& ns,
00220 const CIMClass& cc,
00221 OperationContext& context);
00222 #endif // #ifndef OW_DISABLE_SCHEMA_MANIPULATION
00223
00245 virtual void enumClasses(const String& ns,
00246 const String& className,
00247 CIMClassResultHandlerIFC& result,
00248 WBEMFlags::EDeepFlag deep, WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00249 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, OperationContext& context);
00269 virtual void enumClassNames(const String& ns,
00270 const String& className,
00271 StringResultHandlerIFC& result,
00272 WBEMFlags::EDeepFlag deep, OperationContext& context);
00299 virtual void enumInstances(
00300 const String& ns,
00301 const String& className,
00302 CIMInstanceResultHandlerIFC& result,
00303 WBEMFlags::EDeepFlag deep, WBEMFlags::ELocalOnlyFlag localOnly,
00304 WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00305 const StringArray* propertyList,
00306 WBEMFlags::EEnumSubclassesFlag enumSubclasses,
00307 OperationContext& context);
00328 virtual void enumInstanceNames(
00329 const String& ns,
00330 const String& className,
00331 CIMObjectPathResultHandlerIFC& result,
00332 WBEMFlags::EDeepFlag deep, OperationContext& context);
00356 virtual CIMInstance getInstance(
00357 const String& ns,
00358 const CIMObjectPath& instanceName,
00359 WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00360 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00361 OperationContext& context);
00362 virtual CIMInstance getInstance(
00363 const String& ns,
00364 const CIMObjectPath& instanceName,
00365 WBEMFlags::ELocalOnlyFlag localOnly, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00366 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00367 CIMClass* pOutClass, OperationContext& context);
00368 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00369
00383 virtual CIMInstance deleteInstance(const String& ns, const CIMObjectPath& cop,
00384 OperationContext& context);
00400 virtual CIMObjectPath createInstance(const String& ns,
00401 const CIMInstance& ci,
00402 OperationContext& context);
00421 virtual CIMInstance modifyInstance(
00422 const String& ns,
00423 const CIMInstance& modifiedInstance,
00424 WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00425 const StringArray* propertyList,
00426 OperationContext& context);
00435 virtual void setProperty(
00436 const String& ns,
00437 const CIMObjectPath& name, const String& propertyName,
00438 const CIMValue& cv, OperationContext& context);
00439 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00440
00449 virtual CIMValue getProperty(
00450 const String& ns,
00451 const CIMObjectPath& name,
00452 const String& propertyName, OperationContext& context);
00466 virtual CIMValue invokeMethod(
00467 const String& ns,
00468 const CIMObjectPath& path,
00469 const String& methodName, const CIMParamValueArray& inParams,
00470 CIMParamValueArray& outParams, OperationContext& context);
00471 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00472 virtual void associatorNames(
00473 const String& ns,
00474 const CIMObjectPath& path,
00475 CIMObjectPathResultHandlerIFC& result,
00476 const String& assocClass,
00477 const String& resultClass, const String& role,
00478 const String& resultRole, OperationContext& context);
00479 virtual void associators(
00480 const String& ns,
00481 const CIMObjectPath& path,
00482 CIMInstanceResultHandlerIFC& result,
00483 const String& assocClass,
00484 const String& resultClass, const String& role,
00485 const String& resultRole, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00486 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00487 OperationContext& context);
00488 virtual void associatorsClasses(
00489 const String& ns,
00490 const CIMObjectPath& path,
00491 CIMClassResultHandlerIFC& result,
00492 const String& assocClass,
00493 const String& resultClass, const String& role,
00494 const String& resultRole, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00495 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00496 OperationContext& context);
00497 virtual void referenceNames(
00498 const String& ns,
00499 const CIMObjectPath& path,
00500 CIMObjectPathResultHandlerIFC& result,
00501 const String& resultClass,
00502 const String& role, OperationContext& context);
00503 virtual void references(
00504 const String& ns,
00505 const CIMObjectPath& path,
00506 CIMInstanceResultHandlerIFC& result,
00507 const String& resultClass,
00508 const String& role, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00509 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00510 OperationContext& context);
00511
00512 virtual void referencesClasses(
00513 const String& ns,
00514 const CIMObjectPath& path,
00515 CIMClassResultHandlerIFC& result,
00516 const String& resultClass,
00517 const String& role, WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00518 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00519 OperationContext& context);
00520 #endif // #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00521
00533 virtual void execQuery(
00534 const String& ns,
00535 CIMInstanceResultHandlerIFC& result,
00536 const String &query, const String& queryLanguage,
00537 OperationContext& context);
00538
00539 virtual void beginOperation(WBEMFlags::EOperationFlag op, OperationContext& context);
00540 virtual void endOperation(WBEMFlags::EOperationFlag op, OperationContext& context, WBEMFlags::EOperationResultFlag result);
00541
00542 ServiceEnvironmentIFCRef getEnvironment() const { return m_env; }
00543
00544 CIMClass _getClass(const String& ns, const String& className);
00545 CIMClass _instGetClass(const String& ns, const String& className);
00546 void checkGetClassRvalAndThrow(CIMException::ErrNoType rval,
00547 const String& ns, const String& className);
00548 void checkGetClassRvalAndThrowInst(CIMException::ErrNoType rval,
00549 const String& ns, const String& className);
00550 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00551 void _commonAssociators(
00552 const String& ns,
00553 const CIMObjectPath& path_,
00554 const String& assocClassName, const String& resultClass,
00555 const String& role, const String& resultRole,
00556 WBEMFlags::EIncludeQualifiersFlag includeQualifiers,
00557 WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00558 const StringArray* propertyList,
00559 CIMInstanceResultHandlerIFC* piresult,
00560 CIMObjectPathResultHandlerIFC* popresult,
00561 CIMClassResultHandlerIFC* pcresult,
00562 OperationContext& context);
00563 void _commonReferences(
00564 const String& ns,
00565 const CIMObjectPath& path_,
00566 const String& resultClass, const String& role,
00567 WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00568 const StringArray* propertyList, CIMInstanceResultHandlerIFC* piresult,
00569 CIMObjectPathResultHandlerIFC* popresult,
00570 CIMClassResultHandlerIFC* pcresult, OperationContext& context);
00571
00572 void _getAssociationClasses(const String& ns,
00573 const String& assocClassName, const String& className,
00574 CIMClassResultHandlerIFC& result, const String& role,
00575 OperationContext& context);
00576 void _staticReferences(const CIMObjectPath& path,
00577 const SortedVectorSet<String>* refClasses, const String& role,
00578 WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00579 const StringArray* propertyList, CIMInstanceResultHandlerIFC& result,
00580 OperationContext& context);
00581
00582 void _staticReferenceNames(const CIMObjectPath& path,
00583 const SortedVectorSet<String>* refClasses, const String& role,
00584 CIMObjectPathResultHandlerIFC& result);
00585 void _staticReferencesClass(const CIMObjectPath& path,
00586 const SortedVectorSet<String>* resultClasses,
00587 const String& role,
00588 WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00589 const StringArray* propertyList,
00590 CIMObjectPathResultHandlerIFC* popresult,
00591 CIMClassResultHandlerIFC* pcresult,
00592 OperationContext& context);
00593 void _staticAssociators(const CIMObjectPath& path,
00594 const SortedVectorSet<String>* passocClasses,
00595 const SortedVectorSet<String>* presultClasses,
00596 const String& role, const String& resultRole,
00597 WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00598 const StringArray* propertyList, CIMInstanceResultHandlerIFC& result,
00599 OperationContext& context);
00600 void _staticAssociatorNames(const CIMObjectPath& path,
00601 const SortedVectorSet<String>* passocClasses,
00602 const SortedVectorSet<String>* presultClasses,
00603 const String& role, const String& resultRole,
00604 CIMObjectPathResultHandlerIFC& result);
00605 void _staticAssociatorsClass(
00606 const CIMObjectPath& path,
00607 const SortedVectorSet<String>* assocClassNames,
00608 const SortedVectorSet<String>* resultClasses,
00609 const String& role, const String& resultRole,
00610 WBEMFlags::EIncludeQualifiersFlag includeQualifiers, WBEMFlags::EIncludeClassOriginFlag includeClassOrigin,
00611 const StringArray* propertyList, CIMObjectPathResultHandlerIFC* popresult,
00612 CIMClassResultHandlerIFC* pcresult,
00613 OperationContext& context);
00614 #endif // #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00615 void _validatePropagatedKeys(const String& ns,
00616 const CIMInstance& ci, const CIMClass& theClass);
00617
00618 private:
00619 CIMRepository2(const CIMRepository2&);
00620 CIMRepository2& operator=(const CIMRepository2&);
00621
00622 public:
00623 InstanceRepository2 m_iStore;
00624 MetaRepository2 m_mStore;
00625 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00626 AssocDb2 m_classAssocDb;
00627 AssocDb2 m_instAssocDb;
00628 #endif
00629 ServiceEnvironmentIFCRef m_env;
00630 private:
00631 bool m_checkReferentialIntegrity;
00632
00633 DB_ENV* m_dbenv;
00634
00635 friend class CIMServer;
00636 };
00637
00638 }
00639
00640 #endif