示例#1
0
   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;
   }
示例#2
0
   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;
   }
示例#3
0
    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.
    }
示例#4
0
    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.
    }
示例#5
0
   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;
   }
示例#6
0
    static CMPIEnumeration* mbReferences(
        const CMPIBroker *mb,
        const CMPIContext *ctx,
        const CMPIObjectPath *cop,
        const char *resultClass,
        const char *role ,
        const char **properties,
        CMPIStatus *rc)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Broker:mbReferences()");
        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;
        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)->references(
                    *CM_Context(ctx),
                    scmoObjPath->getNameSpace(),
                    qop,
                    resultClass ? CIMName(resultClass) : CIMName(),
                    role ? String(role) : String::EMPTY,
                    CM_IncludeQualifiers(flgs),
                    CM_ClassOrigin(flgs),
                    props);

            CMSetStatus(rc,CMPI_RC_OK);

            // Add the namespace from the input parameters when neccessary
            resData.completeNamespace(scmoObjPath);

            Array<SCMOInstance>* aObj =
                new Array<SCMOInstance>(resData.getSCMO());

            CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
                new CMPI_Object(new CMPI_ObjEnumeration(aObj)));
            PEG_METHOD_EXIT();
            return cmpiEnum;
        }
        HandlerCatchSetStatus(rc, NULL);

        // Code flow should never get here.
    }