/* * Helper function that builds a unique object path for an instance defined by the input arguments */ wbem::framework::ObjectPath wbem::memory::MemoryControllerFactory::getInstanceObjectPath( std::string &hostServerName, std::string &memory_controller_id) { framework::attributes_t keys; // SystemCreationClassName = server::BASESERVER_CREATIONCLASSNAME framework::Attribute attrSysCCName(server::BASESERVER_CREATIONCLASSNAME, true); keys.insert(std::pair<std::string, framework::Attribute>( SYSTEMCREATIONCLASSNAME_KEY, attrSysCCName)); // SystemName = (host) server name framework::Attribute attrSysName(hostServerName, true); keys.insert(std::pair<std::string, framework::Attribute>( SYSTEMNAME_KEY, attrSysName)); // Creation Class Name = topology::MEMORYCONTROLLER_CREATIONCLASSNAME framework::Attribute attrCCName(MEMORYCONTROLLER_CREATIONCLASSNAME, true); keys.insert(std::pair<std::string, framework::Attribute>( CREATIONCLASSNAME_KEY, attrCCName)); // DeviceID = Unique Memory Controller ID framework::Attribute attrDeviceID(memory_controller_id, true); keys.insert(std::pair<std::string, framework::Attribute>( DEVICEID_KEY, attrDeviceID)); // generate the ObjectPath for the instance return framework::ObjectPath(hostServerName, NVM_NAMESPACE, MEMORYCONTROLLER_CREATIONCLASSNAME, keys); }
/* * Return the object paths for the BaseServer class. Should only * be one server. */ wbem::framework::instance_names_t* wbem::server::BaseServerFactory::getInstanceNames() throw (wbem::framework::Exception) { LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__); framework::instance_names_t *pNames = new framework::instance_names_t(); try { // Note that unlike several other WBEM classes, this function cannot succeed with zero // instances. That is to say, either the only instance was found, or there was an error, // and that error needs to be carried back to the caller. // get the host server info so that we have the host name std::string hostName = wbem::server::getHostName(); framework::attributes_t keys; // CreationClassName = server::BASESERVER_CREATIONCLASSNAME framework::Attribute attrCCName(BASESERVER_CREATIONCLASSNAME, true); keys.insert(std::pair<std::string, framework::Attribute>( CREATIONCLASSNAME_KEY, attrCCName)); // Name = (host) server name framework::Attribute attrName(std::string(hostName), true); keys.insert(std::pair<std::string, framework::Attribute>( NAME_KEY, attrName)); // generate the ObjectPath for the instance (there should only be one) framework::ObjectPath path(hostName, NVM_NAMESPACE, BASESERVER_CREATIONCLASSNAME, keys); pNames->push_back(path); } catch (framework::Exception &) // clean up and re-throw { delete pNames; throw; } return pNames; }