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