Search in sources :

Example 6 with IPentahoDefinableObjectFactory

use of org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory in project pentaho-platform by pentaho.

the class MicroPlatform method defineInstance.

public MicroPlatform defineInstance(String key, Object instance) {
    if (getFactory() instanceof IPentahoDefinableObjectFactory) {
        IPentahoDefinableObjectFactory definableFactory = (IPentahoDefinableObjectFactory) getFactory();
        definableFactory.defineInstance(key, instance);
    } else {
        throw new NoSuchMethodError("define is only supported by IPentahoDefinableObjectFactory");
    }
    return this;
}
Also used : IPentahoDefinableObjectFactory(org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory)

Example 7 with IPentahoDefinableObjectFactory

use of org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory in project pentaho-platform by pentaho.

the class PentahoBoot method enablePluginManager.

/**
 * Enables the plugin manager
 */
public void enablePluginManager() {
    if (getFactory() instanceof IPentahoDefinableObjectFactory) {
        define(IPluginProvider.class, SystemPathXmlPluginProvider.class, Scope.GLOBAL);
        define(IPluginManager.class, DefaultPluginManager.class, Scope.GLOBAL);
        define(IServiceManager.class, DefaultServiceManager.class, Scope.GLOBAL);
        define(IPluginResourceLoader.class, PluginResourceLoader.class, Scope.GLOBAL);
    }
    addLifecycleListener(new PluginAdapter());
}
Also used : IPentahoDefinableObjectFactory(org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory) PluginAdapter(org.pentaho.platform.plugin.services.pluginmgr.PluginAdapter)

Example 8 with IPentahoDefinableObjectFactory

use of org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory in project pentaho-platform by pentaho.

the class PentahoBoot method enablePooledDatasources.

/**
 * Enables the pooled datasources
 */
public void enablePooledDatasources() {
    IPentahoObjectFactory objectFactory = getFactory();
    if (objectFactory instanceof IPentahoDefinableObjectFactory) {
        define(IDBDatasourceService.class, PooledOrJndiDatasourceService.class, Scope.LOCAL);
        define(IPooledDatasourceService.class, PooledDatasourceService.class, Scope.LOCAL);
        define(IJndiDatasourceService.class, JndiDatasourceService.class, Scope.LOCAL);
    }
    addLifecycleListener(new PooledDatasourceSystemListener());
}
Also used : IPentahoDefinableObjectFactory(org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory) IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) PooledDatasourceSystemListener(org.pentaho.platform.engine.services.connection.datasource.dbcp.PooledDatasourceSystemListener)

Example 9 with IPentahoDefinableObjectFactory

use of org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory in project pentaho-platform by pentaho.

the class BootTest method testBootActions.

@Test
public void testBootActions() throws Exception {
    PentahoSystemBoot boot = new PentahoSystemBoot();
    boot.setFilePath("src/test/resources/solution");
    boot.define(ISolutionEngine.class.getSimpleName(), Object1.class.getName(), IPentahoDefinableObjectFactory.Scope.GLOBAL);
    TestStartupAction startupAction1 = new TestStartupAction();
    TestStartupAction startupAction2 = new TestStartupAction();
    boot.addStartupAction(startupAction1);
    List<ISessionStartupAction> startupActions1 = boot.getStartupActions();
    assertEquals(1, startupActions1.size());
    assertEquals(startupAction1, startupActions1.get(0));
    List<ISessionStartupAction> startupActions2 = new ArrayList<ISessionStartupAction>();
    startupActions2.add(startupAction2);
    boot.setStartupActions(startupActions2);
    List<ISessionStartupAction> startupActions3 = boot.getStartupActions();
    assertEquals(1, startupActions3.size());
    assertEquals(startupAction2, startupActions3.get(0));
    assertEquals(startupActions2, startupActions3);
    IPentahoObjectFactory factory = boot.getFactory();
    assertNotNull("object factory is null", factory);
    assertTrue("object factory not definable", factory instanceof IPentahoDefinableObjectFactory);
    assertFalse(boot.isInitialized());
    boolean ok = boot.start();
    assertNull(boot.getSettingsProvider());
    assertTrue(boot.isInitialized());
    assertTrue(ok);
    boot.stop();
    assertFalse(boot.isInitialized());
}
Also used : PentahoSystemBoot(org.pentaho.platform.engine.core.system.boot.PentahoSystemBoot) IPentahoDefinableObjectFactory(org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory) ISolutionEngine(org.pentaho.platform.api.engine.ISolutionEngine) IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) ArrayList(java.util.ArrayList) ISessionStartupAction(org.pentaho.platform.api.engine.ISessionStartupAction) Test(org.junit.Test)

Example 10 with IPentahoDefinableObjectFactory

use of org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory in project pentaho-platform by pentaho.

the class BootTest method testBoot.

@Test
public void testBoot() throws Exception {
    PentahoSystemBoot boot = new PentahoSystemBoot();
    boot.setFilePath("solution");
    IPentahoObjectFactory factory = boot.getFactory();
    assertNotNull("object factory is null", factory);
    assertTrue("object factory not definable", factory instanceof IPentahoDefinableObjectFactory);
    boot.define(ISolutionEngine.class.getSimpleName(), Object1.class.getName(), IPentahoDefinableObjectFactory.Scope.GLOBAL);
    boot.define("MyObject", Object1.class.getName(), IPentahoDefinableObjectFactory.Scope.GLOBAL);
    boot.define("MyObject", Object2.class.getName(), IPentahoDefinableObjectFactory.Scope.GLOBAL);
    assertFalse(boot.isInitialized());
    boolean ok = boot.start();
    assertNull(boot.getSettingsProvider());
    assertTrue(boot.isInitialized());
    assertTrue(ok);
    factory = boot.getFactory();
    Object2 object = factory.get(Object2.class, "MyObject", null);
    assertNotNull("object get failed", object);
    assertEquals("file path is wrong", "solution", boot.getFilePath());
    boot.stop();
    assertFalse(boot.isInitialized());
}
Also used : PentahoSystemBoot(org.pentaho.platform.engine.core.system.boot.PentahoSystemBoot) IPentahoDefinableObjectFactory(org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory) ISolutionEngine(org.pentaho.platform.api.engine.ISolutionEngine) IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) Test(org.junit.Test)

Aggregations

IPentahoDefinableObjectFactory (org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory)10 IPentahoObjectFactory (org.pentaho.platform.api.engine.IPentahoObjectFactory)6 Test (org.junit.Test)3 ISolutionEngine (org.pentaho.platform.api.engine.ISolutionEngine)3 PentahoSystemBoot (org.pentaho.platform.engine.core.system.boot.PentahoSystemBoot)3 ArrayList (java.util.ArrayList)2 IPentahoSystemListener (org.pentaho.platform.api.engine.IPentahoSystemListener)1 ISessionStartupAction (org.pentaho.platform.api.engine.ISessionStartupAction)1 PooledDatasourceSystemListener (org.pentaho.platform.engine.services.connection.datasource.dbcp.PooledDatasourceSystemListener)1 MondrianSystemListener (org.pentaho.platform.plugin.action.mondrian.MondrianSystemListener)1 MDXConnection (org.pentaho.platform.plugin.services.connections.mondrian.MDXConnection)1 PluginAdapter (org.pentaho.platform.plugin.services.pluginmgr.PluginAdapter)1