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        /**
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        PropertyPersistenceStrategy getStrategy(String name);
039    
040        /**
041         * Returns all changes ({@link PropertyChange}) collected by any
042         * persistence strategy for the page. May return an empty list.
043         * 
044         * @see PropertyPersistenceStrategy#getStoredChanges(String)
045         */
046    
047        Collection getAllStoredChanges(String pageName);
048    
049        /**
050         * Discards any stored property changes for the named page.
051         */
052    
053        void discardAllStoredChanged(String pageName);
054    
055        /**
056         * Invoked by a {@link org.apache.tapestry.services.LinkFactory} , the
057         * parameters may be modified (added to) to store information related to
058         * persistent properties. This method is forwarded to all
059         * {@link PropertyPersistenceStrategy}s.
060         * 
061         * @param encoding
062         *            Service encoding, which indentifies the URL and the query
063         *            parameters from which the
064         *            {@link org.apache.tapestry.engine.ILink} will be created.
065         * @param post
066         *            if true, then the link will be used for a post (not a get,
067         *            i.e., for a HTML form); this may affect what information is
068         *            encoded into the link
069         * @see PropertyPersistenceStrategySource
070         */
071    
072        void addParametersForPersistentProperties(ServiceEncoding encoding,
073                boolean post);
074    }