[Schmitzm-commits] r1327 - trunk/src/skrueger/geotools/io
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sun Dec 5 18:23:22 CET 2010
Author: alfonx
Date: 2010-12-05 18:23:22 +0100 (Sun, 05 Dec 2010)
New Revision: 1327
Modified:
trunk/src/skrueger/geotools/io/GsServerSettings.java
trunk/src/skrueger/geotools/io/GtDbServerSettings.java
trunk/src/skrueger/geotools/io/GtWfsServerSettings.java
trunk/src/skrueger/geotools/io/ServerSettings.java
Log:
added "isAvailable" to ServerSettings interface
Modified: trunk/src/skrueger/geotools/io/GsServerSettings.java
===================================================================
--- trunk/src/skrueger/geotools/io/GsServerSettings.java 2010-12-01 14:35:53 UTC (rev 1326)
+++ trunk/src/skrueger/geotools/io/GsServerSettings.java 2010-12-05 17:23:22 UTC (rev 1327)
@@ -1,5 +1,7 @@
package skrueger.geotools.io;
+import java.io.IOException;
+import java.net.URL;
import java.util.HashMap;
import java.util.regex.Pattern;
@@ -95,4 +97,15 @@
return serialized.toString();
}
+
+ @Override
+ public boolean isAvailable() {
+ try {
+ new URL(getUrl()).openStream().close();
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
+
+ }
}
Modified: trunk/src/skrueger/geotools/io/GtDbServerSettings.java
===================================================================
--- trunk/src/skrueger/geotools/io/GtDbServerSettings.java 2010-12-01 14:35:53 UTC (rev 1326)
+++ trunk/src/skrueger/geotools/io/GtDbServerSettings.java 2010-12-05 17:23:22 UTC (rev 1327)
@@ -9,6 +9,7 @@
import java.util.regex.Pattern;
import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.geotools.data.postgis.PostgisNGDataStoreFactory;
@@ -37,7 +38,8 @@
* connection into a {@link String} with {@link #toPropertiesString()} and
* re-import the String with {@link #parsePropertiesString(String)}.
*/
-public class GtDbServerSettings extends AbstractGTServerSettings<Object, Object> {
+public class GtDbServerSettings extends
+ AbstractGTServerSettings<Object, Object> {
Logger log = Logger.getLogger(GtDbServerSettings.class);
@@ -465,4 +467,10 @@
+ toString(), e);
}
}
+
+ @Override
+ public boolean isAvailable() {
+ // TODO
+ throw new NotImplementedException("");
+ }
}
\ No newline at end of file
Modified: trunk/src/skrueger/geotools/io/GtWfsServerSettings.java
===================================================================
--- trunk/src/skrueger/geotools/io/GtWfsServerSettings.java 2010-12-01 14:35:53 UTC (rev 1326)
+++ trunk/src/skrueger/geotools/io/GtWfsServerSettings.java 2010-12-05 17:23:22 UTC (rev 1327)
@@ -7,6 +7,7 @@
import java.util.regex.Pattern;
import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.NotImplementedException;
import org.geotools.data.wfs.WFSDataStoreFactory;
import org.jfree.util.Log;
@@ -31,7 +32,8 @@
* connection into a {@link String} with {@link #toPropertiesString()} and
* re-import the String with {@link #parsePropertiesString(String)}.
*/
-public class GtWfsServerSettings extends AbstractGTServerSettings<Object, Object> {
+public class GtWfsServerSettings extends
+ AbstractGTServerSettings<Object, Object> {
public enum Key {
BASE_URL, VERSION
@@ -435,4 +437,10 @@
return (String) get(WFSDataStoreFactory.USERNAME.key);
}
+ @Override
+ public boolean isAvailable() {
+ // TODO
+ throw new NotImplementedException("");
+ }
+
}
Modified: trunk/src/skrueger/geotools/io/ServerSettings.java
===================================================================
--- trunk/src/skrueger/geotools/io/ServerSettings.java 2010-12-01 14:35:53 UTC (rev 1326)
+++ trunk/src/skrueger/geotools/io/ServerSettings.java 2010-12-05 17:23:22 UTC (rev 1327)
@@ -1,6 +1,5 @@
package skrueger.geotools.io;
-
public interface ServerSettings {
public String getTitle();
@@ -8,4 +7,9 @@
public String toPropertiesString();
public boolean parsePropertiesString(String propString);
+
+ /**
+ * @return <code>true</code> is the server seems to be online
+ */
+ public boolean isAvailable();
}
More information about the Schmitzm-commits
mailing list