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 Page 27 * 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$ 33 */ 34 public class PageLoader 35 extends GenericLoader<Page> 36 { 37 /** The single instance of this class. */ 38 private static PageLoader instance = new PageLoader(); 39 40 /** 41 * These ctor's are private to force clients to use getInstance() 42 * to access this class. 43 */ 44 private PageLoader() 45 { 46 super(Page.class, 47 () -> Turbine.getConfiguration().getInt(Page.CACHE_SIZE_KEY, 48 Page.CACHE_SIZE_DEFAULT)); 49 } 50 51 /** 52 * Attempts to load and execute the external page. 53 * 54 * @param pipelineData Turbine information. 55 * @param name Name of object that will execute the page. 56 * @throws Exception a generic exception. 57 */ 58 @Override 59 public void exec(PipelineData pipelineData, String name) 60 throws Exception 61 { 62 // Execute page 63 getAssembler(name).build(pipelineData); 64 } 65 66 /** 67 * The method through which this class is accessed. 68 * 69 * @return The single instance of this class. 70 */ 71 public static PageLoader getInstance() 72 { 73 return instance; 74 } 75 }