diff --git a/.gitignore b/.gitignore index 724be690c0..f7a12deb76 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ pom.xml.next release.properties .externalToolBuilders extensions/do/core/configuration.db +**.*~ +*.tern-project diff --git a/NOTICE b/NOTICE index 3afb5a99f4..9cfcc0d224 100644 --- a/NOTICE +++ b/NOTICE @@ -4,19 +4,26 @@ Licensed under GNU General Public License, Version 2.0 This project includes: + 52North Sensor Web Client PDF report structure under GNU GENERAL PUBLIC LICENSE Version 2, June 1991 52North SOS Integration and Compliance 2.0 under Eclipse Public License 1.0 52North SOS Integration and Compliance Common under Eclipse Public License 1.0 52°North Aggregated Third Party modules under GPLv2 + 52°North AQD - 1.0 XML Coding under GPLv2 52°North Sensor Observation Service under GPLv2 52°North SOS - 2.0 XML Request Coding under GPLv2 + 52°North SOS - Abstract Identifier Modifier Modules under GPLv2 52°North SOS - Abstract SensorML Coding Module under GPLv2 52°North SOS - Administrator Service Operator under GPLv2 + 52°North SOS - AQD 1.0 API Operator under GPLv2 + 52°North SOS - AQD 1.0 Core Profile Operator under GPLv2 + 52°North SOS - AQD Split and Merge observations module under GPLv2 52°North SOS - Binding Modules under GPLv2 52°North SOS - Cache under GPLv2 52°North SOS - Coding Modules under GPLv2 52°North SOS - Converter Modules under GPLv2 52°North SOS - Coordinate transformation module under GPLv2 52°North SOS - Core Modules under GPLv2 + 52°North SOS - eReporting Prefixed identifier convert module under GPLv2 52°North SOS - EXI Coding under GPLv2 52°North SOS - EXI Efficient XML Interchange Binding under GPLv2 52°North SOS - Extension Delete Observation under GPLv2 @@ -25,6 +32,8 @@ This project includes: 52°North SOS - Extension Delete Observation - KVP under GPLv2 52°North SOS - Extension Delete Observation - Operation under GPLv2 52°North SOS - Extension Delete Observation - XML under GPLv2 + 52°North SOS - Extension for AQD under GPLv2 + 52°North SOS - Extension for AQD coding under GPLv2 52°North SOS - Extension for Inspire - Code Module under GPLv2 52°North SOS - Extension GetDataAvailability under GPLv2 52°North SOS - Extension GetDataAvailability - Hibernate DAO under GPLv2 @@ -33,6 +42,7 @@ This project includes: 52°North SOS - Extension REST Binding under GPLv2 52°North SOS - Extension REST Binding - Core under GPLv2 52°North SOS - Extension REST Binding - XML under GPLv2 + 52°North SOS - Flexible identifier convert module under GPLv2 52°North SOS - GetCapabilities DAO under GPLv2 52°North SOS - Hibernate Common under GPLv2 52°North SOS - Hibernate Common Datasource under GPLv2 @@ -48,6 +58,7 @@ This project includes: 52°North SOS - Hibernate Postgres/PostGIS Datasource under GPLv2 52°North SOS - Hibernate Session Factory under GPLv2 52°North SOS - Hibernate SQL Server Datasource under GPLv2 + 52°North SOS - Identifier Modifier Modules under GPLv2 52°North SOS - JSON Binding under GPLv2 52°North SOS - JSON Coding under GPLv2 52°North SOS - JSON Common under GPLv2 @@ -55,6 +66,7 @@ This project includes: 52°North SOS - Operation Request Operators under GPLv2 52°North SOS - OWS 1.1.0 XML Request Coding under GPLv2 52°North SOS - POX Binding under GPLv2 + 52°North SOS - Prefixed identifier convert module under GPLv2 52°North SOS - Profile Coding Module under GPLv2 52°North SOS - Profile Module under GPLv2 52°North SOS - Profile XmlBeans Module under GPLv2 @@ -65,10 +77,12 @@ This project includes: 52°North SOS - SOS 1.0.0 XML Request Coding under GPLv2 52°North SOS - SOS 2.0 Core Profile Operator under GPLv2 52°North SOS - SOS 2.0 Enhanced Profile Operator under GPLv2 + 52°North SOS - SOS 2.0 eReporting Extension under GPLv2 52°North SOS - SOS 2.0 Inspire extension under GPLv2 52°North SOS - SOS 2.0 Result Handling Profile Operator under GPLv2 52°North SOS - SOS 2.0 Transactional Profile Operator under GPLv2 52°North SOS - SOS API Module under GPLv2 + 52°North SOS - Split and Merge observations module under GPLv2 52°North SOS - SQLite Configuration under GPLv2 52°North SOS - Test Module under GPLv2 52°North SOS - WaterML 2.0 XML Coding under GPLv2 @@ -79,11 +93,31 @@ This project includes: 52°North SOS - Web Modules under GPLv2 52°North SOS - Web Views under GPLv2 52°North SOS - Webapp under GPLv2 + 52°North SOS - Webapp with Sensor Web REST API under GPLv2 52°North Third Party - NCName resolver under BSD 2-clause "Simplified" or "FreeBSD" License AntLR Parser Generator under BSD License AOP alliance under Public Domain + Apache FOP under The Apache Software License, Version 2.0 + Apache XML Graphics Commons under The Apache Software License, Version 2.0 API interfaces under Lesser General Public License (LGPL) + Avalon Framework API under The Apache Software License, Version 2.0 + Avalon Framework Implementation under The Apache Software License, Version 2.0 + Batik animation engine under The Apache Software License, Version 2.0 + Batik AWT utilities under The Apache Software License, Version 2.0 + Batik bridge classes under The Apache Software License, Version 2.0 + Batik CSS engine under The Apache Software License, Version 2.0 + Batik DOM implementation under The Apache Software License, Version 2.0 + Batik extension classes under The Apache Software License, Version 2.0 + Batik external code under The Apache Software License, Version 2.0 + Batik GVT (Graphics Vector Tree) under The Apache Software License, Version 2.0 + Batik Java2D SVG generator under The Apache Software License, Version 2.0 + Batik scripting language classes under The Apache Software License, Version 2.0 + Batik SVG DOM implementation under The Apache Software License, Version 2.0 + Batik SVG microsyntax parser library under The Apache Software License, Version 2.0 + Batik SVG transcoder classes under The Apache Software License, Version 2.0 + Batik utility library under The Apache Software License, Version 2.0 + Batik XML utility library under The Apache Software License, Version 2.0 c3p0 under GNU Lesser General Public License, Version 2.1 or Eclipse Public License, Version 1.0 ClassLoader leak prevention under Apache 2 Commons Codec under The Apache Software License, Version 2.0 @@ -113,17 +147,23 @@ This project includes: Jackson-annotations under The Apache Software License, Version 2.0 or GNU Lesser General Public License, Version 2.1 Jackson-core under The Apache Software License, Version 2.0 or GNU Lesser General Public License, Version 2.1 jackson-databind under The Apache Software License, Version 2.0 or GNU Lesser General Public License, Version 2.1 + jackson-module-jsonSchema under The Apache Software License, Version 2.0 or GNU Lesser General Public License, Version 2.1 Java Advanced Imaging under Java Advanced Imaging Distribution License, http://download.java.net/media/jai/builds/release/1_1_3/LICENSE-jai.txt Java Annotation Indexer under AL 2.0 + Java Excel API under GNU Lesser General Public License Java Persistence API, Version 2.1 under Eclipse Public License (EPL), Version 1.0 or Eclipse Distribution License (EDL), Version 1.0 Java Property Utility under The Apache Software License, Version 2.0 Java Transaction API under Common Development and Distribution License or GNU General Public License, Version 2 with the Classpath Exception JavaBeans Activation Framework (JAF) under Common Development and Distribution License (CDDL) v1.0 JavaMail API jar under CDDL or GPLv2+CE + JavaScript SOS Client under GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Javassist under MPL 1.1 or LGPL 2.1 or Apache License 2.0 JBoss Logging 3 under Apache License, version 2.0 JBoss Logging I18n Annotations under Public Domain JCL 1.1.1 implemented over SLF4J under MIT License + jcommon under GNU Lesser General Public Licence + jdom under JDOM license (Apache style), https://github.com/hunterhacker/jdom/blob/master/LICENSE.txt + jfreechart under GNU Lesser General Public Licence jgridshift under GNU Lesser General Public License, version 2.0 (LGPLv2) Joda-Time under Apache 2 JOpt Simple under The MIT License @@ -137,6 +177,7 @@ This project includes: Log4j Implemented Over SLF4J under Apache Software Licenses Logback Classic Module under Eclipse Public License - v 1.0 or GNU Lesser General Public License Logback Core Module under Eclipse Public License - v 1.0 or GNU Lesser General Public License + Main module under Lesser General Public License (LGPL) mchange-commons-java library under GNU Lesser General Public License, Version 2.1 or Eclipse Public License, Version 1.0 Metadata under Lesser General Public License (LGPL) Mockito under The MIT License @@ -173,6 +214,10 @@ This project includes: Referencing services under Lesser General Public License (LGPL) Reflections under WTFPL SaxonB under Mozilla Public License Version 1.0 + Sensor Web Timeseries API - IO under GNU General Public License, Version 2.0 + Sensor Web Timeseries API - REST Binding under GNU General Public License, Version 2.0 + Sensor Web Timeseries API - SPI under GNU General Public License, Version 2.0 + Sensor Web Timeseries API - SPI Impl DAO under GNU General Public License, Version 2.0 servlet-api under CDDL 1.1 or GPL2 w/ CPE SLF4J API Module under MIT License Spring AOP under The Apache Software License, Version 2.0 @@ -195,12 +240,14 @@ This project includes: SQLite JDBC under The Apache Software License, Version 2.0 sqljdbc4 under MICROSOFT SOFTWARE LICENSE TERMS, http://download.microsoft.com/download/0/2/A/02AAE597-3865-456C-AE7F-613F99F850A8/license.txt StAX API under The Apache Software License, Version 2.0 - vecmath under GNU General Public License (GPL), version 2, with the CLASSPATH exception + vecmath under GPL 2.0 license w/ CPE W3C SOAP specification recommondation (v1.2 part 1) under The Apache Software License, Version 2.0 W3C WS-Addressing specification schemas (v1.0) under The Apache Software License, Version 2.0 W3C xlink schema (spec. v1.1.0) under The Apache Software License, Version 2.0 - Xerces2-j under The Apache Software License, Version 2.0 - XML Commons External Components XML APIs under The Apache Software License, Version 2.0 or The SAX License or The W3C License + xalan under The Apache Software License, Version 2.0 + Xerces2 Java Parser under The Apache Software License, Version 2.0 + XML Commons External Components XML APIs under The Apache Software License, Version 2.0 + XML Commons External Components XML APIs Extensions under The Apache Software License, Version 2.0 XmlBeans under The Apache Software License, Version 2.0 XmlBeansXPath under The Apache Software License, Version 2.0 XMLUnit for Java under BSD License diff --git a/README.md b/README.md index e184b07050..580b65faf1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # 52°North SOS [![OpenHUB](https://www.openhub.net/p/SensorObservationService/widgets/project_thin_badge.gif)](https://www.openhub.net/p/SensorObservationService) -README file for the 52°North Sensor Observation Service (SOS) version 4.2 +README file for the 52°North Sensor Observation Service (SOS) version 4.3 This is the repository of the [52°North Sensor Observation Service (SOS)][1]. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5757ffb9dd..dfa072d6a6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -6,6 +6,46 @@ RELEASE NOTES SensorML instance document), and information about the sensor mounting platform (SensorML as well). + Release 52n-sensorweb-sos-4.3.0 +================================== + + --- New features --- + + * Support for AQD e-Reporting flows E + * Primary validated assessment data - measurements (E1a). + * Primary validated assessment data -modelled (E1b) + * Primary up-to-date assessment data - measurements (E2a) + * More information about AQD e-Reporting: http://www.eionet.europa.eu/aqportal + * Documentation: https://wiki.52north.org/bin/view/SensorWeb/AqdEReporting + * Flexible identifier + * The flexible identifier extension offers the possibility to return human readable names + as identifiers instead of the sometimes cryptic identifiers. + * Affects offering, procedure, observableProperty and featureOfInterest. + * Documentation: https://wiki.52north.org/bin/view/SensorWeb/FlexibleIdentifier + * Add core and custom datasources for Oracle (#228) + * Support clear datasource for SQL Server (#199) + * Add webapp-bundle module which builds a 52N SOS war including + * Sensor Web Client REST-API (https://github.com/52North/timeseries-api) + * Direct access to the database tables. + * JavaScript SOS Client (https://github.com/52North/js-sensorweb-client) + * Linked by default to the SWC REST-API of the bundle + + --- Changes --- + + * Harmonize existing datasources (#228) + * Use latest vecmath version + * Move Role to correct package (#201) + + --- Fixed issues --- + + * Issue #211: Failing InsertSensor if sml:DataInterface in puts + * Issue #225: Use setting default when missing + * Issue #227: GetResult returns values of not published series + * Issue #226: ERROR log statements while importing observations: "Duplicity of the featureOfInterest identifier" + * Issue #230: INSPIRE namespace element is not present in SpatialDatasetIdentifier + * Issue #233: Outdated links + + Release 52n-sensorweb-sos-4.2.0 ================================== diff --git a/bindings/exi/pom.xml b/bindings/exi/pom.xml index dd4f6fbafe..c70f61f51c 100644 --- a/bindings/exi/pom.xml +++ b/bindings/exi/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.n52.sensorweb.sos bindings - 4.2.0 + 4.3.0 binding-exi 52°North SOS - EXI Efficient XML Interchange Binding diff --git a/bindings/json/pom.xml b/bindings/json/pom.xml index f9ea13d907..7cc60240cc 100644 --- a/bindings/json/pom.xml +++ b/bindings/json/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.n52.sensorweb.sos bindings - 4.2.0 + 4.3.0 binding-json 52°North SOS - JSON Binding diff --git a/bindings/kvp/pom.xml b/bindings/kvp/pom.xml index 11bf560ea1..a13b058e05 100644 --- a/bindings/kvp/pom.xml +++ b/bindings/kvp/pom.xml @@ -1,30 +1,29 @@ - - - - org.n52.sensorweb.sos - bindings - 4.2.0 - - 4.0.0 - binding-kvp - jar - 52°North SOS - KVP Binding - 52°North Sensor Observation Service KVP binding - - - ${project.groupId} - api - true - - - javax.servlet - servlet-api - - - ${project.groupId} - test - test - - - + + + + org.n52.sensorweb.sos + bindings + 4.3.0 + + 4.0.0 + binding-kvp + jar + 52°North SOS - KVP Binding + 52°North Sensor Observation Service KVP binding + + + ${project.groupId} + api + true + + + javax.servlet + servlet-api + + + ${project.groupId} + test + test + + + diff --git a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/AbstractKvpDecoder.java b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/AbstractKvpDecoder.java index b4c6b3b2d7..dd4d0cb931 100644 --- a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/AbstractKvpDecoder.java +++ b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/AbstractKvpDecoder.java @@ -47,17 +47,23 @@ import org.n52.sos.exception.CodedException; import org.n52.sos.exception.ConfigurationException; import org.n52.sos.exception.ows.InvalidParameterValueException; +import org.n52.sos.exception.ows.MissingParameterValueException; import org.n52.sos.exception.ows.concrete.DateTimeParseException; +import org.n52.sos.exception.ows.concrete.MissingServiceParameterException; +import org.n52.sos.exception.ows.concrete.MissingVersionParameterException; import org.n52.sos.ogc.filter.FilterConstants.SpatialOperator; import org.n52.sos.ogc.filter.FilterConstants.TimeOperator; +import org.n52.sos.ogc.filter.FilterConstants.TimeOperator2; import org.n52.sos.ogc.filter.SpatialFilter; import org.n52.sos.ogc.filter.TemporalFilter; import org.n52.sos.ogc.gml.time.Time; import org.n52.sos.ogc.gml.time.TimeInstant; import org.n52.sos.ogc.gml.time.TimePeriod; +import org.n52.sos.ogc.ows.CompositeOwsException; import org.n52.sos.ogc.ows.OWSConstants; import org.n52.sos.ogc.ows.OwsExceptionReport; import org.n52.sos.ogc.sos.SosConstants.SosIndeterminateTime; +import org.n52.sos.ogc.swe.simpleType.SweBoolean; import org.n52.sos.ogc.swe.simpleType.SweText; import org.n52.sos.ogc.swes.SwesExtension; import org.n52.sos.ogc.swes.SwesExtensionImpl; @@ -102,16 +108,6 @@ public Map> getSupportedTypes() { return Collections.emptyMap(); } - @Deprecated - public int getDefaultEPSG() { - return getStorageEPSG(); - } - - @Deprecated - public int getDefault3DEPSG() { - return getStorage3DEPSG(); - } - public int getStorageEPSG() { return storageEPSG; } @@ -128,18 +124,6 @@ public int getDefaultResponse3DEPSG() { return defaultResponse3DEPSG; } - @Deprecated - @Setting(FeatureQuerySettingsProvider.DEFAULT_EPSG) - public void setDefaultEpsg(final int epsgCode) throws ConfigurationException { - setStorageEpsg(epsgCode); - } - - @Deprecated - @Setting(FeatureQuerySettingsProvider.DEFAULT_3D_EPSG) - public void setDefault3DEpsg(final int epsgCode3D) throws ConfigurationException { - setStorage3DEpsg(epsgCode3D); - } - /** * Set storage EPSG code from settings * @@ -196,6 +180,11 @@ public void setDefaultResponse3DEpsg(final int epsgCode3D) throws ConfigurationE defaultResponse3DEPSG = epsgCode3D; } + protected boolean parseExtensionParameter(AbstractServiceRequest request, String parameterValues, + String parameterName) throws OwsExceptionReport { + return false; + } + protected boolean parseDefaultParameter(AbstractServiceRequest request, String parameterValues, String parameterName) throws OwsExceptionReport { // service (mandatory) @@ -224,7 +213,34 @@ else if (parameterName.equalsIgnoreCase(OWSConstants.AdditionalRequestParams.crs request.addExtension(getCrsExtension(KvpHelper.checkParameterSingleValue(parameterValues, parameterName))); return true; } - return false; + + else if (parameterName.equalsIgnoreCase(OWSConstants.AdditionalRequestParams.returnHumanReadableIdentifier + .name())) { + request.addExtension(getReturnHumanReadableIdentifierExtension(KvpHelper.checkParameterSingleValue( + parameterValues, parameterName))); + return true; + } else { + return parseExtensionParameter(request, parameterValues, parameterName); + } + } + + /** + * Check if service and version are contained in the request + * + * @param request + * Parsed request + * @param exceptions + * {@link CompositeOwsException} to add + * {@link MissingParameterValueException}s + */ + protected void checkIfServiceVersionIsMissing(AbstractServiceRequest request, CompositeOwsException exceptions) { + if (!request.isSetService()) { + exceptions.add(new MissingServiceParameterException()); + } + + if (!request.isSetVersion()) { + exceptions.add(new MissingVersionParameterException()); + } } protected SpatialFilter parseSpatialFilter(List parameterValues, String parameterName) @@ -239,7 +255,7 @@ protected SpatialFilter parseSpatialFilter(List parameterValues, String spatialFilter.setValueReference(parameterValues.get(0)); - int srid = getDefaultEPSG(); + int srid = getStorageEPSG(); if (parameterValues.get(parameterValues.size() - 1).startsWith(getSrsNamePrefixSosV2()) || parameterValues.get(parameterValues.size() - 1).startsWith(getSrsNamePrefix())) { hasSrid = true; @@ -317,10 +333,17 @@ protected Time parseTime(String parameterValue, String parameterName) throws Cod protected List parseTemporalFilter(List parameterValues, String parameterName) throws OwsExceptionReport, DateTimeParseException { List filterList = new ArrayList(1); - if (parameterValues.size() != 2) { + // order: valueReference, time + if (parameterValues.size() == 2) { + filterList.add(createTemporalFilterFromValue(parameterValues.get(1), parameterValues.get(0))); + } + // order: valueReference, temporal operator, time + else if (parameterValues.size() == 3) { + filterList.add(createTemporalFilterFromValue(parameterValues.get(2), parameterValues.get(1), parameterValues.get(0))); + } else { throw new InvalidParameterValueException().withMessage("The parameter value is not valid!"); } - filterList.add(createTemporalFilterFromValue(parameterValues.get(1), parameterValues.get(0))); + return filterList; } @@ -339,11 +362,23 @@ protected Map parseNamespaces(String parameterValues) { private TemporalFilter createTemporalFilterFromValue(String value, String valueReference) throws OwsExceptionReport, DateTimeParseException { + String[] times = value.split("/"); + if (times.length == 1) { + return createTemporalFilterFromValue(value, TimeOperator.TM_Equals.name(), valueReference); + } else if (times.length == 2) { + return createTemporalFilterFromValue(value, TimeOperator.TM_During.name(), valueReference); + } else { + throw new InvalidParameterValueException().withMessage("The paramter value '%s' is invalid!", value); + } + } + + private TemporalFilter createTemporalFilterFromValue(String value, String operator, String valueReference) + throws OwsExceptionReport, DateTimeParseException { TemporalFilter temporalFilter = new TemporalFilter(); temporalFilter.setValueReference(valueReference); + temporalFilter.setOperator(getTimeOperator(operator)); String[] times = value.split("/"); - - if (times.length == 1) { + if (times.length == 1 && !temporalFilter.getOperator().equals(TimeOperator.TM_During)) { TimeInstant ti = new TimeInstant(); if (SosIndeterminateTime.contains(times[0])) { ti.setSosIndeterminateTime(SosIndeterminateTime.getEnumForString(times[0])); @@ -352,9 +387,8 @@ private TemporalFilter createTemporalFilterFromValue(String value, String valueR ti.setValue(instant); ti.setRequestedTimeLength(DateTimeHelper.getTimeLengthBeforeTimeZone(times[0])); } - temporalFilter.setOperator(TimeOperator.TM_Equals); temporalFilter.setTime(ti); - } else if (times.length == 2) { + } else if (times.length == 2 & temporalFilter.getOperator().equals(TimeOperator.TM_During)) { DateTime start = DateTimeHelper.parseIsoString2DateTime(times[0]); // check if end time is a full ISO 8106 string int timeLength = DateTimeHelper.getTimeLengthBeforeTimeZone(times[1]); @@ -363,15 +397,22 @@ private TemporalFilter createTemporalFilterFromValue(String value, String valueR TimePeriod tp = new TimePeriod(); tp.setStart(start); tp.setEnd(end); - temporalFilter.setOperator(TimeOperator.TM_During); temporalFilter.setTime(tp); - } else { throw new InvalidParameterValueException().withMessage("The paramter value '%s' is invalid!", value); } return temporalFilter; } + private TimeOperator getTimeOperator(String operator) { + try { + return TimeOperator.from(operator); + } catch (IllegalArgumentException iae) { + LOGGER.debug("Not a FES 1.0.0 temporal operator!", iae); + } + return TimeOperator.from(TimeOperator2.from(operator)); + } + protected String getSrsNamePrefix() { return ServiceConfiguration.getInstance().getSrsNamePrefix(); } @@ -387,10 +428,17 @@ protected SwesExtension getLanguageExtension(String language) { protected SwesExtension getCrsExtension(String crs) { return getSweTextFor(OWSConstants.AdditionalRequestParams.crs.name(), crs); } - + + protected SwesExtension getReturnHumanReadableIdentifierExtension(String returnHumanReadableIdentifier) { + SweBoolean bool = + (SweBoolean) new SweBoolean().setValue(Boolean.parseBoolean(returnHumanReadableIdentifier)) + .setIdentifier(OWSConstants.AdditionalRequestParams.returnHumanReadableIdentifier.name()); + return new SwesExtensionImpl().setValue(bool); + } + protected SwesExtension getSweTextFor(String identifier, String value) { - SweText text = - (SweText) new SweText().setValue(value).setIdentifier(identifier); + SweText text = (SweText) new SweText().setValue(value).setIdentifier(identifier); return new SwesExtensionImpl().setValue(text); } + } diff --git a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/DescribeSensorKvpDecoderv20.java b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/DescribeSensorKvpDecoderv20.java index 928dd6d364..f867307544 100644 --- a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/DescribeSensorKvpDecoderv20.java +++ b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/DescribeSensorKvpDecoderv20.java @@ -54,6 +54,7 @@ * */ public class DescribeSensorKvpDecoderv20 extends AbstractKvpDecoder { + private static final DecoderKey KVP_DECODER_KEY_TYPE = new OperationDecoderKey(SosConstants.SOS, Sos2Constants.SERVICEVERSION, SosConstants.Operations.DescribeSensor, MediaTypes.APPLICATION_KVP); @@ -68,9 +69,6 @@ public DescribeSensorRequest decode(Map element) throws OwsExcep DescribeSensorRequest request = new DescribeSensorRequest(); CompositeOwsException exceptions = new CompositeOwsException(); - boolean foundProcedure = false; - boolean foundProcedureDescriptionFormat = false; - for (String parameterName : element.keySet()) { String parameterValues = element.get(parameterName); try { @@ -90,13 +88,11 @@ public DescribeSensorRequest decode(Map element) throws OwsExcep // else if (parameterName.equalsIgnoreCase(SosConstants.DescribeSensorParams.procedure.name())) { request.setProcedure(KvpHelper.checkParameterSingleValue(parameterValues, parameterName)); - foundProcedure = true; } // procedureDescriptionFormat else if (parameterName.equalsIgnoreCase(Sos2Constants.DescribeSensorParams.procedureDescriptionFormat .name())) { request.setProcedureDescriptionFormat(KvpHelper.checkParameterSingleValue(parameterValues, parameterName)); - foundProcedureDescriptionFormat = true; } // valid time (optional) else if (parameterName.equalsIgnoreCase(Sos2Constants.DescribeSensorParams.validTime.name())) { try { diff --git a/bindings/kvp/src/test/java/org/n52/sos/decode/kvp/AbstractKvpDecoderTest.java b/bindings/kvp/src/test/java/org/n52/sos/decode/kvp/AbstractKvpDecoderTest.java new file mode 100644 index 0000000000..70fc1f6545 --- /dev/null +++ b/bindings/kvp/src/test/java/org/n52/sos/decode/kvp/AbstractKvpDecoderTest.java @@ -0,0 +1,249 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.decode.kvp; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.junit.Test; +import org.n52.sos.decode.DecoderKey; +import org.n52.sos.exception.ows.concrete.DateTimeParseException; +import org.n52.sos.exception.ows.concrete.UnsupportedDecoderInputException; +import org.n52.sos.ogc.filter.FilterConstants.TimeOperator; +import org.n52.sos.ogc.filter.FilterConstants.TimeOperator2; +import org.n52.sos.ogc.filter.TemporalFilter; +import org.n52.sos.ogc.ows.OwsExceptionReport; +import org.n52.sos.ogc.sos.Sos1Constants; +import org.n52.sos.ogc.sos.Sos2Constants; +import org.n52.sos.request.AbstractServiceRequest; + +import com.google.common.collect.Lists; + +public class AbstractKvpDecoderTest extends AbstractKvpDecoder { + + private static final String START_TIME = "2012-11-19T14:00:00+01:00"; + + private static final String END_TIME = "2012-11-19T14:15:00+01:00"; + + private static final String START_END_TIME = "2012-11-19T14:15:00+01:00/" + END_TIME; + + private static final String OM_PHENOMENON_TIME = "om:phenomenonTime"; + + + @Override + public Set getDecoderKeyTypes() { + return null; + } + + @Override + public AbstractServiceRequest decode(Map objectToDecode) throws OwsExceptionReport, + UnsupportedDecoderInputException { + return null; + } + + /* + * SOS 1.0.0 tests + */ + + /* + * two parameter + */ + + @Test + public void should_decode_eventTime_TM_Equals_2_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, START_TIME)), TimeOperator.TM_Equals); + } + + @Test + public void should_decode_eventTime_TM_During_2_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, START_END_TIME)), TimeOperator.TM_During); + } + + /* + * three parameter + */ + @Test + public void should_decode_eventTime_TM_After_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_After.name(), START_TIME)), TimeOperator.TM_After); + } + + @Test + public void should_decode_eventTime_TM_Before_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_Before.name(), START_TIME)), TimeOperator.TM_Before); + } + + @Test + public void should_decode_eventTime_TM_Begins_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_Begins.name(), START_TIME)), TimeOperator.TM_Begins); + } + + @Test + public void should_decode_eventTime_TM_BegunBy_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_BegunBy.name(), START_TIME)), TimeOperator.TM_BegunBy); + } + + @Test + public void should_decode_eventTime_TM_Contains_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_Contains.name(), START_TIME)), TimeOperator.TM_Contains); + } + + @Test + public void should_decode_eventTime_TM_During_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_During.name(), START_END_TIME)), TimeOperator.TM_During); + } + + @Test + public void should_decode_eventTime_TM_EndedBy_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_EndedBy.name(), START_TIME)), TimeOperator.TM_EndedBy); + } + + @Test + public void should_decode_eventTime_TM_Ends_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_Ends.name(), START_TIME)), TimeOperator.TM_Ends); + } + + @Test + public void should_decode_eventTime_TM_Equals_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_Equals.name(), START_TIME)), TimeOperator.TM_Equals); + } + + @Test + public void should_decode_eventTime_TM_Meets_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_Meets.name(), START_TIME)), TimeOperator.TM_Meets); + } + + @Test + public void should_decode_eventTime_TM_MetBy_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_MetBy.name(), START_TIME)), TimeOperator.TM_MetBy); + } + + @Test + public void should_decode_eventTime_TM_OverlappedBy_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_OverlappedBy.name(), START_TIME)), TimeOperator.TM_OverlappedBy); + } + + @Test + public void should_decode_eventTime_TM_Overlaps_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseEventTime(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator.TM_Overlaps.name(), START_TIME)), TimeOperator.TM_Overlaps); + } + + /* + * SOS 2.0 tests + */ + + /* + * three parameter + */ + + @Test + public void should_decode_temporalFilter_After_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.After.name(), START_TIME)), TimeOperator.TM_After); + } + + @Test + public void should_decode_temporalFilter_Before_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.Before.name(), START_TIME)), TimeOperator.TM_Before); + } + + @Test + public void should_decode_temporalFilter_Begins_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.Begins.name(), START_TIME)), TimeOperator.TM_Begins); + } + + @Test + public void should_decode_temporalFilter_BegunBy_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.BegunBy.name(), START_TIME)), TimeOperator.TM_BegunBy); + } + + @Test + public void should_decode_temporalFilter_TContains_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.TContains.name(), START_TIME)), TimeOperator.TM_Contains); + } + + @Test + public void should_decode_temporalFilter_During_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.During.name(), START_END_TIME)), TimeOperator.TM_During); + } + + @Test + public void should_decode_temporalFilter_EndedBy_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.EndedBy.name(), START_TIME)), TimeOperator.TM_EndedBy); + } + + @Test + public void should_decode_temporalFilter_Ends_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.Ends.name(), START_TIME)), TimeOperator.TM_Ends); + } + + @Test + public void should_decode_temporalFilter_TEquals_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.TEquals.name(), START_TIME)), TimeOperator.TM_Equals); + } + + @Test + public void should_decode_temporalFilter_Meets_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.Meets.name(), START_TIME)), TimeOperator.TM_Meets); + } + + @Test + public void should_decode_temporalFilter_MetBy_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.MetBy.name(), START_TIME)), TimeOperator.TM_MetBy); + } + + @Test + public void should_decode_temporalFilter_OverlappedBy_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.OverlappedBy.name(), START_TIME)), TimeOperator.TM_OverlappedBy); + } + + @Test + public void should_decode_temporalFilter_TOverlaps_3_Param() throws DateTimeParseException, OwsExceptionReport { + check(parseTemporalFilter(Lists.newArrayList(OM_PHENOMENON_TIME, TimeOperator2.TOverlaps.name(), START_TIME)), TimeOperator.TM_Overlaps); + } + + + + private List parseEventTime(List parameterValues) throws DateTimeParseException, OwsExceptionReport { + return parseTemporalFilter(parameterValues, Sos1Constants.GetObservationParams.eventTime.name()); + } + + private List parseTemporalFilter(List parameterValues) throws DateTimeParseException, OwsExceptionReport { + return parseTemporalFilter(parameterValues, Sos2Constants.GetObservationParams.temporalFilter.name()); + } + + private void check(List parseEventTime, TimeOperator operator) { + for (TemporalFilter temporalFilter : parseEventTime) { + assertThat(temporalFilter.getOperator().name(), is(operator.name())); + } + } + +} diff --git a/bindings/pom.xml b/bindings/pom.xml index 6fdde52a72..92bf91a527 100644 --- a/bindings/pom.xml +++ b/bindings/pom.xml @@ -4,7 +4,7 @@ org.n52.sensorweb.sos 52n-sos - 4.2.0 + 4.3.0 bindings pom diff --git a/bindings/pox/pom.xml b/bindings/pox/pom.xml index f59bf44b9d..a6e0a43d7f 100644 --- a/bindings/pox/pom.xml +++ b/bindings/pox/pom.xml @@ -1,24 +1,23 @@ - - - - org.n52.sensorweb.sos - bindings - 4.2.0 - - 4.0.0 - binding-pox - jar - 52°North SOS - POX Binding - 52°North Sensor Observation Service Plain Old XML binding - - - ${project.groupId} - api - - - javax.servlet - servlet-api - - - + + + + org.n52.sensorweb.sos + bindings + 4.3.0 + + 4.0.0 + binding-pox + jar + 52°North SOS - POX Binding + 52°North Sensor Observation Service Plain Old XML binding + + + ${project.groupId} + api + + + javax.servlet + servlet-api + + + diff --git a/bindings/rest/code/pom.xml b/bindings/rest/code/pom.xml index 6b29ec0018..5515bd1332 100644 --- a/bindings/rest/code/pom.xml +++ b/bindings/rest/code/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.n52.sensorweb.sos rest - 4.2.0 + 4.3.0 rest-code 52°North SOS - Extension REST Binding - Core diff --git a/bindings/rest/pom.xml b/bindings/rest/pom.xml index 59b9f68f6a..e6f94976bb 100644 --- a/bindings/rest/pom.xml +++ b/bindings/rest/pom.xml @@ -1,73 +1,72 @@ - - - - org.n52.sensorweb.sos - bindings - 4.2.0 - - 4.0.0 - rest - pom - 4.2.0 - 52°North SOS - Extension REST Binding - RESTful binding for the 52°North SOS - http://52north.org/communities/sensorweb/sosREST/ - 2012 - - xml - code - - - org.n52.sensorweb.sos - https://svn.52north.org/svn/swe/main/SOS/Extensions/Binding/RESTful/trunk/ - - - scm:svn:${svn.url}trunk/ - scm:svn:${svn.url}trunk/ - https://svn.52north.org/svn/swe/main/SOS/Extensions/Binding/RESTful/trunk/ - - - 52°North - http://52north.org/ - - - - Eike Hinderk Jürrens - 52°North - http://52north.org/ - - - - - Sensor Web Mailing List - swe@52north.org - http://list.52north.org/mailman/listinfo/swe - http://list.52north.org/mailman/listinfo/swe#subscribers - http://list.52north.org/pipermail/swe/ - - - - Bugzilla - https://bugzilla.52north.org/ - - - - Eike Hinderk Jürrens - - designer - - 52°North - http://52north.org/ - - - Arne Bröring - - manager - designer - - 52°North - http://52north.org/ - - - + + + + org.n52.sensorweb.sos + bindings + 4.3.0 + + 4.0.0 + rest + pom + 4.3.0 + 52°North SOS - Extension REST Binding + RESTful binding for the 52°North SOS + http://52north.org/communities/sensorweb/sosREST/ + 2012 + + xml + code + + + org.n52.sensorweb.sos + https://svn.52north.org/svn/swe/main/SOS/Extensions/Binding/RESTful/trunk/ + + + scm:svn:${svn.url}trunk/ + scm:svn:${svn.url}trunk/ + https://svn.52north.org/svn/swe/main/SOS/Extensions/Binding/RESTful/trunk/ + + + 52°North + http://52north.org/ + + + + Eike Hinderk Jürrens + 52°North + http://52north.org/ + + + + + Sensor Web Mailing List + swe@52north.org + http://list.52north.org/mailman/listinfo/swe + http://list.52north.org/mailman/listinfo/swe#subscribers + http://list.52north.org/pipermail/swe/ + + + + Bugzilla + https://bugzilla.52north.org/ + + + + Eike Hinderk Jürrens + + designer + + 52°North + http://52north.org/ + + + Arne Bröring + + manager + designer + + 52°North + http://52north.org/ + + + diff --git a/bindings/rest/xml/pom.xml b/bindings/rest/xml/pom.xml index c84512ae41..633ab4ccc3 100644 --- a/bindings/rest/xml/pom.xml +++ b/bindings/rest/xml/pom.xml @@ -1,11 +1,10 @@ - + 4.0.0 org.n52.sensorweb.sos rest - 4.2.0 + 4.3.0 rest-xml 52°North SOS - Extension REST Binding - XML diff --git a/bindings/soap/pom.xml b/bindings/soap/pom.xml index afb3cfa9fd..4777d5f280 100644 --- a/bindings/soap/pom.xml +++ b/bindings/soap/pom.xml @@ -1,37 +1,36 @@ - - - - org.n52.sensorweb.sos - bindings - 4.2.0 - - 4.0.0 - binding-soap - jar - 52°North SOS - SOAP Binding - 52°North Sensor Observation Service SOAP binding - - - ${project.groupId} - api - true - - - javax.servlet - servlet-api - - - org.n52.sensorweb - 52n-xml-soap-v12 - - - org.n52.sensorweb - 52n-xml-wsa-v10 - - - org.n52.sensorweb - 52n-xml-ows-v110 - - - + + + + org.n52.sensorweb.sos + bindings + 4.3.0 + + 4.0.0 + binding-soap + jar + 52°North SOS - SOAP Binding + 52°North Sensor Observation Service SOAP binding + + + ${project.groupId} + api + true + + + javax.servlet + servlet-api + + + org.n52.sensorweb + 52n-xml-soap-v12 + + + org.n52.sensorweb + 52n-xml-wsa-v10 + + + org.n52.sensorweb + 52n-xml-ows-v110 + + + diff --git a/bindings/soap/src/main/java/org/n52/sos/encode/Soap12Encoder.java b/bindings/soap/src/main/java/org/n52/sos/encode/Soap12Encoder.java index d112ee121d..d5aa6d69b8 100644 --- a/bindings/soap/src/main/java/org/n52/sos/encode/Soap12Encoder.java +++ b/bindings/soap/src/main/java/org/n52/sos/encode/Soap12Encoder.java @@ -102,6 +102,11 @@ public Soap12Encoder() { LOGGER.debug("Encoder for the following keys initialized successfully: {}!", Joiner.on(", ").join(getEncoderKeyType())); } + + @Override + public boolean forceStreaming() { + return false; + } @SuppressWarnings("unchecked") @Override diff --git a/coding/exi/pom.xml b/coding/exi/pom.xml index db42a00196..20f83be912 100644 --- a/coding/exi/pom.xml +++ b/coding/exi/pom.xml @@ -1,10 +1,9 @@ - + org.n52.sensorweb.sos coding - 4.2.0 + 4.3.0 4.0.0 coding-exi diff --git a/coding/exi/src/main/java/org/n52/sos/encode/exi/AbstractSosResponseEncoder.java b/coding/exi/src/main/java/org/n52/sos/encode/exi/AbstractSosResponseEncoder.java index 6d7250c5b1..37e885ebc6 100644 --- a/coding/exi/src/main/java/org/n52/sos/encode/exi/AbstractSosResponseEncoder.java +++ b/coding/exi/src/main/java/org/n52/sos/encode/exi/AbstractSosResponseEncoder.java @@ -47,6 +47,7 @@ import org.n52.sos.ogc.sos.SosConstants.HelperValues; import org.n52.sos.request.ResponseFormat; import org.n52.sos.response.AbstractServiceResponse; +import org.n52.sos.response.StreamingDataResponse; import org.n52.sos.service.ServiceConstants.SupportedTypeKey; import org.n52.sos.util.http.MediaType; import org.n52.sos.util.http.MediaTypes; @@ -107,8 +108,8 @@ public EXIObject encode(T objectToEncode, Map additionalVa UnsupportedEncoderInputException { AbstractServiceResponse asr = objectToEncode; Encoder encoder = getEncoder(asr); - if (!(encoder instanceof StreamingDataEncoder) && asr.hasStreamingData()) { - asr.mergeStreamingData(); + if (asr instanceof StreamingDataResponse && ((StreamingDataResponse)asr).hasStreamingData() && !(encoder instanceof StreamingDataEncoder)) { + ((StreamingDataResponse)asr).mergeStreamingData(); } Object encode = encoder.encode(asr); if (encode != null && encode instanceof XmlObject) { diff --git a/coding/json-common/pom.xml b/coding/json-common/pom.xml index 8dd2c460d1..7607642012 100644 --- a/coding/json-common/pom.xml +++ b/coding/json-common/pom.xml @@ -1,58 +1,57 @@ - - - - org.n52.sensorweb.sos - coding - 4.2.0 - - 4.0.0 - coding-json-common - jar - 52°North SOS - JSON Common - 52°North Sensor Observation Service JSON Common - - - ${project.groupId} - api - - - ${project.groupId} - test - - - com.github.fge - json-schema-validator - - - com.github.fge - json-schema-core - - - jackson-core - com.fasterxml.jackson.core - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - test-jar - - - without - - **/*Test.* - **/*$.* - - - - - - - - + + + + org.n52.sensorweb.sos + coding + 4.3.0 + + 4.0.0 + coding-json-common + jar + 52°North SOS - JSON Common + 52°North Sensor Observation Service JSON Common + + + ${project.groupId} + api + + + ${project.groupId} + test + + + com.github.fge + json-schema-validator + + + com.github.fge + json-schema-core + + + jackson-core + com.fasterxml.jackson.core + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + without + + **/*Test.* + **/*$.* + + + + + + + + diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/JSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/JSONEncoder.java index 8eb76536dd..2dc38468af 100644 --- a/coding/json-common/src/main/java/org/n52/sos/encode/json/JSONEncoder.java +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/JSONEncoder.java @@ -56,11 +56,11 @@ /** * TODO JavaDoc - * + * * @param - * + * * @author Christian Autermann - * + * * @since 4.0.0 */ public abstract class JSONEncoder implements Encoder { @@ -68,7 +68,7 @@ public abstract class JSONEncoder implements Encoder { private final Set encoderKeys; - public JSONEncoder(Class type, EncoderKey... additionalKeys) { + public JSONEncoder(Class type, EncoderKey... additionalKeys) { Builder set = ImmutableSet.builder(); set.add(new JSONEncoderKey(type)); set.addAll(Arrays.asList(additionalKeys)); @@ -113,6 +113,9 @@ public JsonNode encode(T objectToEncode, Map v) throws Ows @Override public JsonNode encode(T objectToEncode) throws OwsExceptionReport { try { + if (objectToEncode == null) { + return nodeFactory().nullNode(); + } return encodeJSON(objectToEncode); } catch (JSONEncodingException ex) { throw new NoApplicableCodeException().causedBy(ex); diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BigDecimalJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BigDecimalJSONEncoder.java new file mode 100644 index 0000000000..3693f98da2 --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BigDecimalJSONEncoder.java @@ -0,0 +1,53 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import java.math.BigDecimal; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class BigDecimalJSONEncoder extends JSONEncoder { + + public BigDecimalJSONEncoder() { + super(BigDecimal.class); + } + + @Override + public JsonNode encodeJSON(BigDecimal t) { + return nodeFactory().numberNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BigIntegerJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BigIntegerJSONEncoder.java new file mode 100644 index 0000000000..af02f3fd79 --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BigIntegerJSONEncoder.java @@ -0,0 +1,53 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import java.math.BigInteger; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class BigIntegerJSONEncoder extends JSONEncoder { + + public BigIntegerJSONEncoder() { + super(BigInteger.class); + } + + @Override + public JsonNode encodeJSON(BigInteger t) { + return nodeFactory().numberNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BooleanJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BooleanJSONEncoder.java new file mode 100644 index 0000000000..37b6d26ed7 --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/BooleanJSONEncoder.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class BooleanJSONEncoder extends JSONEncoder { + + public BooleanJSONEncoder() { + super(Boolean.class); + } + + @Override + public JsonNode encodeJSON(Boolean t) { + return nodeFactory().booleanNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/ByteJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/ByteJSONEncoder.java new file mode 100644 index 0000000000..3e3cfcbbfc --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/ByteJSONEncoder.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class ByteJSONEncoder extends JSONEncoder { + + public ByteJSONEncoder() { + super(Byte.class); + } + + @Override + public JsonNode encodeJSON(Byte t) { + return nodeFactory().numberNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/DoubleJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/DoubleJSONEncoder.java new file mode 100644 index 0000000000..f46e4cf8ff --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/DoubleJSONEncoder.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class DoubleJSONEncoder extends JSONEncoder { + + public DoubleJSONEncoder() { + super(Double.class); + } + + @Override + public JsonNode encodeJSON(Double t) { + return nodeFactory().numberNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/FloatJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/FloatJSONEncoder.java new file mode 100644 index 0000000000..abff5b5c90 --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/FloatJSONEncoder.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class FloatJSONEncoder extends JSONEncoder { + + public FloatJSONEncoder() { + super(Float.class); + } + + @Override + public JsonNode encodeJSON(Float t) { + return nodeFactory().numberNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/IntegerJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/IntegerJSONEncoder.java new file mode 100644 index 0000000000..c972877fb6 --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/IntegerJSONEncoder.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class IntegerJSONEncoder extends JSONEncoder { + + public IntegerJSONEncoder() { + super(Integer.class); + } + + @Override + public JsonNode encodeJSON(Integer t) { + return nodeFactory().numberNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/LongJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/LongJSONEncoder.java new file mode 100644 index 0000000000..0e1f3aa637 --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/LongJSONEncoder.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class LongJSONEncoder extends JSONEncoder { + + public LongJSONEncoder() { + super(Long.class); + } + + @Override + public JsonNode encodeJSON(Long t) { + return nodeFactory().numberNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/ShortJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/ShortJSONEncoder.java new file mode 100644 index 0000000000..7580bf7480 --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/ShortJSONEncoder.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class ShortJSONEncoder extends JSONEncoder { + + public ShortJSONEncoder() { + super(Short.class); + } + + @Override + public JsonNode encodeJSON(Short t) { + return nodeFactory().numberNode(t); + } + +} diff --git a/coding/json-common/src/main/java/org/n52/sos/encode/json/base/StringJSONEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/StringJSONEncoder.java new file mode 100644 index 0000000000..d620cef5a0 --- /dev/null +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/StringJSONEncoder.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2012-2015 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * If the program is linked with libraries which are licensed under one of + * the following licenses, the combination of the program with the linked + * library is not considered a "derivative work" of the program: + * + * - Apache License, version 2.0 + * - Apache Software License, version 1.0 + * - GNU Lesser General Public License, version 3 + * - Mozilla Public License, versions 1.0, 1.1 and 2.0 + * - Common Development and Distribution License (CDDL), version 1.0 + * + * Therefore the distribution of the program linked with libraries licensed + * under the aforementioned licenses, is permitted by the copyright holders + * if the distribution is compliant with both the GNU General Public + * License version 2 and the aforementioned licenses. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + */ +package org.n52.sos.encode.json.base; + +import org.n52.sos.encode.json.JSONEncoder; + +import com.fasterxml.jackson.databind.JsonNode; + +/** + * TODO JavaDoc + * + * @author Christian Autermann + */ +public class StringJSONEncoder extends JSONEncoder { + + public StringJSONEncoder() { + super(String.class); + } + + @Override + public JsonNode encodeJSON(String t) { + return nodeFactory().textNode(t); + } + +} diff --git a/coding/json/src/main/java/org/n52/sos/encode/json/impl/TimeEncoder.java b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/TimeJSONEncoder.java similarity index 96% rename from coding/json/src/main/java/org/n52/sos/encode/json/impl/TimeEncoder.java rename to coding/json-common/src/main/java/org/n52/sos/encode/json/base/TimeJSONEncoder.java index a219f72f4d..77d5d7f5d1 100644 --- a/coding/json/src/main/java/org/n52/sos/encode/json/impl/TimeEncoder.java +++ b/coding/json-common/src/main/java/org/n52/sos/encode/json/base/TimeJSONEncoder.java @@ -26,7 +26,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. */ -package org.n52.sos.encode.json.impl; +package org.n52.sos.encode.json.base; import static org.n52.sos.util.DateTimeHelper.formatDateTime2IsoString; import static org.n52.sos.util.DateTimeHelper.formatDateTime2String; @@ -49,8 +49,8 @@ * * @since 4.0.0 */ -public class TimeEncoder extends JSONEncoder