01: /*
02: * %W% %E%
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package com.sun.jump.module.preferences;
28:
29: import com.sun.jump.module.JUMPModule;
30:
31: /**
32: * <code>JUMPPreferencesModule</code> provides the ability to maintain a set of
33: * persistent preferences, in the form of key-value pairs. This class can be
34: * viewed as encapsulating a namespace of key-value pairs.
35: *
36: * <p>An implementation is free to commit the set of preferences to permanent
37: * store when it chooses, allowing in-memory caching if necessary. The use of
38: * the <code>save()</code> method is recommended to force persistence of this
39: * JUMPPreferencesModule.
40: *
41: * <p>Preference namespaces retain their contents across runs of the
42: * device. So upon initialization, a JUMPPreferencesModule instance of a given
43: * type name is expected to re-construct its latest known saved state.
44: */
45: public interface JUMPPreferencesModule extends JUMPModule {
46:
47: /**
48: * @param prefName the name of the preference to look up
49: * @return value of the preference
50: */
51: public String getPreference(String prefName);
52:
53: /**
54: * @param prefName the name of the preference to set
55: * @param prefValue the value to set the preference to
56: * @return value of the preference
57: */
58: public String setPreference(String prefName, String prefValue);
59:
60: /**
61: * @param prefName the name of the preference to delete
62: */
63: public void deletePreference(String prefName);
64:
65: /**
66: * @return a list of names of preferences.
67: */
68: public String[] getPreferenceNames();
69:
70: /**
71: * Force persistence of the namespace.
72: */
73: public void save();
74: }
|