001// Copyright 2006, 2007, 2008, 2011 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007// http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.internal.services;
016
017import org.apache.tapestry5.commons.Messages;
018import org.apache.tapestry5.commons.services.InvalidationEventHub;
019import org.apache.tapestry5.ioc.services.UpdateListener;
020import org.apache.tapestry5.services.pageload.ComponentResourceSelector;
021
022public interface MessagesSource extends InvalidationEventHub, UpdateListener
023{
024    /**
025     * Used to obtain a {@link Messages} instance for a particular component, within a particular locale. If the
026     * component extends from another component, then its localized properties will merge with its parent's properties
027     * (with the subclass overriding the super class on any conflicts).
028     * 
029     * @param bundle
030     *            defines the set of properties files to read, as well as a series of parent bundles to extend and
031     *            override
032     * @param selector
033     *            defines the locale and other axes used to locate the necessary resources
034     * @return the message catalog for the bundle, for the indicated selector
035     */
036    Messages getMessages(MessagesBundle bundle, ComponentResourceSelector selector);
037}