| 160 | |
| 161 | static const char PLUGINS_KEY[] = "plugins"; |
| 162 | bool ConfigureServer::loadPlugins() { |
| 163 | Json::Value const &root(m_data->root); |
| 164 | const Json::Value plugins = root[PLUGINS_KEY]; |
| 165 | bool success = true; |
| 166 | for (Json::ArrayIndex i = 0, e = plugins.size(); i < e; ++i) { |
| 167 | if (!plugins[i].isString()) { |
| 168 | success = false; |
| 169 | m_failedPlugins.push_back(std::make_pair( |
| 170 | "Plugin entry " + boost::lexical_cast<std::string>(i), |
| 171 | "Plugin name not string: " + plugins[i].toStyledString())); |
| 172 | // skip it! |
| 173 | continue; |
| 174 | } |
| 175 | |
| 176 | const std::string plugin = plugins[i].asString(); |
| 177 | try { |
| 178 | m_server->loadPlugin(plugin); |
| 179 | m_successfulPlugins.push_back(plugin); |
| 180 | } catch (std::exception &e) { |
| 181 | m_failedPlugins.push_back(std::make_pair(plugin, e.what())); |
| 182 | success = false; |
| 183 | } |
| 184 | } |
| 185 | return success; |
| 186 | } |
| 187 | |
| 188 | ConfigureServer::SuccessList const & |
| 189 | ConfigureServer::getSuccessfulPlugins() const { |
no test coverage detected