    001    // Copyright 2006, 2008, 2010 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.services;
    016
    017    import org.apache.tapestry5.ioc.ServiceLifecycle;
    018    import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
    019
    020    /**
    021     * Provides access to user defined lifecycles (beyond the two built-in lifecycles: "singleton" and "primitive"). The
    022     * user defined lifecycles are contributed into the service's configuration.
    023     * <p/>
    024     * Note that the default scope {@linkplain org.apache.tapestry5.ioc.ScopeConstants#DEFAULT "singleton"} is special and
    025     * not a contribution.
    026     */
    027    @UsesMappedConfiguration(ServiceLifecycle.class)
    028    public interface ServiceLifecycleSource
    029    {
    030        /**
    031         * Used to locate a configuration lifecycle, by name.
    032         *
    033         * @param scope
    034         * @return the named lifecycle, or null if the name is not found
    035         */
    036        ServiceLifecycle get(String scope);
    037    }