Skip to content

Commit d944b02

Browse files
committed
Fixed Godiva3 GWT compilation issues
1 parent c5d08c7 commit d944b02

File tree

7 files changed

+90
-79
lines changed

7 files changed

+90
-79
lines changed

docs/images/palettes.png

9.31 KB
Loading

pom.xml

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
35
<modelVersion>4.0.0</modelVersion>
46
<groupId>uk.ac.rdg.resc</groupId>
57
<artifactId>ncWMS</artifactId>
6-
<version>2.4.3-SNAPSHOT</version>
8+
<version>2.5.0-SNAPSHOT</version>
79

810
<properties>
911
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10-
<gwt.version>2.7.0</gwt.version>
12+
<gwt.version>2.8.2</gwt.version>
1113
<winstone.version>0.9.10</winstone.version>
12-
<edal.version>1.4.3-SNAPSHOT</edal.version>
14+
<edal.version>1.5.0-SNAPSHOT</edal.version>
1315
<resc.url>http://www.met.reading.ac.uk/resc/home/</resc.url>
1416
</properties>
1517

@@ -32,7 +34,8 @@
3234
full details).</comments>
3335
</license>
3436
</licenses>
35-
<!-- groupId, developers and build sections are all inherited by child modules -->
37+
<!-- groupId, developers and build sections are all inherited by child
38+
modules -->
3639
<developers>
3740
<developer>
3841
<name>Guy Griffiths</name>
@@ -63,6 +66,18 @@
6366
<artifactId>edal-godiva</artifactId>
6467
<version>${edal.version}</version>
6568
</dependency>
69+
<dependency>
70+
<groupId>com.google.gwt</groupId>
71+
<artifactId>gwt-dev</artifactId>
72+
<version>${gwt.version}</version>
73+
<scope>provided</scope>
74+
<exclusions>
75+
<exclusion>
76+
<groupId>xml-apis</groupId>
77+
<artifactId>xml-apis</artifactId>
78+
</exclusion>
79+
</exclusions>
80+
</dependency>
6681
<dependency>
6782
<groupId>com.google.gwt</groupId>
6883
<artifactId>gwt-user</artifactId>
@@ -104,6 +119,12 @@
104119
<groupId>com.google.gwt</groupId>
105120
<artifactId>gwt-codeserver</artifactId>
106121
<version>${gwt.version}</version>
122+
<exclusions>
123+
<exclusion>
124+
<groupId>com.google.gwt</groupId>
125+
<artifactId>gwt-dev</artifactId>
126+
</exclusion>
127+
</exclusions>
107128
<scope>provided</scope>
108129
</dependency>
109130
<dependency>
@@ -123,21 +144,6 @@
123144
<build>
124145
<finalName>ncWMS2</finalName>
125146
<plugins>
126-
<plugin>
127-
<groupId>org.codehaus.mojo</groupId>
128-
<artifactId>gwt-maven-plugin</artifactId>
129-
<version>${gwt.version}</version>
130-
<executions>
131-
<execution>
132-
<goals>
133-
<goal>compile</goal>
134-
</goals>
135-
</execution>
136-
</executions>
137-
<configuration>
138-
<inplace>true</inplace>
139-
</configuration>
140-
</plugin>
141147
<plugin>
142148
<artifactId>maven-war-plugin</artifactId>
143149
<version>2.2</version>
@@ -162,21 +168,23 @@
162168
<configuration>
163169
<cmdLineOptions>
164170
<property>
165-
<!-- This gives no-password access to the admin interface, which is what we want when running as a local standalone application -->
171+
<!-- This gives no-password access to the admin
172+
interface, which is what we want when running as a local standalone application -->
166173
<name>realmClassName</name>
167174
<value>uk.ac.rdg.resc.edal.ncwms.StandaloneAuthentication</value>
168175
</property>
169176
</cmdLineOptions>
170177
</configuration>
171178
</plugin>
172179
<plugin>
173-
<!-- Sets the source version to 1.7 -->
180+
<!-- Sets the source version to Java 11 -->
174181
<artifactId>maven-compiler-plugin</artifactId>
175182
<configuration>
176-
<source>1.8</source>
177-
<target>1.8</target>
183+
<source>11</source>
184+
<target>11</target>
185+
<strict>true</strict>
178186
</configuration>
179-
<version>2.5.1</version>
187+
<version>3.8.1</version>
180188
</plugin>
181189
<plugin>
182190
<groupId>org.sonatype.plugins</groupId>
@@ -204,12 +212,15 @@
204212
<artifactId>maven-javadoc-plugin</artifactId>
205213
<version>2.10.3</version>
206214
<configuration>
207-
<!-- Output the apidocs to the base directory. These are ignored in .gitignore for most branches, but NOT in the gh-pages branch. This makes documentation deployment very simple -->
215+
<!-- Output the apidocs to the base directory. These
216+
are ignored in .gitignore for most branches, but NOT in the gh-pages branch.
217+
This makes documentation deployment very simple -->
208218
<reportOutputDirectory>${project.basedir}</reportOutputDirectory>
209219
</configuration>
210220
</plugin>
211221
<plugin>
212-
<!-- On package, generate an image containing all of the palettes for the documentation -->
222+
<!-- On package, generate an image containing all of the
223+
palettes for the documentation -->
213224
<groupId>org.codehaus.mojo</groupId>
214225
<artifactId>exec-maven-plugin</artifactId>
215226
<version>1.5.0</version>
@@ -237,6 +248,16 @@
237248
</dependency>
238249
</dependencies>
239250
</plugin>
251+
<plugin>
252+
<groupId>net.ltgt.gwt.maven</groupId>
253+
<artifactId>gwt-maven-plugin</artifactId>
254+
<version>1.0.0</version>
255+
<extensions>true</extensions>
256+
<configuration>
257+
<moduleName>uk.ac.rdg.resc.edal.ncwms.Godiva3</moduleName>
258+
<webappDirectory>src/main/webapp</webappDirectory>
259+
</configuration>
260+
</plugin>
240261
</plugins>
241262
<resources>
242263
<resource>
@@ -365,7 +386,10 @@
365386
<version>2.10.3</version>
366387
<configuration>
367388
<goal>javadoc:aggregate</goal>
368-
<!-- These links really belong in the child POMs but if we put them there, they don't seem to get picked up when building the javadoc for the aggregated project. Therefore if the versions of any of the dependencies change these links will also have to be updated. -->
389+
<!-- These links really belong in the child POMs but
390+
if we put them there, they don't seem to get picked up when building the
391+
javadoc for the aggregated project. Therefore if the versions of any of the
392+
dependencies change these links will also have to be updated. -->
369393
<links>
370394
<link>http://java.sun.com/j2se/1.6.0/docs/api/</link>
371395
<link>http://joda-time.sourceforge.net/api-2.0/</link>

