KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > record > PropertyPersistenceStrategy


1 // Copyright 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.record;
16
17 import java.util.Collection JavaDoc;
18
19 import org.apache.tapestry.IRequestCycle;
20 import org.apache.tapestry.engine.ServiceEncoding;
21
22 /**
23  * Defines how a persistent property is made persistent. The typical implementation is to store the
24  * persistent property into the session as a session attribute.
25  *
26  * @author Howard M. Lewis Ship
27  * @since 4.0
28  */

29 public interface PropertyPersistenceStrategy
30 {
31     /**
32      * Stores the new value.
33      *
34      * @param pageName
35      * the name of the page containing the property
36      * @param idPath
37      * the path to the component with the property (may be null)
38      * @param propertyName
39      * the name of the property to be persisted
40      * @param newValue
41      * the new value (which may be null)
42      */

43
44     public void store(String JavaDoc pageName, String JavaDoc idPath, String JavaDoc propertyName, Object JavaDoc newValue);
45
46     /**
47      * Returns a collection of {@link org.apache.tapestry.record.PropertyChange}s. These represent
48      * prior changes previously stored. The order is not significant. Must not return null. Does not
49      * have to reflect changes made during the current request (this method is typically invoked as
50      * part of rolling back a page to a prior state, before any further changes are possible).
51      */

52
53     public Collection JavaDoc getStoredChanges(String JavaDoc pageName, IRequestCycle cycle);
54
55     /**
56      * Invoked to discard any stored changes for the specified page.
57      */

58     public void discardStoredChanges(String JavaDoc pageName, IRequestCycle cycle);
59
60     /**
61      * Invoked by a {@link org.apache.tapestry.services.LinkFactory} , the parameters may be
62      * modified (added to) to store information related to persistent properties. This method is
63      * forwarded to all {@link PropertyPersistenceStrategy}s.
64      *
65      * @param encoding
66      * Service encoding, which indentifies the URL and the query parameters from which
67      * the {@link org.apache.tapestry.engine.ILink} will be created.
68      * @param cycle
69      * The current request cycle.
70      * @see PropertyPersistenceStrategySource
71      */

72
73     public void addParametersForPersistentProperties(ServiceEncoding encoding, IRequestCycle cycle);
74 }
Popular Tags