use of org.b3log.solo.repository.PluginRepository in project solo by b3log.
the class PluginRefresher method action.
@Override
public void action(final Event<List<AbstractPlugin>> event) throws EventException {
final List<AbstractPlugin> plugins = event.getData();
LOGGER.log(Level.DEBUG, "Processing an event[type={0}, data={1}] in listener[className={2}]", new Object[] { event.getType(), plugins, PluginRefresher.class.getName() });
final LatkeBeanManager beanManager = Lifecycle.getBeanManager();
final PluginRepository pluginRepository = beanManager.getReference(PluginRepositoryImpl.class);
final Transaction transaction = pluginRepository.beginTransaction();
try {
final PluginMgmtService pluginMgmtService = beanManager.getReference(PluginMgmtService.class);
pluginMgmtService.refresh(plugins);
transaction.commit();
} catch (final Exception e) {
if (transaction.isActive()) {
transaction.rollback();
}
LOGGER.log(Level.ERROR, "Processing plugin loaded event error", e);
throw new EventException(e);
}
}
Aggregations