src/main/java/uk/ac/rdg/resc/edal/ncwms/NcwmsCatalogue.java

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
package uk.ac.rdg.resc.edal.ncwms;
3030

3131
import java.io.IOException;
32+
import java.lang.reflect.InvocationTargetException;
3233

3334
import net.sf.ehcache.Cache;
3435
import net.sf.ehcache.Element;
@@ -91,15 +92,12 @@ public NcwmsCatalogue(NcwmsConfig config) throws IOException {
9192
/*
9293
* Configure cache
9394
*/
94-
CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME,
95-
cacheInfo.getNumberOfDatasets())
96-
.memoryStoreEvictionPolicy(EVICTION_POLICY)
97-
.persistence(new PersistenceConfiguration()
98-
.strategy(PERSISTENCE_STRATEGY))
99-
.transactionalMode(TRANSACTIONAL_MODE);
95+
CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME, cacheInfo.getNumberOfDatasets())
96+
.memoryStoreEvictionPolicy(EVICTION_POLICY)
97+
.persistence(new PersistenceConfiguration().strategy(PERSISTENCE_STRATEGY))
98+
.transactionalMode(TRANSACTIONAL_MODE);
10099
if (cacheInfo.getElementLifetimeMinutes() > 0) {
101-
cacheConfig.setTimeToLiveSeconds(
102-
(long) (cacheInfo.getElementLifetimeMinutes() * 60));
100+
cacheConfig.setTimeToLiveSeconds((long) (cacheInfo.getElementLifetimeMinutes() * 60));
103101
} else {
104102
cacheConfig.eternal(true);
105103
}
@@ -112,8 +110,8 @@ public NcwmsCatalogue(NcwmsConfig config) throws IOException {
112110
}
113111

