|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ClientPropertyPersistenceScope.java | - | - | - | - |
|
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 org.apache.tapestry.IRequestCycle; | |
18 | import org.apache.tapestry.engine.ServiceEncoding; | |
19 | ||
20 | /** | |
21 | * Service tapestry.persist.ClientPropertyPersistenceScope. Determines whether a particular property | |
22 | * needs to be persisted or not. | |
23 | * | |
24 | * @author Mindbridge | |
25 | * @since 4.0 | |
26 | * @see org.apache.tapestry.record.ClientPropertyPersistenceStrategy | |
27 | */ | |
28 | public interface ClientPropertyPersistenceScope | |
29 | { | |
30 | /** | |
31 | * Determines whether state should be encoded for the request. | |
32 | * | |
33 | * @param encoding | |
34 | * identifies the service, URL and base set of parameters | |
35 | * @param cycle | |
36 | * current request | |
37 | * @param pageName | |
38 | * the page for which data is potentially to be encoded | |
39 | * @param data | |
40 | * @return true if state should be encoded into the encoding, false otherwise | |
41 | */ | |
42 | ||
43 | public boolean shouldEncodeState(ServiceEncoding encoding, IRequestCycle cycle, | |
44 | String pageName, PersistentPropertyData data); | |
45 | ||
46 | /** | |
47 | * Constructs a parameter name for a particular page name. The parameter name can be recognized | |
48 | * (in a later request) by the {@link #isParameterForScope(String)} method. | |
49 | * | |
50 | * @param pageName | |
51 | * the name of the page for which a corresponding parameter name should be generated. | |
52 | * @returns a query parameter name that identifies the page and this client persistence scope. | |
53 | */ | |
54 | ||
55 | public String constructParameterName(String pageName); | |
56 | ||
57 | /** | |
58 | * Checks a parameter to see if it was the result of {@link #constructParameterName(String)} for | |
59 | * this persistence scope. | |
60 | * | |
61 | * @param parameterName | |
62 | * a query parameter name | |
63 | * @return true if the parameterName was genereted (i.e., is properly prefixed) by this scope, | |
64 | * false otherwise. | |
65 | */ | |
66 | ||
67 | public boolean isParameterForScope(String parameterName); | |
68 | ||
69 | /** | |
70 | * Extracts a page name from a query parameter name. | |
71 | * | |
72 | * @param parameterName | |
73 | * the paramter name, for which {@link #isParameterForScope(String) must return true | |
74 | * @return the name of the page | |
75 | */ | |
76 | public String extractPageName(String parameterName); | |
77 | } |
|