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

Diff of /branches/2.4.x/src/skrueger/geotools/io/GtDbServerSettings.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1195 by alfonx, Tue Nov 2 10:33:32 2010 UTC revision 1292 by alfonx, Mon Nov 22 10:39:13 2010 UTC
# Line 148  public class DbServerSettings extends Se Line 148  public class DbServerSettings extends Se
148           *         .properties line. @see #parsePropertiesString           *         .properties line. @see #parsePropertiesString
149           * @throws MalformedURLException           * @throws MalformedURLException
150           */           */
151          public static DbServerSettings parsePropertiesString(String propString)          @Override
152            public boolean parsePropertiesString(String propString)
153                          throws MalformedURLException {                          throws MalformedURLException {
154    
155                  if (propString == null || propString.isEmpty())                  if (propString == null || propString.isEmpty())
# Line 158  public class DbServerSettings extends Se Line 159  public class DbServerSettings extends Se
159                          String[] split = propString.split(Pattern.quote(DELIMITER));                          String[] split = propString.split(Pattern.quote(DELIMITER));
160    
161                          int i = 0;                          int i = 0;
162                          DbServerSettings dbServer = new DbServerSettings(                          setDbType(      DbType.valueOf(split[i++]));
163                                          DbType.valueOf(split[i++]));  //                      DbServerSettings dbServer = new DbServerSettings(
164    //                                      DbType.valueOf(split[i++])
165    //                                      );
166    
167                            setTitle(split[i++]);
168                            setHost(split[i++]);
169                            setPort(java.lang.Integer.valueOf(split[i++]));
170                            setUsername(StringUtils.stripToNull(split[i++]));
171                            setPassword(split[i++]);
172                            setDatabase(split[i++]);
173                            setExposePrimaryKey(Boolean.valueOf(split[i++]));
174                            setSchema(stringOrNull(split[i++]));
175    
176                          dbServer.setTitle(split[i++]);                          return true;
                         dbServer.setHost(split[i++]);  
                         dbServer.setPort(java.lang.Integer.valueOf(split[i++]));  
                         dbServer.setUsername(StringUtils.stripToNull(split[i++]));  
                         dbServer.setPassword(split[i++]);  
                         dbServer.setDatabase(split[i++]);  
                         dbServer.setExposePrimaryKey(Boolean.valueOf(split[i++]));  
                         dbServer.setSchema(stringOrNull(split[i++]));  
   
                         return dbServer;  
177                  } catch (Exception e) {                  } catch (Exception e) {
178                          Log.warn("couldn't parse " + propString, e);                          Log.warn("couldn't parse " + propString, e);
179                          return null;                          return false;
180                  }                  }
181          }          }
182    
# Line 182  public class DbServerSettings extends Se Line 185  public class DbServerSettings extends Se
185    
186          public DbServerSettings() {          public DbServerSettings() {
187                  this(DbType.postgis);                  this(DbType.postgis);
188                    
189          }          }
190    
191          public DbServerSettings(DbType dbType) {          public DbServerSettings(DbType dbType) {
# Line 191  public class DbServerSettings extends Se Line 195  public class DbServerSettings extends Se
195                  put(JDBCDataStoreFactory.PK_METADATA_TABLE.key, null);                  put(JDBCDataStoreFactory.PK_METADATA_TABLE.key, null);
196          }          }
197    
198            public DbServerSettings(String propertiesString) {
199                    try {
200                            parsePropertiesString(propertiesString);
201                    } catch (MalformedURLException e) {
202                            throw new RuntimeException(e);
203                    }
204            }
205    
206          public String[] getCachedTypeNames() {          public String[] getCachedTypeNames() {
207                  return cachedTypeNames;                  return cachedTypeNames;
208          }          }

Legend:
Removed from v.1195  
changed lines
  Added in v.1292

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26