001// Copyright 2006, 2007, 2008, 2009 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.ioc.def; 016 017import org.apache.tapestry5.ioc.*; 018 019/** 020 * Contribution to a service configuration. 021 * <p/> 022 * The toString() method of the ContributionDef will be used for some exception reporting and should clearly identify 023 * where the contribution comes from; the normal behavior is to identify the class and method of the contribution 024 * method. 025 */ 026public interface ContributionDef 027{ 028 /** 029 * Identifies the service contributed to. 030 */ 031 String getServiceId(); 032 033 /** 034 * Performs the work needed to contribute into the standard, unordered configuration. 035 * 036 * @param moduleSource the source, if needed, of the module instance associated with the contribution 037 * @param resources allows access to services visible to the module 038 * @param configuration the unordered configuration into which values should be loaded. This instance will 039 * encapsulate all related error checks (such as passing of nulls or inappropriate classes). 040 */ 041 void contribute(ModuleBuilderSource moduleSource, ServiceResources resources, 042 Configuration configuration); 043 044 /** 045 * Performs the work needed to contribute into the ordered configuration. 046 * 047 * @param moduleSource the source, if needed, of the module instance associated with the contribution 048 * @param resources allows access to services visible to the module 049 * @param configuration the ordered configuration into which values should be loaded. This instance will encapsulate 050 * all related error checks (such as passing of nulls or inappropriate classes). 051 */ 052 void contribute(ModuleBuilderSource moduleSource, ServiceResources resources, 053 OrderedConfiguration configuration); 054 055 /** 056 * Performs the work needed to contribute into the mapped configuration. 057 * 058 * @param moduleSource the source, if needed, of the module instance associated with the contribution 059 * @param resources allows access to services visible to the module 060 * @param configuration the mapped configuration into which values should be loaded. This instance will encapsulate 061 * all related error checks (such as passing of null keys or values or inappropriate classes, 062 * or duplicate keys). 063 */ 064 void contribute(ModuleBuilderSource moduleSource, ServiceResources resources, 065 MappedConfiguration configuration); 066}