# HG changeset patch # User Ingo Weinzierl # Date 1267082721 0 # Node ID a72ecacccc91cfd81cbd2ca4d540152bbbd25d13 # Parent d08b9ba148c5320fb067a7c8f27e9572f59766c1 Changed cache initialization so that we can use GNV without using a cache. gnv-artifacts/trunk@708 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d08b9ba148c5 -r a72ecacccc91 gnv-artifacts/ChangeLog --- a/gnv-artifacts/ChangeLog Wed Feb 24 14:30:52 2010 +0000 +++ b/gnv-artifacts/ChangeLog Thu Feb 25 07:25:21 2010 +0000 @@ -1,3 +1,14 @@ +2010-02-25 Ingo Weinzierl + + * src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java: + Better exception handling while cache configuration. The cache is not + initialized, if no cache is configured in conf.xml. There would have been + an exception without having a cache section in conf.xml. Now, it's + possible to use GNV without using a cache. + + * src/main/java/de/intevation/gnv/state/StateBase.java: Changed logger name + from irritating 'GNVArtifactBase' to 'StateBase'. + 2010-02-24 Ingo Weinzierl * src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: diff -r d08b9ba148c5 -r a72ecacccc91 gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java Wed Feb 24 14:30:52 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java Thu Feb 25 07:25:21 2010 +0000 @@ -116,7 +116,7 @@ XPATH_GEOBACKEND_CONFIGURATION); backendConfigurationFile = Config.replaceConfigDir( backendConfigurationFile); - + Properties properties = getProperties(backendConfigurationFile); ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); cpf.initializeConnectionPool(properties); @@ -126,19 +126,12 @@ XPATH_GEOBACKEND_QUERYCONFIGURATION); queryConfigurationFile = Config.replaceConfigDir( queryConfigurationFile); - + Properties queryProperties = getProperties(queryConfigurationFile); QueryContainerFactory qcf = QueryContainerFactory.getInstance(); qcf.initializeQueryContainer(queryProperties); - log.info("Initialisation of the Cache"); - String cacheConfigurationFile = Config.getStringXPath(config, - CACHECONFIGNODEPATH); - cacheConfigurationFile = Config.replaceConfigDir( - cacheConfigurationFile); - - CacheFactory cf = CacheFactory.getInstance(); - cf.initializeCache(cacheConfigurationFile); + configureCache(config); returnValue = new GNVArtifactContext(config); @@ -173,6 +166,23 @@ configureVerticalCrossSectionGroundFillColor(config, context); } + + protected void configureCache(Document config) { + String cacheConfigurationFile = Config.getStringXPath( + config, CACHECONFIGNODEPATH); + + if (cacheConfigurationFile != null + && !cacheConfigurationFile.equals("")) + { + log.info("Initialisation of the Cache"); + cacheConfigurationFile = Config.replaceConfigDir( + cacheConfigurationFile); + + CacheFactory cf = CacheFactory.getInstance(); + cf.initializeCache(cacheConfigurationFile); + } + } + protected void configureVerticalCrossSectionGroundFillColor( Document config, GNVArtifactContext context diff -r d08b9ba148c5 -r a72ecacccc91 gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java Wed Feb 24 14:30:52 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java Thu Feb 25 07:25:21 2010 +0000 @@ -69,7 +69,7 @@ /** * the logger, used to log exceptions and additonaly information */ - private static Logger log = Logger.getLogger(GNVArtifactBase.class); + private static Logger log = Logger.getLogger(StateBase.class); protected final static String MINVALUEFIELDNAME = "minvalue"; protected final static String MAXVALUEFIELDNAME = "maxvalue";