org.pentaho.platform.engine.core.output
Class SimpleOutputHandler

java.lang.Object
  extended by org.pentaho.platform.engine.core.output.SimpleOutputHandler
All Implemented Interfaces:
IOutputHandler

public class SimpleOutputHandler
extends Object
implements IOutputHandler

Author:
aaron

Field Summary
 
Fields inherited from interface org.pentaho.platform.api.engine.IOutputHandler
CONTENT, FILE, OUTPUT_TYPE_CONTENT, OUTPUT_TYPE_DEFAULT, OUTPUT_TYPE_PARAMETERS, RESPONSE
 
Constructor Summary
SimpleOutputHandler(IContentItem contentItem, boolean allowFeedback)
          Creates a SimpleContentItem copy of an IContentItem
SimpleOutputHandler(OutputStream outputStream, boolean allowFeedback)
          Creates a SimpleContentItem from an OutputStream.
 
Method Summary
 boolean allowFeedback()
          Determines whether this output handler can send feedback ContentItems or not.
 boolean contentDone()
           
 IContentItem getFeedbackContentItem()
          Retrieve the ContentItem that describes the request interface for additional or missing information (missing from the original request)
 String getMimeType()
           
 IMimeTypeListener getMimeTypeListener()
           
 IContentItem getOutputContentItem(String outputName, String contentName, String solution, String instanceId, String localMimeType)
          Retrieve the ContentItem that describes the output from this request's component execution.
 IContentItem getOutputContentItem(String objectName, String contentName, String title, String url, String solution, String instanceId, String localMimeType)
          Retrieve the ContentItem that describes the output from this request's component execution.
 IOutputDef getOutputDef(String name)
          Retrieve a single output parameter definition by name
 Map getOutputDefs()
          Returns a map of the valid output parameter definitions for this request.
 int getOutputPreference()
          Gets the output type prefered by the handler.
 Map getResponseAttributes()
           
 IPentahoSession getSession()
           
 boolean isResponseExpected()
          Indicates whether or not the handler is expected to have data written to a response output stream managed by the handler.
 void setContentItem(IContentItem content, String objectName, String contentName)
          Sets the output ContentItem for this handler.
 void setMimeType(String mimeType)
           
 void setMimeTypeListener(IMimeTypeListener mimeTypeListener)
           
 void setOutput(String name, Object value)
          Sets an output of the handler.
 void setOutputPreference(int outputType)
          Sets the output type that is wanted by the handler.
 void setOutputStream(OutputStream outputStream, String outputName, String contentName)
           
 void setRuntimeContext(IRuntimeContext runtimeContext)
           
 void setSession(IPentahoSession session)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleOutputHandler

public SimpleOutputHandler(IContentItem contentItem,
                           boolean allowFeedback)
Creates a SimpleContentItem copy of an IContentItem

Parameters:
contentItem - provides the underlying outputStream this outputhandler manages. Feedback will also be written to this contentItem's output stream if allowFeedback is true
allowFeedback -

SimpleOutputHandler

public SimpleOutputHandler(OutputStream outputStream,
                           boolean allowFeedback)
Creates a SimpleContentItem from an OutputStream.

Parameters:
outputStream - the underlying outputStream this outputhandler manages. Feedback will be written to this output stream if allowFeedback is true
allowFeedback -
Method Detail

setSession

public void setSession(IPentahoSession session)
Specified by:
setSession in interface IOutputHandler

getSession

public IPentahoSession getSession()
Specified by:
getSession in interface IOutputHandler

setOutputStream

public void setOutputStream(OutputStream outputStream,
                            String outputName,
                            String contentName)

setOutputPreference

public void setOutputPreference(int outputType)
Description copied from interface: IOutputHandler
Sets the output type that is wanted by the handler. Valid values are OUTPUT_TYPE_PARAMETERS, OUTPUT_TYPE_CONTENT, OUTPUT_TYPE_DEFAULT

Specified by:
setOutputPreference in interface IOutputHandler
Parameters:
outputType - Output type requested

contentDone

public boolean contentDone()
Specified by:
contentDone in interface IOutputHandler

getOutputPreference

public int getOutputPreference()
Description copied from interface: IOutputHandler
Gets the output type prefered by the handler. Values are defined in org.pentaho.platform.api.engine.IOutputHandler and are OUTPUT_TYPE_PARAMETERS, OUTPUT_TYPE_CONTENT, or OUTPUT_TYPE_DEFAULT

