KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > theme > PortalLayout


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.server.theme;
10
11 import org.jboss.portal.common.MediaType;
12 import org.jboss.portal.server.theme.strategy.LayoutStrategy;
13
14 import javax.servlet.ServletContext JavaDoc;
15
16 /**
17  * A layout is a resource to lay out a portal page, that can be reached via a <code>javax.servlet.RequestDispatcher</code>.
18  * <p>A layout is lost likely a jsp page, but servlets could be used as well. The layout is not limited
19  * to exist in the portal's archive, it can be located in any deployed archive on the server.</p>
20  * <p>Any layout that the portal will pick up needs to be defined in a layout descriptor. The Layout
21  * desciptor is an xml file in WEB-INF/ with the file name *-layouts.xml</p>
22  * <p>A portal layout cooperates with a portal theme and a renderer set to render the markup of a portal page.</p>
23  *
24  * @author <a HREF="mailto:mholzner@novell.com>Martin Holzner</a>
25  * @version $LastChangedRevision$, $LastChangedDate$
26  * @see org.jboss.portal.server.theme.render.Renderer
27  * @see org.jboss.portal.server.theme.strategy.LayoutStrategy
28  * @see PortalTheme
29  */

30 public interface PortalLayout
31 {
32    /**
33     * Get the servlet context in which the layout resides
34     *
35     * @return the servlet context in which the layout resides
36     */

37    ServletContext JavaDoc getServletContext();
38
39    /**
40     * Get the name of the application (WAR) that contains the layout
41     *
42     * @return the name of the application (WAR) that contains the layout
43     */

44    String JavaDoc getAppName();
45
46    /**
47     * Get the name of the layout.
48     * The name of a layout is defined in the layout descriptor.
49     *
50     * @return the name of the layout
51     */

52    String JavaDoc getName();
53
54    /**
55     * Get the uri, the location of the layout, relative to its context
56     *
57     * @return the uri of the layout relative to its context
58     */

59    String JavaDoc getURI();
60
61    /**
62     * Get the uri, the location of the layout, relative to its context.
63     *
64     * @param state an optional key to further separate URIs (for example for maximized window state).
65     * If a layout uri was defined for the provided state, that uri will be returned, otherwise the generic
66     * URI for this layout will be returned. If null is provided, the result is the same as calling getURI()
67     * @return the uri of the layout relative to its context
68     * @see #getServletContext()
69     * @see #getURI
70     */

71    String JavaDoc getURI(String JavaDoc state);
72
73    /**
74     * Return the context path of the war file in which the layout is deployed.
75     *
76     * @return the context path of the war file in which the layout is deployed
77     */

78    String JavaDoc getContextPath();
79
80    /**
81     * Out of the render sets defined for this layout (in portal-layouts.xml), get the one that matches the
82     * requested content type.
83     *
84     * @param mediaType the media type of the current request
85     * @return a PortalRenderSet for this layout and provided media/content type
86     * @see MediaType
87     * @see PortalRenderSet
88     */

89    PortalRenderSet getRenderSet(MediaType mediaType);
90
91    /**
92     * Get the class loader for this layout, the loader of the portal web application.
93     *
94     * @return the class loader of the portal web application
95     */

96    ClassLoader JavaDoc getLoader();
97
98    /**
99     * Out of the portal strategies defined for this layout (if any), get the one that was defined for the
100     * provided media type. (see also portal-layouts.xml)
101     *
102     * @param mediaType the media type (content type) for which to get the strategy for
103     * @return the strategy that was defined for this layout and media type, or null if no strategy was defined for the
104     * provided criteria.
105     */

106    LayoutStrategy getStrategy(MediaType mediaType);
107 }
108
Popular Tags