Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
BaseSessionStoreOptimized |
|
| 1.0;1 |
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; |
|
16 | ||
17 | import java.io.Serializable; |
|
18 | ||
19 | import javax.servlet.http.HttpSessionBindingEvent; |
|
20 | import javax.servlet.http.HttpSessionBindingListener; |
|
21 | ||
22 | /** |
|
23 | * Base implementation of {@link org.apache.tapestry.SessionStoreOptimized}. Subclasses should |
|
24 | * invoke {@link #markSessionStoreNeeded()} any time internal state changed. |
|
25 | * |
|
26 | * @author Howard M. Lewis Ship |
|
27 | * @since 4.0 |
|
28 | */ |
|
29 | 3 | public class BaseSessionStoreOptimized implements SessionStoreOptimized, Serializable, |
30 | HttpSessionBindingListener |
|
31 | { |
|
32 | private static final long serialVersionUID = -2786704444616789831L; |
|
33 | ||
34 | private transient boolean _dirty; |
|
35 | ||
36 | /** |
|
37 | * Clears the dirty flag. |
|
38 | */ |
|
39 | public void valueBound(HttpSessionBindingEvent event) |
|
40 | { |
|
41 | 1 | _dirty = false; |
42 | 1 | } |
43 | ||
44 | /** |
|
45 | * Does nothing. |
|
46 | */ |
|
47 | public void valueUnbound(HttpSessionBindingEvent event) |
|
48 | { |
|
49 | 1 | } |
50 | ||
51 | /** |
|
52 | * Sets the dirty flag. |
|
53 | */ |
|
54 | protected void markSessionStoreNeeded() |
|
55 | { |
|
56 | 3 | _dirty = true; |
57 | 3 | } |
58 | ||
59 | /** |
|
60 | * Returns the dirty flag. |
|
61 | */ |
|
62 | public boolean isStoreToSessionNeeded() |
|
63 | { |
|
64 | 4 | return _dirty; |
65 | } |
|
66 | ||
67 | } |