// // Send notify config change message to provider manager service // This code was borrowed from the ConfigSettingProvider and should // be kept in sync. // The purpose is to ensure that OOP agents also get the update. // TBD, or is it for other reasons as well? // void ZOSConsoleManager::_sendNotifyConfigChangeMessage( const String& propertyName, const String& newPropertyValue, Boolean currentValueModified) { PEG_METHOD_ENTER(TRC_SERVER, "ZOSConsoleManager::_sendNotifyConfigChangeMessage"); ModuleController* controller = ModuleController::getModuleController(); MessageQueue * queue = MessageQueue::lookup( PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP); MessageQueueService * service = dynamic_cast<MessageQueueService *>(queue); if (service != NULL) { // create CIMNotifyConfigChangeRequestMessage CIMNotifyConfigChangeRequestMessage * notify_req = new CIMNotifyConfigChangeRequestMessage ( XmlWriter::getNextMessageId (), propertyName, newPropertyValue, currentValueModified, QueueIdStack(service->getQueueId())); notify_req->operationContext.insert( IdentityContainer(System::getEffectiveUserName())); // create request envelope AsyncLegacyOperationStart asyncRequest( NULL, service->getQueueId(), notify_req); AutoPtr<AsyncReply> asyncReply( controller->ClientSendWait(service->getQueueId(), &asyncRequest)); AutoPtr<CIMNotifyConfigChangeResponseMessage> response( reinterpret_cast<CIMNotifyConfigChangeResponseMessage *>( (static_cast<AsyncLegacyOperationResult *> (asyncReply.get()))->get_result())); if (response->cimException.getCode() != CIM_ERR_SUCCESS) { CIMException e = response->cimException; const CString exMsg = e.getMessage().getCString(); PEG_TRACE((TRC_SERVER, Tracer::LEVEL1, "Notify config changed failed with rc=%d, message = %s", e.getCode(), (const char*)exMsg)); PEG_METHOD_EXIT(); } } PEG_METHOD_EXIT(); }
int ModuleController::requestML(const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { ModuleController *mc = (ModuleController *)user_data; mc->sendModuleList(); return 0; }
// // send notify config change message to provider manager service // void ConfigSettingProvider::_sendNotifyConfigChangeMessage( const String& propertyName, const String& newPropertyValue, const String& userName, const char *queueName, Boolean currentValueModified) { PEG_METHOD_ENTER(TRC_CONFIG, "ConfigSettingProvider::_sendNotifyConfigChangeMessage"); ModuleController* controller = ModuleController::getModuleController(); MessageQueue * queue = MessageQueue::lookup(queueName); MessageQueueService * service = dynamic_cast<MessageQueueService *>(queue); if (service != NULL) { // create CIMNotifyConfigChangeRequestMessage CIMNotifyConfigChangeRequestMessage * notify_req = new CIMNotifyConfigChangeRequestMessage ( XmlWriter::getNextMessageId (), propertyName, newPropertyValue, currentValueModified, QueueIdStack(service->getQueueId())); notify_req->operationContext.insert( IdentityContainer(userName)); // create request envelope AsyncLegacyOperationStart asyncRequest( NULL, service->getQueueId(), notify_req); AutoPtr<AsyncReply> asyncReply( controller->ClientSendWait(service->getQueueId(), &asyncRequest)); AutoPtr<CIMNotifyConfigChangeResponseMessage> response( reinterpret_cast<CIMNotifyConfigChangeResponseMessage *>( (static_cast<AsyncLegacyOperationResult *> (asyncReply.get()))->get_result())); if (response->cimException.getCode() != CIM_ERR_SUCCESS) { CIMException e = response->cimException; throw (e); } } }
void ModuleController::_async_handleEnqueue(AsyncOpNode *op, MessageQueue *q, void *parm) { ModuleController *myself = static_cast<ModuleController *>(q); Message *request = op->get_request(); Message *response = op->get_response(); if( request && (! (request->getMask() & message_mask::ha_async))) throw TypeMismatchException(); if( response && (! (response->getMask() & message_mask::ha_async) )) throw TypeMismatchException(); op->release(); myself->return_op(op); Uint32 routing=0; // get rid of the module wrapper if( request && request->getType() == async_messages::ASYNC_MODULE_OP_START ) { (static_cast<AsyncMessage *>(request))->op = NULL; AsyncModuleOperationStart *rq = static_cast<AsyncModuleOperationStart *>(request); request = rq->get_action(); request->setRouting(routing = rq->getRouting()); delete rq; } // get rid of the module wrapper if(response && response->getType() == async_messages::ASYNC_MODULE_OP_RESULT ) { (static_cast<AsyncMessage *>(response))->op = NULL; AsyncModuleOperationResult *rp = static_cast<AsyncModuleOperationResult *>(response); response = rp->get_result(); response->setRouting(routing = rp->getRouting()); delete rp; } callback_handle *cb = reinterpret_cast<callback_handle *>(parm); cb->_module->_send_async_callback(routing, response, cb->_parm); delete cb; return; }
// called by a module to register itself, returns a handle to the controller ModuleController & ModuleController::register_module(const String & controller_name, const String & module_name, void *module_address, Message * (*receive_message)(Message *, void *), void (*async_callback)(Uint32, Message *, void *), void (*shutdown_notify)(Uint32, void *), pegasus_module **instance) { pegasus_module *module ; ModuleController *controller; Array<Uint32> services; MessageQueue *message_queue = MessageQueue::lookup(controller_name.getCString()); if ((message_queue == NULL) || ( false == message_queue->isAsync() )) { throw IncompatibleTypesException(); } MessageQueueService *service = static_cast<MessageQueueService *>(message_queue); if( (service == NULL) || ! ( service->get_capabilities() & module_capabilities::module_controller )) { throw IncompatibleTypesException(); } controller = static_cast<ModuleController *>(service); { // see if the module already exists in this controller. _module_lock lock(&(controller->_modules)); module = controller->_modules.next(0); while(module != NULL ) { if(module->get_name() == module_name ) { //l10n //throw AlreadyExistsException("module \"" + module_name + "\""); MessageLoaderParms parms("Common.ModuleController.MODULE", "module \"$0\"", module_name); throw AlreadyExistsException(parms); } module = controller->_modules.next(module); } } // now reserve this module name with the meta dispatcher Uint32 result = 0 ; AutoPtr<RegisteredModule> request(new RegisteredModule(controller->get_next_xid(), 0, true, controller->getQueueId(), module_name)); request->dest = CIMOM_Q_ID; AutoPtr<AsyncReply> response(controller->SendWait(request.get())); if( response.get() != NULL) result = response->result; request.reset(); response.reset(); if ( result == async_results::MODULE_ALREADY_REGISTERED){ //l10n //throw AlreadyExistsException("module \"" + module_name + "\""); MessageLoaderParms parms("Common.ModuleController.MODULE", "module \"$0\"", module_name); throw AlreadyExistsException(parms); } // the module does not exist, go ahead and create it. module = new pegasus_module(controller, module_name, module_address, receive_message, async_callback, shutdown_notify); controller->_modules.insert_last(module); if(instance != NULL) *instance = module; return *controller; }