org.pentaho.platform.engine.core.system
Class StandaloneApplicationContext

java.lang.Object
  extended by org.pentaho.platform.engine.core.system.StandaloneApplicationContext
All Implemented Interfaces:
IApplicationContext
Direct Known Subclasses:
PortletApplicationContext, WebApplicationContext

public class StandaloneApplicationContext
extends Object
implements IApplicationContext


Constructor Summary
StandaloneApplicationContext(String solutionRootPath, String applicationPath)
           
StandaloneApplicationContext(String solutionRootPath, String applicationPath, Object context)
           
 
Method Summary
 void addEntryPointHandler(IPentahoSystemEntryPoint entryPoint)
          Adds an entry point handler.
 void addExitPointHandler(IPentahoSystemExitPoint exitPoint)
          Adds an exit point handler.
 File createTempFile(IPentahoSession session, String prefix, String extn, boolean trackFile)
          Creates a temporary file in the system/tmp solutions folder
 File createTempFile(IPentahoSession session, String prefix, String extn, File parentDir, boolean trackFile)
          Creates a temporary file in the specified parent folder and optionally tracks it for deletion on session termination
 String getApplicationPath(String path)
          Returns the path to the web application or standalone application.
 String getBaseUrl()
          Returns a URL to the server application, up to and including the context.
 Object getContext()
           
 String getFileOutputPath(String path)
          Used for content output (temporary and otherwise), returns a fully qualified path suitable for creating a File object from.
 String getPentahoServerName()
          Retrieves the descriptive name of the platform application.
 String getProperty(String key)
          If there were any other properties set (for example, initParams in the servlet context), this will let you have access to all of those properties that are set.
 String getProperty(String key, String defaultValue)
          If there were any other properties set (for example, initParams in the servlet context), this will let you have access to all of those properties that are set.
 int getServerPort()
           
 String getSolutionPath(String path)
          Retrieves the fully qualified path to the location of the Pentaho solution, appending the path given in the parameter.
 String getSolutionRootPath()
           
 void invokeEntryPoints()
          Invokes all entry point handlers.
 void invokeExitPoints()
          Invokes all exit point handlers.
 void removeEntryPointHandler(IPentahoSystemEntryPoint entryPoint)
          Removes an entry point handler.
 void removeExitPointHandler(IPentahoSystemExitPoint exitPoint)
          Removes an exit point handler.
 void setBaseUrl(String baseUrl)
           
 void setContext(Object context)
           
 void setProperties(Properties props)
           
 void setSolutionRootPath(String solutionRootPath)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandaloneApplicationContext

public StandaloneApplicationContext(String solutionRootPath,
                                    String applicationPath,
                                    Object context)

StandaloneApplicationContext

public StandaloneApplicationContext(String solutionRootPath,
                                    String applicationPath)
Method Detail

setBaseUrl

public void setBaseUrl(String baseUrl)
Specified by:
setBaseUrl in interface IApplicationContext

getFileOutputPath

public String getFileOutputPath(String path)
Description copied from interface: IApplicationContext
Used for content output (temporary and otherwise), returns a fully qualified path suitable for creating a File object from.

Specified by:
getFileOutputPath in interface IApplicationContext
Parameters:
path - Relative path within the solution to the file location. Solution path will be pre-pended
Returns:
Fully qualified path

getSolutionPath

public String getSolutionPath(String path)
Description copied from interface: IApplicationContext
Retrieves the fully qualified path to the location of the Pentaho solution, appending the path given in the parameter. The path is formatted appropriately for the platform that the application is running on.

Specified by:
getSolutionPath in interface IApplicationContext
Parameters:
path - a path to a location that exists relative to the solution tree
Returns:
fully qualified path to the requested location in the solution tree

setSolutionRootPath

public void setSolutionRootPath(String solutionRootPath)
Specified by:
setSolutionRootPath in interface IApplicationContext

createTempFile

public File createTempFile(IPentahoSession session,
                           String prefix,
                           String extn,
                           boolean trackFile)
                    throws IOException
Description copied from interface: IApplicationContext
Creates a temporary file in the system/tmp solutions folder

