コード例 #1
0
ファイル: CMPI_Broker.cpp プロジェクト: rdobson/openpegasus
    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.
    }