001    // Copyright 2006, 2007, 2008 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    
015    package org.apache.tapestry5.services;
016    
017    import org.apache.tapestry5.ioc.annotations.UsesConfiguration;
018    
019    import java.util.Map;
020    
021    /**
022     * A thin wrapper around a set of {@link org.apache.tapestry5.services.AliasContribution}s. An {@link
023     * org.apache.tapestry5.ioc.ObjectProvider} is contributed to the {@link org.apache.tapestry5.ioc.services.MasterObjectProvider}
024     * service, to allow contributed objects to replace other objects (typically, built in services).
025     */
026    @UsesConfiguration(AliasContribution.class)
027    public interface AliasManager
028    {
029        /**
030         * Filters down the contributions based on the mode. Each {@link AliasContribution contribution} will identify a
031         * contribution type and a non-null object that implements the type and may identify a mode. Only contributions
032         * where the mode is blank or the mode matches the provided mode are returned. Mode specific contributions quietly
033         * override non-specific contributions (where the mode is blank).
034         *
035         * @param mode
036         * @return map from contribution type to contribution object
037         */
038        Map<Class, Object> getAliasesForMode(String mode);
039    }