1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.plugin.overnet.util;
21
22 import org.apache.log4j.Logger;
23 import org.xnap.util.AbstractPluginPreferences;
24 import org.xnap.util.prefs.IntValidator;
25
26 public class OvernetPreferences extends AbstractPluginPreferences
27 {
28
29
30 public static final int VERSION = 1;
31
32
33
34 private static OvernetPreferences instance = null;
35
36 private static Logger logger = Logger.getLogger(OvernetPreferences.class);
37
38
39
40 private OvernetPreferences()
41 {
42 super("plugin.overnet", VERSION);
43
44 setDefault("autoconnect", "true");
45 setDefault("coreCommand", "");
46 setDefault("coreHost", "localhost");
47 setDefault("corePort", "4663", new IntValidator(0));
48 setDefault("commandLineOption", "");
49 setDefault("newDownloadID", "false");
50 setDefault("password", "");
51 setDefault("startCore", "false");
52 setDefault("username", "");
53 setDefault("useCustomCommandLineOption", "false");
54 setDefault("useXNapDownloadDirs", "true");
55 }
56
57
58
59 public static synchronized OvernetPreferences getInstance()
60 {
61 if (instance == null) {
62 instance = new OvernetPreferences();
63 }
64 return instance;
65 }
66
67 public static synchronized void disposeInstance()
68 {
69 instance = null;
70 }
71
72 public void convert(int oldVersion)
73 {
74
75 }
76
77 public boolean getAutoconnect()
78 {
79 return getBoolean("autoconnect");
80 }
81
82 public void setAutoconnect(boolean newValue)
83 {
84 set("autoconnect", newValue);
85 }
86
87 public String getCoreCommand()
88 {
89 return get("coreCommand");
90 }
91
92 public void setCoreCommand(String newValue)
93 {
94 set("coreCommand", newValue);
95 }
96
97 public String getCoreHost()
98 {
99 return get("coreHost");
100 }
101
102 public void setCoreHost(String newValue)
103 {
104 set("coreHost", newValue);
105 }
106
107 public int getCorePort()
108 {
109 return getInt("corePort");
110 }
111
112 public void setCorePort(int newValue)
113 {
114 set("corePort", newValue);
115 }
116
117 public String getCommandLineOption()
118 {
119 return get("commandLineOption");
120 }
121
122 public void setCommandLineOption(String newValue)
123 {
124 set("commandLineOption", newValue);
125 }
126
127 public boolean getNewDownloadID()
128 {
129 return getBoolean("newDownloadID");
130 }
131
132 public void setNewDownloadID(boolean newValue)
133 {
134 set("newDownloadID", newValue);
135 }
136
137 public String getPassword()
138 {
139 return get("password");
140 }
141
142 public void setPassword(String newValue)
143 {
144 set("password", newValue);
145 }
146
147 public boolean getStartCore()
148 {
149 return getBoolean("startCore");
150 }
151
152 public void setStartCore(boolean newValue)
153 {
154 set("startCore", newValue);
155 }
156
157 public boolean getUseCustomCommandLineOption()
158 {
159 return getBoolean("useCustomCommandLineOption");
160 }
161
162 public void setUseCustomCommandLineOption(boolean newValue)
163 {
164 set("useCustomCommandLineOption", newValue);
165 }
166
167 public String getUsername()
168 {
169 return get("username");
170 }
171
172 public void setUsername(String newValue)
173 {
174 set("username", newValue);
175 }
176
177 public boolean getUseXNapDownloadDirs()
178 {
179 return getBoolean("useXNapDownloadDirs");
180 }
181
182 public void setUseXNapDownloadDirs(boolean newValue)
183 {
184 set("useXNapDownloadDirs", newValue);
185 }
186 }