Specified by:
getOutputPreference in interface IOutputHandler
Returns:
Output type

setMimeType

public void setMimeType(String mimeType)

getMimeType

public String getMimeType()

allowFeedback

public boolean allowFeedback()
Description copied from interface: IOutputHandler
Determines whether this output handler can send feedback ContentItems or not.

Generally, if there is no client on the other side of the request that could receive and process feedback, then this boolean should be setto false.

Specified by:
allowFeedback in interface IOutputHandler
Returns:
true if feedback is allowed, false otherwise

getOutputDefs

public Map getOutputDefs()
Description copied from interface: IOutputHandler
Returns a map of the valid output parameter definitions for this request.

Specified by:
getOutputDefs in interface IOutputHandler
Returns:
Map of parameters in name-value or name-list form

getOutputDef

public IOutputDef getOutputDef(String name)
Description copied from interface: IOutputHandler
Retrieve a single output parameter definition by name

Specified by:
getOutputDef in interface IOutputHandler
Parameters:
name - name of the output parameter definition requested
Returns:
IOutputDef, output definition object

getFeedbackContentItem

public IContentItem getFeedbackContentItem()
Description copied from interface: IOutputHandler
Retrieve the ContentItem that describes the request interface for additional or missing information (missing from the original request)

Specified by:
getFeedbackContentItem in interface IOutputHandler
Returns:
ContentItem describing user feedback

getOutputContentItem

public IContentItem getOutputContentItem(String outputName,
                                         String contentName,
                                         String solution,
                                         String instanceId,
                                         String localMimeType)
Description copied from interface: IOutputHandler
Retrieve the ContentItem that describes the output from this request's component execution.

Specified by:
getOutputContentItem in interface IOutputHandler
Parameters:
outputName - Name of the object
contentName - Name of the content
Returns:
ContentItem describing end result output

getOutputContentItem

public IContentItem getOutputContentItem(String objectName,
                                         String contentName,
                                         String title,
                                         String url,
                                         String solution,
                                         String instanceId,
                                         String localMimeType)
Description copied from interface: IOutputHandler
Retrieve the ContentItem that describes the output from this request's component execution.

Specified by:
getOutputContentItem in interface IOutputHandler
Parameters:
objectName - Name of the object
contentName - Name of the content
title - Title of the object
url - URL to view the object
Returns:
ContentItem describing end result output

setContentItem

public void setContentItem(IContentItem content,
                           String objectName,
                           String contentName)
Description copied from interface: IOutputHandler
Sets the output ContentItem for this handler. objectName will be the name of the destination node from the action sequence output contentName will be the value of the destination node from the action sequence output e.g. if the outputs section in the ation sequence looks like this: content objectName should be 'response' contentName should be 'content'

Specified by:
setContentItem in interface IOutputHandler
Parameters:
content - ContentItem to set
objectName - Name of the object
contentName - Name of the content

setOutput

public void setOutput(String name,
                      Object value)
Description copied from interface: IOutputHandler
Sets an output of the handler. For example the HTTP handler will accept output names of 'header' allowing an HTTP header to be set, and 'redirect' allowing the responses sendRedirect to be called.

Specified by:
setOutput in interface IOutputHandler
Parameters:
name - Name of the output
value - Value of the output

getResponseAttributes

public Map getResponseAttributes()

getMimeTypeListener

public IMimeTypeListener getMimeTypeListener()
Specified by:
getMimeTypeListener in interface IOutputHandler

setMimeTypeListener

public void setMimeTypeListener(IMimeTypeListener mimeTypeListener)
Specified by:
setMimeTypeListener in interface IOutputHandler

setRuntimeContext

public void setRuntimeContext(IRuntimeContext runtimeContext)
Specified by:
setRuntimeContext in interface IOutputHandler

isResponseExpected

public boolean isResponseExpected()
Description copied from interface: IOutputHandler
Indicates whether or not the handler is expected to have data written to a response output stream managed by the handler. Typically, a handler will want to return true here if its getOutputContentItem or setOutput methods have been invoked and their invocations can result in a write to the response output stream that is managed by the handler. In general, handlers are responsible for setting this flag any time a client response is possible.

Specified by:
isResponseExpected in interface IOutputHandler
Returns:
true if the handler gave something the opportunity to write data to the its response output stream