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.decoration;
018:
019: import java.util.List;
020: import java.util.Set;
021:
022: import org.apache.jetspeed.om.page.Fragment;
023: import org.apache.jetspeed.om.page.Page;
024: import org.apache.jetspeed.request.RequestContext;
025:
026: /**
027: * Factory class used for locating Decorations and Themes for
028: * Fragments and pages.
029: *
030: * @see org.apache.jetspeed.decoration.Decoration
031: * @see org.apache.jetspeed.decoration.PortletDecoration
032: * @see org.apache.jetspeed.decoration.LayoutDecoration
033: * @see org.apache.jetspeed.decoration.Theme
034: *
035: * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
036: *
037: */
038: public interface DecorationFactory {
039: /** Default nested layout portlet decorator */
040: String DEFAULT_NESTED_LAYOUT_PORTLET_DECORATOR = "clear";
041:
042: /**
043: * Returns a theme containing all of the Decorations for all of
044: * the layouts on the current page.
045: *
046: * @param page Page whose theme we are requesting
047: * @param requestContext Current portal request.
048: * @return Theme for this page based on the current portal request.
049: *
050: * @see Theme
051: * @see RequestContext
052: */
053: Theme getTheme(Page page, RequestContext requestContext);
054:
055: /**
056: * Returns a names portlet Decoration appropriate to the
057: * current request conetext.
058: *
059: * @param name Formal name of the decoration.
060: * @param requestContext Current portal request.
061: *
062: * @return Decoration requested. If the decoration does not exist, an
063: * empty Decoration will be created "in memory" and a message should be logged
064: * informing the admin that non-existent decoration has been requested.
065: *
066: * @see RequestContext
067: * @see PortletDecoration
068: */
069: PortletDecoration getPortletDecoration(String name,
070: RequestContext requestContext);
071:
072: /**
073: * Returns a named layout Decoration appropriate to the
074: * current request conetext.
075: *
076: * @param name Formal name of the decoration.
077: * @param requestContext Current portal request.
078: *
079: * @return Decoration requested. If the decoration does not exist, an
080: * empty Decoration will be created "in memory" and a message should be logged
081: * informing the admin that non-existent decoration has been requested.
082: *
083: * @see LayoutDecoration
084: * @see RequestContext
085: */
086: LayoutDecoration getLayoutDecoration(String name,
087: RequestContext requestContext);
088:
089: /**
090: * Returns a Decoration for a specific <code>Fragment</code> contained
091: * within the specified <code>Page</code>.
092: *
093: * @param page Current page
094: * @param fragment Fragment whose decoration we require.
095: * @param requestContext Current portal request.
096: *
097: * @return Decoration requested. If the decoration does not exist, an
098: * empty Decoration will be created "in memory" and a message should be logged
099: * informing the admin that non-existent decoration has been requested.
100: *
101: * @see Page
102: * @see Fragment
103: * @see RequestContext
104: */
105: Decoration getDecoration(Page page, Fragment fragment,
106: RequestContext requestContext);
107:
108: /**
109: * Indicates whether /desktop is enabled for the current portal request.
110: * Located here due to range of jetspeed components which need this information and
111: * already have a DecorationFactory reference.
112: *
113: * @param requestContext current portal request.
114: *
115: * @return true if /desktop is enabled for the current portal request, otherwise false
116: */
117: boolean isDesktopEnabled(RequestContext requestContext);
118:
119: /**
120: * Clears the lookup cache of all previous located pathes. This only
121: * clears the cache the <code>RequestContext</code>'s current user. This
122: * will generally delegate the cache operation to the <code>PathResolverCache</code>
123: * currently in use.
124: *
125: * @param requestContext Current portal request.
126: *
127: * @see RequestContext
128: * @see PathResolverCache
129: */
130: void clearCache(RequestContext requestContext);
131:
132: /**
133: * Get the portal-wide list of page decorations.
134: *
135: * @return A list of page decorations of type <code>String</code>
136: */
137: Set getPageDecorations(RequestContext request);
138:
139: /**
140: * Get the portal-wide list of portlet decorations.
141: *
142: * @return A list of portlet decorations of type <code>String</code>
143: */
144: Set getPortletDecorations(RequestContext request);
145:
146: /**
147: * Get the portal-wide list of available layouts.
148: *
149: * @return A list of layout portlets of type <code>LayoutInfo</code>
150: */
151: List getLayouts(RequestContext request);
152:
153: /**
154: * Get the portal-wide list of available desktop page decorations.
155: *
156: * @return A list of desktop skins of type <code>String</code>
157: */
158: Set getDesktopPageDecorations(RequestContext request);
159:
160: /**
161: * Get the portal-wide list of desktop portlet decorations.
162: *
163: * @return A list of desktop skins of type <code>String</code>
164: */
165: Set getDesktopPortletDecorations(RequestContext request);
166:
167: /**
168: * Get the path to the layout decorations directory.
169: *
170: * @return path to layout decorations directory
171: */
172: String getLayoutDecorationsBasePath();
173:
174: /**
175: * Get the path to the portlet decorations directory.
176: *
177: * @return path to portlet decorations directory
178: */
179: String getPortletDecorationsBasePath();
180:
181: /**
182: * Get the default desktop layout decoration to be used when
183: * selected layout decoration does not support /desktop.
184: *
185: * @return default desktop layout decoration.
186: */
187: String getDefaultDesktopLayoutDecoration();
188:
189: /**
190: * Set the default desktop layout decoration to be used when
191: * selected layout decoration does not support /desktop.
192: */
193: void setDefaultDesktopLayoutDecoration(String newOne);
194:
195: /**
196: * Get the default desktop portlet decoration to be used when
197: * selected portlet decoration does not support /desktop.
198: *
199: * @return default desktop portlet decoration.
200: */
201: String getDefaultDesktopPortletDecoration();
202:
203: /**
204: * Set the default desktop portlet decoration to be used when
205: * selected portlet decoration does not support /desktop.
206: */
207: void setDefaultDesktopPortletDecoration(String newOne);
208: }
|