org.pentaho.platform.engine.core.system.boot
Class PentahoSystemBoot

java.lang.Object
  extended by org.pentaho.platform.engine.core.system.boot.PentahoSystemBoot
Direct Known Subclasses:
MicroPlatform, PentahoBoot

public class PentahoSystemBoot
extends Object

This class is designed to help embedded deployments start the Pentaho 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

  1. Construct a PentahoSystemBoot
  2. define the system objects that your system requires, by using one of the define(Class, Class) variants
  3. (optionally) initialize the Pentaho system for processing requests by calling start()
An extremely minimal platform might be configured like this:
 @Before
 public void init() {
   PentahoSystemBoot booter = new PentahoSystemBoot();
   //setup your required object definitions
   booter.define(ISolutionRepository.class, FileBasedSolutionRepository.class);
   
   //initialize the minimal platform
   booter.init();
 }
 

Author:
jamesdixon and aphillips

Constructor Summary
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, IPentahoDefinableObjectFactory factory)
           
PentahoSystemBoot(String solutionPath, String baseUrl)
           
PentahoSystemBoot(String solutionPath, String baseUrl, IPentahoDefinableObjectFactory factory)
           
 
Method Summary
 void addAdminAction(IPentahoPublisher adminAction)
          Adds an administrative action to the system.
 void addLifecycleListener(IPentahoSystemListener lifecycleListener)
          Adds a lifecycle listener.
 void addStartupAction(ISessionStartupAction startupAction)
          Adds a strtup action to 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, IPentahoDefinableObjectFactory.Scope scope)
          Define an arbitrarily scoped object
 PentahoSystemBoot 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, IPentahoDefinableObjectFactory.Scope scope)
          Define an arbitrarily scoped object
 PentahoSystemBoot define(String key, String implClassName, IPentahoDefinableObjectFactory.Scope scope)
          Define an arbitrarily scoped object
 IPentahoObjectFactory getFactory()
          Gets the object factory for the Pentaho platform
 String getFilePath()
          Sets the file path that will be used to get to file-based resources
 List<IPentahoSystemListener> getLifecycleListeners()
          Returns the list of lifecycle listeners that will be used.
 ISystemSettings getSettingsProvider()
          Gets the system settings object that will be used by the Pentaho platform
 List<ISessionStartupAction> getStartupActions()
          Returns the list of startup actions.
 void init()
          Deprecated. use start(). This method is hanging around for backward compatibility with MicroPlatform
 boolean isInitialized()
          Returns true if the Pentaho platform has initialized successfully.
 void setAdminActions(List<IPentahoPublisher> adminActions)
           
 void setBaseUrl(String baseUrl)
          Sets the URL that the platform uses to generate paths to its own resources
 void setFactory(IPentahoObjectFactory factory)
          Sets the object factory for the Pentaho platform, This defaults to the StandaloneObjectFactory
 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.
 void setLifecycleListeners(List<IPentahoSystemListener> lifecycleListeners)
          Returns the list of lifecycle listeners that will be used.
 void setSettingsProvider(ISystemSettings settingsProvider)
          Sets the system settings object that will be used by the Pentaho platform
 void setStartupActions(List<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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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,
                         String baseUrl)

PentahoSystemBoot

public PentahoSystemBoot(String solutionPath,
                         IPentahoDefinableObjectFactory factory)

PentahoSystemBoot

public PentahoSystemBoot(String solutionPath,
                         String baseUrl,
                         IPentahoDefinableObjectFactory factory)
Method Detail

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 -

setBaseUrl

public void setBaseUrl(String baseUrl)
Sets the URL that the platform uses to generate paths to its own resources

Parameters:
baseUrl -

init

public void init()
Deprecated. use start(). 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 IPentahoObjectFactory getFactory()
Gets the object factory for the Pentaho platform

Returns:

setFactory

public void setFactory(IPentahoObjectFactory factory)
Sets the object factory for the Pentaho platform, This defaults to the StandaloneObjectFactory


addAdminAction

public void addAdminAction(IPentahoPublisher adminAction)
Adds an administrative action to the system.

Parameters:
adminAction -

setAdminActions

public void setAdminActions(List<IPentahoPublisher> adminActions)

addLifecycleListener

public void addLifecycleListener(IPentahoSystemListener lifecycleListener)
Adds a lifecycle listener. This object will be notified when the Pentaho platform starts and stops.

Parameters:
lifecycleListener -

getLifecycleListeners

public List<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<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 ISystemSettings getSettingsProvider()
Gets the system settings object that will be used by the Pentaho platform

Returns:

setSettingsProvider

public void setSettingsProvider(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<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<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(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,
                                IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped object

Parameters:
key - the key to retrieval of this object
implClassName - 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,
                                IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped object

Parameters:
interfaceClass - the key to retrieval of this object
implClass - 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,
                                IPentahoDefinableObjectFactory.Scope scope)
Define an arbitrarily scoped object

Parameters:
key - the key to retrieval of this object
implClass - 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 object
implClass - 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 object
implClass - the actual type that is served back to you when requested.
Returns:
the current MicroPlatform instance, for chaining