/** This method is called when the consumer is initialized for the first time.
 *  It reads the outstanding requests from the dat file and enqueues them.
 *
 * ATTN: This method will only get called when a consumer is initialized.
 * Therefore, when the listener starts, the outstanding indications for this
 * consumer will not get sent UNTIL a new indication comes in.  This is not
 * really an acceptable scenario.  Maybe the consumer manager needs to check
 * the .dat files upon startup and load if they are not empty.
 */
void DynamicConsumer::_loadOutstandingIndications(
         Array<IndicationDispatchEvent> indications)
{
    PEG_METHOD_ENTER(
        TRC_LISTENER,
        "DynamicConsumer::_loadOutstandingIndications");

    //create dispatch events from the instances
    IndicationDispatchEvent* event = 0;
    for (Uint32 i=0; i < indications.size(); i++)
    {

        event = new IndicationDispatchEvent(
                        OperationContext(),  //ATTN: Do we need to store this?
                        indications[i].getURL(),
                        indications[i].getIndicationInstance());

        _eventqueue.insert_back(event);
    }

    //signal the worker thread so it falls into the queue processing code
    if (_eventqueue.size())
    {
        _check_queue->signal();
    }

    PEG_METHOD_EXIT();
}
Exemple #2
0
   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;
   }
Exemple #3
0
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;
}
Exemple #4
0
   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;
   }
Exemple #5
0
   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");
   }
Exemple #6
0
   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;
   }
Exemple #7
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;
   }
Exemple #8
0
   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");
   }
Exemple #9
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;
   }
Exemple #10
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;
   }
Exemple #11
0
   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");
   }
Exemple #12
0
   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;
   }