Search in sources :

Example 1 with DelegatingBackingRepositoryLifecycleManager

use of org.pentaho.platform.repository2.unified.lifecycle.DelegatingBackingRepositoryLifecycleManager in project data-access by pentaho.

the class DataAccessLifecycleListener method ready.

@Override
public void ready() throws PluginLifecycleException {
    // the platform is booted, spring initialized, all plugins init and loaded
    boolean enableAgilemartDatasource = false;
    try {
        IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
        enableAgilemartDatasource = Boolean.parseBoolean(resLoader.getPluginSetting(DataAccessLifecycleListener.class, ENABLE_AGILEMART_DATASOURCE, "false"));
    } catch (Throwable t) {
        log.warn(t.getMessage(), t);
    }
    if (enableAgilemartDatasource) {
        try {
            SecurityHelper.getInstance().runAsSystem(new Callable<Void>() {

                public Void call() throws Exception {
                    AgileMartDatasourceLifecycleManager.getInstance().startup();
                    return null;
                }
            });
        } catch (Exception e) {
            log.warn(e.getMessage(), e);
        }
        DelegatingBackingRepositoryLifecycleManager manager = PentahoSystem.get(DelegatingBackingRepositoryLifecycleManager.class, "backingRepositoryLifecycleManager", null);
        manager.addLifeCycleManager(AgileMartDatasourceLifecycleManager.getInstance());
    }
}
Also used : IPluginResourceLoader(org.pentaho.platform.api.engine.IPluginResourceLoader) PluginLifecycleException(org.pentaho.platform.api.engine.PluginLifecycleException) DelegatingBackingRepositoryLifecycleManager(org.pentaho.platform.repository2.unified.lifecycle.DelegatingBackingRepositoryLifecycleManager)

Aggregations

IPluginResourceLoader (org.pentaho.platform.api.engine.IPluginResourceLoader)1 PluginLifecycleException (org.pentaho.platform.api.engine.PluginLifecycleException)1 DelegatingBackingRepositoryLifecycleManager (org.pentaho.platform.repository2.unified.lifecycle.DelegatingBackingRepositoryLifecycleManager)1