001: /*
002: * Copyright 2006 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
007: * BI Platform. The Initial Developer is Pentaho Corporation.
008: *
009: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
011: * the license for the specific language governing your rights and limitations.
012: */
013: package org.pentaho.core.runtime;
014:
015: import java.util.List;
016:
017: import org.pentaho.core.repository.IContentItem;
018: import org.pentaho.core.session.IPentahoSession;
019: import org.pentaho.core.solution.IOutputHandler;
020: import org.pentaho.core.solution.IParameterProvider;
021:
022: public interface IBackgroundExecution {
023:
024: public static final String BACKGROUND_ACTION_NAME_STR = "background_action_name"; //$NON-NLS-1$
025:
026: public static final String BACKGROUND_SUBMITTED = "background_submit_time"; //$NON-NLS-1$
027:
028: public static final String DEFAULT_USER_NAME = "SYSTEM"; //$NON-NLS-1$
029:
030: /**
031: * Queues the action specified in the request parameters for execution in the background
032: * @param userSession IPentahoSession of the session executing in background
033: * @param parameterProvider Provides the parameters containing the action to execute in the background
034: * @return String response that will be used for user feedback.
035: */
036: public String backgroundExecuteAction(IPentahoSession userSession,
037: IParameterProvider parameterProvider);
038:
039: /**
040: * Gets the list of items scheduled for background execution, and those currently executing
041: * @param userSession The usersession
042: * @return List of scheduled/executing jobs
043: */
044: public List getScheduledAndExecutingBackgroundJobs(
045: IPentahoSession userSession);
046:
047: /**
048: * Removes the content generated by background execution
049: * @param contentGUID The GUID of the content generated
050: * @param userSession The user session
051: */
052: public void removeBackgroundExecutedContentForID(
053: String contentGUID, IPentahoSession userSession);
054:
055: /**
056: * Gets the content generated by background execution
057: * @param contentGUID The GUID for the content
058: * @param userSession The user session
059: * @return IContentItem pointing to the generated content
060: */
061: public IContentItem getBackgroundContent(String contentGUID,
062: IPentahoSession userSession);
063:
064: /**
065: * Gets a list of content GUIDs of background executed jobs
066: * @param userSession User session
067: * @return List of executed content ids
068: */
069: public List getBackgroundExecutedContentList(
070: IPentahoSession userSession);
071:
072: /**
073: * When the job runs in background, gets the effective user session for the user executing the job
074: * @param user The user name
075: * @return IPentahoSession for the user as if the user was clicking to run the job in realtime.
076: */
077: public IPentahoSession getEffectiveUserSession(String user);
078:
079: /**
080: * This provides an entry point for tracking the created background execution task
081: * @param userSession
082: * @param GUID
083: */
084: public void trackBackgroundExecution(IPentahoSession userSession,
085: String GUID);
086:
087: /**
088: * Returns the output handler for content, specific to the implementation of the background execution helper.
089: * @param location Location for the content
090: * @param fileName File name for the content
091: * @param solutionName Solution name
092: * @param userSession IPentahoSession of the caller
093: * @param parameterProvider parameter provider containing request parameters
094: * @return IOutputHandler implementation for storing the content.
095: */
096: public IOutputHandler getContentOutputHandler(String location,
097: String fileName, String solutionName,
098: IPentahoSession userSession,
099: IParameterProvider parameterProvider);
100:
101: }
|