Search in sources :

Example 11 with PathBasedSystemSettings

use of org.pentaho.platform.engine.core.system.PathBasedSystemSettings in project pentaho-platform by pentaho.

the class SystemSettingsTest method init.

public boolean init() {
    PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
    File file = new File(SOLUTION_PATH + PENTAHO_XML_PATH);
    StandaloneApplicationContext applicationContext = null;
    if (file.exists()) {
        // $NON-NLS-1$
        applicationContext = new StandaloneApplicationContext(SystemSettingsTest.SOLUTION_PATH, "");
    } else {
        // $NON-NLS-1$
        applicationContext = new StandaloneApplicationContext(SystemSettingsTest.ALT_SOLUTION_PATH, "");
    }
    // $NON-NLS-1$ //$NON-NLS-2$
    String inContainer = System.getProperty("incontainer", "false");
    if (inContainer.equalsIgnoreCase("false")) {
        // $NON-NLS-1$
        // Setup simple-jndi for datasources
        // $NON-NLS-1$ //$NON-NLS-2$
        System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory");
        // $NON-NLS-1$ //$NON-NLS-2$
        System.setProperty("org.osjava.sj.root", getSolutionPath() + "/system/simple-jndi");
        // $NON-NLS-1$ //$NON-NLS-2$
        System.setProperty("org.osjava.sj.delimiter", "/");
    }
    // $NON-NLS-1$
    String objectFactoryCreatorCfgFile = getSolutionPath() + SYSTEM_FOLDER + "/" + DEFAULT_SPRING_CONFIG_FILE_NAME;
    IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
    pentahoObjectFactory.init(objectFactoryCreatorCfgFile, null);
    PentahoSystem.registerObjectFactory(pentahoObjectFactory);
    return PentahoSystem.init(applicationContext);
}
Also used : IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) PathBasedSystemSettings(org.pentaho.platform.engine.core.system.PathBasedSystemSettings) File(java.io.File) StandaloneSpringPentahoObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)

Example 12 with PathBasedSystemSettings

use of org.pentaho.platform.engine.core.system.PathBasedSystemSettings in project pentaho-platform by pentaho.

the class PluginManagerNotConfiguredIT method setUp.

public void setUp() {
    List<?> messages = TestManager.getMessagesList();
    if (messages == null) {
        messages = new ArrayList<String>();
    }
    if (initOk) {
        return;
    }
    PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
    if (PentahoSystem.getApplicationContext() == null) {
        // $NON-NLS-1$
        StandaloneApplicationContext applicationContext = new StandaloneApplicationContext(getSolutionPath(), "");
        // $NON-NLS-1$ //$NON-NLS-2$
        String inContainer = System.getProperty("incontainer", "false");
        if (inContainer.equalsIgnoreCase("false")) {
            // $NON-NLS-1$
            // Setup simple-jndi for datasources
            // $NON-NLS-1$ //$NON-NLS-2$
            System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory");
            // $NON-NLS-1$ //$NON-NLS-2$
            System.setProperty("org.osjava.sj.root", getSolutionPath() + "/system/simple-jndi");
            // $NON-NLS-1$ //$NON-NLS-2$
            System.setProperty("org.osjava.sj.delimiter", "/");
        }
        ApplicationContext springApplicationContext = getSpringApplicationContext();
        IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
        pentahoObjectFactory.init(null, springApplicationContext);
        PentahoSystem.registerObjectFactory(pentahoObjectFactory);
        // force Spring to populate PentahoSystem
        // $NON-NLS-1$
        springApplicationContext.getBean("pentahoSystemProxy");
        initOk = PentahoSystem.init(applicationContext);
    } else {
        initOk = true;
    }
    initOk = true;
}
Also used : StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) GenericApplicationContext(org.springframework.context.support.GenericApplicationContext) IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) PathBasedSystemSettings(org.pentaho.platform.engine.core.system.PathBasedSystemSettings) StandaloneSpringPentahoObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)

Example 13 with PathBasedSystemSettings

use of org.pentaho.platform.engine.core.system.PathBasedSystemSettings in project data-access by pentaho.

the class PentahoSystemHelper method init.

public static void init() {
    if (PentahoSystem.getInitializedOK()) {
        return;
    }
    try {
        PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
        if (PentahoSystem.getApplicationContext() == null) {
            StandaloneApplicationContext applicationContext = // $NON-NLS-1$
            new StandaloneApplicationContext(getSolutionPath(), "");
            // set the base url assuming there is a running server on port 8080
            if (PentahoRequestContextHolder.getRequestContext() != null) {
                applicationContext.setFullyQualifiedServerURL(PentahoRequestContextHolder.getRequestContext().getContextPath());
            }
            // $NON-NLS-1$ //$NON-NLS-2$
            String inContainer = System.getProperty("incontainer", "false");
            if (inContainer.equalsIgnoreCase("false")) {
                // $NON-NLS-1$
                // Setup simple-jndi for datasources
                System.setProperty("java.naming.factory.initial", // $NON-NLS-1$ //$NON-NLS-2$
                "org.osjava.sj.SimpleContextFactory");
                System.setProperty("org.osjava.sj.root", // $NON-NLS-1$ //$NON-NLS-2$
                getSolutionPath() + "/system/simple-jndi");
                // $NON-NLS-1$ //$NON-NLS-2$
                System.setProperty("org.osjava.sj.delimiter", "/");
            }
            ApplicationContext springApplicationContext = getSpringApplicationContext();
            IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
            pentahoObjectFactory.init(null, springApplicationContext);
            PentahoSystem.registerObjectFactory(pentahoObjectFactory);
            // force Spring to inject PentahoSystem, there has got to be a better way than this,
            // perhaps an alternate way of initting spring's app context
            // $NON-NLS-1$
            springApplicationContext.getBean("pentahoSystemProxy");
            PentahoSystem.init(applicationContext);
        }
    } catch (Exception e) {
        logger.error(e);
    }
}
Also used : StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) GenericApplicationContext(org.springframework.context.support.GenericApplicationContext) IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) StandaloneApplicationContext(org.pentaho.platform.engine.core.system.StandaloneApplicationContext) PathBasedSystemSettings(org.pentaho.platform.engine.core.system.PathBasedSystemSettings) StandaloneSpringPentahoObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)

Aggregations

PathBasedSystemSettings (org.pentaho.platform.engine.core.system.PathBasedSystemSettings)13 StandaloneApplicationContext (org.pentaho.platform.engine.core.system.StandaloneApplicationContext)7 StandaloneSpringPentahoObjectFactory (org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)7 IPentahoObjectFactory (org.pentaho.platform.api.engine.IPentahoObjectFactory)6 File (java.io.File)5 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)5 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)4 ApplicationContext (org.springframework.context.ApplicationContext)3 Before (org.junit.Before)2 BeforeClass (org.junit.BeforeClass)2 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)2 FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Properties (java.util.Properties)1 Test (org.junit.Test)1 KettleException (org.pentaho.di.core.exception.KettleException)1 KettlePluginException (org.pentaho.di.core.exception.KettlePluginException)1 MetaverseException (org.pentaho.metaverse.api.MetaverseException)1 MetaverseUtil (org.pentaho.metaverse.util.MetaverseUtil)1