View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  
21  /***
22   * This class provides the Azureus preferences. 
23   */
24  package org.xnap.plugin.azureus;
25  
26  import org.xnap.util.AbstractPluginPreferences;
27  import org.xnap.util.prefs.PortRangeValidator;
28  
29  public class AzureusPreferences extends AbstractPluginPreferences {
30  
31      //--- Constant(s) ---
32  
33      public static final int VERSION = 1;
34  
35      //--- Data field(s) ---
36  
37      //--- Constructor(s) ---
38  
39      public AzureusPreferences()
40      {
41  		super("plugin.azureus", VERSION);
42  
43  		setDefault("autoConnect", "false");
44  		setDefault("connectionTableColumns", 
45  				   "host;status;msgCount;type;uptime");
46  		setDefault("hostCaches", "connect1.gnutellanet.com:6346;connect2.gnutellanet.com:6346;");
47  		setDefault("localPortRange", "6249-6349", new PortRangeValidator());
48      }
49  
50      //--- Method(s) ---
51  
52      public void convert(int oldVersion)
53      {
54  		// nothing to do yet
55      }
56  
57      public boolean getAutoConnect() {
58  		return getBoolean("autoConnect");
59      }
60      
61      public void setAutoConnect(boolean newValue) {
62  		set("autoConnect", newValue);
63      }
64  
65      public String[] getHostCaches() {
66  		return getArray("hostCaches");
67      }
68  
69      public void setHostCaches(String[] newValue) {
70  		set("hostCaches", newValue);
71      }
72  
73      public String getLocalPortRange() {
74          return get("localPortRange");
75      }
76  
77      public void setLocalPortRange(String newValue) {
78  		set("localPortRange", newValue);
79      }
80  
81  }