Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LayoutLoader |
|
| 0.0;0 |
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.Turbine; | |
23 | import org.apache.turbine.pipeline.PipelineData; | |
24 | ||
25 | /** | |
26 | * The purpose of this class is to allow one to load and execute | |
27 | * Layout modules. | |
28 | * | |
29 | * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> | |
30 | * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> | |
31 | * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> | |
32 | * @version $Id: LayoutLoader.java 1854786 2019-03-04 18:29:18Z tv $ | |
33 | */ | |
34 | public class LayoutLoader | |
35 | extends GenericLoader<Layout> | |
36 | { | |
37 | /** The single instance of this class. */ | |
38 | 102 | private static LayoutLoader instance = new LayoutLoader(); |
39 | ||
40 | /** | |
41 | * These ctor's are private to force clients to use getInstance() | |
42 | * to access this class. | |
43 | */ | |
44 | private LayoutLoader() | |
45 | { | |
46 | 102 | super(Layout.class, |
47 | 264 | () -> Turbine.getConfiguration().getInt(Layout.CACHE_SIZE_KEY, |
48 | Layout.CACHE_SIZE_DEFAULT)); | |
49 | 102 | } |
50 | ||
51 | /** | |
52 | * Attempts to load and execute the external layout. | |
53 | * | |
54 | * @param pipelineData Turbine information. | |
55 | * @param name Name of object that will execute the layout. | |
56 | * @throws Exception a generic exception. | |
57 | */ | |
58 | @Override | |
59 | public void exec(PipelineData pipelineData, String name) | |
60 | throws Exception | |
61 | { | |
62 | 18 | getAssembler(name).build(pipelineData); |
63 | 12 | } |
64 | ||
65 | /** | |
66 | * The method through which this class is accessed. | |
67 | * | |
68 | * @return The single instance of this class. | |
69 | */ | |
70 | public static LayoutLoader getInstance() | |
71 | { | |
72 | 234 | return instance; |
73 | } | |
74 | } |