001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.layout;
018:
019: import java.io.IOException;
020: import java.util.List;
021:
022: import javax.portlet.PortletMode;
023: import javax.portlet.WindowState;
024: import javax.security.auth.Subject;
025:
026: import org.apache.jetspeed.locator.TemplateDescriptor;
027: import org.apache.jetspeed.locator.TemplateLocatorException;
028: import org.apache.jetspeed.om.page.ContentFragment;
029: import org.apache.jetspeed.om.page.Page;
030: import org.apache.pluto.om.entity.PortletEntity;
031:
032: /**
033: * JetspeedPowerTool
034: *
035: * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
036: * @version $Id: JetspeedPowerTool.java 516448 2007-03-09 16:25:47Z ate $
037: */
038:
039: public interface JetspeedPowerTool {
040:
041: public static final String GENERIC_TEMPLATE_TYPE = "generic";
042:
043: public static final String FRAGMENT_PROCESSING_ERROR_PREFIX = "fragment.processing.error.";
044:
045: public static final String FRAGMENT_ATTR = "fragment";
046:
047: public static final String LAYOUT_ATTR = "layout";
048:
049: public static final String HIDDEN = "hidden";
050:
051: public static final String LAYOUT_TEMPLATE_TYPE = "layout";
052:
053: public static final String DECORATOR_TYPE = "decorator";
054:
055: /**
056: * Gets the window state for the current portlet window (fragment)
057: *
058: * @return The window state for the current window
059: * @throws Exception
060: */
061: WindowState getWindowState() throws Exception;
062:
063: /**
064: * Gets the internal (portal) window state for the current portlet window (fragment)
065: *
066: * @return The window state for the current window
067: * @throws Exception
068: */
069: WindowState getMappedWindowState() throws Exception;
070:
071: /**
072: * Gets the portlet mode for a current portlet window (fragment)
073: *
074: * @return The portlet mode of the current window
075: * @throws Exception
076: */
077: PortletMode getPortletMode() throws Exception;
078:
079: /**
080: * Gets the internal (portal) portlet mode for a current portlet window (fragment)
081: *
082: * @return The portlet mode of the current window
083: * @throws Exception
084: */
085: PortletMode getMappedPortletMode() throws Exception;
086:
087: /**
088: *
089: * @return
090: */
091: ContentFragment getCurrentFragment();
092:
093: /**
094: *
095: * @param f
096: */
097: void setCurrentFragment(ContentFragment f);
098:
099: void setCurrentLayout();
100:
101: /**
102: *
103: * @return
104: */
105: ContentFragment getCurrentLayout();
106:
107: /**
108: *
109: * @return
110: */
111: Page getPage();
112:
113: /**
114: *
115: * @return
116: */
117: List[] getColumns();
118:
119: List getColumnSizes();
120:
121: /**
122: *
123: * @return
124: * @throws Exception
125: */
126: PortletEntity getCurrentPortletEntity() throws Exception;
127:
128: /**
129: *
130: * @param f
131: * Fragment whose <code>PortletEntity</code> we want to
132: * retreive.
133: * @return The PortletEntity represented by the current fragment.
134: * @throws Exception
135: */
136: PortletEntity getPortletEntity(ContentFragment f) throws Exception;
137:
138: /**
139: * Checks the the visibilty of this fragment with respect to the current
140: * RenderReqeust.
141: *
142: * @param f
143: * Fragment
144: * @return whether or not the Fragment in question should be considered
145: * visible during rendering.
146: */
147: boolean isHidden(ContentFragment f);
148:
149: /**
150: * Retreives a template using Jetspeed's
151: *
152: * @see org.apache.jetspeed.locator.TemplateLocator
153: *
154: *
155: * @param path
156: * Expected to the template. This may actually be changed by the
157: * TL service based the capability and localization information
158: * provided by the client.
159: * @param templateType
160: * Type off template we are interested in.
161: * @return Template object containng the pertinent information required to
162: * inlcude the request template path in the current response
163: * @throws TemplateLocatorException
164: * if the <code>path</code> does not exist.
165: */
166: TemplateDescriptor getTemplate(String path, String templateType)
167: throws TemplateLocatorException;
168:
169: TemplateDescriptor getDecoration(String path, String templateType)
170: throws TemplateLocatorException;
171:
172: String includeTemplate(String template, String templateType)
173: throws IOException;
174:
175: String includeDecoration(String template, String templateType)
176: throws IOException;
177:
178: /**
179: * <p>
180: * Decorate and include fragment content.
181: * </p>
182: *
183: * @param f
184: * Fragment to include and decorate
185: * @throws Exception
186: * @return String path to the decorator.
187: */
188: String decorateAndInclude(ContentFragment f) throws Exception;
189:
190: /**
191: * Gets the list of decorator actions for a window. Each window (on each
192: * page) has its own collection of actionAccess flags associated with it.
193: *
194: * @return A list of actions available to the current window, filtered by
195: * securty access and current state.
196: * @throws Exception
197: */
198: List getDecoratorActions();
199:
200: /**
201: * Gets the list of decorator actions for a page. Each layout fragment on a
202: * page has its own collection of actionAccess flags associated with it.
203: *
204: * @return A list of actions available to the current window, filtered by
205: * securty access and current state.
206: * @throws Exception
207: */
208: List getPageDecoratorActions() throws Exception;
209:
210: /**
211: *
212: * <p>
213: * getTitle
214: * </p>
215: * Returns the appropriate for the title based on locale prferences
216: *
217: * @param entity
218: * @return
219: */
220: String getTitle(PortletEntity entity, ContentFragment f);
221:
222: /**
223: *
224: * <p>
225: * getTitle
226: * </p>
227: * Returns the appropriate for the title based on locale prferences
228: *
229: * @param entity
230: * @return
231: */
232: String getTitle(PortletEntity entity);
233:
234: Object getComponent(String name);
235:
236: String getAbsoluteUrl(String relativePath);
237:
238: Subject getSubject();
239:
240: boolean getLoggedOn();
241:
242: String getBasePath();
243:
244: String getPageBasePath();
245:
246: String renderPortletEntity(String entityId, String portletId);
247: }
|