114112
/**
115-
* @return The NcwmsConfig object used by this catalogue. Package-private
116-
* since this should not be accessed by external users
113+
* @return The NcwmsConfig object used by this catalogue. Package-private since
114+
* this should not be accessed by external users
117115
*/
118116
public NcwmsConfig getConfig() {
119117
return (NcwmsConfig) super.getConfig();
@@ -126,15 +124,12 @@ public void updateDynamicDatasetCache(NcwmsDynamicCacheInfo cacheInfo) {
126124
/*
127125
* Create cache
128126
*/
129-
CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME,
130-
cacheInfo.getNumberOfDatasets())
131-
.memoryStoreEvictionPolicy(EVICTION_POLICY)
132-
.persistence(
133-
new PersistenceConfiguration().strategy(PERSISTENCE_STRATEGY))
134-
.transactionalMode(TRANSACTIONAL_MODE);
127+
CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME, cacheInfo.getNumberOfDatasets())
128+
.memoryStoreEvictionPolicy(EVICTION_POLICY)
129+
.persistence(new PersistenceConfiguration().strategy(PERSISTENCE_STRATEGY))
130+
.transactionalMode(TRANSACTIONAL_MODE);
135131
if (cacheInfo.getElementLifetimeMinutes() > 0) {
136-
cacheConfig
137-
.setTimeToLiveSeconds((long) (cacheInfo.getElementLifetimeMinutes() * 60));
132+
cacheConfig.setTimeToLiveSeconds((long) (cacheInfo.getElementLifetimeMinutes() * 60));
138133
} else {
139134
cacheConfig.eternal(true);
140135
}
@@ -150,8 +145,7 @@ public void updateDynamicDatasetCache(NcwmsDynamicCacheInfo cacheInfo) {
150145
} else {
151146
dynamicDatasetCache.getCacheConfiguration().eternal(true);
152147
}
153-
dynamicDatasetCache.getCacheConfiguration()
154-
.setMaxEntriesInCache(cacheInfo.getNumberOfDatasets());
148+
dynamicDatasetCache.getCacheConfiguration().setMaxEntriesInCache(cacheInfo.getNumberOfDatasets());
155149
}
156150
}
157151

