1 // Copyright 2004, 2005 The Apache Software Foundation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package org.apache.tapestry.engine; 16 17 import org.apache.tapestry.IPage; 18 import org.apache.tapestry.event.ChangeObserver; 19 20 /** 21 * Defines an object that can observe changes to properties of a page and its components, store the 22 * state of the page between request cycles, and restore a page's state on a subsequent request 23 * cycle. 24 * <p> 25 * Concrete implementations of this can store the changes in memory, as client-side cookies, in a 26 * flat file, or in a database. 27 * 28 * @author Howard Lewis Ship 29 */ 30 31 public interface IPageRecorder extends ChangeObserver 32 { 33 /** 34 * Persists all changes that have been accumulated. If the recorder saves change incrementally, 35 * this should ensure that all changes have been persisted. 36 * <p> 37 * After commiting, a page recorder automatically locks itself. 38 */ 39 40 public void commit(); 41 42 /** 43 * Rolls back the page to the currently persisted state. 44 * <p> 45 * A page recorder can only rollback changes to properties which have changed at some point. 46 * This can cause some minor problems, addressed by 47 * {@link org.apache.tapestry.event.PageDetachListener#pageDetached(org.apache.tapestry.event.PageEvent)}. 48 */ 49 50 public void rollback(IPage page); 51 }