001/*
002 *  Copyright 2013 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.core.cocoon;
017
018import java.util.Locale;
019
020import org.apache.avalon.framework.service.ServiceManager;
021import org.apache.cocoon.i18n.Bundle;
022import org.apache.excalibur.source.SourceResolver;
023
024import org.ametys.core.util.cocoon.InvalidSourceValidity;
025
026/**
027 * This implementation of <code>Bundle</code> interface for XML resources allows to be invalidated. 
028 *
029 */
030public class XMLResourceBundle extends org.apache.cocoon.i18n.XMLResourceBundle
031{
032    /**
033     * Construct a bundle.
034     * @param sourceURI source URI of the XML bundle
035     * @param locale locale
036     * @param parentBundle parent bundle of this bundle
037     */
038    public XMLResourceBundle(String sourceURI, Locale locale, Bundle parentBundle)
039    {
040        super(sourceURI, locale, parentBundle);
041    }
042
043    @Override
044    public boolean reload(ServiceManager manager, SourceResolver resolver, long interval)
045    {
046        return super.reload(manager, resolver, interval);
047    }
048    
049    /**
050     * Invalidate bundle
051     */
052    public void invalidate ()
053    {
054        setValidity(new InvalidSourceValidity());
055    }
056}