use of org.pentaho.platform.api.engine.IPlatformReadyListener in project pentaho-platform by pentaho.
the class PentahoSystemReadyListener method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class);
IPentahoSession session = PentahoSessionHolder.getSession();
IPluginProvider pluginProvider = PentahoSystem.get(IPluginProvider.class, "IPluginProvider", session);
try {
List<IPlatformPlugin> providedPlugins = pluginProvider.getPlugins(session);
for (IPlatformPlugin plugin : providedPlugins) {
try {
if (!StringUtils.isEmpty(plugin.getLifecycleListenerClassname())) {
ClassLoader loader = pluginManager.getClassLoader(plugin.getId());
Object listener = loader.loadClass(plugin.getLifecycleListenerClassname()).newInstance();
if (IPlatformReadyListener.class.isAssignableFrom(listener.getClass())) {
((IPlatformReadyListener) listener).ready();
}
}
} catch (Exception e) {
Logger.warn(PentahoSystemReadyListener.class.getName(), e.getMessage(), e);
}
}
} catch (PlatformPluginRegistrationException e) {
Logger.warn(PentahoSystemReadyListener.class.getName(), e.getMessage(), e);
}
}
Aggregations