001    // Copyright 2006, 2007, 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    
015    package org.apache.tapestry5.ioc.def;
016    
017    import org.slf4j.Logger;
018    
019    import java.util.Set;
020    
021    /**
022     * Defines the contents of a module. In the default case, this is information about the services provided by the module
023     * builder class.
024     */
025    public interface ModuleDef
026    {
027        /**
028         * Returns the ids of the services built/provided by the module.
029         */
030        Set<String> getServiceIds();
031    
032        /**
033         * Returns a service definition via the service's id. Ideally, the returned value should be an instance of {@link
034         * org.apache.tapestry5.ioc.def.ServiceDef2}, and will be converted to such if necessary.
035         *
036         * @param serviceId the id of the service to retrieve  (case is ignored)
037         * @return service definition or null if it doesn't exist
038         */
039        ServiceDef getServiceDef(String serviceId);
040    
041        /**
042         * Returns all the decorator definitions built/provided by this module.
043         */
044        Set<DecoratorDef> getDecoratorDefs();
045    
046        /**
047         * Returns all the contribution definitions built/provided by this module.
048         */
049        Set<ContributionDef> getContributionDefs();
050    
051        /**
052         * Returns the class that will be instantiated. Annotated instance methods of this class are invoked to build
053         * services, to decorate/intercept services, and make contributions to other services.
054         * <p/>
055         * Note: this name is maintained for compatibilty; the term "module builder" is now just "module class".
056         */
057        Class getBuilderClass();
058    
059        /**
060         * Returns the name used to create a {@link Logger} instance. This is typically the builder class name.
061         */
062        String getLoggerName();
063    }