    001// Licensed under the Apache License, Version 2.0 (the "License");
    002// you may not use this file except in compliance with the License.
    003// You may obtain a copy of the License at
    004//
    005//     http://www.apache.org/licenses/LICENSE-2.0
    006//
    007// Unless required by applicable law or agreed to in writing, software
    008// distributed under the License is distributed on an "AS IS" BASIS,
    009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    010// See the License for the specific language governing permissions and
    011// limitations under the License.
    012
    013package org.apache.tapestry5.ioc.def;
    014
    015import org.slf4j.Logger;
    016
    017import java.util.Set;
    018
    019/**
    020 * Defines the contents of a module. In the default case, this is information about the services provided by the module
    021 * builder class.
    022 */
    023public interface ModuleDef
    024{
    025    /**
    026     * Returns the ids of the services built/provided by the module.
    027     */
    028    Set<String> getServiceIds();
    029
    030    /**
    031     * Returns a service definition via the service's id. Ideally, the returned value should be an instance of {@link
    032     * org.apache.tapestry5.ioc.def.ServiceDef2}, and will be converted to such if necessary.
    033     *
    034     * @param serviceId the id of the service to retrieve  (case is ignored)
    035     * @return service definition or null if it doesn't exist
    036     */
    037    ServiceDef getServiceDef(String serviceId);
    038
    039    /**
    040     * Returns all the decorator definitions built/provided by this module.
    041     */
    042    Set<DecoratorDef> getDecoratorDefs();
    043
    044    /**
    045     * Returns all the contribution definitions built/provided by this module.
    046     */
    047    Set<ContributionDef> getContributionDefs();
    048
    049    /**
    050     * Returns the class that will be instantiated. Annotated instance methods of this class are invoked to build
    051     * services, to decorate/intercept services, and make contributions to other services.
    052     *
    053     * Note: this name is maintained for compatibilty; the term "module builder" is now just "module class".
    054     */
    055    Class getBuilderClass();
    056
    057    /**
    058     * Returns the name used to create a {@link Logger} instance. This is typically the builder class name.
    059     */
    060    String getLoggerName();
    061}