001 // Copyright 2007, 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.services;
016
017 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
018
019 /**
020 * A contribution to the configuration of the {@link ApplicationStateManager}, identifying the strategy and creator for
021 * a particular Session State Object (SSO), identified by the SSO's class.
022 */
023 @SuppressWarnings("all")
024 public final class ApplicationStateContribution
025 {
026 private final String strategy;
027
028 private final ApplicationStateCreator creator;
029
030 public ApplicationStateContribution(String strategy)
031 {
032 this(strategy, null);
033 }
034
035 public ApplicationStateContribution(String strategy, ApplicationStateCreator creator)
036 {
037 assert InternalUtils.isNonBlank(strategy);
038 this.strategy = strategy;
039 this.creator = creator;
040 }
041
042 /**
043 * The creator for the ASO. If null, the the ASO is created directly from the ASO class, via its public no-arguments
044 * constructor.
045 */
046 public ApplicationStateCreator getCreator()
047 {
048 return creator;
049 }
050
051 /**
052 * The name of the strategy used to control where the ASO is stored.
053 */
054 public String getStrategy()
055 {
056 return strategy;
057 }
058
059 }