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 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 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 CMPIData argsGetArgAt(const CMPIArgs* eArg, CMPICount pos, CMPIString** name, CMPIStatus* rc) { OpenWBEM::CIMParamValueArray * arg=(OpenWBEM::CIMParamValueArray *)eArg->hdl; CMPIData data={(CMPIType) 0, CMPI_nullValue, {0} }; if (pos > arg->size()) { CMSetStatus(rc,CMPI_RC_ERR_NOT_FOUND); return data; } OpenWBEM::CIMValue v=(*arg)[pos].getValue(); if (!v) { // Valid request, but the value for the named // parm is null. CMSetStatus(rc,CMPI_RC_OK); return data; } OpenWBEM::CIMDataType pType=v.getType(); CMPIType t=type2CMPIType(pType,v.isArray()); value2CMPIData(v,t,&data); if (name) { OpenWBEM::String n=(*arg)[pos].getName(); *name=string2CMPIString(n); } CMSetStatus(rc,CMPI_RC_OK); return data; }