001: // ========================================================================
002: // $Id: AroundInterceptor.java,v 1.4 2004/05/09 20:30:47 gregwilkins Exp $
003: // Copyright 2002-2004 Mort Bay Consulting Pty. Ltd.
004: // ------------------------------------------------------------------------
005: // Licensed under the Apache License, Version 2.0 (the "License");
006: // you may not use this file except in compliance with the License.
007: // You may obtain a copy of the License at
008: // http://www.apache.org/licenses/LICENSE-2.0
009: // Unless required by applicable law or agreed to in writing, software
010: // distributed under the License is distributed on an "AS IS" BASIS,
011: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: // See the License for the specific language governing permissions and
013: // limitations under the License.
014: // ========================================================================
015:
016: package org.mortbay.j2ee.session;
017:
018: //----------------------------------------
019:
020: import java.rmi.RemoteException;
021: import java.util.Enumeration;
022: import java.util.Map;
023:
024: //----------------------------------------
025:
026: public abstract class AroundInterceptor extends StateInterceptor {
027: protected abstract void before();
028:
029: protected abstract void after();
030:
031: public long getCreationTime() throws RemoteException {
032: long tmp = 0;
033:
034: before();
035: try {
036: tmp = super .getCreationTime();
037: } finally {
038: after();
039: }
040:
041: return tmp;
042: }
043:
044: public String getId() throws RemoteException {
045: String tmp = null;
046:
047: before();
048: try {
049: tmp = super .getId();
050: } finally {
051: after();
052: }
053:
054: return tmp;
055: }
056:
057: public void setLastAccessedTime(long time) throws RemoteException {
058: before();
059: try {
060: super .setLastAccessedTime(time);
061: } finally {
062: after();
063: }
064: }
065:
066: public long getLastAccessedTime() throws RemoteException {
067: long tmp = 0;
068:
069: before();
070: try {
071: tmp = super .getLastAccessedTime();
072: } finally {
073: after();
074: }
075:
076: return tmp;
077: }
078:
079: public void setMaxInactiveInterval(int interval)
080: throws RemoteException {
081: before();
082: try {
083: super .setMaxInactiveInterval(interval);
084: } finally {
085: after();
086: }
087: }
088:
089: public int getMaxInactiveInterval() throws RemoteException {
090: int tmp = 0;
091:
092: before();
093: try {
094: tmp = super .getMaxInactiveInterval();
095: } finally {
096: after();
097: }
098:
099: return tmp;
100: }
101:
102: public Object getAttribute(String name) throws RemoteException {
103: Object tmp = null;
104:
105: before();
106: try {
107: tmp = super .getAttribute(name);
108: } finally {
109: after();
110: }
111:
112: return tmp;
113: }
114:
115: public Enumeration getAttributeNameEnumeration()
116: throws RemoteException {
117: Enumeration tmp = null;
118:
119: before();
120: try {
121: tmp = super .getAttributeNameEnumeration();
122: } finally {
123: after();
124: }
125:
126: return tmp;
127: }
128:
129: public String[] getAttributeNameStringArray()
130: throws RemoteException {
131: String[] tmp = null;
132:
133: before();
134: try {
135: tmp = super .getAttributeNameStringArray();
136: } finally {
137: after();
138: }
139:
140: return tmp;
141: }
142:
143: public Object setAttribute(String name, Object value,
144: boolean returnValue) throws RemoteException {
145: Object tmp = null;
146:
147: before();
148: try {
149: tmp = super .setAttribute(name, value, returnValue);
150: } finally {
151: after();
152: }
153:
154: return tmp;
155: }
156:
157: public Object removeAttribute(String name, boolean returnValue)
158: throws RemoteException {
159: Object tmp = null;
160:
161: before();
162: try {
163: tmp = super .removeAttribute(name, returnValue);
164: } finally {
165: after();
166: }
167:
168: return tmp;
169: }
170:
171: public Map getAttributes() throws RemoteException {
172: Map tmp = null;
173:
174: before();
175: try {
176: tmp = super .getAttributes();
177: } finally {
178: after();
179: }
180:
181: return tmp;
182: }
183:
184: public void setAttributes(Map attributes) throws RemoteException {
185: before();
186: try {
187: super.setAttributes(attributes);
188: } finally {
189: after();
190: }
191: }
192: }
|