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;
15:
16: import org.itsnat.core.ItsNatUserData;
17: import org.itsnat.impl.core.util.UserData;
18: import org.itsnat.impl.core.util.UserDataImpl;
19: import org.itsnat.impl.core.util.UserDataSynchroImpl;
20:
21: /**
22: *
23: * @author jmarranz
24: */
25: public class ItsNatUserDataImpl implements ItsNatUserData {
26: protected UserData userData;
27:
28: /**
29: * Creates a new instance of ItsNatObjectNoSyncImpl
30: */
31: public ItsNatUserDataImpl(boolean sync) {
32: if (sync)
33: this .userData = new UserDataSynchroImpl();
34: else
35: this .userData = null; // Se crea cuando se necesite.
36: }
37:
38: public UserData getUserData() {
39: if (userData == null)
40: this .userData = new UserDataImpl(); // Para ahorrar memoria si no se usa, no está sincronizada
41: return userData;
42: }
43:
44: public boolean containsUserValueName(String name) {
45: return getUserData().containsName(name);
46: }
47:
48: public String[] getUserValueNames() {
49: return getUserData().getUserDataNames();
50: }
51:
52: public Object getUserValue(String name) {
53: return getUserData().getUserData(name);
54: }
55:
56: public Object setUserValue(String name, Object value) {
57: return getUserData().setUserData(name, value);
58: }
59:
60: public Object removeUserValue(String name) {
61: return getUserData().removeUserData(name);
62: }
63:
64: }
|