Search in sources :

Example 1 with IPlatformReadyListener

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);
    }
}
Also used : IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) IPluginManager(org.pentaho.platform.api.engine.IPluginManager) IPluginProvider(org.pentaho.platform.api.engine.IPluginProvider) IPlatformReadyListener(org.pentaho.platform.api.engine.IPlatformReadyListener) PlatformPluginRegistrationException(org.pentaho.platform.api.engine.PlatformPluginRegistrationException) PlatformPluginRegistrationException(org.pentaho.platform.api.engine.PlatformPluginRegistrationException) IPlatformPlugin(org.pentaho.platform.api.engine.IPlatformPlugin)

Aggregations

IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)1 IPlatformPlugin (org.pentaho.platform.api.engine.IPlatformPlugin)1 IPlatformReadyListener (org.pentaho.platform.api.engine.IPlatformReadyListener)1 IPluginManager (org.pentaho.platform.api.engine.IPluginManager)1 IPluginProvider (org.pentaho.platform.api.engine.IPluginProvider)1 PlatformPluginRegistrationException (org.pentaho.platform.api.engine.PlatformPluginRegistrationException)1