static CMPIStatus mbDeliverIndication(const CMPIBroker* eMb, const CMPIContext* ctx, const char *ns, const CMPIInstance* ind) { DDD(cout<<"--- mbDeliverIndication()"<<endl); eMb=CM_BROKER; CMPI_Broker *mb=(CMPI_Broker*)eMb; CMPIProviderManager::indProvRecord *prec; OperationContext* context=CM_Context(ctx); if (CMPIProviderManager::provTab.lookup(mb->name,prec)) { if (prec->enabled) { try { context->get(SubscriptionInstanceNamesContainer::NAME); } catch (const Exception &) { Array<CIMObjectPath> subscriptionInstanceNames; context->insert(SubscriptionInstanceNamesContainer(subscriptionInstanceNames)); } CIMIndication cimIndication(*CM_Instance(ind)); AutoMutex mtx(((CMPI_Broker*)mb)->mtx); try { prec->handler->deliver( *context, // OperationContext(*CM_Context(ctx)), cimIndication); CMReturn(CMPI_RC_OK); } catch (const CIMException &e) { DDD(cout<<"### exception: mbSetProperty - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); CMReturn((CMPIrc)e.getCode()); } } } CMReturn(CMPI_RC_ERR_FAILED); }
void DynamicIndicationProvider::sendIndication( int severity, String classname, String description) { PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "DynamicIndicationProvider::sendIndications"); CIMInstance instance(classname); instance.addProperty(CIMProperty( CIMName("SystemCreationClassName"), CIMValue(String("CIM_AlertIndication")))); instance.addProperty(CIMProperty( CIMName("SystemName"), CIMValue(System::getHostName()))); instance.addProperty(CIMProperty( CIMName("AlertType"), CIMValue(Uint16(5)))); //Device Alert instance.addProperty(CIMProperty( CIMName("PerceivedSeverity"), CIMValue(severity))); instance.addProperty(CIMProperty( CIMName("Description"), CIMValue(description))); instance.addProperty(CIMProperty( CIMName("ProbableCause"), CIMValue(Uint16(1)))); instance.addProperty(CIMProperty( CIMName("Trending"), CIMValue(Uint16(1)))); instance.addProperty(CIMProperty( CIMName("TimeStamp"), CIMValue(CIMDateTime::getCurrentDateTime()))); Array<CIMKeyBinding> keys; //you have to set the namespace CIMObjectPath cop( System::getHostName(), _DynamicIndicationNameSpace, classname, keys); instance.setPath(cop); Buffer buffer; MofWriter::appendInstanceElement(buffer, instance); PEG_TRACE_CSTRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, buffer.getData()); PEG_TRACE_CSTRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, (const char*)instance.getPath().toString().getCString()); CIMIndication cimIndication(instance); _pHandler->deliver(cimIndication); PEG_METHOD_EXIT(); }
void SNMPIndicationProvider::enableIndications(IndicationResponseHandler & handler) { handler.processing(); //Indication CIMInstance cimInstance("root/PG_InterOp:cycHostAdapterDiscovered"); cimInstance.addProperty(CIMProperty("cycHostAdapterNumber", Uint32(101))); cimInstance.addProperty(CIMProperty("cycHostAdapterID", String("HP-NU-123"))); cimInstance.addProperty(CIMProperty("cycManagerID", String("HP-NU-456"))); CIMIndication cimIndication(cimInstance); handler.deliver(cimIndication); }
static CMPIStatus mbDeliverIndication( const CMPIBroker* eMb, const CMPIContext* ctx, const char *ns, const CMPIInstance* ind) { PEG_METHOD_ENTER( TRC_CMPIPROVIDERINTERFACE, "CMPI_Broker:mbDeliverIndication()"); eMb = CM_BROKER; CMPI_Broker *mb = (CMPI_Broker*)eMb; IndProvRecord *indProvRec; OperationContext* context = CM_Context(ctx); SCMOInstance* scmoInst = SCMO_Instance(ind); CIMInstance indInst; scmoInst->getCIMInstance(indInst); // When an indication to be delivered comes from Remote providers, // the CMPIBroker contains the name of the provider in the form // of physical-name:logical-name. Search using logical-name. -V 5884 String provider_name; CMPIUint32 n; if ( (n = mb->name.find(':') ) != PEG_NOT_FOUND) { provider_name = mb->name.subString (n + 1); } else { provider_name = mb->name; } ReadLock readLock(CMPIProviderManager::rwSemProvTab); if (CMPIProviderManager::indProvTab.lookup(provider_name, indProvRec)) { if (indProvRec->isEnabled()) { try { context->get(SubscriptionInstanceNamesContainer::NAME); } catch (const Exception &e) { PEG_TRACE((TRC_CMPIPROVIDERINTERFACE,Tracer::LEVEL1, "Exception: %s", (const char*)e.getMessage().getCString())); Array<CIMObjectPath> subscriptionInstanceNames; context->insert( SubscriptionInstanceNamesContainer( subscriptionInstanceNames)); } CIMIndication cimIndication(indInst); try { indProvRec->getHandler()->deliver( *context, // OperationContext(*CM_Context(ctx)), cimIndication); PEG_METHOD_EXIT(); CMReturn(CMPI_RC_OK); } HandlerCatchReturnStatus(); } } PEG_METHOD_EXIT(); CMReturn(CMPI_RC_ERR_FAILED); }