1/*2 * $Id: AbstractTilesContainerFactory.java 797540 2009-07-24 15:42:00Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.factory;
2223import org.apache.tiles.TilesApplicationContext;
24import org.apache.tiles.TilesContainer;
25import org.apache.tiles.reflect.ClassUtil;
2627/***28 * Abstract Factory that creates instances of {@link TilesContainerFactory}.29 *30 * @version $Rev: 797540 $ $Date: 2009-07-24 17:42:00 +0200 (ven, 24 lug 2009) $31 * @since 2.1.032 */33publicabstractclassAbstractTilesContainerFactory {
3435/***36 * Initialization parameter that represents the container factory class37 * name.38 *39 * @since 2.1.040 */41publicstaticfinal String CONTAINER_FACTORY_INIT_PARAM =
42"org.apache.tiles.factory.AbstractTilesContainerFactory";
4344/***45 * Creates a factory instance.46 *47 * @param context The application context object.48 * @return The created factory.49 * @throws TilesContainerFactoryException If something goes wrong during50 * creation.51 * @since 2.1.152 * @deprecated Create directly a new instance of this class.53 */54publicstaticAbstractTilesContainerFactory getTilesContainerFactory(
55 TilesApplicationContext context) {
56AbstractTilesContainerFactory retValue;
57 String factoryName = context.getInitParams().get(
58 CONTAINER_FACTORY_INIT_PARAM);
59if (factoryName == null) {
60 factoryName = context.getInitParams().get(
61 TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM);
62 }
63if (factoryName != null) {
64 retValue = (AbstractTilesContainerFactory) ClassUtil.instantiate(factoryName);
65 } else {
66 retValue = newTilesContainerFactory();
67 }
68return retValue;
69 }
7071/***72 * Creates a Tiles container.73 *74 * @param applicationContext The Tiles application context object.75 * @return The created container.76 * @throws TilesContainerFactoryException If something goes wrong during77 * instantiation.78 * @since 2.1.179 */80publicabstract TilesContainer createContainer(TilesApplicationContext applicationContext);
81 }