Class PentahoSystemBoot
- java.lang.Object
-
- org.pentaho.platform.engine.core.system.boot.PentahoSystemBoot
-
public class PentahoSystemBoot extends Object
This class is designed to help embedded deployments start the Hitachi Vantara system.PentahoSystemBoot
is a self-contained and very easy to configure platform initializer which does not impose the use of configuration files on your filesystem. A booter instance gives you the flexibility to configure and run the platform entirely in memory.In general you will want to
- Construct a
PentahoSystemBoot
- define the system objects that your system requires, by using one of the
define(Class, Class)
variants - (optionally) initialize the Hitachi Vantara system for processing requests by calling
start()
@Before public void init() { PentahoSystemBoot booter = new PentahoSystemBoot(); // setup your required object definitions booter.define( IUnifiedRepository.class, DefaultUnifiedRepository.class ); // initialize the minimal platform booter.init(); }
- Author:
- jamesdixon and aphillips
- Construct a
-
-
Constructor Summary
Constructors Constructor Description PentahoSystemBoot()
Creates a minimal ready-to-run platform.PentahoSystemBoot(String solutionPath)
Creates a minimal ready-to-run platform with a specified solution path.PentahoSystemBoot(String solutionPath, String fullyQualifiedServerUrl)
PentahoSystemBoot(String solutionPath, String fullyQualifiedServerUrl, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory factory)
PentahoSystemBoot(String solutionPath, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAdminAction(org.pentaho.platform.api.engine.IPentahoPublisher adminAction)
Adds an administrative action to the system.void
addLifecycleListener(org.pentaho.platform.api.engine.IPentahoSystemListener lifecycleListener)
Adds a lifecycle listener.void
addStartupAction(org.pentaho.platform.api.engine.ISessionStartupAction startupAction)
Adds a strtup action to the system.protected void
configure(String userFilePath, String userFullyQualifiedServerUrl, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory userFactory)
Configures this booter to run.protected org.pentaho.platform.api.engine.IApplicationContext
createApplicationContext()
Override this method if you want to change the type and state of the application context used to initialize the system.PentahoSystemBoot
define(Class<?> interfaceClass, Class<?> implClass)
Define a locally scoped object (aka prototype scope -- unique instance for each request for the class)PentahoSystemBoot
define(Class<?> interfaceClass, Class<?> implClass, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped objectPentahoSystemBoot
define(String key, Class<?> implClass)
Define a locally scoped object (aka prototype scope -- unique instance for each request for the class)PentahoSystemBoot
define(String key, Class<?> implClass, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped objectPentahoSystemBoot
define(String key, Object instance)
Hold an object instance by key name.PentahoSystemBoot
define(String key, String implClassName, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped objectorg.pentaho.platform.api.engine.IPentahoObjectFactory
getFactory()
Gets the object factory for the Pentaho platformString
getFilePath()
Sets the file path that will be used to get to file-based resourcesList<org.pentaho.platform.api.engine.IPentahoSystemListener>
getLifecycleListeners()
Returns the list of lifecycle listeners that will be used.org.pentaho.platform.api.engine.ISystemSettings
getSettingsProvider()
Gets the system settings object that will be used by the Pentaho platformList<org.pentaho.platform.api.engine.ISessionStartupAction>
getStartupActions()
Returns the list of startup actions.void
init()
Deprecated.usestart()
.boolean
isInitialized()
Returns true if the Pentaho platform has initialized successfully.void
setAdminActions(List<org.pentaho.platform.api.engine.IPentahoPublisher> adminActions)
void
setFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory factory)
Sets the object factory for the Pentaho platform, This defaults to the StandaloneObjectFactoryvoid
setFilePath(String filePath)
Sets the file path to be used to find configuration and content files If this is not set the current directory (.) is used.void
setFullyQualifiedServerUrl(String fullyQualifiedServerUrl)
Sets the URL that the platform uses to generate paths to its own resourcesvoid
setLifecycleListeners(List<org.pentaho.platform.api.engine.IPentahoSystemListener> lifecycleListeners)
Returns the list of lifecycle listeners that will be used.void
setSettingsProvider(org.pentaho.platform.api.engine.ISystemSettings settingsProvider)
Sets the system settings object that will be used by the Pentaho platformvoid
setStartupActions(List<org.pentaho.platform.api.engine.ISessionStartupAction> startupActions)
Sets the list of startup actions These actions will be executed on system startup or on session creation.boolean
start()
Starts the Pentaho platform, making it ready to process requests.boolean
stop()
Stops the Pentaho platform
-
-
-
Constructor Detail
-
PentahoSystemBoot
public PentahoSystemBoot()
Creates a minimal ready-to-run platform. Use this constructor if you want to accept all the defaults for your in-memory platform.
-
PentahoSystemBoot
public PentahoSystemBoot(String solutionPath)
Creates a minimal ready-to-run platform with a specified solution path. Use this constructor if your system needs to access system or other solution files from a particular directory.- Parameters:
solutionPath
- full path to the pentaho_solutions folder
-
PentahoSystemBoot
public PentahoSystemBoot(String solutionPath, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory factory)
-
-
Method Detail
-
configure
protected void configure(String userFilePath, String userFullyQualifiedServerUrl, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory userFactory)
Configures this booter to run. Any parameters that arenull
will be set with default values. The default values are as follows:- solutionPath = "." (current working directory)
- fullyQualifiedServerUrl = "http://localhost:8080/pentaho/"
- factory = a new StandaloneObjectFactory instance
-
getFilePath
public String getFilePath()
Sets the file path that will be used to get to file-based resources- Returns:
-
setFilePath
public void setFilePath(String filePath)
Sets the file path to be used to find configuration and content files If this is not set the current directory (.) is used.- Parameters:
filePath
-
-
setFullyQualifiedServerUrl
public void setFullyQualifiedServerUrl(String fullyQualifiedServerUrl)
Sets the URL that the platform uses to generate paths to its own resources- Parameters:
baseUrl
-
-
createApplicationContext
protected org.pentaho.platform.api.engine.IApplicationContext createApplicationContext()
Override this method if you want to change the type and state of the application context used to initialize the system.- Returns:
- an application context for system initialization
-
init
public void init()
Deprecated.usestart()
. This method is hanging around for backward compatibility with MicroPlatform
-
start
public boolean start() throws PlatformInitializationException
Starts the Pentaho platform, making it ready to process requests.- Throws:
PlatformInitializationException
- if there was a problem initializing the platform
-
stop
public boolean stop()
Stops the Pentaho platform- Returns:
-
getFactory
public org.pentaho.platform.api.engine.IPentahoObjectFactory getFactory()
Gets the object factory for the Pentaho platform- Returns:
-
setFactory
public void setFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory factory)
Sets the object factory for the Pentaho platform, This defaults to the StandaloneObjectFactory
-
addAdminAction
public void addAdminAction(org.pentaho.platform.api.engine.IPentahoPublisher adminAction)
Adds an administrative action to the system.- Parameters:
adminAction
-
-
setAdminActions
public void setAdminActions(List<org.pentaho.platform.api.engine.IPentahoPublisher> adminActions)
-
addLifecycleListener
public void addLifecycleListener(org.pentaho.platform.api.engine.IPentahoSystemListener lifecycleListener)
Adds a lifecycle listener. This object will be notified when the Pentaho platform starts and stops.- Parameters:
lifecycleListener
-
-
getLifecycleListeners
public List<org.pentaho.platform.api.engine.IPentahoSystemListener> getLifecycleListeners()
Returns the list of lifecycle listeners that will be used. These objects will be notified when the Pentaho platform starts and stops.- Returns:
-
setLifecycleListeners
public void setLifecycleListeners(List<org.pentaho.platform.api.engine.IPentahoSystemListener> lifecycleListeners)
Returns the list of lifecycle listeners that will be used. These objects will be notified when the Pentaho platform starts and stops.
-
getSettingsProvider
public org.pentaho.platform.api.engine.ISystemSettings getSettingsProvider()
Gets the system settings object that will be used by the Pentaho platform- Returns:
-
setSettingsProvider
public void setSettingsProvider(org.pentaho.platform.api.engine.ISystemSettings settingsProvider)
Sets the system settings object that will be used by the Pentaho platform
-
isInitialized
public boolean isInitialized()
Returns true if the Pentaho platform has initialized successfully.- Returns:
-
getStartupActions
public List<org.pentaho.platform.api.engine.ISessionStartupAction> getStartupActions()
Returns the list of startup actions. These actions will be executed on system startup or on session creation.- Returns:
-
setStartupActions
public void setStartupActions(List<org.pentaho.platform.api.engine.ISessionStartupAction> startupActions)
Sets the list of startup actions These actions will be executed on system startup or on session creation.- Parameters:
startupActions
-
-
addStartupAction
public void addStartupAction(org.pentaho.platform.api.engine.ISessionStartupAction startupAction)
Adds a strtup action to the system. These actions will be executed on system startup or on session creation.- Parameters:
startupAction
-
-
define
public PentahoSystemBoot define(String key, String implClassName, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped object- Parameters:
key
- the key to retrieval of this objectimplClassName
- the actual type that is served back to you when requested.scope
- the scope of the object- Returns:
- the current
PentahoSystemBoot
instance, for chaining - Throws:
NoSuchMethodError
- if the object factory does not support runtime object definition
-
define
public PentahoSystemBoot define(Class<?> interfaceClass, Class<?> implClass, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped object- Parameters:
interfaceClass
- the key to retrieval of this objectimplClass
- the actual type that is served back to you when requested.scope
- the scope of the object- Returns:
- the current
PentahoSystemBoot
instance, for chaining - Throws:
NoSuchMethodError
- if the object factory does not support runtime object definition
-
define
public PentahoSystemBoot define(String key, Class<?> implClass, org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped object- Parameters:
key
- the key to retrieval of this objectimplClass
- the actual type that is served back to you when requested.scope
- the scope of the object- Returns:
- the current
PentahoSystemBoot
instance, for chaining - Throws:
NoSuchMethodError
- if the object factory does not support runtime object definition
-
define
public PentahoSystemBoot define(Class<?> interfaceClass, Class<?> implClass)
Define a locally scoped object (aka prototype scope -- unique instance for each request for the class)- Parameters:
interfaceClass
- the key to retrieval of this objectimplClass
- the actual type that is served back to you when requested.- Returns:
- the current MicroPlatform instance, for chaining
-
define
public PentahoSystemBoot define(String key, Class<?> implClass)
Define a locally scoped object (aka prototype scope -- unique instance for each request for the class)- Parameters:
key
- the key to retrieval of this objectimplClass
- the actual type that is served back to you when requested.- Returns:
- the current MicroPlatform instance, for chaining
-
define
public PentahoSystemBoot define(String key, Object instance)
Hold an object instance by key name.- Parameters:
key
- the key to retrieval of this objectinstance
- the actual instance that is served back to you when requested.- Returns:
- the current MicroPlatform instance, for chaining
-
-