View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.portal;
18  
19  import org.apache.jetspeed.util.MimeType;
20  import org.apache.turbine.util.RunData;
21  import org.apache.ecs.ConcreteElement;
22  import java.util.Map;
23  import java.io.Serializable;
24  
25  /***
26   * A PortletController is responsible for laying out and rendering the content of 
27   * a PortletSet. 
28   * <p>As such, it also provides 2 additionnal services :
29   * <ul>
30   *   <li>factory for the creating appropriate PortletSet;Constraints
31   *   <li>customization facilities for handling the addition of a new portlet
32   *       within the set and moving entries around within the set
33   * </ul>
34   *
35   * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
36   * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
37   * @version $Id: PortletController.java,v 1.54 2004/02/23 04:05:35 jford Exp $
38   */
39  public interface PortletController extends Serializable
40  {
41  
42      /***
43       * Initialize this PortletController. This method must be called after
44       * the Config object has been set and whenever it is changed
45       */
46      public void init();
47  
48      /***
49       * Sets the configuration object for this controller instance
50       *
51       * @param conf the controller configuration
52       */
53      public void setConfig(PortletControllerConfig conf);
54  
55      /***
56       * Returns the configuration object for this object
57       *
58       * @return a configuration object
59       */
60      public PortletControllerConfig getConfig();
61  
62      /***
63       * Sets the PotletSet to render by this controller
64       *
65       * @param portlets the portlet set to render
66       */
67      public void setPortlets(PortletSet portlets);
68  
69      /***
70       * Returns the PortletSet to render by this controller
71       *
72       * @return the portlet set that should currently be rendered by this
73       * controller
74       */
75      public PortletSet getPortlets();
76  
77      /***
78       * Renders the content of the PortletSet for the current request
79       * 
80       * @param rundata the RunData for the request
81       * @return the rendered content for this set or null if the content
82       * was written directly on the writer available in RunData
83       */
84      public ConcreteElement getContent( RunData rundata );
85  
86      /***
87       * Tests whether the controller supports outputting content for 
88       * a specific mime type
89       *
90       * @param mimeType the requested mime type
91       * @return true if the requested mime type is supported by this controller
92       */
93      public boolean supportsType( MimeType mimeType );
94          
95      /***
96       * Creates a constraint object based on an original source.
97       *
98       * @param original the source for this constraint object
99       * @return a new Constraints object appropriate for this controller
100      */
101     public PortletSet.Constraints getConstraints( Map original );
102         
103 }