try {
ret.put(Keys.STATUS_CODE, false);
ret.put(Keys.MSG, langs.get("setFailLabel"));
return ret;
} catch (final JSONException ex) {
throw new ActionException(
"Set plugin status fatal error!");
}
}
final PluginManager pluginManager = PluginManager.getInstance();
final List<AbstractPlugin> plugins = pluginManager.getPlugins();
for (final AbstractPlugin plugin : plugins) {
if (plugin.getId().equals(pluginId)) {
final Transaction transaction =
pluginRepository.beginTransaction();
try {
plugin.setStatus(PluginStatus.valueOf(status));
pluginRepository.update(pluginId, plugin.toJSONObject());
transaction.commit();
pluginManager.update(plugin);
ret.put(Keys.STATUS_CODE, true);
ret.put(Keys.MSG, langs.get("setSuccLabel"));
return ret;
} catch (final Exception e) {
if (transaction.isActive()) {
transaction.rollback();
}
LOGGER.log(Level.SEVERE, "Set plugin status error", e);
try {
ret.put(Keys.STATUS_CODE, false);
ret.put(Keys.MSG, langs.get("setFailLabel"));
return ret;
} catch (final JSONException ex) {
throw new ActionException(
"Set plugin status fatal error!");
}
}
}
}
try {
ret.put(Keys.STATUS_CODE, false);
ret.put(Keys.MSG, langs.get("refreshAndRetryLabel"));
return ret;
} catch (final JSONException ex) {
throw new ActionException("Set plugin status fatal error!");
}
}