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 * @author Howard M. Lewis Ship 019 * @since 4.0 020 */ 021 public interface ApplicationStateManager 022 { 023 /** 024 * Checks to see if the named object exists. 025 * 026 * @param objectName 027 * the name of the application state object 028 * @throws org.apache.hivemind.ApplicationRuntimeException 029 * if no such object is declared 030 */ 031 public boolean exists(String objectName); 032 033 /** 034 * Gets the named application state object, creating it if necessary. 035 * 036 * @param objectName 037 * the name of the application state object 038 * @return the object 039 * @throws org.apache.hivemind.ApplicationRuntimeException 040 * if no such object is declared 041 */ 042 public Object get(String objectName); 043 044 /** 045 * Stores a new state object, replacing the old one. The 046 * new object may be null. 047 * 048 * @param objectName the name of the object to store 049 * @param stateObject the new object, possibly null 050 * @throws org.apache.hivemind.ApplicationRuntimeException 051 * if no such object is declared 052 */ 053 054 public void store(String objectName, Object stateObject); 055 056 /** 057 * Asks each {@link StateObjectManager} to store each object obtained. 058 */ 059 060 public void flush(); 061 }