PLUGIN_REPOS.setCacheEnabled(false);
// Reads plugin status from datastore and clear plugin datastore
for (final JSONObject oldPluginDesc : persistedPlugins) {
final String descId = oldPluginDesc.getString(Keys.OBJECT_ID);
final AbstractPlugin plugin = get(plugins, descId);
PLUGIN_REPOS.remove(descId);
if (null != plugin) {
final String status =
oldPluginDesc.getString(Plugin.PLUGIN_STATUS);
plugin.setStatus(PluginStatus.valueOf(status));
}
}
// Adds these plugins into datastore
for (final AbstractPlugin plugin : plugins) {
final JSONObject pluginDesc = plugin.toJSONObject();
PLUGIN_REPOS.addAsync(pluginDesc);
LOGGER.log(Level.FINEST, "Refreshed plugin[{0}]", pluginDesc);
}