001//  Copyright 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
015package org.apache.tapestry5.ioc;
016
017
018/**
019 * Defines constants for built-in scopes (used with the {@link org.apache.tapestry5.ioc.annotations.Scope} annotation.
020 */
021public class ScopeConstants
022{
023    /**
024     * The default scope is a singleton within the {@link org.apache.tapestry5.ioc.Registry}. A single instance will be
025     * created on demand.  The lifespan of the instance lasts until the registry is {@linkplain Registry#shutdown() shut
026     * down}. <p/>Some implementations will want to know when the Registry is shutdown; they should register for
027     * notifications via the {@link org.apache.tapestry5.ioc.services.RegistryShutdownHub} service.
028     */
029    public static final String DEFAULT = "singleton";
030
031    /**
032     * An alternate scope provided with Tapestry; a per-thread instance is created on demand, behind a shared proxy.
033     * Method invocations on the shared proxy are forwarded to the per-thread instance. Each per-thread instance lasts
034     * until the {@linkplain Registry#cleanupThread() thread is cleaned up} (at the end of a request for a web
035     * application). <p>Some implementations will want to be notified before being discarded and should register with
036     * the {@link org.apache.tapestry5.ioc.services.PerthreadManager} to receive notifications.
037     *
038     * @see org.apache.tapestry5.ioc.internal.services.PerThreadServiceLifecycle
039     */
040    public static final String PERTHREAD = "perthread";
041}