001 // Copyright 2005 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.tapestry.engine.state;
016
017 /**
018 * Interface for an object that manages a single application state object.
019 * Represents the named intersection of a
020 * {@link org.apache.tapestry.engine.state.StateObjectPersistenceManager}for
021 * storing the state object between request cycles, and a
022 * {@link org.apache.tapestry.engine.state.StateObjectFactory}to create the
023 * object in the first place.
024 *
025 * @author Howard M. Lewis Ship
026 * @since 4.0
027 */
028 public interface StateObjectManager
029 {
030
031 /**
032 * Returns true if the application state object exists (i.e., a value has
033 * been stored).
034 */
035 boolean exists();
036
037 /**
038 * Gets or creates the application state object.
039 */
040
041 Object get();
042
043 /**
044 * Stores (if necessary) the object back into persistent storage. This is
045 * not application to all storage scopes.
046 *
047 * @param stateObject
048 * the application state object previously obtained from
049 * {@link #get()}.
050 */
051
052 void store(Object stateObject);
053 }