01: /*
02: ItsNat Java Web Application Framework
03: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
04: Author: Jose Maria Arranz Santamaria
05:
06: This program is free software: you can redistribute it and/or modify
07: it under the terms of the GNU Affero General Public License as published by
08: the Free Software Foundation, either version 3 of the License, or
09: (at your option) any later version. See the GNU Affero General Public
10: License for more details. See the copy of the GNU Affero General Public License
11: included in this program. If not, see <http://www.gnu.org/licenses/>.
12: */
13:
14: package org.itsnat.impl.core.util;
15:
16: /**
17: *
18: * @author jmarranz
19: */
20: public class UserDataSynchroImpl implements UserData {
21: protected UserDataImpl userData;
22:
23: /** Creates a new instance of UserDataSynchroImpl */
24: public UserDataSynchroImpl() {
25: }
26:
27: private UserDataImpl getInternalUserData() {
28: // Es llamado siempre por métodos sincronizados, no hay problema de hilos
29: if (userData == null)
30: this .userData = new UserDataImpl(); // Para ahorrar memoria si no se usa
31: return userData;
32: }
33:
34: public synchronized String[] getUserDataNames() {
35: UserDataImpl userData = getInternalUserData();
36: return userData.getUserDataNames();
37: }
38:
39: public synchronized boolean containsName(String name) {
40: UserDataImpl userData = getInternalUserData();
41: return userData.containsName(name);
42: }
43:
44: public synchronized Object getUserData(String name) {
45: UserDataImpl userData = getInternalUserData();
46: return userData.getUserData(name);
47: }
48:
49: public synchronized Object setUserData(String name, Object value) {
50: UserDataImpl userData = getInternalUserData();
51: return userData.setUserData(name, value);
52: }
53:
54: public synchronized Object removeUserData(String name) {
55: UserDataImpl userData = getInternalUserData();
56: return userData.removeUserData(name);
57: }
58:
59: }
|