Specified by:
createTempFile in interface IApplicationContext
Parameters:
session - - IPentahoSession
prefix - - file prefix
extn - - file extension
trackFile - - true = add it to the session deleter
Returns:
Throws:
IOException

createTempFile

public File createTempFile(IPentahoSession session,
                           String prefix,
                           String extn,
                           File parentDir,
                           boolean trackFile)
                    throws IOException
Description copied from interface: IApplicationContext
Creates a temporary file in the specified parent folder and optionally tracks it for deletion on session termination

Specified by:
createTempFile in interface IApplicationContext
Parameters:
session - - IPentahoSession
prefix - - file prefix
extn - - file extension
parentDir - - parent folder to create the temp file in
trackFile - - true = add it to the session deleter
Returns:
Throws:
IOException

getPentahoServerName

public String getPentahoServerName()
Description copied from interface: IApplicationContext
Retrieves the descriptive name of the platform application.

The Pentaho server name should specified in the system settings configuration file, using the name element

Specified by:
getPentahoServerName in interface IApplicationContext
Returns:
the descriptive server name as specified in the system settings, or "Pentaho Business Intelligence Platform" by default.

getServerPort

public int getServerPort()

getBaseUrl

public String getBaseUrl()
Description copied from interface: IApplicationContext
Returns a URL to the server application, up to and including the context.

The URL that is returned is derived from the server context, and thus will include the protocol, host name, port, and application context root.

Specified by:
getBaseUrl in interface IApplicationContext
Returns:
the URL to the server application context root.

getApplicationPath

public String getApplicationPath(String path)
Description copied from interface: IApplicationContext
Returns the path to the web application or standalone application. This is only used in a few places, like loading the portlet localization messages.

Specified by:
getApplicationPath in interface IApplicationContext
Parameters:
path - a path to a location that exists relative to the application root directory
Returns:
the path to the server application root

getProperty

public String getProperty(String key)
Description copied from interface: IApplicationContext
If there were any other properties set (for example, initParams in the servlet context), this will let you have access to all of those properties that are set.

Specified by:
getProperty in interface IApplicationContext
Parameters:
key - property Name
Returns:
string property value

getProperty

public String getProperty(String key,
                          String defaultValue)
Description copied from interface: IApplicationContext
If there were any other properties set (for example, initParams in the servlet context), this will let you have access to all of those properties that are set.

Specified by:
getProperty in interface IApplicationContext
Parameters:
key - property Name
defaultValue - default value if the property is not specified.
Returns:
string property value

setProperties

public void setProperties(Properties props)

addEntryPointHandler

public void addEntryPointHandler(IPentahoSystemEntryPoint entryPoint)
Description copied from interface: IApplicationContext
Adds an entry point handler. The entry point handler is called when actions start on a particular thread.

Specified by:
addEntryPointHandler in interface IApplicationContext

removeEntryPointHandler

public void removeEntryPointHandler(IPentahoSystemEntryPoint entryPoint)
Description copied from interface: IApplicationContext
Removes an entry point handler.

Specified by:
removeEntryPointHandler in interface IApplicationContext

addExitPointHandler

public void addExitPointHandler(IPentahoSystemExitPoint exitPoint)
Description copied from interface: IApplicationContext
Adds an exit point handler. The exit point handler is called when actions stop on a particular thread

Specified by:
addExitPointHandler in interface IApplicationContext

removeExitPointHandler

public void removeExitPointHandler(IPentahoSystemExitPoint exitPoint)
Description copied from interface: IApplicationContext
Removes an exit point handler.

Specified by:
removeExitPointHandler in interface IApplicationContext

invokeEntryPoints

public void invokeEntryPoints()
Description copied from interface: IApplicationContext
Invokes all entry point handlers.

Specified by:
invokeEntryPoints in interface IApplicationContext

invokeExitPoints

public void invokeExitPoints()
Description copied from interface: IApplicationContext
Invokes all exit point handlers.

Specified by:
invokeExitPoints in interface IApplicationContext

getContext

public Object getContext()
Specified by:
getContext in interface IApplicationContext

setContext

public void setContext(Object context)
Specified by:
setContext in interface IApplicationContext

getSolutionRootPath

public String getSolutionRootPath()
Specified by:
getSolutionRootPath in interface IApplicationContext