/[schmitzm]/branches/2.4.x/src/skrueger/geotools/io/GsServerSettings.java
ViewVC logotype

Annotation of /branches/2.4.x/src/skrueger/geotools/io/GsServerSettings.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1312 - (hide annotations)
Sun Nov 28 21:51:04 2010 UTC (14 years, 3 months ago) by alfonx
Original Path: trunk/src/skrueger/geotools/io/GsServerSettings.java
File MIME type: text/plain
File size: 2229 byte(s)
* MailUtil kann jetzt SMTP mail verschicken.
* GP /AS versichen jetzt BugReports per SMTP wenn möglich, sonst über Desktop
1 alfonx 1291 package skrueger.geotools.io;
2    
3     import java.util.HashMap;
4 alfonx 1295 import java.util.regex.Pattern;
5 alfonx 1291
6 alfonx 1295 import org.apache.commons.lang.StringUtils;
7     import org.jfree.util.Log;
8    
9 alfonx 1291 /**
10 alfonx 1295 * This class describes all settings needed to connect to a Geoserver server via
11     * REST configuration. This class extends a {@link HashMap} and contains two
12     * groups of keys:<br/>
13     * The first group of keys, are all keys provided by Geotools to create a WFS <br/>
14 alfonx 1291 * This class can serialize all important parameters needed to define the
15     * connection into a {@link String} with {@link #toPropertiesString()} and
16     * re-import the String with {@link #parsePropertiesString(String)}.
17 alfonx 1312 *
18     * TODO THis is wrong, should not extend AbstractGTServerSettings since it is
19     * not a GeoTools specific server setting
20 alfonx 1291 */
21 alfonx 1295 public class GsServerSettings extends AbstractGTServerSettings<Void, Void> {
22 alfonx 1291
23 alfonx 1295 public GsServerSettings() {
24 alfonx 1291 }
25    
26 alfonx 1295 public GsServerSettings(String s) {
27     super(s);
28     }
29    
30 alfonx 1291 @Override
31 alfonx 1295 public boolean parsePropertiesString(String propString) {
32     if (propString == null || propString.isEmpty())
33     return false;
34     try {
35    
36     String[] split = propString.split(Pattern.quote(DELIMITER));
37    
38     int i = 0;
39     setUrl(split[i++]);
40     setTitle(split[i++]);
41     setUsername(StringUtils.stripToNull(split[i++]));
42     setPassword(split[i++]);
43    
44     return true;
45     } catch (Exception e) {
46     Log.warn("couldn't parse " + propString, e);
47     return false;
48     }
49 alfonx 1291 }
50    
51     String url;
52 alfonx 1295
53 alfonx 1291 public String getUrl() {
54     return url;
55     }
56    
57     public void setUrl(String url) {
58     this.url = url;
59     }
60    
61     public String getUsername() {
62     return username;
63     }
64    
65     public void setUsername(String username) {
66     this.username = username;
67     }
68    
69     public String getPassword() {
70     return password;
71     }
72    
73     public void setPassword(String password) {
74     this.password = password;
75     }
76    
77     String username;
78     String password;
79    
80 alfonx 1295 @Override
81     public String toPropertiesString() {
82     StringBuffer serialized = new StringBuffer(100);
83    
84     serialized.append(getUrl());
85     serialized.append(DELIMITER);
86    
87     serialized.append(getTitle());
88     serialized.append(DELIMITER);
89    
90     serialized.append(getUsername());
91     serialized.append(DELIMITER);
92    
93     serialized.append(getPassword());
94     serialized.append(DELIMITER);
95    
96     return serialized.toString();
97     }
98 alfonx 1291 }

Properties

Name Value
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26