org.pentaho.platform.scheduler
Class QuartzBackgroundExecutionHelper

java.lang.Object
  extended by org.pentaho.platform.scheduler.QuartzBackgroundExecutionHelper
All Implemented Interfaces:
IBackgroundExecution
Direct Known Subclasses:
SecurityAwareBackgroundExecutionHelper

public class QuartzBackgroundExecutionHelper
extends Object
implements IBackgroundExecution


Nested Class Summary
static class QuartzBackgroundExecutionHelper.BackgroundExecuteListener
           
 
Field Summary
static String BACKGROUND_CONTENT_COOKIE_PREFIX
           
static String BACKGROUND_CONTENT_GUID_STR
           
static String BACKGROUND_CONTENT_LOCATION_STR
           
static String BACKGROUND_EXECUTION_FLAG
           
static String BACKGROUND_USER_NAME_STR
           
static String DEFAULT_BACKGROUND_LOCATION
           
static String DEFAULT_JOB_NAME
           
static String DEFAULT_TRIGGER_NAME
           
 
Fields inherited from interface org.pentaho.platform.api.engine.IBackgroundExecution
BACKGROUND_ACTION_NAME_STR, BACKGROUND_SUBMITTED, DEFAULT_USER_NAME
 
Constructor Summary
QuartzBackgroundExecutionHelper()
           
 
Method Summary
 String backgroundExecuteAction(IPentahoSession userSession, IParameterProvider parameterProvider)
          NOTE: client code is responsible for making sure a job with the name identified by the parameter StandardSettings.SCHEDULE_NAME in the parameter provider does not already exist in the quartz scheduler.
 IContentItem getBackgroundContent(String contentGUID, IPentahoSession userSession)
          Gets the content generated by background execution
 List getBackgroundExecutedContentList(IPentahoSession userSession)
          Gets a list of content GUIDs of background executed jobs
 IOutputHandler getContentOutputHandler(String location, String fileName, String solutionName, IPentahoSession userSession, IParameterProvider parameterProvider)
          Returns the output handler for content, specific to the implementation of the background execution helper.
 IPentahoSession getEffectiveUserSession(String user)
          When the job runs in background, gets the effective user session for the user executing the job
 List<IJobDetail> getScheduledAndExecutingBackgroundJobs(IPentahoSession userSession)
          Gets the list of items scheduled for background execution, and those currently executing
 void removeBackgroundExecutedContentForID(String contentGUID, IPentahoSession userSession)
          Removes the content generated by background execution
 void trackBackgroundExecution(IPentahoSession userSession, String GUID)
          This provides an entry point for tracking the created background execution task
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JOB_NAME

public static final String DEFAULT_JOB_NAME
See Also:
Constant Field Values

DEFAULT_TRIGGER_NAME

public static final String DEFAULT_TRIGGER_NAME
See Also:
Constant Field Values

DEFAULT_BACKGROUND_LOCATION

public static final String DEFAULT_BACKGROUND_LOCATION
See Also:
Constant Field Values

BACKGROUND_USER_NAME_STR

public static final String BACKGROUND_USER_NAME_STR
See Also:
Constant Field Values

BACKGROUND_CONTENT_GUID_STR

public static final String BACKGROUND_CONTENT_GUID_STR
See Also:
Constant Field Values

BACKGROUND_CONTENT_LOCATION_STR

public static final String BACKGROUND_CONTENT_LOCATION_STR
See Also:
Constant Field Values

BACKGROUND_CONTENT_COOKIE_PREFIX

public static final String BACKGROUND_CONTENT_COOKIE_PREFIX
See Also:
Constant Field Values

BACKGROUND_EXECUTION_FLAG

public static final String BACKGROUND_EXECUTION_FLAG
See Also:
Constant Field Values
Constructor Detail

QuartzBackgroundExecutionHelper

public QuartzBackgroundExecutionHelper()
Method Detail

backgroundExecuteAction

public String backgroundExecuteAction(IPentahoSession userSession,
                                      IParameterProvider parameterProvider)
                               throws BackgroundExecutionException
NOTE: client code is responsible for making sure a job with the name identified by the parameter StandardSettings.SCHEDULE_NAME in the parameter provider does not already exist in the quartz scheduler. If such a job does already exist,

Specified by:
backgroundExecuteAction in interface IBackgroundExecution
Parameters:
parameterProvider - IParameterProvider expected to have the following parameters: required: solution path action optional (cron-string is required to create a CronTrigger): cron-string repeat-count repeat-time-milliseconds start-date end-date
userSession - IPentahoSession of the session executing in background
Returns:
String response that will be used for user feedback.
Throws:
BackgroundExecutionException

trackBackgroundExecution

public void trackBackgroundExecution(IPentahoSession userSession,
                                     String GUID)
Description copied from interface: IBackgroundExecution
This provides an entry point for tracking the created background execution task

Specified by:
trackBackgroundExecution in interface IBackgroundExecution

getBackgroundContent

public IContentItem getBackgroundContent(String contentGUID,
                                         IPentahoSession userSession)
Description copied from interface: IBackgroundExecution
Gets the content generated by background execution

Specified by:
getBackgroundContent in interface IBackgroundExecution
Parameters:
contentGUID - The GUID for the content
userSession - The user session
Returns:
IContentItem pointing to the generated content

getScheduledAndExecutingBackgroundJobs

public List<IJobDetail> getScheduledAndExecutingBackgroundJobs(IPentahoSession userSession)
                                                        throws BackgroundExecutionException
Description copied from interface: IBackgroundExecution
Gets the list of items scheduled for background execution, and those currently executing

Specified by:
getScheduledAndExecutingBackgroundJobs in interface IBackgroundExecution
Parameters:
userSession - The usersession
Returns:
List of scheduled/executing jobs
Throws:
BackgroundExecutionException

removeBackgroundExecutedContentForID

public void removeBackgroundExecutedContentForID(String contentGUID,
                                                 IPentahoSession userSession)
Description copied from interface: IBackgroundExecution
Removes the content generated by background execution

Specified by:
removeBackgroundExecutedContentForID in interface IBackgroundExecution
Parameters:
contentGUID - The GUID of the content generated
userSession - The user session

getBackgroundExecutedContentList

public List getBackgroundExecutedContentList(IPentahoSession userSession)
Description copied from interface: IBackgroundExecution
Gets a list of content GUIDs of background executed jobs

Specified by:
getBackgroundExecutedContentList in interface IBackgroundExecution
Parameters:
userSession - User session
Returns:
List of executed content ids

getEffectiveUserSession

public IPentahoSession getEffectiveUserSession(String user)
Description copied from interface: IBackgroundExecution
When the job runs in background, gets the effective user session for the user executing the job

Specified by:
getEffectiveUserSession in interface IBackgroundExecution
Parameters:
user - The user name
Returns:
IPentahoSession for the user as if the user was clicking to run the job in realtime.

getContentOutputHandler

public IOutputHandler getContentOutputHandler(String location,
                                              String fileName,
                                              String solutionName,
                                              IPentahoSession userSession,
                                              IParameterProvider parameterProvider)
Description copied from interface: IBackgroundExecution
Returns the output handler for content, specific to the implementation of the background execution helper.

Specified by:
getContentOutputHandler in interface IBackgroundExecution
Parameters:
location - Location for the content
fileName - File name for the content
solutionName - Solution name
userSession - IPentahoSession of the caller
parameterProvider - parameter provider containing request parameters
Returns:
IOutputHandler implementation for storing the content.