@@ -180,17 +174,16 @@ public Dataset getDatasetFromId(String datasetId) {
180174
return dataset;
181175
} else {
182176
/*
183-
* We may have a dynamic dataset. First check the dynamic dataset
184-
* cache.
177+
* We may have a dynamic dataset. First check the dynamic dataset cache.
185178
*/
186179
Element element = dynamicDatasetCache.get(datasetId);
187180
if (element != null && element.getObjectValue() != null) {
188181
return (Dataset) element.getObjectValue();
189182
}
190183

191184
/*
192-
* Check to see if we have a dynamic service defined which this
193-
* dataset ID can map to
185+
* Check to see if we have a dynamic service defined which this dataset ID can
186+
* map to
194187
*/
195188
NcwmsDynamicService dynamicService = getDynamicServiceFromLayerName(datasetId);
196189
if (dynamicService == null || dynamicService.isDisabled()) {
@@ -209,8 +202,8 @@ public Dataset getDatasetFromId(String datasetId) {
209202
String datasetPath = datasetId.substring(dynamicService.getAlias().length() + 1);
210203

211204
/*
212-
* Check if we allow this path or if it is disallowed by the dynamic
213-
* dataset regex
205+
* Check if we allow this path or if it is disallowed by the dynamic dataset
206+
* regex
214207
*/
215208
if (!dynamicService.getIdMatchPattern().matcher(datasetPath).matches()) {
216209
return null;
@@ -223,8 +216,7 @@ public Dataset getDatasetFromId(String datasetId) {
223216
title = title.substring(1);
224217

225218
try {
226-
DatasetFactory datasetFactory = DatasetFactory
227-
.forName(dynamicService.getDataReaderClass());
219+
DatasetFactory datasetFactory = DatasetFactory.forName(dynamicService.getDataReaderClass());
228220
Dataset dynamicDataset = datasetFactory.createDataset(datasetId, datasetUrl);
229221
/*
230222
* Store in the cache
@@ -233,8 +225,9 @@ public Dataset getDatasetFromId(String datasetId) {
233225
dynamicDatasetCache.put(new Element(datasetId, dynamicDataset));
234226
}
235227
return dynamicDataset;
236-
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException
237-
| IOException | EdalException e) {
228+
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException
229+
| EdalException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
230+
| SecurityException e) {
238231
/*
239232
* TODO log error
240233
*/
@@ -250,11 +243,11 @@ public EnhancedVariableMetadata getLayerMetadata(final VariableMetadata variable
250243
return super.getLayerMetadata(variableMetadata);
251244
} catch (EdalLayerNotFoundException e) {
252245
/*
253-
* The layer is not defined in the XmlDataCatalogue. However, we may
254-
* still have a dynamic dataset
246+
* The layer is not defined in the XmlDataCatalogue. However, we may still have
247+
* a dynamic dataset
255248
*/
256-
final String layerName = getLayerNameMapper()
257-
.getLayerName(variableMetadata.getDataset().getId(), variableMetadata.getId());
249+
final String layerName = getLayerNameMapper().getLayerName(variableMetadata.getDataset().getId(),
250+
variableMetadata.getId());
258251

259252
final NcwmsDynamicService dynamicService = getDynamicServiceFromLayerName(layerName);
260253
if (dynamicService == null) {
@@ -276,8 +269,8 @@ public String getTitle() {
276269

277270
@Override
278271
public PlottingStyleParameters getDefaultPlottingParameters() {
279-
return new PlottingStyleParameters(null, ColourPalette.DEFAULT_PALETTE_NAME,
280-
null, null, null, false, ColourPalette.MAX_NUM_COLOURS, 1f);
272+
return new PlottingStyleParameters(null, ColourPalette.DEFAULT_PALETTE_NAME, null, null, null,
273+
false, ColourPalette.MAX_NUM_COLOURS, 1f);
281274
}
282275

283276
@Override
@@ -321,8 +314,7 @@ private NcwmsDynamicService getDynamicServiceFromLayerName(String layerName) {
321314
dynamicService = testDynamicService;
322315
}
323316
}
324-
if (dynamicService == null
325-
|| !dynamicService.getIdMatchPattern().matcher(layerName).matches()) {
317+
if (dynamicService == null || !dynamicService.getIdMatchPattern().matcher(layerName).matches()) {
326318
return null;
327319
}
328320
return dynamicService;
@@ -346,8 +338,7 @@ public String getDatasetTitle(String datasetId) {
346338
} else if (getDynamicServiceFromLayerName(datasetId) != null) {
347339
return "Dynamic service from " + datasetId;
348340
} else {
349-
throw new EdalLayerNotFoundException(
350-
datasetId + " does not refer to an existing dataset");
341+
throw new EdalLayerNotFoundException(datasetId + " does not refer to an existing dataset");
351342
}
352343
}
353344

@@ -404,11 +395,9 @@ public boolean isDisabled(String layerName) {
404395
}
405396

406397
private VariableConfig getXmlVariable(String layerName) {
407-
DatasetConfig datasetInfo = config
408-
.getDatasetInfo(getLayerNameMapper().getDatasetIdFromLayerName(layerName));
398+
DatasetConfig datasetInfo = config.getDatasetInfo(getLayerNameMapper().getDatasetIdFromLayerName(layerName));
409399
if (datasetInfo != null) {
410-
return datasetInfo
411-
.getVariableById(getLayerNameMapper().getVariableIdFromLayerName(layerName));
400+
return datasetInfo.getVariableById(getLayerNameMapper().getVariableIdFromLayerName(layerName));
412401
} else {
413402
return null;
414403
}

src/main/java/uk/ac/rdg/resc/edal/ncwms/NcwmsServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import org.slf4j.Logger;
4343
import org.slf4j.LoggerFactory;
4444

45-
import uk.ac.rdg.resc.edal.ncwms.config.NcwmsConfig;
45+
import uk.ac.rdg.resc.edal.catalogue.jaxb.CatalogueConfig;
4646
import uk.ac.rdg.resc.edal.util.GISUtils;
4747
import uk.ac.rdg.resc.edal.wms.RequestParams;
4848
import uk.ac.rdg.resc.edal.wms.WmsCatalogue;
@@ -70,7 +70,7 @@ public NcwmsServlet() {
7070
@Override
7171
public void destroy() {
7272
super.destroy();
73-
NcwmsConfig.shutdown();
73+
CatalogueConfig.shutdown();
7474
GISUtils.releaseEpsgDatabase();
7575
}
7676

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<module rename-to='godiva3'>
3-
<!-- <inherits name='com.google.gwt.user.User' /> -->
43
<inherits name='uk.ac.rdg.resc.godiva.Godiva' />
54

65
<!-- Specify the app entry point class. -->
76
<entry-point class='uk.ac.rdg.resc.godiva.client.Godiva' />
8-
97
</module>

src/test/java/uk/ac/rdg/resc/edal/ncwms/config/NcwmsConfigTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
import org.junit.Before;
4242
import org.junit.Test;
43-
import org.xml.sax.SAXException;
4443

4544
import uk.ac.rdg.resc.edal.catalogue.jaxb.CacheInfo;
4645
import uk.ac.rdg.resc.edal.catalogue.jaxb.DatasetConfig;
@@ -122,7 +121,7 @@ public void testSerialise() throws JAXBException {
122121
}
123122

124123
// @Test
125-
public void testDeserialise() throws JAXBException, SAXException, FileNotFoundException {
124+
public void testDeserialise() throws JAXBException, FileNotFoundException {
126125
NcwmsConfig deserialise = NcwmsConfig.deserialise(new StringReader(XML));
127126
// NcwmsConfig deserialise = NcwmsConfig.deserialise(new FileReader(new File(
128127
// "/home/guy/.ncWMS2/config.xml")));

0 commit comments

Comments
 (0)