static CMPIStatus mbModifyInstance(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const CMPIInstance *ci,const char ** properties) { DDD(cout<<"--- mbSetInstance()"<<endl); mb=CM_BROKER; CMPIFlags flgs=ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; const CIMPropertyList props=getList(properties); AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { CIMInstance cmi(*CM_Instance(ci)); cmi.setPath(*CM_ObjectPath(cop)); CM_CIMOM(mb)->modifyInstance( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), cmi, CM_IncludeQualifiers(flgs), props); CMReturn(CMPI_RC_OK); } catch (const CIMException &e) { DDD(cout<<"### exception: mbSetInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); CMReturnWithString((CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); } CMReturnWithChars(mb,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-2"); }
static CMPIData mbGetProperty( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *name, CMPIStatus *rc) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbGetProperty()"); mb = CM_BROKER; CMPIData data = {0,CMPI_nullValue,{0}}; SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop); CIMObjectPath qop; scmoObjPath->getCIMObjectPath(qop); try { CIMValue v = CM_CIMOM(mb)->getProperty( *CM_Context(ctx), SCMO_ObjectPath(cop)->getNameSpace(), qop, String(name)); CIMType vType = v.getType(); CMPIType t = type2CMPIType(vType,v.isArray()); value2CMPIData(v,t,&data); CMSetStatus(rc,CMPI_RC_OK); } HandlerCatchSetStatus(rc, data); PEG_METHOD_EXIT(); return data; // "data" will be valid data or nullValue (in error case) }
static CMPIInstance* mbGetInstance(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char **properties, CMPIStatus *rc) { DDD(cout<<"--- mbGetInstance()"<<endl); mb=CM_BROKER; CMPIFlags flgs=ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; const CIMPropertyList props=getList(properties); CIMObjectPath qop(String::EMPTY,CIMNamespaceName(), CM_ObjectPath(cop)->getClassName(), CM_ObjectPath(cop)->getKeyBindings()); AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { CIMInstance ci=CM_CIMOM(mb)->getInstance( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), qop, //*CM_ObjectPath(cop), CM_LocalOnly(flgs), CM_IncludeQualifiers(flgs), CM_ClassOrigin(flgs), props); ci.setPath(*CM_ObjectPath(cop)); if (rc) CMSetStatus(rc,CMPI_RC_OK); return (CMPIInstance*)new CMPI_Object(new CIMInstance(ci)); } catch (const CIMException &e) { DDD(cout<<"### exception: mbGetInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); return NULL; } if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-0"); return NULL; }
static CMPIStatus mbDeleteInstance( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbDeleteInstance()"); mb = CM_BROKER; SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop); CIMObjectPath qop; try { scmoObjPath->getCIMObjectPath(qop); CM_CIMOM(mb)->deleteInstance( *CM_Context(ctx), SCMO_ObjectPath(cop)->getNameSpace(), qop); } HandlerCatchReturnStatus(); PEG_METHOD_EXIT(); CMReturn(CMPI_RC_OK); }
static CMPIEnumeration* mbEnumInstances(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char **properties, CMPIStatus *rc) { DDD(cout<<"--- mbEnumInstances()"<<endl); mb=CM_BROKER; CMPIFlags flgs=ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; const CIMPropertyList props=getList(properties); AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { Array<CIMInstance> const &en=CM_CIMOM(mb)->enumerateInstances( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), CM_ObjectPath(cop)->getClassName(), CM_DeepInheritance(flgs), CM_LocalOnly(flgs), CM_IncludeQualifiers(flgs), CM_ClassOrigin(flgs), props); if (rc) CMSetStatus(rc,CMPI_RC_OK); CMPI_Object *obj = new CMPI_Object(new CMPI_InstEnumeration(new Array<CIMInstance>(en))); return (CMPI_InstEnumeration*)obj->getHdl(); } catch (const CIMException &e) { DDD(cout<<"### exception: mbEnumInstances - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); return NULL; } if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-5"); return NULL; }
static CMPIStatus mbModifyInstance( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const CMPIInstance *ci, const char ** properties) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbModifyInstance()"); mb = CM_BROKER; CMPIFlags flgs = ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; const CIMPropertyList props = getList(properties); SCMOInstance* scmoInst = SCMO_Instance(ci); CIMInstance inst; try { scmoInst->getCIMInstance(inst); CM_CIMOM(mb)->modifyInstance( *CM_Context(ctx), SCMO_ObjectPath(cop)->getNameSpace(), inst, CM_IncludeQualifiers(flgs), props); } HandlerCatchReturnStatus(); PEG_METHOD_EXIT(); CMReturn(CMPI_RC_OK); }
CIMClass* mbGetClass(const CMPIBroker *mb, const CIMObjectPath &cop) { DDD(cout<<"--- mbGetClass()"<<endl); mb=CM_BROKER; CMPI_Broker *xBroker=(CMPI_Broker*)mb; String clsId=cop.getNameSpace().getString()+":"+cop.getClassName().getString(); CIMClass *ccp; AutoMutex mtx(((CMPI_Broker*)mb)->mtx); if (xBroker->clsCache) { if (xBroker->clsCache->lookup(clsId,ccp)) return ccp; } else xBroker->clsCache=new ClassCache(); try { CIMClass cc=CM_CIMOM(mb)->getClass( OperationContext(), cop.getNameSpace(), cop.getClassName(), (bool)0, (bool)1, (bool)0, CIMPropertyList()); ccp=new CIMClass(cc); xBroker->clsCache->insert(clsId,ccp); return ccp; } catch (const CIMException &e) { DDD(cout<<"### exception: mbGetClass - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); } return NULL; }
static CMPIStatus mbSetProperty(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *name, const CMPIValue *val, CMPIType type) { DDD(cout<<"--- mbSetProperty()"<<endl); mb=CM_BROKER; CMPIrc rc; CIMValue v=value2CIMValue(val,type,&rc); AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { CM_CIMOM(mb)->setProperty( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), *CM_ObjectPath(cop), String(name), v); CMReturn(CMPI_RC_OK); } catch (const CIMException &e) { DDD(cout<<"### exception: mbSetProperty - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); CMReturnWithString((CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); } CMReturnWithChars(mb,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-12"); }
static CMPIData mbGetProperty(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *name, CMPIStatus *rc) { DDD(cout<<"--- mbGetProperty()"<<endl); mb=CM_BROKER; CMPIData data={0,CMPI_nullValue,{0}}; AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { CIMValue v=CM_CIMOM(mb)->getProperty( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), *CM_ObjectPath(cop), String(name)); CIMType vType=v.getType(); CMPIType t=type2CMPIType(vType,v.isArray()); value2CMPIData(v,t,&data); if (rc) CMSetStatus(rc,CMPI_RC_OK); return data; } catch (const CIMException &e) { DDD(cout<<"### exception: mbGetProperty - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); } if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED); return data; }
static CMPIEnumeration* mbReferenceNames(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *resultClass, const char *role, CMPIStatus *rc) { DDD(cout<<"--- mbReferencesNames()"<<endl); mb=CM_BROKER; CIMObjectPath qop(String::EMPTY,CIMNamespaceName(), CM_ObjectPath(cop)->getClassName(), CM_ObjectPath(cop)->getKeyBindings()); AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { Array<CIMObjectPath> const &en=CM_CIMOM(mb)->referenceNames( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), qop, resultClass ? CIMName(resultClass) : CIMName(), role ? String(role) : String::EMPTY); if (rc) CMSetStatus(rc,CMPI_RC_OK); CMPI_Object *obj = new CMPI_Object(new CMPI_OpEnumeration(new Array<CIMObjectPath>(en))); return (CMPI_OpEnumeration *)obj->getHdl(); } catch (const CIMException &e) { DDD(cout<<"### exception: mbReferencesNames - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); } if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-11"); return NULL; }
static CMPIStatus mbSetProperty( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *name, const CMPIValue *val, CMPIType type) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbSetProperty()"); mb = CM_BROKER; CMPIrc rc; CIMValue v = value2CIMValue(val,type,&rc); SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop); CIMObjectPath qop; try { scmoObjPath->getCIMObjectPath(qop); CM_CIMOM(mb)->setProperty( *CM_Context(ctx), SCMO_ObjectPath(cop)->getNameSpace(), qop, String(name), v); } HandlerCatchReturnStatus(); PEG_METHOD_EXIT(); CMReturn(CMPI_RC_OK); }
static CMPIEnumeration* mbEnumInstanceNames(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, CMPIStatus *rc) { DDD(cout<<"--- mbEnumInstanceNames()"<<endl); mb=CM_BROKER; AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { Array<CIMObjectPath> const &en=CM_CIMOM(mb)->enumerateInstanceNames( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), CM_ObjectPath(cop)->getClassName()); if (rc) CMSetStatus(rc,CMPI_RC_OK); CMPI_Object *obj = new CMPI_Object(new CMPI_OpEnumeration(new Array<CIMObjectPath>(en))); return (CMPI_OpEnumeration *)obj->getHdl(); } catch (const CIMException &e) { DDD(cout<<"### exception: mbEnumInstances - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); } if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-6"); return NULL; }
static CMPIEnumeration* mbReferenceNames( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *resultClass, const char *role, CMPIStatus *rc) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbReferenceNames()"); mb = CM_BROKER; // ATTN-CAKG-P2-20020726: The following condition does not correctly // distinguish instanceNames from classNames in every case // The instanceName of a singleton instance of a keyless class has no // key bindings if (!SCMO_ObjectPath(cop)->getKeyBindingCount()) { CMSetStatus(rc, CMPI_RC_ERR_FAILED); PEG_METHOD_EXIT(); return 0; } SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop); CIMObjectPath qop; try { scmoObjPath->getCIMObjectPath(qop); // For compatibility with previous implementations have empty ns qop.setNameSpace(CIMNamespaceName()); CIMResponseData resData = CM_CIMOM(mb)->referenceNames( *CM_Context(ctx), scmoObjPath->getNameSpace(), qop, resultClass ? CIMName(resultClass) : CIMName(), role ? String(role) : String::EMPTY); // Add the namespace from the input parameters when neccessary resData.completeNamespace(scmoObjPath); Array<SCMOInstance>* aRef = new Array<SCMOInstance>(resData.getSCMO()); CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>( new CMPI_Object(new CMPI_OpEnumeration(aRef))); CMSetStatus(rc,CMPI_RC_OK); PEG_METHOD_EXIT(); return cmpiEnum; } HandlerCatchSetStatus(rc, NULL); // Code flow should never get here. }
static CMPIInstance* mbGetInstance( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char **properties, CMPIStatus *rc) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbGetInstance()"); mb = CM_BROKER; CMPIFlags flgs = ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; const CIMPropertyList props = getList(properties); SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop); CIMObjectPath qop; try { scmoObjPath->getCIMObjectPath(qop); CIMResponseData resData = CM_CIMOM(mb)->getInstance( *CM_Context(ctx), scmoObjPath->getNameSpace(), qop, CM_IncludeQualifiers(flgs), CM_ClassOrigin(flgs), props); // When running out of process the returned instances don't contain // a namespace. // Add the namespace from the input parameters where neccessary resData.completeNamespace(SCMO_ObjectPath(cop)); SCMOInstance& scmoOrgInst = resData.getSCMO()[0]; SCMOInstance* scmoInst = new SCMOInstance(scmoOrgInst); // Rebuild the objectPath scmoInst->buildKeyBindingsFromProperties(); CMPIInstance* cmpiInst = reinterpret_cast<CMPIInstance*>( new CMPI_Object(scmoInst,CMPI_Object::ObjectTypeInstance)); CMSetStatus(rc,CMPI_RC_OK); PEG_METHOD_EXIT(); return cmpiInst; } HandlerCatchSetStatus(rc, NULL); // Code flow should never get here. }
static CMPIEnumeration* mbEnumInstances( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char **properties, CMPIStatus *rc) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbEnumInstances()"); mb = CM_BROKER; CMPIFlags flgs = ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; const CIMPropertyList props = getList(properties); try { CIMResponseData resData = CM_CIMOM(mb)->enumerateInstances( *CM_Context(ctx), SCMO_ObjectPath(cop)->getNameSpace(), SCMO_ObjectPath(cop)->getClassName(), true, CM_IncludeQualifiers(flgs), CM_ClassOrigin(flgs), props); // When running out of process the returned instances don't contain // a namespace. // Add the namespace from the input parameters where neccessary resData.completeNamespace(SCMO_ObjectPath(cop)); Array<SCMOInstance>* aInst = new Array<SCMOInstance>(resData.getSCMO()); CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>( new CMPI_Object(new CMPI_InstEnumeration(aInst))); CMSetStatus(rc,CMPI_RC_OK); PEG_METHOD_EXIT(); return cmpiEnum; } HandlerCatchSetStatus(rc, NULL); // Code flow should never get here. }
static CMPIData mbInvokeMethod( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *method, const CMPIArgs *in, CMPIArgs *out, CMPIStatus *rc) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbInvokeMethod()"); CMPIData data = {0,CMPI_nullValue,{0}}; mb = CM_BROKER; SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop); CIMObjectPath qop; try { scmoObjPath->getCIMObjectPath(qop); CIMValue v = CM_CIMOM(mb)->invokeMethod( *CM_Context(ctx), SCMO_ObjectPath(cop)->getNameSpace(), qop, method ? String(method) : String::EMPTY, *CM_Args(in), *CM_Args(out)); CIMType vType=v.getType(); CMPIType t = type2CMPIType(vType,v.isArray()); value2CMPIData(v,t,&data); if (rc) { CMSetStatus(rc,CMPI_RC_OK); } } HandlerCatchSetStatus(rc, data); PEG_METHOD_EXIT(); return data; // "data" will be valid data or nullValue (in error case) }
static CMPIObjectPath* mbCreateInstance( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const CMPIInstance *ci, CMPIStatus *rc) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbCreateInstance()"); mb = CM_BROKER; SCMOInstance* scmoInst = SCMO_Instance(ci); CIMInstance inst; try { scmoInst->getCIMInstance(inst); CIMObjectPath ncop = CM_CIMOM(mb)->createInstance( *CM_Context(ctx), scmoInst->getNameSpace(), inst); SCMOInstance* newScmoInst= CMPISCMOUtilities::getSCMOFromCIMObjectPath( ncop, scmoInst->getNameSpace()); CMPIObjectPath* cmpiObjPath = reinterpret_cast<CMPIObjectPath*>( new CMPI_Object(newScmoInst,CMPI_Object::ObjectTypeObjectPath)); CMSetStatus(rc,CMPI_RC_OK); PEG_METHOD_EXIT(); return cmpiObjPath; } HandlerCatchSetStatus(rc, NULL); // Code flow should never get here. }
static CMPIEnumeration* mbAssociators(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *assocClass, const char *resultClass, const char *role, const char *resultRole, const char **properties, CMPIStatus *rc) { DDD(cout<<"--- mbAssociators()"<<endl); mb=CM_BROKER; CMPIFlags flgs=ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; const CIMPropertyList props=getList(properties); CIMObjectPath qop(String::EMPTY,CIMNamespaceName(), CM_ObjectPath(cop)->getClassName(), CM_ObjectPath(cop)->getKeyBindings()); AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { Array<CIMObject> const &en=CM_CIMOM(mb)->associators( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), qop, assocClass ? CIMName(assocClass) : CIMName(), resultClass ? CIMName(resultClass) : CIMName(), role ? String(role) : String::EMPTY, resultRole ? String(resultRole) : String::EMPTY, CM_IncludeQualifiers(flgs), CM_ClassOrigin(flgs), props); if (rc) CMSetStatus(rc,CMPI_RC_OK); CMPI_Object *obj = new CMPI_Object(new CMPI_ObjEnumeration(new Array<CIMObject>(en))); return (CMPI_ObjEnumeration *)obj->getHdl(); } catch (const CIMException &e) { DDD(cout<<"### exception: mbAssociators - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); return NULL; } if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-7"); return NULL; }
static CMPIEnumeration* mbEnumInstanceNames( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, CMPIStatus *rc) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbEnumInstanceNames()"); mb = CM_BROKER; try { CIMResponseData resData = CM_CIMOM(mb)->enumerateInstanceNames( *CM_Context(ctx), SCMO_ObjectPath(cop)->getNameSpace(), SCMO_ObjectPath(cop)->getClassName()); // When running out of process the returned instances don't contain // a namespace. // Add the namespace from the input parameters where neccessary resData.completeNamespace(SCMO_ObjectPath(cop)); Array<SCMOInstance>* aRef = new Array<SCMOInstance>(resData.getSCMO()); CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>( new CMPI_Object(new CMPI_OpEnumeration(aRef))); CMSetStatus(rc,CMPI_RC_OK); PEG_METHOD_EXIT(); return cmpiEnum; } HandlerCatchSetStatus(rc, NULL); // Code flow should never get here. }
static CMPIStatus mbDeleteInstance (const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop) { DDD(cout<<"--- mbDeleteInstance()"<<endl); mb=CM_BROKER; CIMObjectPath qop(String::EMPTY,CIMNamespaceName(), CM_ObjectPath(cop)->getClassName(), CM_ObjectPath(cop)->getKeyBindings()); AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { CM_CIMOM(mb)->deleteInstance( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), qop); //*CM_ObjectPath(cop)); CMReturn(CMPI_RC_OK); } catch (const CIMException &e) { DDD(cout<<"### exception: mbDeleteInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); CMReturnWithString((CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); } CMReturnWithChars(mb,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-3"); }
static CMPIObjectPath* mbCreateInstance(const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const CMPIInstance *ci, CMPIStatus *rc) { DDD(cout<<"--- mbCreateInstance()"<<endl); mb=CM_BROKER; AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { CIMObjectPath ncop=CM_CIMOM(mb)->createInstance( OperationContext(*CM_Context(ctx)), CM_ObjectPath(cop)->getNameSpace(), *CM_Instance(ci)); if (rc) CMSetStatus(rc,CMPI_RC_OK); return (CMPIObjectPath*)new CMPI_Object(new CIMObjectPath(ncop)); } catch (const CIMException &e) { DDD(cout<<"### exception: mbCreateInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), (CMPIString*)string2CMPIString(e.getMessage())); return NULL; } if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-1"); return NULL; }
static CMPIEnumeration* mbAssociators( const CMPIBroker *mb, const CMPIContext *ctx, const CMPIObjectPath *cop, const char *assocClass, const char *resultClass, const char *role, const char *resultRole, const char **properties, CMPIStatus *rc) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbAssociators()"); mb = CM_BROKER; // ATTN-CAKG-P2-20020726: The following condition does not correctly // distinguish instanceNames from classNames in every case // The instanceName of a singleton instance of a keyless class has no // key bindings if (!SCMO_ObjectPath(cop)->getKeyBindingCount()) { CMSetStatus(rc, CMPI_RC_ERR_FAILED); PEG_METHOD_EXIT(); return 0; } CMPIFlags flgs = ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; const CIMPropertyList props = getList(properties); SCMOInstance* scmoObjPath = SCMO_ObjectPath(cop); CIMObjectPath qop; try { scmoObjPath->getCIMObjectPath(qop); // For compatibility with previous implementations have empty ns qop.setNameSpace(CIMNamespaceName()); CIMResponseData resData = CM_CIMOM(mb)->associators( *CM_Context(ctx), SCMO_ObjectPath(cop)->getNameSpace(), qop, assocClass ? CIMName(assocClass) : CIMName(), resultClass ? CIMName(resultClass) : CIMName(), role ? String(role) : String::EMPTY, resultRole ? String(resultRole) : String::EMPTY, CM_IncludeQualifiers(flgs), CM_ClassOrigin(flgs), props); // When running out of process the returned instances don't contain // a namespace. // Add the namespace from the input parameters where neccessary resData.completeNamespace(scmoObjPath); Array<SCMOInstance>* aObj = new Array<SCMOInstance>(resData.getSCMO()); CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>( new CMPI_Object(new CMPI_ObjEnumeration(aObj))); CMSetStatus(rc,CMPI_RC_OK); PEG_METHOD_EXIT(); return cmpiEnum; } HandlerCatchSetStatus(rc, NULL); // Code flow should never get here. }