Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
AbstractSessionBean |
|
| 1.0;1 |
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to you under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | ||
18 | package org.apache.shale.view; |
|
19 | ||
20 | import java.io.Serializable; |
|
21 | ||
22 | /** |
|
23 | * <p><strong>AbstractSessionBean</strong> is the abstract base class for |
|
24 | * data bean(s) that are stored in session scope attributes. It extends |
|
25 | * {@link AbstractFacesBean}, so it inherits all of the default behavior |
|
26 | * found there. In addition, the following lifecycle methods are called |
|
27 | * automatically when the corresponding events occur:</p> |
|
28 | * <ul> |
|
29 | * <li><code>init()</code> - Called when this bean is initially added |
|
30 | * as a session attribute (typically as the result of evaluating a |
|
31 | * value binding or method binding expression).</li> |
|
32 | * <li><code>passivate()</code> - Called when the servlet container is about |
|
33 | * to serialize and remove this session from its current container.</li> |
|
34 | * <li><code>activate()</code> - Called when the servlet container has |
|
35 | * finished deserializing this session and making it available in a |
|
36 | * (potentially different) container.</li> |
|
37 | * <li><code>destroy()</code> - Called when the bean is removed from the |
|
38 | * session attributes (typically as a result of the session timing out |
|
39 | * or being terminated by the application).</li> |
|
40 | * </ul> |
|
41 | * |
|
42 | * $Id: AbstractSessionBean.java 464373 2006-10-16 04:21:54Z rahul $ |
|
43 | */ |
|
44 | public abstract class AbstractSessionBean |
|
45 | extends AbstractFacesBean implements Serializable { |
|
46 | ||
47 | ||
48 | // ------------------------------------------------------------- Constructor |
|
49 | ||
50 | ||
51 | /** |
|
52 | * <p>Create a new session scope bean.</p> |
|
53 | */ |
|
54 | 0 | public AbstractSessionBean() { |
55 | 0 | } |
56 | ||
57 | ||
58 | // ------------------------------------------------------- Lifecycle Methods |
|
59 | ||
60 | ||
61 | /** |
|
62 | * <p>This method is called when this bean is initially added to |
|
63 | * session scope. Typically, this occurs as a result of evaluating |
|
64 | * a value binding or method binding expression, which utilizes the |
|
65 | * managed bean facility to instantiate this bean and store it into |
|
66 | * session scope.</p> |
|
67 | * |
|
68 | * <p>You may customize this method to initialize and cache data values |
|
69 | * or resources that are required for the lifetime of a particular |
|
70 | * user session.</p> |
|
71 | */ |
|
72 | public void init() { |
|
73 | ||
74 | // The default implementation does nothing |
|
75 | ||
76 | 0 | } |
77 | ||
78 | ||
79 | /** |
|
80 | * <p>This method is called when the session containing it is about to be |
|
81 | * passivated. Typically, this occurs in a distributed servlet container |
|
82 | * when the session is about to be transferred to a different |
|
83 | * container instance, after which the <code>activate()</code> method |
|
84 | * will be called to indicate that the transfer is complete.</p> |
|
85 | * |
|
86 | * <p>You may customize this method to release references to session data |
|
87 | * or resources that can not be serialized with the session itself.</p> |
|
88 | */ |
|
89 | public void passivate() { |
|
90 | ||
91 | // The default implementation does nothing |
|
92 | ||
93 | 0 | } |
94 | ||
95 | ||
96 | /** |
|
97 | * <p>This method is called when the session containing it was |
|
98 | * reactivated.</p> |
|
99 | * |
|
100 | * <p>You may customize this method to reacquire references to session |
|
101 | * data or resources that could not be serialized with the |
|
102 | * session itself.</p> |
|
103 | */ |
|
104 | public void activate() { |
|
105 | ||
106 | // The default implementation does nothing |
|
107 | ||
108 | 0 | } |
109 | ||
110 | ||
111 | /** |
|
112 | * <p>This method is called when this bean is removed from |
|
113 | * session scope. Typically, this occurs as a result of |
|
114 | * the session timing out or being terminated by the application.</p> |
|
115 | * |
|
116 | * <p>You may customize this method to clean up resources allocated |
|
117 | * during the execution of the <code>init()</code> method, or |
|
118 | * at any later time during the lifetime of the application.</p> |
|
119 | */ |
|
120 | public void destroy() { |
|
121 | ||
122 | // The default implementation does nothing |
|
123 | ||
124 | 0 | } |
125 | ||
126 | ||
127 | } |