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.om.page;
18  
19  import java.util.List;
20  
21  import org.apache.jetspeed.aggregator.PortletContent;
22  import org.apache.jetspeed.decoration.Decoration;
23  
24  
25  /***
26   * 
27   * ContentFragment provides a volatile wrapper interface for
28   * actual {@link org.apache.jetspeed.om.page.Fragment} metadata
29   * objects.  Since Fragments are cached and are not request specific
30   * they cannot be used to store request-level content.  This is where
31   * we use the <code>ContentFragment</code> to solve this problem.
32   * 
33   * @author weaver@apache.org
34   *
35   */
36  public interface ContentFragment extends Fragment
37  {
38      /***
39       * Provides a list of of child ContentFragments that wrap
40       * the actual Fragment metadata objects.
41       * @return
42       */
43     List getContentFragments();
44  
45      /***     
46       * Overridden to make it clear to the implemetor the {@link List}
47       * returned <strong>MUST</strong> ContentFragments and not
48       * just regular {@link org.apache.jetspeed.om.page.Fragment}s
49       *
50       * @return a collection containing ContentFragment objects
51       */
52      public List getFragments();
53  
54      /***
55       * 
56       * <p>
57       * getRenderedContent
58       * </p>
59       * <p>
60       *   Returns the raw,undecorated content of this fragment.  If
61       *   overridenContent has been set and portlet content has not,
62       *   overridden content should be returned.
63       * </p>
64       *  
65       * @return The raw,undecorated content of this fragment.
66       * @throws java.lang.IllegalStateException if the content has not yet been set.
67       */
68      public String getRenderedContent() throws IllegalStateException;
69  
70      /***
71       * 
72       * <p>
73       * overrideRenderedContent
74       * </p>
75       * <p>
76       * Can be used to store errors that may have occurred during the
77       * rendering process.
78       * </p>
79       *
80       * @param contnent
81       */
82      public void overrideRenderedContent(String contnent);
83  
84      /***
85       * @return the overridden content set by overrideRenderedContent
86       */
87      public String getOverriddenContent();
88      /***
89       * 
90       * <p>
91       * setPortletContent
92       * </p>
93       *
94       * @param portletContent
95       */
96      public void setPortletContent(PortletContent portletContent);
97      
98      /***
99       * Retrieves the actual <code>org.apache.jetspeed.decoration.decorator</code>
100      * object for this content fragment.
101      * 
102      * TODO: Re-evaluate the naming as this is somewhat confusing
103      * due to the existence of Fragment.getDecorator()
104      * @return
105      */
106     Decoration getDecoration();
107     
108     /***
109      * 
110      * @param decoration
111      */
112     void setDecoration(Decoration decoration);
113     
114     /***
115      * Checks if the content is instantly rendered from JPT.
116      */
117     public boolean isInstantlyRendered();
118 
119 }