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.record; 016 017 import java.util.Collection; 018 019 import org.apache.tapestry.IRequestCycle; 020 import org.apache.tapestry.engine.ServiceEncoding; 021 022 /** 023 * A source for {@link org.apache.tapestry.record.PropertyPersistenceStrategy}s. 024 * 025 * @author Howard M. Lewis Ship 026 * @since 4.0 027 */ 028 public interface PropertyPersistenceStrategySource 029 { 030 /** 031 * Returns the name strategy. 032 * 033 * @param name 034 * the name of the strategy to retrieve. 035 * @throws org.apache.hivemind.ApplicationRuntimeException 036 * if no such strategy exists. 037 */ 038 public PropertyPersistenceStrategy getStrategy(String name); 039 040 /** 041 * Returns all changes ({@link PropertyChange}) collected by any persistence strategy for the 042 * page. May return an empty list. 043 * 044 * @see PropertyPersistenceStrategy#getStoredChanges(String, IRequestCycle) 045 */ 046 047 public Collection getAllStoredChanges(String pageName, IRequestCycle cycle); 048 049 /** 050 * Discards any stored property changes for the named page. 051 */ 052 053 public void discardAllStoredChanged(String pageName, IRequestCycle cycle); 054 055 /** 056 * Invoked by a {@link org.apache.tapestry.services.LinkFactory} , the parameters may be 057 * modified (added to) to store information related to persistent properties. This method is 058 * forwarded to all {@link PropertyPersistenceStrategy}s. 059 * 060 * @param encoding 061 * Service encoding, which indentifies the URL and the query parameters from which 062 * the {@link org.apache.tapestry.engine.ILink} will be created. 063 * @param cycle 064 * The current request cycle. 065 * @param post 066 * if true, then the link will be used for a post (not a get, i.e., for a HTML form); 067 * this may affect what information is encoded into the link 068 * @see PropertyPersistenceStrategySource 069 */ 070 071 public void addParametersForPersistentProperties(ServiceEncoding encoding, IRequestCycle cycle, boolean post); 072 }