Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Page |
|
| 1.0;1 |
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 base class 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: Page.java 1773378 2016-12-09 13:19:59Z tv $ | |
31 | */ | |
32 | 4 | public abstract class Page |
33 | extends Assembler | |
34 | { | |
35 | /** Prefix for page related classes and templates */ | |
36 | public static final String PREFIX = "pages"; | |
37 | ||
38 | /** Property for the size of the page cache if caching is on */ | |
39 | public static final String CACHE_SIZE_KEY = "page.cache.size"; | |
40 | ||
41 | /** The default size for the page cache */ | |
42 | public static final int CACHE_SIZE_DEFAULT = 5; | |
43 | ||
44 | /** Represents Page Objects */ | |
45 | public static final String NAME = "page"; | |
46 | ||
47 | /** | |
48 | * @see org.apache.turbine.modules.Assembler#getPrefix() | |
49 | */ | |
50 | @Override | |
51 | public String getPrefix() | |
52 | { | |
53 | 0 | return PREFIX; |
54 | } | |
55 | ||
56 | /** | |
57 | * A subclass must override this method to build itself. | |
58 | * Subclasses override this method to store the page in PipelineData or | |
59 | * to write the page to the output stream referenced in PipelineData. | |
60 | * @param pipelineData Turbine information. | |
61 | * @throws Exception a generic exception. | |
62 | */ | |
63 | protected abstract void doBuild(PipelineData pipelineData) throws Exception; | |
64 | ||
65 | /** | |
66 | * Subclasses can override this method to add additional | |
67 | * functionality. This method is protected to force clients to | |
68 | * use PageLoader to build a Page. | |
69 | * | |
70 | * @param pipelineData Turbine information. | |
71 | * @throws Exception a generic exception. | |
72 | */ | |
73 | protected void build(PipelineData pipelineData) | |
74 | throws Exception | |
75 | { | |
76 | 4 | doBuild(pipelineData); |
77 | 2 | } |
78 | } |