View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.decoration;
18  
19  import java.util.List;
20  import java.util.Set;
21  
22  import org.apache.jetspeed.om.page.Fragment;
23  import org.apache.jetspeed.om.page.Page;
24  import org.apache.jetspeed.request.RequestContext;
25  
26  /***
27   * Factory class used for locating Decorations and Themes for 
28   * Fragments and pages.
29   * 
30   * @see org.apache.jetspeed.decoration.Decoration
31   * @see org.apache.jetspeed.decoration.PortletDecoration
32   * @see org.apache.jetspeed.decoration.LayoutDecoration
33   * @see org.apache.jetspeed.decoration.Theme
34   * 
35   * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
36   *
37   */
38  public interface DecorationFactory
39  {
40      /*** Default nested layout portlet decorator */
41      String DEFAULT_NESTED_LAYOUT_PORTLET_DECORATOR = "clear";
42      
43      /***
44       * Returns a theme containing all of the Decorations for all of 
45       * the layouts on the current page.
46       * 
47       * @param page Page whose theme we are requesting
48       * @param requestContext Current portal request.
49       * @return Theme for this page based on the current portal request.
50       * 
51       * @see Theme
52       * @see RequestContext
53       */
54      Theme getTheme(Page page, RequestContext requestContext);
55      
56      /***
57       * Returns a names portlet Decoration appropriate to the 
58       * current request conetext.
59       * 
60       * @param name Formal name of the decoration.
61       * @param requestContext Current portal request.
62       * 
63       * @return Decoration requested.  If the decoration does not exist, an
64       * empty Decoration will be created "in memory" and a message should be logged
65       * informing the admin that non-existent decoration has been requested.
66       * 
67       * @see RequestContext
68       * @see PortletDecoration
69       */
70      PortletDecoration getPortletDecoration(String name, RequestContext requestContext);
71      
72      /***
73       * Returns a named layout Decoration appropriate to the 
74       * current request conetext.
75       * 
76       * @param name Formal name of the decoration.
77       * @param requestContext Current portal request.
78       * 
79       * @return Decoration requested.  If the decoration does not exist, an
80       * empty Decoration will be created "in memory" and a message should be logged
81       * informing the admin that non-existent decoration has been requested.
82       * 
83       * @see LayoutDecoration
84       * @see RequestContext
85       */
86      LayoutDecoration getLayoutDecoration(String name, RequestContext requestContext);
87      
88      /***
89       * Returns a Decoration for a specific <code>Fragment</code> contained
90       * within the specified <code>Page</code>.
91       * 
92       * @param page Current page
93       * @param fragment Fragment whose decoration we require.
94       * @param requestContext Current portal request.
95       * 
96       * @return Decoration requested.  If the decoration does not exist, an
97       * empty Decoration will be created "in memory" and a message should be logged
98       * informing the admin that non-existent decoration has been requested.
99       * 
100      * @see Page
101      * @see Fragment
102      * @see RequestContext
103      */
104     Decoration getDecoration(Page page, Fragment fragment, RequestContext requestContext);
105     
106     /***
107      * Indicates whether /desktop is enabled for the current portal request.
108      * Located here due to range of jetspeed components which need this information and
109      * already have a DecorationFactory reference.
110      * 
111      * @param requestContext current portal request.
112      * 
113      * @return true if /desktop is enabled for the current portal request, otherwise false
114      */
115     boolean isDesktopEnabled( RequestContext requestContext );
116     
117     /***
118      * Clears the lookup cache of all previous located pathes.  This only
119      * clears the cache the <code>RequestContext</code>'s current user.  This
120      * will generally delegate the cache operation to the <code>PathResolverCache</code>
121      * currently in use. 
122      * 
123      * @param requestContext Current portal request.
124      * 
125      * @see RequestContext
126      * @see PathResolverCache
127      */
128     void clearCache(RequestContext requestContext);
129     
130     /***
131      * Get the portal-wide list of page decorations.
132      * 
133      * @return A list of page decorations of type <code>String</code>
134      */
135     Set getPageDecorations(RequestContext request);
136 
137     /***
138      * Get the portal-wide list of portlet decorations.
139      * 
140      * @return A list of portlet decorations of type <code>String</code>
141      */    
142     Set getPortletDecorations(RequestContext request);
143     
144     /***
145      * Get the portal-wide list of available layouts.
146      * 
147      * @return A list of layout portlets of type <code>LayoutInfo</code>
148      */    
149     List getLayouts(RequestContext request);
150     
151     /***
152      * Get the portal-wide list of available desktop page decorations.
153      * 
154      * @return A list of desktop skins of type <code>String</code>
155      */    
156     Set getDesktopPageDecorations(RequestContext request);
157     
158     /***
159      * Get the portal-wide list of desktop portlet decorations.
160      * 
161      * @return A list of desktop skins of type <code>String</code>
162      */
163     Set getDesktopPortletDecorations(RequestContext request);
164     
165     /***
166      * Get the path to the layout decorations directory.
167      * 
168      * @return path to layout decorations directory
169      */
170     String getLayoutDecorationsBasePath();
171     
172     /***
173      * Get the path to the portlet decorations directory.
174      * 
175      * @return path to portlet decorations directory
176      */
177     String getPortletDecorationsBasePath();
178     
179     /***
180      * Get the default desktop layout decoration to be used when
181      * selected layout decoration does not support /desktop.
182      * 
183      * @return default desktop layout decoration.
184      */
185     String getDefaultDesktopLayoutDecoration();
186     
187     /***
188      * Set the default desktop layout decoration to be used when
189      * selected layout decoration does not support /desktop.
190      */
191     void setDefaultDesktopLayoutDecoration( String newOne );
192     
193     /***
194      * Get the default desktop portlet decoration to be used when
195      * selected portlet decoration does not support /desktop.
196      * 
197      * @return default desktop portlet decoration.
198      */
199     String getDefaultDesktopPortletDecoration();
200     
201     /***
202      * Set the default desktop portlet decoration to be used when
203      * selected portlet decoration does not support /desktop.
204      */
205     void setDefaultDesktopPortletDecoration( String newOne );
206 }