org.pentaho.platform.api.engine
Interface IApplicationContext

All Known Implementing Classes:
PortletApplicationContext, StandaloneApplicationContext, WebApplicationContext

public interface IApplicationContext

Defines a set of methods to retrieve information about the application environment.

There is one context per server application (web application), so the class can be used as a place to share global application data.

Version:
1.0

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 extension, boolean trackFile)
          Creates a temporary file in the system/tmp solutions folder
 File createTempFile(IPentahoSession session, String prefix, String extension, 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.
 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 url)
           
 void setContext(Object context)
           
 void setSolutionRootPath(String path)
           
 

Method Detail

getSolutionPath

String getSolutionPath(String path)
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.

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

getSolutionRootPath

String getSolutionRootPath()

getFileOutputPath

String getFileOutputPath(String path)
Used for content output (temporary and otherwise), returns a fully qualified path suitable for creating a File object from.

Parameters:
path - Relative path within the solution to the file location. Solution path will be pre-pended
Returns:
Fully qualified path

getPentahoServerName

String getPentahoServerName()
Retrieves the descriptive name of the platform application.

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

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

getBaseUrl

String getBaseUrl()
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.

Returns:
the URL to the server application context root.

getApplicationPath

String getApplicationPath(String path)
Returns the path to the web application or standalone application. This is only used in a few places, like loading the portlet localization messages.

Parameters:
path - a path to a location that exists relative to the application root directory
Returns:
the path to the server application root

getProperty

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.

Parameters:
key - property Name
Returns:
string property value

getProperty

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.

Parameters:
key - property Name
defaultValue - default value if the property is not specified.
Returns:
string property value

addEntryPointHandler

void addEntryPointHandler(IPentahoSystemEntryPoint entryPoint)
Adds an entry point handler. The entry point handler is called when actions start on a particular thread.

Parameters:
entryPoint -

removeEntryPointHandler

void removeEntryPointHandler(IPentahoSystemEntryPoint entryPoint)
Removes an entry point handler.

Parameters:
entryPoint -

addExitPointHandler

void addExitPointHandler(IPentahoSystemExitPoint exitPoint)
Adds an exit point handler. The exit point handler is called when actions stop on a particular thread

Parameters:
entryPoint -

removeExitPointHandler

void removeExitPointHandler(IPentahoSystemExitPoint exitPoint)
Removes an exit point handler.

Parameters:
exitPoint -

invokeEntryPoints

void invokeEntryPoints()
Invokes all entry point handlers.


invokeExitPoints

void invokeExitPoints()
Invokes all exit point handlers.


setBaseUrl

void setBaseUrl(String url)

setSolutionRootPath

void setSolutionRootPath(String path)

getContext

Object getContext()

setContext

void setContext(Object context)

createTempFile

File createTempFile(IPentahoSession session,
                    String prefix,
                    String extension,
                    File parentDir,
                    boolean trackFile)
                    throws IOException
Creates a temporary file in the specified parent folder and optionally tracks it for deletion on session termination

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

createTempFile

File createTempFile(IPentahoSession session,
                    String prefix,
                    String extension,
                    boolean trackFile)
                    throws IOException
Creates a temporary file in the system/tmp solutions folder

Parameters:
session - - IPentahoSession
prefix - - file prefix
extension - - file extension
trackFile - - true = add it to the session deleter
Returns:
Throws:
IOException