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: * @created Jun 17, 2005
014: * @author James Dixon
015: *
016: */
017:
018: package org.pentaho.core.solution;
019:
020: import java.util.*;
021:
022: import org.pentaho.core.repository.IContentItem;
023: import org.pentaho.core.runtime.IRuntimeContext;
024: import org.pentaho.core.session.IPentahoSession;
025:
026: /**
027: * An OutputHandler manages the content generated from a Component execution.
028: * Output can take the form of the generated results from a component, or
029: * content that solicits additional information from the requester. The handler
030: * also manages the relationship with the ActionDefinition and output content
031: * validation.
032: */
033: public interface IOutputHandler {
034: // TODO sbarkdull, convert these 3 OUTPUT_* to enumerated type
035: public static final int OUTPUT_TYPE_PARAMETERS = 1;
036:
037: public static final int OUTPUT_TYPE_CONTENT = 2;
038:
039: public static final int OUTPUT_TYPE_DEFAULT = 3;
040:
041: public static final String RESPONSE = "response"; //$NON-NLS-1$
042:
043: public static final String CONTENT = "content"; //$NON-NLS-1$
044:
045: public static final String FILE = "file"; //$NON-NLS-1$
046:
047: /**
048: * Returns a map of the valid output parameter definitions for this request.
049: *
050: * @return Map of parameters in name-value or name-list form
051: */
052: public Map getOutputDefs();
053:
054: public void setSession(IPentahoSession session);
055:
056: public IPentahoSession getSession();
057:
058: public boolean contentDone();
059:
060: /**
061: * Retrieve a single output parameter definition by name
062: *
063: * @param name
064: * name of the output parameter definition requested
065: * @return IOutputDef, output definition object
066: */
067: public IOutputDef getOutputDef(String name);
068:
069: /**
070: * Retrieve the ContentItem that describes the request interface for
071: * additional or missing information (missing from the original request)
072: *
073: * @return ContentItem describing user feedback
074: */
075: public IContentItem getFeedbackContentItem();
076:
077: /**
078: * Retrieve the ContentItem that describes the output from this request's
079: * component execution.
080: *
081: * @return ContentItem describing end result output
082: */
083: // public IContentItem getOutputContentItem();
084: /**
085: * Retrieve the ContentItem that describes the output from this request's
086: * component execution.
087: *
088: * @param objectName
089: * Name of the object
090: * @param contentName
091: * Name of the content
092: * @return ContentItem describing end result output
093: */
094: public IContentItem getOutputContentItem(String objectName,
095: String contentName, String solution, String instanceId,
096: String mimeType);
097:
098: /**
099: * Retrieve the ContentItem that describes the output from this request's
100: * component execution.
101: *
102: * @param objectName
103: * Name of the object
104: * @param contentName
105: * Name of the content
106: * @param title
107: * Title of the object
108: * @param url
109: * URL to view the object
110: * @return ContentItem describing end result output
111: */
112:
113: public IContentItem getOutputContentItem(String objectName,
114: String contentName, String title, String url,
115: String solution, String instanceId, String mimeType);
116:
117: /**
118: * Determines whether this output handler can send feedback ContentItems or
119: * not.
120: * <p>
121: * Generally, if there is no client on the other side of the request that
122: * could receive and process feedback, then this boolean should be setto
123: * false.
124: *
125: * @return true if feedback is allowed, false otherwise
126: */
127: public boolean allowFeedback();
128:
129: /**
130: * Sets the output ContentItem for this handler.
131: *
132: * objectName will be the name of the destination node from the action
133: * sequence output contentName will be the value of the destination node
134: * from the action sequence output e.g. if the outputs section in the ation
135: * sequence looks like this: <outputs> <report type="string"> <destinations>
136: * <response>content</response> </destinations> </report> </outputs>
137: * objectName should be 'response' contentName should be 'content'
138: *
139: * @param content
140: * ContentItem to set
141: * @param objectName
142: * Name of the object
143: * @param contentName
144: * Name of the content
145: */
146: public void setContentItem(IContentItem content, String objectName,
147: String contentName);
148:
149: /**
150: * Sets the output type that is wanted by the handler. Valid values are
151: * OUTPUT_TYPE_PARAMETERS, OUTPUT_TYPE_CONTENT, OUTPUT_TYPE_DEFAULT
152: *
153: * @param outputType
154: * Output type requested
155: */
156: public void setOutputPreference(int outputType);
157:
158: /**
159: * Gets the output type prefered by the handler. Values are defined in
160: * org.pentaho.core.solution.IOutputHander and are OUTPUT_TYPE_PARAMETERS,
161: * OUTPUT_TYPE_CONTENT, or OUTPUT_TYPE_DEFAULT
162: *
163: * @return Output type
164: */
165: public int getOutputPreference();
166:
167: /**
168: * Sets an output of the handler. For example the HTTP handler will accept
169: * output names of 'header' allowing an HTTP header to be set, and
170: * 'redirect' allowing the responses sendRedirect to be called.
171: *
172: * @param name
173: * Name of the output
174: * @param value
175: * Value of the output
176: */
177: public void setOutput(String name, Object value);
178:
179: public MimeTypeListener getMimeTypeListener();
180:
181: public void setMimeTypeListener(MimeTypeListener mimeTypeListener);
182:
183: public void setRuntimeContext(IRuntimeContext runtimeContext);
184:
185: }
|