View Javadoc
1   package org.apache.turbine.modules;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.turbine.pipeline.PipelineData;
23  
24  /**
25   * This is the interface that defines what a Page module is.
26   *
27   * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
28   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
29   * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
30   * @version $Id$
31   */
32  @FunctionalInterface
33  public interface Page extends Assembler
34  {
35      /** Prefix for page related classes and templates */
36      String PREFIX = "pages";
37  
38      /** Property for the size of the page cache if caching is on */
39      String CACHE_SIZE_KEY = "page.cache.size";
40  
41      /** The default size for the page cache */
42      int CACHE_SIZE_DEFAULT = 5;
43  
44      /** Represents Page Objects */
45      String NAME = "page";
46  
47      /**
48       * A subclass must override this method to build itself.
49       * Subclasses override this method to store the page in PipelineData or
50       * to write the page to the output stream referenced in PipelineData.
51       * @param pipelineData Turbine information.
52       * @throws Exception a generic exception.
53       */
54      void doBuild(PipelineData pipelineData) throws Exception;
55  
56      /**
57       * Subclasses can override this method to add additional
58       * functionality.
59       *
60       * @param pipelineData Turbine information.
61       * @throws Exception a generic exception.
62       */
63      default void build(PipelineData pipelineData)
64      	throws Exception
65      {
66          doBuild(pipelineData);
67      }
68  }