1/*2 * $Id: DefinitionsFactoryUtil.java 734110 2009-01-13 11:49:19Z 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 */2122package org.apache.tiles.definition.util;
2324import org.apache.tiles.TilesContainer;
25import org.apache.tiles.access.TilesAccess;
26import org.apache.tiles.definition.DefinitionsFactory;
27import org.apache.tiles.definition.Refreshable;
28import org.apache.tiles.impl.BasicTilesContainer;
2930/***31 * Various {@link DefinitionsFactory} utilities.32 *33 * @version $Rev: 734110 $ $Date: 2009-01-13 12:49:19 +0100 (mar, 13 gen 2009) $34 */35publicfinalclassDefinitionsFactoryUtil {
3637/***38 * Private constructor to avoid instatiation.39 */40privateDefinitionsFactoryUtil() {
41 }
4243/***44 * Reloads the definitions factory content, if necessary.45 *46 * @param context The context object to use47 * @throws org.apache.tiles.definition.DefinitionsFactoryException If48 * something goes wrong during reload.49 * @deprecated Let the definitions DAO manage auto-reload.50 */51 @Deprecated
52publicstaticvoid reloadDefinitionsFactory(Object context) {
53 TilesContainer container = TilesAccess.getContainer(context);
54if (container instanceof BasicTilesContainer) {
55BasicTilesContainer basic = (BasicTilesContainer) container;
56DefinitionsFactory factory = basic.getDefinitionsFactory();
57if (factory instanceof Refreshable) {
58Refreshable rFactory = (Refreshable) factory;
59if (rFactory.refreshRequired()) {
60 rFactory.refresh();
61 }
62 }
63 }
64 }
65 }