Skip to content

Commit

Permalink
Merge pull request #2 from ernstdevreede/KNMI-FMI-versioned
Browse files Browse the repository at this point in the history
Knmi fmi versioned
  • Loading branch information
ernstdevreede authored Sep 27, 2019
2 parents cdf396d + dbd8b10 commit d23ff65
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 8 deletions.
25 changes: 22 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<description>Aviation weather message conversions - IWXXM module</description>
<groupId>fi.fmi.avi.converter</groupId>
<artifactId>fmi-avi-messageconverter-iwxxm</artifactId>
<version>0.11.1.K-SNAPSHOT</version>
<version>0.11.2.K-SNAPSHOT</version>

<scm>
<connection>${scm-url}</connection>
Expand Down Expand Up @@ -83,7 +83,7 @@
<dependency>
<groupId>fi.fmi.avi.converter</groupId>
<artifactId>fmi-avi-messageconverter</artifactId>
<version>3.6.1-SNAPSHOT</version>
<version>3.6.1.K-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -111,7 +111,26 @@
<artifactId>JAXBNamespacePrefixMapper</artifactId>
<version>2.2.4</version>
</dependency>


<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<scope>compile</scope>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<scope>compile</scope>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<scope>compile</scope>
<version>2.4.0-b180830.0359</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected Document renderXMLDocument(final Object input, final ConversionHints h
"http://icao.int/iwxxm/2.1 http://schemas.wmo.int/iwxxm/2.1.1/iwxxm.xsd http://def.wmo.int/metce/2013 "
+ "http://schemas.wmo.int/metce/1.2/metce.xsd http://def.wmo.int/collect/2014 http://schemas.wmo.int/collect/1.2/collect.xsd "
+ "http://www.opengis.net/samplingSpatial/2.0 http://schemas.opengis.net/samplingSpatial/2.0/spatialSamplingFeature.xsd");
marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", new IWXXMNamespaceContext());
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new IWXXMNamespaceContext());
marshaller.marshal(wrap(input, (Class<Object>) input.getClass()), sw);
return asCleanedUpXML(sw.toString(), hints);
} catch (final JAXBException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ protected static <S> void validateDocument(final S input, final Class<S> clz, fi
final Marshaller marshaller = getJAXBContext().createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation);
marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", new IWXXMNamespaceContext());
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new IWXXMNamespaceContext());

marshaller.setSchema(schemaFactory.newSchema(schemaSources));
marshaller.setEventHandler(eventHandler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import javax.xml.namespace.NamespaceContext;

import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;
import com.sun.xml.bind.marshaller.NamespacePrefixMapper;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,8 @@ public ConversionResult<T> convertMessage(final AIRMET input, final ConversionHi

if (eventHandler.errorsFound()) {
result.setStatus(Status.FAIL);
System.err.println("FAILED in eventhandler");
for (ConversionIssue iss: eventHandler.getResult().getConversionIssues()) {
System.err.println("Validation issue: "+iss.getMessage());
result.addIssue(new ConversionIssue(ConversionIssue.Severity.ERROR, ConversionIssue.Type.OTHER, iss.getMessage()));
}
} else {
result.setConvertedMessage(this.render(airmet, hints));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ public ConversionResult<T> convertMessage(final SIGMET input, final ConversionHi
{
result.setStatus(Status.SUCCESS);
this.updateMessageMetadata(input, result, sigmet);

ConverterValidationEventHandler eventHandler = new ConverterValidationEventHandler(result);
if (input.getSigmetPhenomenon().equals(AviationCodeListUser.AeronauticalSignificantWeatherPhenomenon.VA)) {
this.validateDocument(((VolcanicAshSIGMETType) sigmet), VolcanicAshSIGMETType.class, hints, eventHandler); //TODO true is for debugging: shows
Expand Down

0 comments on commit d23ff65

Please sign in to comment.