1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.layout;
18
19 import java.io.IOException;
20 import java.util.List;
21
22 import javax.portlet.PortletMode;
23 import javax.portlet.WindowState;
24 import javax.security.auth.Subject;
25
26 import org.apache.jetspeed.locator.TemplateDescriptor;
27 import org.apache.jetspeed.locator.TemplateLocatorException;
28 import org.apache.jetspeed.om.page.ContentFragment;
29 import org.apache.jetspeed.om.page.Page;
30 import org.apache.pluto.om.entity.PortletEntity;
31
32 /***
33 * JetspeedPowerTool
34 *
35 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
36 * @version $Id: JetspeedPowerTool.java 516448 2007-03-09 16:25:47Z ate $
37 */
38
39 public interface JetspeedPowerTool
40 {
41
42 public static final String GENERIC_TEMPLATE_TYPE = "generic";
43
44 public static final String FRAGMENT_PROCESSING_ERROR_PREFIX = "fragment.processing.error.";
45
46 public static final String FRAGMENT_ATTR = "fragment";
47
48 public static final String LAYOUT_ATTR = "layout";
49
50 public static final String HIDDEN = "hidden";
51
52 public static final String LAYOUT_TEMPLATE_TYPE = "layout";
53
54 public static final String DECORATOR_TYPE = "decorator";
55
56 /***
57 * Gets the window state for the current portlet window (fragment)
58 *
59 * @return The window state for the current window
60 * @throws Exception
61 */
62 WindowState getWindowState() throws Exception;
63
64 /***
65 * Gets the internal (portal) window state for the current portlet window (fragment)
66 *
67 * @return The window state for the current window
68 * @throws Exception
69 */
70 WindowState getMappedWindowState() throws Exception;
71
72 /***
73 * Gets the portlet mode for a current portlet window (fragment)
74 *
75 * @return The portlet mode of the current window
76 * @throws Exception
77 */
78 PortletMode getPortletMode() throws Exception;
79
80 /***
81 * Gets the internal (portal) portlet mode for a current portlet window (fragment)
82 *
83 * @return The portlet mode of the current window
84 * @throws Exception
85 */
86 PortletMode getMappedPortletMode() throws Exception;
87
88 /***
89 *
90 * @return
91 */
92 ContentFragment getCurrentFragment();
93
94 /***
95 *
96 * @param f
97 */
98 void setCurrentFragment(ContentFragment f);
99
100 void setCurrentLayout();
101
102 /***
103 *
104 * @return
105 */
106 ContentFragment getCurrentLayout();
107
108 /***
109 *
110 * @return
111 */
112 Page getPage();
113
114 /***
115 *
116 * @return
117 */
118 List[] getColumns();
119
120 List getColumnSizes();
121
122 /***
123 *
124 * @return
125 * @throws Exception
126 */
127 PortletEntity getCurrentPortletEntity() throws Exception;
128
129 /***
130 *
131 * @param f
132 * Fragment whose <code>PortletEntity</code> we want to
133 * retreive.
134 * @return The PortletEntity represented by the current fragment.
135 * @throws Exception
136 */
137 PortletEntity getPortletEntity(ContentFragment f) throws Exception;
138
139 /***
140 * Checks the the visibilty of this fragment with respect to the current
141 * RenderReqeust.
142 *
143 * @param f
144 * Fragment
145 * @return whether or not the Fragment in question should be considered
146 * visible during rendering.
147 */
148 boolean isHidden(ContentFragment f);
149
150 /***
151 * Retreives a template using Jetspeed's
152 *
153 * @see org.apache.jetspeed.locator.TemplateLocator
154 *
155 *
156 * @param path
157 * Expected to the template. This may actually be changed by the
158 * TL service based the capability and localization information
159 * provided by the client.
160 * @param templateType
161 * Type off template we are interested in.
162 * @return Template object containng the pertinent information required to
163 * inlcude the request template path in the current response
164 * @throws TemplateLocatorException
165 * if the <code>path</code> does not exist.
166 */
167 TemplateDescriptor getTemplate(String path, String templateType)
168 throws TemplateLocatorException;
169
170 TemplateDescriptor getDecoration(String path, String templateType)
171 throws TemplateLocatorException;
172
173 String includeTemplate(String template, String templateType)
174 throws IOException;
175
176 String includeDecoration(String template, String templateType)
177 throws IOException;
178
179 /***
180 * <p>
181 * Decorate and include fragment content.
182 * </p>
183 *
184 * @param f
185 * Fragment to include and decorate
186 * @throws Exception
187 * @return String path to the decorator.
188 */
189 String decorateAndInclude(ContentFragment f) throws Exception;
190
191 /***
192 * Gets the list of decorator actions for a window. Each window (on each
193 * page) has its own collection of actionAccess flags associated with it.
194 *
195 * @return A list of actions available to the current window, filtered by
196 * securty access and current state.
197 * @throws Exception
198 */
199 List getDecoratorActions();
200
201 /***
202 * Gets the list of decorator actions for a page. Each layout fragment on a
203 * page has its own collection of actionAccess flags associated with it.
204 *
205 * @return A list of actions available to the current window, filtered by
206 * securty access and current state.
207 * @throws Exception
208 */
209 List getPageDecoratorActions() throws Exception;
210
211 /***
212 *
213 * <p>
214 * getTitle
215 * </p>
216 * Returns the appropriate for the title based on locale prferences
217 *
218 * @param entity
219 * @return
220 */
221 String getTitle(PortletEntity entity, ContentFragment f);
222
223 /***
224 *
225 * <p>
226 * getTitle
227 * </p>
228 * Returns the appropriate for the title based on locale prferences
229 *
230 * @param entity
231 * @return
232 */
233 String getTitle(PortletEntity entity);
234
235 Object getComponent(String name);
236
237 String getAbsoluteUrl(String relativePath);
238
239 Subject getSubject();
240
241 boolean getLoggedOn();
242
243 String getBasePath();
244
245 String getPageBasePath();
246
247 String renderPortletEntity(String entityId, String portletId);
248 }