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