1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.plugin.gift.util;
21
22 import org.xnap.util.AbstractPluginPreferences;
23 import org.xnap.util.prefs.IntValidator;
24
25 public class GiFTPreferences extends AbstractPluginPreferences {
26
27
28
29 private static final int VERSION = 1;
30
31
32
33 private static GiFTPreferences singleton = null;
34
35
36
37 private GiFTPreferences()
38 {
39 super("plugin.gift", VERSION);
40
41 setDefault("daemon", "");
42 setDefault("host", "127.0.0.1");
43 setDefault("port", "1213", new IntValidator(0));
44 setDefault("httpport", "1216", new IntValidator(0));
45 setDefault("autoconnect", "true");
46 setDefault("startDaemon", "false");
47 }
48
49
50
51 public static synchronized GiFTPreferences getInstance() {
52 if (singleton == null) {
53 singleton = new GiFTPreferences();
54 }
55
56 return singleton;
57 }
58
59 public void destroy() {
60 singleton = null;
61 }
62
63 public String getGiftDaemon() {
64 return get("daemon");
65 }
66
67 public void setGiftDaemon(String newValue) {
68 set("daemon", newValue);
69 }
70
71 public String getGiftHost() {
72 return get("host");
73 }
74
75 public void setGiftHost(String newValue) {
76 set("host", newValue);
77 }
78
79 public int getDaemonPort() {
80 return getInt("port");
81 }
82
83 public void setDaemonPort(int newValue) {
84 set("port", newValue);
85 }
86
87 public int getHttpPort() {
88 return getInt("httpport");
89 }
90
91 public void setHttpPort(int newValue) {
92 set("httpport", newValue);
93 }
94
95 public boolean getAutoconnect()
96 {
97 return getBoolean("autoconnect");
98 }
99
100 public void setAutoconnect(boolean newValue)
101 {
102 set("autoconnect", newValue);
103 }
104
105 public boolean getStartDaemon()
106 {
107 return getBoolean("startDaemon");
108 }
109
110 public void setStartDaemon(boolean newValue)
111 {
112 set("startDaemon", newValue);
113 }
114
115 /***
116 * @see xnap.util.AbstractPreferences#convert(int)
117 */
118 public void convert(int oldVersion) {
119
120 }
121
122 }