KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > j2ee > session > AroundInterceptor


1 // ========================================================================
2
// $Id: AroundInterceptor.java,v 1.4 2004/05/09 20:30:47 gregwilkins Exp $
3
// Copyright 2002-2004 Mort Bay Consulting Pty. Ltd.
4
// ------------------------------------------------------------------------
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
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

16 package org.mortbay.j2ee.session;
17
18 //----------------------------------------
19

20 import java.rmi.RemoteException JavaDoc;
21 import java.util.Enumeration JavaDoc;
22 import java.util.Map JavaDoc;
23
24 //----------------------------------------
25

26
27 public abstract class AroundInterceptor
28   extends StateInterceptor
29 {
30   protected abstract void before();
31   protected abstract void after();
32
33   public long
34     getCreationTime()
35     throws RemoteException JavaDoc
36   {
37     long tmp=0;
38
39     before();
40     try
41     {
42       tmp=super.getCreationTime();
43     }
44     finally
45     {
46       after();
47     }
48
49     return tmp;
50   }
51
52   public String JavaDoc
53     getId()
54     throws RemoteException JavaDoc
55   {
56     String JavaDoc tmp=null;
57
58     before();
59     try
60     {
61       tmp=super.getId();
62     }
63     finally
64     {
65       after();
66     }
67
68     return tmp;
69   }
70
71   public void
72     setLastAccessedTime(long time)
73     throws RemoteException JavaDoc
74   {
75     before();
76     try
77     {
78       super.setLastAccessedTime(time);
79     }
80     finally
81     {
82       after();
83     }
84   }
85
86   public long
87     getLastAccessedTime()
88     throws RemoteException JavaDoc
89   {
90     long tmp=0;
91
92     before();
93     try
94     {
95       tmp=super.getLastAccessedTime();
96     }
97     finally
98     {
99       after();
100     }
101
102     return tmp;
103   }
104
105   public void
106     setMaxInactiveInterval(int interval)
107     throws RemoteException JavaDoc
108   {
109     before();
110     try
111     {
112       super.setMaxInactiveInterval(interval);
113     }
114     finally
115     {
116       after();
117     }
118   }
119
120   public int
121     getMaxInactiveInterval()
122     throws RemoteException JavaDoc
123   {
124     int tmp=0;
125
126     before();
127     try
128     {
129       tmp=super.getMaxInactiveInterval();
130     }
131     finally
132     {
133       after();
134     }
135
136     return tmp;
137   }
138
139   public Object JavaDoc
140     getAttribute(String JavaDoc name)
141     throws RemoteException JavaDoc
142   {
143     Object JavaDoc tmp=null;
144
145     before();
146     try
147     {
148       tmp=super.getAttribute(name);
149     }
150     finally
151     {
152       after();
153     }
154
155     return tmp;
156   }
157
158   public Enumeration JavaDoc
159     getAttributeNameEnumeration()
160     throws RemoteException JavaDoc
161   {
162     Enumeration JavaDoc tmp=null;
163
164     before();
165     try
166     {
167       tmp=super.getAttributeNameEnumeration();
168     }
169     finally
170     {
171       after();
172     }
173
174     return tmp;
175   }
176
177   public String JavaDoc[]
178     getAttributeNameStringArray()
179     throws RemoteException JavaDoc
180   {
181     String JavaDoc[] tmp=null;
182
183     before();
184     try
185     {
186       tmp=super.getAttributeNameStringArray();
187     }
188     finally
189     {
190       after();
191     }
192
193     return tmp;
194   }
195
196   public Object JavaDoc
197     setAttribute(String JavaDoc name, Object JavaDoc value, boolean returnValue)
198     throws RemoteException JavaDoc
199   {
200     Object JavaDoc tmp=null;
201
202     before();
203     try
204     {
205       tmp=super.setAttribute(name, value, returnValue);
206     }
207     finally
208     {
209       after();
210     }
211
212     return tmp;
213   }
214
215   public Object JavaDoc
216     removeAttribute(String JavaDoc name, boolean returnValue)
217     throws RemoteException JavaDoc
218   {
219     Object JavaDoc tmp=null;
220
221     before();
222     try
223     {
224       tmp=super.removeAttribute(name, returnValue);
225     }
226     finally
227     {
228       after();
229     }
230
231     return tmp;
232   }
233
234   public Map JavaDoc
235     getAttributes()
236     throws RemoteException JavaDoc
237   {
238     Map JavaDoc tmp=null;
239
240     before();
241     try
242     {
243       tmp=super.getAttributes();
244     }
245     finally
246     {
247       after();
248     }
249
250     return tmp;
251   }
252
253   public void
254     setAttributes(Map JavaDoc attributes)
255     throws RemoteException JavaDoc
256   {
257     before();
258     try
259     {
260       super.setAttributes(attributes);
261     }
262     finally
263     {
264       after();
265     }
266   }
267 }
268
Popular Tags