KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > core > solution > IOutputHandler


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * @created Jun 17, 2005
14  * @author James Dixon
15  *
16  */

17
18 package org.pentaho.core.solution;
19
20 import java.util.*;
21
22 import org.pentaho.core.repository.IContentItem;
23
24 /**
25  * An OutputHandler manages the content generated from a Component execution.
26  * Output can take the form of the generated results from a component, or
27  * content that solicits additional information from the requester. The handler
28  * also manages the relationship with the ActionDefinition and output content
29  * validation.
30  */

31 public interface IOutputHandler {
32
33     public static final int OUTPUT_TYPE_PARAMETERS = 1;
34
35     public static final int OUTPUT_TYPE_CONTENT = 2;
36
37     public static final int OUTPUT_TYPE_DEFAULT = 3;
38
39     public static final String JavaDoc RESPONSE = "response"; //$NON-NLS-1$
40

41     public static final String JavaDoc CONTENT = "content"; //$NON-NLS-1$
42

43     public static final String JavaDoc FILE = "file"; //$NON-NLS-1$
44

45     /**
46      * Returns a map of the valid output parameter definitions for this request.
47      *
48      * @return Map of parameters in name-value or name-list form
49      */

50     public Map getOutputDefs();
51
52     public boolean contentDone();
53
54     /**
55      * Retrieve a single output parameter definition by name
56      *
57      * @param name
58      * name of the output parameter definition requested
59      * @return IOutputDef, output definition object
60      */

61     public IOutputDef getOutputDef(String JavaDoc name);
62
63     /**
64      * Retrieve the ContentItem that describes the request interface for
65      * additional or missing information (missing from the original request)
66      *
67      * @return ContentItem describing user feedback
68      */

69     public IContentItem getFeedbackContentItem();
70
71     /**
72      * Retrieve the ContentItem that describes the output from this request's
73      * component execution.
74      *
75      * @return ContentItem describing end result output
76      */

77     // public IContentItem getOutputContentItem();
78
/**
79      * Retrieve the ContentItem that describes the output from this request's
80      * component execution.
81      *
82      * @param objectName
83      * Name of the object
84      * @param contentName
85      * Name of the content
86      * @return ContentItem describing end result output
87      */

88     public IContentItem getOutputContentItem(String JavaDoc objectName, String JavaDoc contentName);
89
90     /**
91      * Retrieve the ContentItem that describes the output from this request's
92      * component execution.
93      *
94      * @param objectName
95      * Name of the object
96      * @param contentName
97      * Name of the content
98      * @param title
99      * Title of the object
100      * @param url
101      * URL to view the object
102      * @return ContentItem describing end result output
103      */

104     public IContentItem getOutputContentItem(String JavaDoc objectName, String JavaDoc contentName, String JavaDoc title, String JavaDoc url);
105     
106     /**
107      * Determines whether this output handler can send feedback ContentItems or
108      * not.
109      * <p>
110      * Generally, if there is no client on the other side of the request that
111      * could receive and process feedback, then this boolean should be setto
112      * false.
113      *
114      * @return true if feedback is allowed, false otherwise
115      */

116     public boolean allowFeedback();
117
118     /**
119      * Sets the output ContentItem for this handler.
120      *
121      * objectName will be the name of the destination node from the action
122      * sequence output contentName will be the value of the destination node
123      * from the action sequence output e.g. if the outputs section in the ation
124      * sequence looks like this: <outputs> <report type="string"> <destinations>
125      * <response>content</response> </destinations> </report> </outputs>
126      * objectName should be 'response' contentName should be 'content'
127      *
128      * @param content
129      * ContentItem to set
130      * @param objectName
131      * Name of the object
132      * @param contentName
133      * Name of the content
134      */

135     public void setContentItem(IContentItem content, String JavaDoc objectName, String JavaDoc contentName);
136
137     /**
138      * Sets the output type that is wanted by the handler. Valid values are
139      * OUTPUT_TYPE_PARAMETERS, OUTPUT_TYPE_CONTENT, OUTPUT_TYPE_DEFAULT
140      *
141      * @param outputType
142      * Output type requested
143      */

144     public void setOutputPreference(int outputType);
145
146     /**
147      * Gets the output type prefered by the handler. Values are defined in
148      * org.pentaho.core.solution.IOutputHander and are OUTPUT_TYPE_PARAMETERS,
149      * OUTPUT_TYPE_CONTENT, or OUTPUT_TYPE_DEFAULT
150      *
151      * @return Output type
152      */

153     public int getOutputPreference();
154
155     /**
156      * Sets an output of the handler. For example the HTTP handler will accept
157      * output names of 'header' allowing an HTTP header to be set, and
158      * 'redirect' allowing the responses sendRedirect to be called.
159      *
160      * @param name
161      * Name of the output
162      * @param value
163      * Value of the output
164      */

165     public void setOutput(String JavaDoc name, Object JavaDoc value);
166
167 }
168
Popular Tags