Mercurial > dive4elements > gnv-client
changeset 23:b11f941f7eb2
Made ArtifactDatabase URL configurable
gnv/trunk@118 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Wed, 23 Sep 2009 15:29:26 +0000 |
parents | 367a00e4b9ad |
children | ec56ef8f3e58 |
files | gnv/Changelog gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java gnv/src/main/webapp/WEB-INF/web.xml |
diffstat | 4 files changed, 31 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/Changelog Wed Sep 23 15:17:32 2009 +0000 +++ b/gnv/Changelog Wed Sep 23 15:29:26 2009 +0000 @@ -1,3 +1,12 @@ +2009-09-23 Tim Englich <tim.englich@intevation.de> + + * src/main/webapp/WEB-INF/web.xml Edited: + Added Count of ArtifactDatabases and Database-URL to this File + * src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java (ARTIFACTDATABASE_URL_ID) Edited: + Added Static Constants for identifing ArtifactDatabase URLS in PropertiesReader + * src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java (initialize) Edited: + Read ArtifactDatabase URLS from PropertiesReader + 2009-09-23 Tim Englich <tim.englich@intevation.de> * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java (execute) Edited:
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java Wed Sep 23 15:17:32 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java Wed Sep 23 15:29:26 2009 +0000 @@ -19,6 +19,9 @@ public interface ArtifactDatabaseClient { + public final static String ARTIFACTDATABASE_COUNT_ID = "de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.count"; + + public final static String ARTIFACTDATABASE_URL_ID = "de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.url"; /** * Return the Artifactfactories which can be resolved. * @return the Artifactfactories which can be resolved.
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Wed Sep 23 15:17:32 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Wed Sep 23 15:29:26 2009 +0000 @@ -31,6 +31,8 @@ import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory; import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; import de.intevation.gnv.artifactdatabase.objects.InputParameter; +import de.intevation.gnv.propertiesreader.PropertiesReader; +import de.intevation.gnv.propertiesreader.PropertiesReaderFactory; import de.intevation.gnv.util.XMLUtils; /** @@ -174,8 +176,12 @@ private synchronized void initialize(){ if (!initialized){ - this.artifactDatabases = new HashMap<String, String>(); - this.artifactDatabases.put("test", "http://localhost:8181"); // TODO Read from Config + PropertiesReader pr = PropertiesReaderFactory.getInstance().getPropertiesReader(); + int count = Integer.parseInt(pr.getPropertieValue(ARTIFACTDATABASE_COUNT_ID, "0")); + this.artifactDatabases = new HashMap<String, String>(count); + for (int i = 0; i < count ; i++){ + this.artifactDatabases.put(""+(i+1), pr.getPropertieValue(ARTIFACTDATABASE_URL_ID+"."+(i+1), "N/N")); + } initialized = true; }
--- a/gnv/src/main/webapp/WEB-INF/web.xml Wed Sep 23 15:17:32 2009 +0000 +++ b/gnv/src/main/webapp/WEB-INF/web.xml Wed Sep 23 15:29:26 2009 +0000 @@ -9,9 +9,19 @@ <servlet-class>de.intevation.gnv.servlet.GNVActionServlet</servlet-class> <init-param> <param-name>config</param-name> - <!-- --> <param-value>/WEB-INF/config/struts-config.xml</param-value> </init-param> + + <init-param> + <param-name>de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.count</param-name> + <param-value>1</param-value> + </init-param> + + <init-param> + <param-name>de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.url.1</param-name> + <param-value>http://localhost:8181</param-value> + </init-param> + <load-on-startup>1</load-on-startup> </servlet> <!-- Standard Action Servlet Mapping -->