diff --git a/.gitignore b/.gitignore
index f7a12deb76..f60dadb94f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ release.properties
extensions/do/core/configuration.db
**.*~
*.tern-project
+extensions/inspire/coding/configuration.db
diff --git a/NOTICE b/NOTICE
index 76ecd10b23..dcf0b2da9d 100644
--- a/NOTICE
+++ b/NOTICE
@@ -4,21 +4,25 @@ Licensed under GNU General Public License, Version 2.0
This project includes:
+ "Java Concurrency in Practice" book annotations under Creative Commons Attribution License, http://creativecommons.org/licenses/by/2.5
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 - GMLCOV 1.0 XML Request Coding 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 - API for INSPIRE Module 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 Module for INSPIRE under GPLv2
52°North SOS - Coding Modules under GPLv2
52°North SOS - Converter Modules under GPLv2
52°North SOS - Coordinate transformation module under GPLv2
@@ -31,14 +35,21 @@ This project includes:
52°North SOS - Extension Delete Observation - JSON under GPLv2
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 DeleteResultTemplate under GPLv2
+ 52°North SOS - Extension DeleteResultTemplate - Hibernate DAO under GPLv2
+ 52°North SOS - Extension DeleteResultTemplate - SOS 2.0 Operation 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 for INSPIRE - Coding Module under GPLv2
52°North SOS - Extension GetDataAvailability under GPLv2
52°North SOS - Extension GetDataAvailability - Hibernate DAO under GPLv2
52°North SOS - Extension GetDataAvailability - SOS 2.0 Operation under GPLv2
+ 52°North SOS - Extension InsertFeatureOfInterest under GPLv2
+ 52°North SOS - Extension InsertFeatureOfInterest - Hibernate DAO under GPLv2
+ 52°North SOS - Extension InsertFeatureOfInterest - SOS 2.0 Operation under GPLv2
52°North SOS - Extension Modules under GPLv2
+ 52°North SOS - Extension register Binding under GPLv2
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
@@ -63,6 +74,9 @@ This project includes:
52°North SOS - JSON Coding under GPLv2
52°North SOS - JSON Common under GPLv2
52°North SOS - KVP Binding under GPLv2
+ 52°North SOS - netCDF under GPLv2
+ 52°North SOS - netCDF Coding under GPLv2
+ 52°North SOS - OceanSITES netCDF Coding under GPLv2
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
@@ -72,6 +86,7 @@ This project includes:
52°North SOS - Profile XmlBeans Module under GPLv2
52°North SOS - SensorML 101 Request Coding under GPLv2
52°North SOS - SensorML 20 Request Coding under GPLv2
+ 52°North SOS - Series type checker module under GPLv2
52°North SOS - SOAP Binding under GPLv2
52°North SOS - SOS 1.0.0 Core Profile Operator under GPLv2
52°North SOS - SOS 1.0.0 XML Request Coding under GPLv2
@@ -85,6 +100,7 @@ This project includes:
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 - UVF under GPLv2
52°North SOS - WaterML 2.0 XML Coding under GPLv2
52°North SOS - Web Admin Controller under GPLv2
52°North SOS - Web Client Controller under GPLv2
@@ -94,16 +110,32 @@ This project includes:
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 Svalbard - CV for GML 3.2.1 XML Request Coding under GPLv2
+ 52°North Svalbard - Extension DeleteResultTemplate coding under GPLv2
+ 52°North Svalbard - Extension GetDataAvailability - SOS 2.0 coding under GPLv2
+ 52°North Svalbard - Extension InsertFeatureOfInterest coding under GPLv2
+ 52°North Svalbard - GML XML Request Coding under GPLv2
+ 52°North Svalbard - GWML 2.2 XML Coding under GPLv2
+ 52°North Svalbard - INSPIRE XML OMPR Coding under GPLv2
+ 52°North Svalbard - INSPIRE XML OMSO Coding under GPLv2
+ 52°North Svalbard - Svalbard Related Offering Coding extension 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 Commons Codec under Apache License, Version 2.0
Apache FOP under The Apache Software License, Version 2.0
+ Apache HttpClient Mime under Apache License, Version 2.0
+ Apache HttpCore under Apache License, Version 2.0
Apache XML Graphics Commons under The Apache Software License, Version 2.0
- API interfaces under Lesser General Public License (LGPL)
+ API interfaces under GNU Lesser General Public License (LGPL) version 2.1
+ AspectJ tools under Eclipse Public License - v 1.0
+ AspectJ weaver under Eclipse Public License - v 1.0
Avalon Framework API under The Apache Software License, Version 2.0
Avalon Framework Implementation under The Apache Software License, Version 2.0
+ AWS Java SDK for Amazon S3 under Apache License, Version 2.0
+ AWS Java SDK for AWS KMS under Apache License, Version 2.0
+ AWS SDK for Java - Core under Apache 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
@@ -120,15 +152,19 @@ This project includes:
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
+ cdm under (MIT-style) netCDF C library license
+ cf4j under GNU Lesser General Public License
ClassLoader leak prevention under Apache 2
Commons Codec under The Apache Software License, Version 2.0
Commons IO under The Apache Software License, Version 2.0
Commons Lang under The Apache Software License, Version 2.0
+ Commons Logging under The Apache Software License, Version 2.0
Commons Pool under The Apache Software License, Version 2.0
Core Hibernate O/RM functionality under GNU Lesser General Public License
CORS Filter under The Apache Software License, Version 2.0
dom4j under DOM4J license, http://dom4j.sourceforge.net/dom4j-1.6.1/license.html (BSD style)
- EPSG Authority Service using HSQL database under Lesser General Public License (LGPL) or EPSG database distribution license or BSD License for HSQL
+ EJML under The Apache Software License, Version 2.0
+ EPSG Authority Service using HSQL database under GNU Lesser General Public License (LGPL) version 2.1
EXIficient under GNU General Public License (GPL), Version 2.0
FindBugs-jsr305 under The Apache Software License, Version 2.0
GeoDB Core under BSD style, https://github.com/jdeolive/geodb/blob/master/LICENSE.txt
@@ -137,35 +173,52 @@ This project includes:
Guava: Google Core Libraries for Java under The Apache Software License, Version 2.0
H2 Database Engine under The H2 License, Version 1.0
Hamcrest All under New BSD License
- Hamcrest Core under BSD style
+ Hamcrest Core under New BSD License
hatbox under GNU Lesser General Public License (LGPL) version 2.1
Hibernate Commons Annotations under GNU Lesser General Public License
hibernate-spatial under GNU Lesser General Public License (LGPL) version 2.1
Hibernate/c3p0 Integration under GNU Lesser General Public License
- HSQLDB under HSQLDB License
HttpClient under Apache License
HttpCore under Apache License
- 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
- Java Advanced Imaging under Java Advanced Imaging Distribution License, http://download.java.net/media/jai/builds/release/1_1_3/LICENSE-jai.txt
+ httpservices under (MIT-style) netCDF C library license
+ HyperSQL Database under HSQLDB License, a BSD open source license
+ INSPIRE Addresses schema (spec. v4.0) under The Apache Software License, Version 2.0
+ INSPIRE Administrative Units schema (spec. v4.0) under The Apache Software License, Version 2.0
+ INSPIRE base schema (spec. v3.3) under The Apache Software License, Version 2.0
+ INSPIRE Base Types 2 schema (spec. v2.0) under The Apache Software License, Version 2.0
+ INSPIRE Building base schema (spec. v4.0) under The Apache Software License, Version 2.0
+ INSPIRE Cadastral Parcels schema (spec. v4.0) under The Apache Software License, Version 2.0
+ INSPIRE Common Transport Elements schema (spec. v4.0) under The Apache Software License, Version 2.0
+ INSPIRE Environmental Monitoring Facilities schema (spec. v4.0) under The Apache Software License, Version 2.0
+ INSPIRE Geographical Name schema (spec. v4.0) under The Apache Software License, Version 2.0
+ INSPIRE Network schema (spec. v4.0) under The Apache Software License, Version 2.0
+ INSPIRE OM Observation References schema (spec. v3.0) under The Apache Software License, Version 2.0
+ INSPIRE OM Process schema (spec. v3.0) under The Apache Software License, Version 2.0
+ INSPIRE OM Specialised Observation schema (spec. v3.0.1) under The Apache Software License, Version 2.0
+ ISO 19139 CV_DiscreteCoverage model (spec. v0.2.2) under The Apache Software License, Version 2.0
+ Jackson-annotations under The Apache Software License, Version 2.0
+ Jackson-core under The Apache Software License, Version 2.0
+ jackson-databind under The Apache Software License, Version 2.0
+ Jackson-dataformat-CBOR under The Apache Software License, Version 2.0
Java Annotation Indexer under AL 2.0
- Java Excel API under GNU Lesser General Public License
+ Java implementation of GeographicLib under The MIT License(MIT)
+ Java Native Access under LGPL, version 2.1 or ASL, version 2
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 Servlet API under CDDL 1.1 or GPL2 w/ CPE
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
+ JCommander under The Apache Software License, Version 2.0
JCommon under GNU Lesser General Public Licence
- jdom under JDOM license (Apache style), https://github.com/hunterhacker/jdom/blob/master/LICENSE.txt
+ JDOM under Similar to Apache License but with the acknowledgment clause removed
JFreeChart under GNU Lesser General Public Licence
jgridshift under GNU Lesser General Public License, version 2.0 (LGPLv2)
+ JMES Path Query library under Apache License, Version 2.0
Joda-Time under Apache 2
JOpt Simple under The MIT License
jsp-api under CDDL 1.1 or GPL2 w/ CPE
@@ -173,17 +226,18 @@ This project includes:
jstl under CDDL 1.1 or GPL2 w/ CPE
JTS Topology Suite under Lesser General Public License (LGPL)
JUL to SLF4J bridge under MIT License
- JUnit under Common Public License Version 1.0
+ JUnit under Eclipse Public License 1.0
libphonenumber under The Apache Software License, Version 2.0
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)
+ Main module under GNU Lesser General Public License (LGPL) version 2.1
mchange-commons-java under GNU Lesser General Public License, Version 2.1 or Eclipse Public License, Version 1.0
- Metadata under Lesser General Public License (LGPL)
+ Metadata under GNU Lesser General Public License (LGPL) version 2.1
Mockito under The MIT License
Mozilla Rhino under Mozilla Public License, Version 2.0
MySQL Connector/J under The GNU General Public License, Version 2
+ netcdf4 under (MIT-style) netCDF C library license
null under Lesser General Public License, version 3 or greater or Apache Software License, version 2.0
OASIS WS-N specification schemas - including WS-BrokeredNotification (v1.3) under The Apache Software License, Version 2.0
OASIS WS-Resources specification schemas v1.2 under The Apache Software License, Version 2.0
@@ -192,6 +246,9 @@ This project includes:
OGC GML Coverage schema (spec. v1.0) under The Apache Software License, Version 2.0
OGC GML schema (spec. v3.1.1) under The Apache Software License, Version 2.0
OGC GML schema (spec. v3.2.1) under The Apache Software License, Version 2.0
+ OGC GML schema (spec. v3.3) under The Apache Software License, Version 2.0
+ OGC GWML 2.0 schema (spec. v2.2) under The Apache Software License, Version 2.0
+ OGC InsertFeatureOfInterest schema 1.0 under The Apache Software License, Version 2.0
OGC O&M schema (spec. v1.0.0) under The Apache Software License, Version 2.0
OGC O&M schema (spec. v2.0) under The Apache Software License, Version 2.0
OGC OWS schema (spec. v1.1.0) under The Apache Software License, Version 2.0
@@ -200,7 +257,10 @@ This project includes:
OGC SensorML schema (spec. v1.0.1) under The Apache Software License, Version 2.0
OGC SensorML schema (spec. v2.0.0) under The Apache Software License, Version 2.0
OGC SOS DeleteObservation schema 1.0 under The Apache Software License, Version 2.0
+ OGC SOS DeleteObservation schema 2.0 under The Apache Software License, Version 2.0
+ OGC SOS DeleteResultTemplate schema 1.0 under The Apache Software License, Version 2.0
OGC SOS GetDataAvailability schema 1.0 (OGC Best Practice 14-004r1) under The Apache Software License, Version 2.0
+ OGC SOS RelatedOfferings schema 1.0 under The Apache Software License, Version 2.0
OGC SOS schema (spec. v1.0.0) under The Apache Software License, Version 2.0
OGC SOS schema (spec. v2.0) under The Apache Software License, Version 2.0
OGC SWECommon schema (spec. v1.0.1) under The Apache Software License, Version 2.0
@@ -208,27 +268,35 @@ This project includes:
OGC SWES schema (spec. v2.0) under The Apache Software License, Version 2.0
OGC WaterML DR schema (spec. v2.0) under The Apache Software License, Version 2.0
OGC WaterML schema (spec. v2.0) under The Apache Software License, Version 2.0
- OGC XML schemas under The Apache Software License, Version 2.0
ojdbc6 under Oracle Technology Network Development and Distribution License, http://www.oracle.com/technetwork/licenses/distribution-license-152002.html
- Open GIS Interfaces under OGC copyright or Lesser General Public License (LGPL)
+ Open GIS Interfaces under GNU Lesser General Public License (LGPL) version 2.1
+ Portele Schape Change schema (spec. v3.0) under The Apache Software License, Version 2.0
Postgis JDBC Driver under GNU Lesser General Public License
- PostgreSQL JDBC Driver under BSD License
PostgreSQL JDBC Driver - JDBC 4.1 under The PostgreSQL License
- Referencing services under Lesser General Public License (LGPL)
+ Protocol Buffer Java API under New BSD license
+ quartz under The Apache Software License, Version 2.0
+ Referencing services under GNU Lesser General Public License (LGPL) version 2.1
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
+ Series REST API - DAO Mappings module under GNU General Public License, Version 2.0
+ Series REST API - DAO module under GNU General Public License, Version 2.0
+ Series REST API - IO module under GNU General Public License, Version 2.0
+ Series REST API - REST module under GNU General Public License, Version 2.0
+ Series REST API - SOS DAO module under GNU General Public License, Version 2.0
+ Series REST API - SPI module under GNU General Public License, Version 2.0
servlet-api under CDDL 1.1 or GPL2 w/ CPE
SLF4J API Module under MIT License
+ software.amazon.ion:ion-java under The Apache License, Version 2.0
Spring AOP under The Apache Software License, Version 2.0
+ Spring Aspects under The Apache Software License, Version 2.0
Spring Beans under The Apache Software License, Version 2.0
Spring Context under The Apache Software License, Version 2.0
+ Spring Context Support under The Apache Software License, Version 2.0
Spring Core under The Apache Software License, Version 2.0
Spring Expression Language (SpEL) under The Apache Software License, Version 2.0
Spring JDBC under The Apache Software License, Version 2.0
+ Spring Object/Relational Mapping under The Apache Software License, Version 2.0
+ Spring Object/XML Marshalling under The Apache Software License, Version 2.0
Spring TestContext Framework under The Apache Software License, Version 2.0
Spring Transaction under The Apache Software License, Version 2.0
Spring Web under The Apache Software License, Version 2.0
@@ -241,12 +309,13 @@ 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
+ udunits under (MIT-style) netCDF C library license
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
xalan under The Apache Software License, Version 2.0
- Xerces2 Java Parser 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
XML Commons External Components XML APIs Extensions under The Apache Software License, Version 2.0
XmlBeans under The Apache Software License, Version 2.0
diff --git a/README.md b/README.md
index 589834acee..ab2a7ce350 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.3.x
+README file for the 52°North Sensor Observation Service (SOS) version 4.4.x
This is the repository of the [52°North Sensor Observation Service (SOS)][1].
@@ -10,6 +10,7 @@ tested to be compliant to this specification within the [OGC CITE testing][4]
in December of 2012.
## Build Status
+
* Master: [![Master Build Status](https://travis-ci.org/52North/SOS.png?branch=master)](https://travis-ci.org/52North/SOS)
* Develop: [![Develop Build Status](https://travis-ci.org/52North/SOS.png?branch=develop)](https://travis-ci.org/52North/SOS)
@@ -31,7 +32,7 @@ Here you can find some information that relates to the distributions of the 52°
The latest release of 52°North SOS can be downloaded from this website:
- http://52north.org/downloads/sensor-web/sos
+ http://52north.org/downloads/category/3-sos
### Contents
* `/src` : The source files of 52°North SOS modules
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index da4f371cf8..436d32c12b 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -6,8 +6,102 @@ RELEASE NOTES
SensorML instance document), and information about the sensor mounting platform
(SensorML as well).
+ Release 52n-sensorweb-sos-4.4.0
+====================================
+
+ --- New features ---
+
+ * INSPIRE support for
+ * Technical Guidance for implementing download services using the OGC Sensor Observation Service
+ and ISO 19143 Filter Encoding (http://inspire.ec.europa.eu/id/document/tg/download-sos) (Since 4.3.0)
+ * https://wiki.52north.org/SensorWeb/SensorObservationServiceIVDocumentation#INSPIRE_Download_Service_extension
+ * Guidelines for the use of Observations & Measurements and Sensor Web Enablement-related
+ standards in INSPIRE (D2.9) (http://inspire.ec.europa.eu/id/document/tg/d2.9-o%26m-swe)
+ * https://wiki.52north.org/SensorWeb/InspireSpecialisedObservations
+ * GetDataAvailability 2.0
+ * Result contains the offering, procedure description formats and responseFormat/observationTypes.
+ * Hierarchical offering (similar to hierarchical procedure)
+ * allows to display only the parent offerings in the Capabilities
+ * InsertFeatureOfInterest operation
+ * Allows the insertion of featureOfInterest
+ * Support for insertion of procedure types
+ * https://wiki.52north.org/SensorWeb/SensorObservationServiceIVDocumentation#A_61_61_Procedure_type_support
+ * DeleteResultTemplate operation
+ * Allows the deletion of resultTemplates by identifier or offering/observedProperty pairs
+ * Update procedure name/description in UpdateSensorDescription
+ * Update the procedure name/description if changed
+ * UVF encoding
+ * https://wiki.52north.org/SensorWeb/UvfEncoding
+ * WaterML 2.0 MonitoringPoint support in database
+ * Inclusive support of relatedParty and verticalDatum
+ * https://wiki.52north.org/SensorWeb/WaterML
+ * ResultHandling
+ * Support insertion of ComplexObservations
+ * Support insertion of samplingGeometry
+ * Support for insertion of related featureOfInterest and procedure identifier in result values
+ * Enhanced DeleteObservation to allow deletion for featureOfInterest, procedure, observedProperty,
+ offering and temporalFilter
+ * Support for stored ISO strings as time in database (Hibernate datatype)
+ * Get name of observedProperty from procedure description if available
+ * Would be inserted into the observedProperty table.
+ * Support for netCDF encoding
+ * Support CF
+ * Support OceanSites
+ * Register binding
+ * Allows the insertion of the raw sensor description via HTTP POST
+ * https://wiki.52north.org/SensorWeb/RegisterBinding
+ * Insertion of "up-to-date" sample data that can be simply used by the Helgoland Client
+ * The SOS example requests are still for the test data!
+ * Show client IP during installation for transactional security settings
+
+ --- Changes ---
+
+ * Update setting descriptions
+ * Contains Sensor Web REST-API v2.0.0
+ * Contains Helgoland map client v1.0.0
+ * Select profile (default SOS 2.0, Hydrology, INSPIRE) via admin interface
+
+ --- Fixed issues ---
- Release 52n-sensorweb-sos-4.3.14
+ * Issue #215: i18N GUI not rendered if required tables are missing
+ * Issue #221: Check identifiers of transactional operations for reserved characters
+ * Issue #250: Dispatching after reset is wrong
+ * Issue #255: NumericSettingDefinition breaks settings view in admin interface bug enhancement high priority
+ * Issue #258: SQL-Server 2012 Express: Can not clean datasource via
+ admin/datasource -> clear datasource
+ * Issue #261: NPE is thrown when sending not supported XML requests.
+ * Issue #264: SOS throws a NPE in SensorML 1.0.1 decoder if characteristics/capabilities
+ element has no AbstractDataRecord element
+ * Issue #266: Reload CapabilitiesExtensionProvider in CapabilitiesExtensionRepository
+ after changing operations status
+ * Issue #267: Capabilities shows procedureDescriptionFormats in transactional
+ operations which are not supported
+ * Issue #277: Check for not null/empty coordinates in CoordinateTransformer.transformSweCoordinates()
+ before joining
+ * Issue #279: Extend the supported coordinate names
+ * Issue #282: Fix potential problems in CoordinateTransformer.getCrsFromString(String)
+ * Issue #285: Client problem with feature capabilities in DescribeSensor
+ response with SensorML 1.0.1 encoded procedure
+ * Issue #287: The XML text of the parsed SensorML 2.0 AbstractProcess from components is invalid.
+ * Issue #288: Clear Datasource fails with 500 Internal Server Error
+ * Issue #305: After changing datasource settings requests fail with exception
+ * Issue #318: NPE if SensorML 2.0 description contains an empty
+ * Issue #323: GetFeatureOfInterestRequestDecoder no parse featureOfInterest parameter
+ * Issue #349: Change wording for SOS time period error
+ * Issue #351: Development Branch always 'enriching with discovery information'
+ * Issue #361: First/last numeric values are not updated in series table in develop branch
+ * Issue #367: java.lang.NullPointerException checking hasObservations
+ * Issue #369: SOS Client InsertObservation example '[POX] InsertObservation - ComplexObservation (SOS 2.0.0)'
+ * Issue #370: ExceptionReport: NullPointerException+CastException for ComplexObservation result template
+ * Issue #389: The build process fails after merging of #385
+ * Issue #395: Creating database schema fails for MySQL
+ * Issue #422: Failed conversion between SML 2.0 and SML 1.0.1
+ * Issue #439: quality tag how metadata of output list
+ * Hidden NPE cause by not set request context while inserting new sample data
+ * Avoid query for next value chunk if previous has less than chunk size
+
+
+ Release 52n-sensorweb-sos-4.3.14
=====================================
--- New features ---
@@ -21,7 +115,7 @@ RELEASE NOTES
* some fixes for the rest api (bundle)
- Release 52n-sensorweb-sos-4.3.13
+ Release 52n-sensorweb-sos-4.3.13
=====================================
--- New features ---
@@ -36,7 +130,7 @@ RELEASE NOTES
* some minor fixes (getting unit from series)
- Release 52n-sensorweb-sos-4.3.12
+ Release 52n-sensorweb-sos-4.3.12
=====================================
--- New features ---
@@ -55,7 +149,8 @@ RELEASE NOTES
* some minor fixes
- Release 52n-sensorweb-sos-4.3.11
+
+ Release 52n-sensorweb-sos-4.3.11
=====================================
--- New features ---
@@ -85,7 +180,7 @@ RELEASE NOTES
* Issue #503: Capabilities cache update fails for old database concept
Release 52n-sensorweb-sos-4.3.9
-=====================================
+====================================
--- New features ---
@@ -105,7 +200,7 @@ RELEASE NOTES
Release 52n-sensorweb-sos-4.3.8
-=====================================
+====================================
--- New features ---
@@ -132,8 +227,8 @@ RELEASE NOTES
* Fix issue with H2 file database when create schema is selected
- Release 52n-sensorweb-sos-4.3.7
-=====================================
+ Release 52n-sensorweb-sos-4.3.7
+====================================
--- New features ---
@@ -164,8 +259,8 @@ RELEASE NOTES
* Issue #426: Add OGC-SOS 1.0.0 GetObservation resultModel support
- Release 52n-sensorweb-sos-4.3.6
-===================================
+ Release 52n-sensorweb-sos-4.3.6
+====================================
--- New features ---
@@ -177,7 +272,7 @@ RELEASE NOTES
--- Fixed issues ---
- Release 52n-sensorweb-sos-4.3.5
+ Release 52n-sensorweb-sos-4.3.5
====================================
--- New features ---
@@ -197,7 +292,7 @@ RELEASE NOTES
* Issue #365: SOS Client InsertResultTemplate example '[POX] InsertResultTemplate - with ResultTime (SOS 2.0.0)'
Release 52n-sensorweb-sos-4.3.4
-===================================
+====================================
--- New features ---
@@ -215,7 +310,7 @@ RELEASE NOTES
* Issue #322: Missing samplingGeometry (om:parameter) in returned observation
Release 52n-sensorweb-sos-4.3.3
-===================================
+====================================
--- New features ---
@@ -227,8 +322,9 @@ RELEASE NOTES
* Issue #310: Invalid prefix in om:parameter of .../SamplingPoint
+
Release 52n-sensorweb-sos-4.3.2
-==================================
+====================================
--- New features ---
@@ -241,8 +337,9 @@ RELEASE NOTES
* Issue #299: SOS does not start on a system with Turkish language
+
Release 52n-sensorweb-sos-4.3.1
-==================================
+====================================
--- New features ---
@@ -255,7 +352,7 @@ RELEASE NOTES
Release 52n-sensorweb-sos-4.3.0
-==================================
+===================================
--- New features ---
@@ -295,7 +392,7 @@ RELEASE NOTES
Release 52n-sensorweb-sos-4.2.0
-==================================
+===================================
--- New features ---
diff --git a/bindings/exi/pom.xml b/bindings/exi/pom.xml
index 09a2befef5..e951348871 100644
--- a/bindings/exi/pom.xml
+++ b/bindings/exi/pom.xml
@@ -1,33 +1,33 @@
-
-
- 4.0.0
-
- org.n52.sensorweb.sos
- bindings
- 4.3.14
-
- binding-exi
- 52°North SOS - EXI Efficient XML Interchange Binding
-
-
- ${project.groupId}
- api
-
-
- ${project.groupId}
- coding-exi
-
-
- com.siemens.ct.exi
- exificient
-
-
- javax.servlet
- servlet-api
-
-
- xerces
- xercesImpl
-
-
-
+
+
+ 4.0.0
+
+ org.n52.sensorweb.sos
+ bindings
+ 4.4.0
+
+ binding-exi
+ 52°North SOS - EXI Efficient XML Interchange Binding
+
+
+ ${project.groupId}
+ api
+
+
+ ${project.groupId}
+ coding-exi
+
+
+ com.siemens.ct.exi
+ exificient
+
+
+ javax.servlet
+ javax.servlet-api
+
+
+ xerces
+ xercesImpl
+
+
+
diff --git a/bindings/json/pom.xml b/bindings/json/pom.xml
index 632412bb9d..71d967cc89 100644
--- a/bindings/json/pom.xml
+++ b/bindings/json/pom.xml
@@ -1,25 +1,25 @@
-
-
- 4.0.0
-
- org.n52.sensorweb.sos
- bindings
- 4.3.14
-
- binding-json
- 52°North SOS - JSON Binding
-
-
- ${project.groupId}
- api
-
-
- ${project.groupId}
- coding-json
-
-
- javax.servlet
- servlet-api
-
-
-
+
+
+ 4.0.0
+
+ org.n52.sensorweb.sos
+ bindings
+ 4.4.0
+
+ binding-json
+ 52°North SOS - JSON Binding
+
+
+ ${project.groupId}
+ api
+
+
+ ${project.groupId}
+ coding-json
+
+
+ javax.servlet
+ javax.servlet-api
+
+
+
diff --git a/bindings/json/src/main/java/org/n52/sos/binding/JSONBinding.java b/bindings/json/src/main/java/org/n52/sos/binding/JSONBinding.java
index f9f9b86c12..22cbb0ee28 100644
--- a/bindings/json/src/main/java/org/n52/sos/binding/JSONBinding.java
+++ b/bindings/json/src/main/java/org/n52/sos/binding/JSONBinding.java
@@ -93,7 +93,7 @@ protected MediaType getDefaultContentType() {
@Override
public boolean checkOperationHttpPostSupported(OperationKey k) throws HTTPException {
- return getDecoder(new OperationDecoderKey(k, MediaTypes.APPLICATION_JSON)) != null;
+ return hasDecoder(new OperationDecoderKey(k, MediaTypes.APPLICATION_JSON));
}
@Override
diff --git a/bindings/kvp/pom.xml b/bindings/kvp/pom.xml
index 44edfc6921..0c3cffaa60 100644
--- a/bindings/kvp/pom.xml
+++ b/bindings/kvp/pom.xml
@@ -1,29 +1,29 @@
-
-
-
- org.n52.sensorweb.sos
- bindings
- 4.3.14
-
- 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.4.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
+ javax.servlet-api
+
+
+ ${project.groupId}
+ test
+ test
+
+
+
diff --git a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v1/DescribeSensorKvpDecoderv100.java b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v1/DescribeSensorKvpDecoderv100.java
index 2f9818b1bb..113595d6d7 100644
--- a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v1/DescribeSensorKvpDecoderv100.java
+++ b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v1/DescribeSensorKvpDecoderv100.java
@@ -35,6 +35,7 @@
import org.n52.sos.decode.DecoderKey;
import org.n52.sos.decode.OperationDecoderKey;
import org.n52.sos.decode.kvp.AbstractKvpDecoder;
+import org.n52.sos.exception.ows.concrete.InvalidOutputFormatParameterException;
import org.n52.sos.exception.ows.concrete.MissingOutputFormatParameterException;
import org.n52.sos.exception.ows.concrete.MissingProcedureParameterException;
import org.n52.sos.exception.ows.concrete.MissingServiceParameterException;
@@ -96,9 +97,13 @@ public DescribeSensorRequest decode(Map element) throws OwsExcep
} // outputFormat
else if (parameterName.equalsIgnoreCase(Sos1Constants.DescribeSensorParams.outputFormat.name())
&& !Strings.isNullOrEmpty(parameterValues)) {
- // parse outputFormat through MediaType to ensure it's a mime type and eliminate whitespace variations
- request.setProcedureDescriptionFormat(KvpHelper.checkParameterSingleValue(
- MediaType.normalizeString(parameterValues), parameterName));
+ // parse outputFormat through MediaType to ensure it's a mime type and eliminate whitespace variations
+ if (MediaType.isMediaType(parameterValues)) {
+ request.setProcedureDescriptionFormat(KvpHelper.checkParameterSingleValue(
+ MediaType.normalizeString(parameterValues), parameterName));
+ } else {
+ throw new InvalidOutputFormatParameterException(parameterValues);
+ }
foundOutputFormat = true;
// // language (optional)
// } else if (parameterName.equalsIgnoreCase(SosConstants.InspireParams.language.name())) {
diff --git a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/AbstractObservationKvpDecoder.java b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/AbstractObservationKvpDecoder.java
new file mode 100644
index 0000000000..98c4b1e6c2
--- /dev/null
+++ b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/AbstractObservationKvpDecoder.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (C) 2012-2017 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.v2;
+
+import org.n52.sos.decode.kvp.AbstractKvpDecoder;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants;
+import org.n52.sos.request.AbstractObservationRequest;
+import org.n52.sos.request.AbstractServiceRequest;
+import org.n52.sos.util.KvpHelper;
+
+public abstract class AbstractObservationKvpDecoder extends AbstractKvpDecoder {
+
+ @Override
+ protected boolean parseDefaultParameter(AbstractServiceRequest> request, String parameterValues,
+ String parameterName) throws OwsExceptionReport {
+ if (parameterName.equalsIgnoreCase(SosConstants.GetObservationParams.resultType.name())) {
+ if (request instanceof AbstractObservationRequest) {
+ ((AbstractObservationRequest)request).setResultModel(KvpHelper.checkParameterSingleValue(parameterValues, parameterName));
+ return true;
+ }
+ }
+ // responseFormat (optional)
+ else if (parameterName.equalsIgnoreCase(SosConstants.GetObservationParams.responseFormat.name())) {
+ ((AbstractObservationRequest)request).setResponseFormat(KvpHelper.checkParameterSingleValue(parameterValues, parameterName));
+ return true;
+ }
+ return super.parseDefaultParameter(request, parameterValues, parameterName);
+ }
+
+}
diff --git a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/GetObservationByIdKvpDecoderv20.java b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/GetObservationByIdKvpDecoderv20.java
index 79ac11ed48..99a3d1c02b 100644
--- a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/GetObservationByIdKvpDecoderv20.java
+++ b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/GetObservationByIdKvpDecoderv20.java
@@ -34,15 +34,17 @@
import org.n52.sos.decode.DecoderKey;
import org.n52.sos.decode.OperationDecoderKey;
-import org.n52.sos.decode.kvp.AbstractKvpDecoder;
+import org.n52.sos.exception.ows.MissingParameterValueException;
import org.n52.sos.exception.ows.concrete.MissingServiceParameterException;
import org.n52.sos.exception.ows.concrete.MissingVersionParameterException;
+import org.n52.sos.exception.ows.concrete.ParameterNotSupportedException;
import org.n52.sos.ogc.ows.CompositeOwsException;
import org.n52.sos.ogc.ows.OwsExceptionReport;
import org.n52.sos.ogc.sos.Sos2Constants;
import org.n52.sos.ogc.sos.SosConstants;
import org.n52.sos.request.AbstractServiceRequest;
import org.n52.sos.request.GetObservationByIdRequest;
+import org.n52.sos.util.CollectionHelper;
import org.n52.sos.util.KvpHelper;
import org.n52.sos.util.http.MediaTypes;
@@ -53,7 +55,7 @@
* @since 4.1.0
*
*/
-public class GetObservationByIdKvpDecoderv20 extends AbstractKvpDecoder {
+public class GetObservationByIdKvpDecoderv20 extends AbstractObservationKvpDecoder {
private static final DecoderKey KVP_DECODER_KEY_TYPE = new OperationDecoderKey(SosConstants.SOS,
Sos2Constants.SERVICEVERSION, SosConstants.Operations.GetObservationById, MediaTypes.APPLICATION_KVP);
@@ -76,6 +78,8 @@ public AbstractServiceRequest> decode(Map element) throws OwsE
if (parameterName.equalsIgnoreCase(Sos2Constants.GetObservationByIdParams.observation.name())) {
request.setObservationIdentifier(KvpHelper.checkParameterMultipleValues(parameterValues,
parameterName));
+ } else {
+ exceptions.add(new ParameterNotSupportedException(parameterName));
}
}
} catch (final OwsExceptionReport owse) {
@@ -90,7 +94,10 @@ public AbstractServiceRequest> decode(Map element) throws OwsE
if (!request.isSetVersion()) {
exceptions.add(new MissingVersionParameterException());
}
-
+
+ if (!CollectionHelper.isNotEmpty(request.getObservationIdentifier())) {
+ exceptions.add(new MissingParameterValueException(Sos2Constants.GetObservationByIdParams.observation));
+ }
exceptions.throwIfNotEmpty();
return request;
diff --git a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/GetObservationKvpDecoderv20.java b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/GetObservationKvpDecoderv20.java
index ad6dba67b1..3bc020dfeb 100644
--- a/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/GetObservationKvpDecoderv20.java
+++ b/bindings/kvp/src/main/java/org/n52/sos/decode/kvp/v2/GetObservationKvpDecoderv20.java
@@ -36,7 +36,6 @@
import org.n52.sos.decode.DecoderKey;
import org.n52.sos.decode.OperationDecoderKey;
-import org.n52.sos.decode.kvp.AbstractKvpDecoder;
import org.n52.sos.exception.ows.InvalidParameterValueException;
import org.n52.sos.exception.ows.MissingParameterValueException;
import org.n52.sos.exception.ows.concrete.MissingServiceParameterException;
@@ -48,18 +47,22 @@
import org.n52.sos.ogc.sos.Sos2Constants.Extensions;
import org.n52.sos.ogc.sos.SosConstants;
import org.n52.sos.ogc.swe.simpleType.SweBoolean;
+import org.n52.sos.ogc.swes.SwesExtension;
import org.n52.sos.ogc.swes.SwesExtensionImpl;
import org.n52.sos.ogc.swes.SwesExtensions;
+import org.n52.sos.request.AbstractServiceRequest;
import org.n52.sos.request.GetObservationRequest;
+import org.n52.sos.util.CodingHelper;
import org.n52.sos.util.CollectionHelper;
import org.n52.sos.util.KvpHelper;
+import org.n52.sos.util.XmlHelper;
import org.n52.sos.util.http.MediaTypes;
/**
* @since 4.0.0
*
*/
-public class GetObservationKvpDecoderv20 extends AbstractKvpDecoder {
+public class GetObservationKvpDecoderv20 extends AbstractObservationKvpDecoder {
private static final DecoderKey KVP_DECODER_KEY_TYPE = new OperationDecoderKey(SosConstants.SOS,
Sos2Constants.SERVICEVERSION, SosConstants.Operations.GetObservation, MediaTypes.APPLICATION_KVP);
@@ -122,11 +125,6 @@ else if (parameterName.equalsIgnoreCase(Sos2Constants.GetObservationParams.spati
KvpHelper.checkParameterMultipleValues(splittedParameterValues, parameterName);
request.setSpatialFilter(parseSpatialFilter(splittedParameterValues, parameterName));
}
-
- // responseFormat (optional)
- else if (parameterName.equalsIgnoreCase(SosConstants.GetObservationParams.responseFormat.name())) {
- request.setResponseFormat(KvpHelper.checkParameterSingleValue(parameterValues, parameterName));
- }
// namespaces (conditional)
else if (parameterName.equalsIgnoreCase(Sos2Constants.GetObservationParams.namespaces.name())) {
request.setNamespaces(parseNamespaces(parameterValues));
@@ -160,6 +158,24 @@ else if (parameterName
return request;
}
+
+ @Override
+ protected boolean parseExtensionParameter(AbstractServiceRequest> request, String parameterValues,
+ String parameterName) throws OwsExceptionReport {
+ if ("extension".equalsIgnoreCase(parameterName)) {
+ List checkParameterMultipleValues = KvpHelper.checkParameterMultipleValues(parameterValues, parameterName);
+ for (String parameterValue : checkParameterMultipleValues) {
+ final Object obj = CodingHelper.decodeXmlElement(XmlHelper.parseXmlString(parameterValue));
+ if (obj instanceof SwesExtension>) {
+ request.addExtension((SwesExtension>) obj);
+ } else {
+ request.addExtension(new SwesExtensionImpl().setValue(obj));
+ }
+ }
+ return true;
+ }
+ return super.parseExtensionParameter(request, parameterValues, parameterName);
+ }
private SwesExtensions parseExtension(final Extensions extension, final String parameterValues,
SwesExtensions extensions) {
diff --git a/bindings/kvp/src/test/java/org/n52/sos/decode/kvp/v2/GetObservationKvpDecoderv20Test.java b/bindings/kvp/src/test/java/org/n52/sos/decode/kvp/v2/GetObservationKvpDecoderv20Test.java
index 3ef441ed7c..3a5863392f 100644
--- a/bindings/kvp/src/test/java/org/n52/sos/decode/kvp/v2/GetObservationKvpDecoderv20Test.java
+++ b/bindings/kvp/src/test/java/org/n52/sos/decode/kvp/v2/GetObservationKvpDecoderv20Test.java
@@ -31,13 +31,17 @@
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertThat;
import java.util.Map;
import org.junit.Test;
+import org.n52.sos.ogc.ows.OWSConstants;
import org.n52.sos.ogc.ows.OwsExceptionReport;
import org.n52.sos.ogc.sos.Sos2Constants;
+import org.n52.sos.ogc.swe.simpleType.SweCount;
+import org.n52.sos.ogc.swe.simpleType.SweText;
import org.n52.sos.request.GetObservationRequest;
import com.google.common.collect.Maps;
@@ -53,7 +57,7 @@ public class GetObservationKvpDecoderv20Test {
@Test
public void should_decode_extension_parameter_MergeObservationsIntoDataArray() throws OwsExceptionReport {
final Map mapTrue = Maps.newHashMap();
- mapTrue.put("MergeObservationsIntoDataArray", "true");
+ mapTrue.put(Sos2Constants.Extensions.MergeObservationsIntoDataArray.name(), "true");
mapTrue.put("service", "SOS");
mapTrue.put("version", "2.0.0");
mapTrue.put("request", "GetObservation");
@@ -61,21 +65,73 @@ public void should_decode_extension_parameter_MergeObservationsIntoDataArray() t
final GetObservationRequest requestTrue = decoder.decode(mapTrue);
final Map mapFalse = Maps.newHashMap();
- mapFalse.put("MergeObservationsIntoDataArray", "false");
+ mapFalse.put(Sos2Constants.Extensions.MergeObservationsIntoDataArray.name(), "false");
mapFalse.put("service", "SOS");
mapFalse.put("version", "2.0.0");
mapFalse.put("request", "GetObservation");
final GetObservationRequest requestFalse = decoder.decode(mapFalse);
assertThat(requestTrue.isSetExtensions(), is(TRUE));
- assertThat(
- requestTrue.getExtensions().isBooleanExtensionSet(
- Sos2Constants.Extensions.MergeObservationsIntoDataArray.name()), is(TRUE));
+ assertThat(requestTrue.getExtensions()
+ .isBooleanExtensionSet(Sos2Constants.Extensions.MergeObservationsIntoDataArray.name()), is(TRUE));
assertThat(requestFalse.isSetExtensions(), is(TRUE));
+ assertThat(requestFalse.getExtensions()
+ .isBooleanExtensionSet(Sos2Constants.Extensions.MergeObservationsIntoDataArray.name()), is(FALSE));
+ }
+
+ @Test
+ public void should_decode_extension_parameter_language() throws OwsExceptionReport {
+ final Map map = Maps.newHashMap();
+ map.put(OWSConstants.AdditionalRequestParams.language.name(), "ger");
+ map.put("service", "SOS");
+ map.put("version", "2.0.0");
+ map.put("request", "GetObservation");
+ final GetObservationKvpDecoderv20 decoder = new GetObservationKvpDecoderv20();
+ final GetObservationRequest request = decoder.decode(map);
+
+ assertThat(request.isSetExtensions(), is(TRUE));
+ assertThat(request.getExtensions().containsExtension(OWSConstants.AdditionalRequestParams.language),
+ is(TRUE));
+ assertThat(request.getExtensions().getExtension(OWSConstants.AdditionalRequestParams.language.name())
+ .getValue(), instanceOf(SweText.class));
+ assertThat(((SweText) request.getExtensions()
+ .getExtension(OWSConstants.AdditionalRequestParams.language.name()).getValue()).getStringValue(),
+ is("ger"));
+ }
+
+ @Test
+ public void should_decode_extension_parameter_crs() throws OwsExceptionReport {
+ final Map map = Maps.newHashMap();
+ map.put(OWSConstants.AdditionalRequestParams.crs.name(), "4852");
+ map.put("service", "SOS");
+ map.put("version", "2.0.0");
+ map.put("request", "GetObservation");
+ final GetObservationKvpDecoderv20 decoder = new GetObservationKvpDecoderv20();
+ final GetObservationRequest request = decoder.decode(map);
+
+ assertThat(request.isSetExtensions(), is(TRUE));
+ assertThat(request.getExtensions().containsExtension(OWSConstants.AdditionalRequestParams.crs), is(TRUE));
assertThat(
- requestFalse.getExtensions().isBooleanExtensionSet(
- Sos2Constants.Extensions.MergeObservationsIntoDataArray.name()), is(FALSE));
+ request.getExtensions().getExtension(OWSConstants.AdditionalRequestParams.crs.name()).getValue(),
+ instanceOf(SweText.class));
+ assertThat(((SweText) request.getExtensions()
+ .getExtension(OWSConstants.AdditionalRequestParams.crs.name()).getValue()).getValue(), is("4852"));
+ }
+
+ @Test
+ public void should_decode_extension_parameter_resultType() throws OwsExceptionReport {
+ final Map map = Maps.newHashMap();
+ map.put("resultType", "MyObservation");
+ map.put("service", "SOS");
+ map.put("version", "2.0.0");
+ map.put("request", "GetObservation");
+ final GetObservationKvpDecoderv20 decoder = new GetObservationKvpDecoderv20();
+ final GetObservationRequest request = decoder.decode(map);
+
+
+ assertThat(request.isSetResultModel(), is(TRUE));
+ assertThat(request.getResultModel(), is("MyObservation"));
}
}
diff --git a/bindings/pom.xml b/bindings/pom.xml
index 051d86e2d4..53770b5cad 100644
--- a/bindings/pom.xml
+++ b/bindings/pom.xml
@@ -1,21 +1,22 @@
-
-
- 4.0.0
-
- org.n52.sensorweb.sos
- 52n-sos
- 4.3.14
-
- bindings
- pom
- 52°North SOS - Binding Modules
- 52°North SOS - Binding Modules
-
- kvp
- pox
- soap
- rest
- json
- exi
-
+
+
+ 4.0.0
+
+ org.n52.sensorweb.sos
+ 52n-sos
+ 4.4.0
+
+ bindings
+ pom
+ 52°North SOS - Binding Modules
+ 52°North SOS - Binding Modules
+
+ kvp
+ pox
+ soap
+ rest
+ json
+ exi
+ register
+
\ No newline at end of file
diff --git a/bindings/pox/pom.xml b/bindings/pox/pom.xml
index 1e8ee41655..272768800c 100644
--- a/bindings/pox/pom.xml
+++ b/bindings/pox/pom.xml
@@ -1,23 +1,23 @@
-
-
-
- org.n52.sensorweb.sos
- bindings
- 4.3.14
-
- 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.4.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
+ javax.servlet-api
+
+
+
diff --git a/bindings/register/pom.xml b/bindings/register/pom.xml
new file mode 100644
index 0000000000..c4363d016d
--- /dev/null
+++ b/bindings/register/pom.xml
@@ -0,0 +1,28 @@
+
+
+
+ org.n52.sensorweb.sos
+ bindings
+ 4.4.0
+
+ 4.0.0
+ binding-register
+ jar
+ 52°North SOS - Extension register Binding
+ Register sensor binding for the 52°North SOS
+ 2012
+
+
+ org.n52.sensorweb.sos
+ api
+
+
+ org.slf4j
+ slf4j-api
+
+
+ javax.servlet
+ javax.servlet-api
+
+
+
diff --git a/bindings/register/src/main/java/org/n52/sos/binding/RegisterBinding.java b/bindings/register/src/main/java/org/n52/sos/binding/RegisterBinding.java
new file mode 100644
index 0000000000..ed12cde528
--- /dev/null
+++ b/bindings/register/src/main/java/org/n52/sos/binding/RegisterBinding.java
@@ -0,0 +1,339 @@
+/**
+ * Copyright (C) 2012-2017 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.binding;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.exception.HTTPException;
+import org.n52.sos.exception.ows.MissingParameterValueException;
+import org.n52.sos.exception.ows.NoApplicableCodeException;
+import org.n52.sos.exception.swes.InvalidRequestException;
+import org.n52.sos.ogc.gml.CodeWithAuthority;
+import org.n52.sos.ogc.om.OmConstants;
+import org.n52.sos.ogc.ows.OWSConstants.RequestParams;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sensorML.AbstractProcess;
+import org.n52.sos.ogc.sensorML.AbstractSensorML;
+import org.n52.sos.ogc.sensorML.SensorML;
+import org.n52.sos.ogc.sensorML.elements.SmlIo;
+import org.n52.sos.ogc.sos.Sos2Constants;
+import org.n52.sos.ogc.sos.SosInsertionMetadata;
+import org.n52.sos.ogc.sos.SosOffering;
+import org.n52.sos.ogc.sos.SosProcedureDescription;
+import org.n52.sos.ogc.swe.SweAbstractDataComponent;
+import org.n52.sos.ogc.swe.SweAbstractDataRecord;
+import org.n52.sos.ogc.swe.SweField;
+import org.n52.sos.ogc.swe.simpleType.SweBoolean;
+import org.n52.sos.ogc.swes.SwesExtensionImpl;
+import org.n52.sos.request.AbstractServiceRequest;
+import org.n52.sos.request.InsertSensorRequest;
+import org.n52.sos.response.AbstractServiceResponse;
+import org.n52.sos.service.Configurator;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.util.KvpHelper;
+import org.n52.sos.util.OMHelper;
+import org.n52.sos.util.XmlHelper;
+import org.n52.sos.util.http.MediaType;
+import org.n52.sos.util.http.MediaTypes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * Binding to register a sensor without using the SOS-InsertSensor operation.
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ */
+public class RegisterBinding extends SimpleBinding {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RegisterBinding.class);
+
+ private static final String PROCEDURE = "procedure";
+
+ private static final String OFFERING = "offering";
+
+ @Override
+ public Set getConformanceClasses() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ protected MediaType getDefaultContentType() {
+ return MediaTypes.APPLICATION_XML;
+ }
+
+ @Override
+ public String getUrlPattern() {
+ return "/register";
+ }
+
+ @Override
+ public Set getSupportedEncodings() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public void doPostOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
+ AbstractServiceRequest> serviceRequest = null;
+ try {
+ serviceRequest = parseRequest(req);
+ // add request context information
+ serviceRequest.setRequestContext(getRequestContext(req));
+ AbstractServiceResponse response = getServiceOperator(serviceRequest).receiveRequest(serviceRequest);
+ writeResponse(req, res, response);
+ } catch (OwsExceptionReport oer) {
+ oer.setVersion(serviceRequest != null ? serviceRequest.getVersion() : null);
+ writeOwsExceptionReport(req, res, oer);
+ }
+ }
+
+ private AbstractServiceRequest> parseRequest(HttpServletRequest req) throws OwsExceptionReport {
+ Map parameterValueMap = KvpHelper.getKvpParameterValueMap(req);
+ XmlObject doc = XmlHelper.parseXmlSosRequest(req);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("REGISTER-REQUEST: {}", doc.xmlText());
+ }
+ Object object = getDecoder(CodingHelper.getDecoderKey(doc)).decode(doc);
+ if (object != null && object instanceof SosProcedureDescription) {
+
+ SosProcedureDescription procDesc = (SosProcedureDescription) object;
+ InsertSensorRequest request = new InsertSensorRequest();
+ // isType extension
+ String isType = KvpHelper.getParameterValue("isType", parameterValueMap);
+ boolean isTypeRequest = false;
+ if (!Strings.isNullOrEmpty(isType) && Boolean.parseBoolean(isType)) {
+ SwesExtensionImpl extension = new SwesExtensionImpl();
+ extension.setDefinition("isType").setValue(new SweBoolean().setValue(true));
+ request.addExtension(extension);
+ isTypeRequest = true;
+ }
+ // check for procedure and offering identifier
+ // parameterValueMap
+ checkForProcedureParameter(procDesc, parameterValueMap);
+ checkForOfferingParameter(procDesc, parameterValueMap);
+
+ // sensor description
+ request.setProcedureDescription(procDesc);
+ // service and version
+ request.setService(getServiceParameterValue(parameterValueMap));
+ request.setVersion(getVersionParameterValue(parameterValueMap));
+ // format
+ request.setProcedureDescriptionFormat(procDesc.getDescriptionFormat());
+ // observable properties
+ // get from parameter or from sml:output
+ List observableProperties = checkForObservablePropertyParameter(procDesc, parameterValueMap);
+ if (!observableProperties.isEmpty()) {
+ request.setObservableProperty(observableProperties);
+ } else if (procDesc instanceof AbstractSensorML) {
+ request.setObservableProperty(getObservablePropertyFromAbstractSensorML((AbstractSensorML)procDesc));
+ } else if (isTypeRequest) {
+ request.setObservableProperty(Lists.newArrayList("not_defined"));
+ } else {
+ throw new NoApplicableCodeException().withMessage(
+ "The sensor description does not contain sml:outputs which is used to fetch the possible observableProperties! "
+ + "Please add an sml:ouput section or define the observableProperties via 'observableProperty' URL parameter!'");
+ }
+ // metadata
+ if (!isTypeRequest) {
+ SosInsertionMetadata metadata = new SosInsertionMetadata();
+ List featureOfInterestTypes =
+ checkForFeatureOfInterestTypeParameter(procDesc, parameterValueMap);
+ if (!featureOfInterestTypes.isEmpty()) {
+ metadata.setFeatureOfInterestTypes(featureOfInterestTypes);
+ } else {
+ metadata.setFeatureOfInterestTypes(
+ Configurator.getInstance().getCache().getFeatureOfInterestTypes());
+ }
+ List observationTypes = checkForObservationTypeParameter(procDesc, parameterValueMap);
+ if (!observationTypes.isEmpty()) {
+ metadata.setObservationTypes(observationTypes);
+ } else if (procDesc instanceof AbstractProcess && ((AbstractProcess) procDesc).isSetOutputs()) {
+ metadata.setObservationTypes(getObservationTypeFrom(((AbstractProcess) procDesc).getOutputs()));
+ } else if (procDesc instanceof SensorML && ((SensorML)procDesc).isWrapper()) {
+ Set obsTyp = Sets.newHashSet();
+ for (AbstractProcess abstractProcess : ((SensorML)procDesc).getMembers()) {
+ if (abstractProcess.isSetOutputs()) {
+ obsTyp.addAll(getObservationTypeFrom(abstractProcess.getOutputs()));
+ }
+ }
+ metadata.setObservationTypes(obsTyp);
+ } else {
+ metadata.setObservationTypes(Configurator.getInstance().getCache().getObservationTypes());
+ }
+ request.setMetadata(metadata);
+ }
+ return request;
+ }
+ throw new InvalidRequestException().withMessage("The requested sensor description {} is not supported!",
+ object != null ? object.getClass().getName() : "null");
+ }
+
+ private String getServiceParameterValue(Map map) {
+ final String service = KvpHelper.getParameterValue(RequestParams.service, map);
+ if (Strings.isNullOrEmpty(service)) {
+ return Sos2Constants.SOS;
+ }
+ return service;
+ }
+
+ private String getVersionParameterValue(Map map) {
+ final String version = KvpHelper.getParameterValue(RequestParams.version, map);
+ if (Strings.isNullOrEmpty(version)) {
+ return Sos2Constants.SERVICEVERSION;
+ }
+ return version;
+ }
+
+ private void checkForProcedureParameter(SosProcedureDescription procDesc, Map map) {
+ final String procedure = KvpHelper.getParameterValue(PROCEDURE, map);
+ if (!Strings.isNullOrEmpty(procedure)) {
+ procDesc.setIdentifier(new CodeWithAuthority(procedure));
+ }
+ }
+
+ private void checkForOfferingParameter(SosProcedureDescription procDesc, Map map)
+ throws MissingParameterValueException {
+ final String offerings = KvpHelper.getParameterValue(OFFERING, map);
+ if (!Strings.isNullOrEmpty(offerings)) {
+ List multipleOfferingValues = KvpHelper.checkParameterMultipleValues(offerings, OFFERING);
+ for (String offering : multipleOfferingValues) {
+ procDesc.addOffering(new SosOffering(offering, offering));
+ }
+ }
+ }
+
+ private List checkForObservablePropertyParameter(SosProcedureDescription procDesc, Map map)
+ throws MissingParameterValueException {
+ final String offering = KvpHelper.getParameterValue(Sos2Constants.InsertSensorParams.observableProperty, map);
+ if (!Strings.isNullOrEmpty(offering)) {
+ return KvpHelper.checkParameterMultipleValues(offering,
+ Sos2Constants.InsertSensorParams.observableProperty);
+ }
+ return Collections.emptyList();
+ }
+
+ private List checkForObservationTypeParameter(SosProcedureDescription procDesc, Map map)
+ throws MissingParameterValueException {
+ final String offering = KvpHelper.getParameterValue(Sos2Constants.InsertSensorParams.observationType, map);
+ if (!Strings.isNullOrEmpty(offering)) {
+ return KvpHelper.checkParameterMultipleValues(offering, Sos2Constants.InsertSensorParams.observationType);
+ }
+ return Collections.emptyList();
+ }
+
+ private List checkForFeatureOfInterestTypeParameter(SosProcedureDescription procDesc,
+ Map map) throws MissingParameterValueException {
+ final String offering =
+ KvpHelper.getParameterValue(Sos2Constants.InsertSensorParams.featureOfInterestType, map);
+ if (!Strings.isNullOrEmpty(offering)) {
+ return KvpHelper.checkParameterMultipleValues(offering,
+ Sos2Constants.InsertSensorParams.featureOfInterestType);
+ }
+ return Collections.emptyList();
+ }
+
+ private String getObservablePropertyIdentifierFrom(SweAbstractDataComponent abstractDataComponent) {
+ if (abstractDataComponent.isSetIdentifier()) {
+ return abstractDataComponent.getIdentifier();
+ } else if (abstractDataComponent.isSetDefinition()) {
+ return abstractDataComponent.getDefinition();
+ }
+ return null;
+ }
+
+ private List getObservablePropertyFromAbstractSensorML(AbstractSensorML absSensorML) {
+ Set obsProps = Sets.newHashSet();
+ if (absSensorML instanceof AbstractProcess && ((AbstractProcess) absSensorML).isSetOutputs()) {
+ for (SmlIo> smlIo : ((AbstractProcess) absSensorML).getOutputs()) {
+ if (smlIo.isSetValue()) {
+ SweAbstractDataComponent abstractDataComponent = smlIo.getIoValue();
+ if (abstractDataComponent instanceof SweAbstractDataRecord) {
+ for (SweField field : ((SweAbstractDataRecord) abstractDataComponent).getFields()) {
+ String identifier = getObservablePropertyIdentifierFrom(field.getElement());
+ if (!Strings.isNullOrEmpty(identifier)) {
+ obsProps.add(identifier);
+ } else {
+ String identifierFromField =
+ getObservablePropertyIdentifierFrom(field.getElement());
+ if (!Strings.isNullOrEmpty(identifierFromField)) {
+ obsProps.add(identifierFromField);
+ } else {
+ obsProps.add(field.getName().getValue());
+ }
+ }
+ }
+ }
+ String identifier = getObservablePropertyIdentifierFrom(abstractDataComponent);
+ if (!Strings.isNullOrEmpty(identifier)) {
+ obsProps.add(identifier);
+ }
+ } else if (smlIo.isSetName()) {
+ obsProps.add(smlIo.getIoName());
+ }
+ }
+ } else if (absSensorML instanceof SensorML && ((SensorML)absSensorML).isWrapper()) {
+ for (AbstractProcess abstractProcess : ((SensorML)absSensorML).getMembers()) {
+ obsProps.addAll(getObservablePropertyFromAbstractSensorML(abstractProcess));
+ }
+ }
+ return Lists.newArrayList(obsProps);
+ }
+
+ private Set getObservationTypeFrom(List> outputs) {
+ Set observationTypes = Sets.newHashSet();
+ for (SmlIo> smlIo : outputs) {
+ if (smlIo.isSetValue()) {
+ try {
+ if (smlIo.getIoValue() instanceof SweAbstractDataRecord) {
+ for (SweField field : ((SweAbstractDataRecord) smlIo.getIoValue()).getFields()) {
+ observationTypes.add(OMHelper.getObservationTypeFrom(field.getElement()));
+ }
+ }
+ observationTypes.add(OMHelper.getObservationTypeFrom(smlIo.getIoValue()));
+ } catch (OwsExceptionReport e) {
+ observationTypes.add(OmConstants.OBS_TYPE_OBSERVATION);
+ LOGGER.debug("The output element can not be assigned to an observation type", e);
+ }
+ }
+ }
+ return observationTypes;
+ }
+}
diff --git a/bindings/register/src/main/resources/META-INF/services/org.n52.sos.binding.Binding b/bindings/register/src/main/resources/META-INF/services/org.n52.sos.binding.Binding
new file mode 100644
index 0000000000..d70db6ef7d
--- /dev/null
+++ b/bindings/register/src/main/resources/META-INF/services/org.n52.sos.binding.Binding
@@ -0,0 +1 @@
+org.n52.sos.binding.RegisterBinding
\ No newline at end of file
diff --git a/bindings/rest/code/pom.xml b/bindings/rest/code/pom.xml
index 0430374a0b..c882e7309a 100644
--- a/bindings/rest/code/pom.xml
+++ b/bindings/rest/code/pom.xml
@@ -1,86 +1,90 @@
-
-
- 4.0.0
-
- org.n52.sensorweb.sos
- rest
- 4.3.14
-
- rest-code
- 52°North SOS - Extension REST Binding - Core
- Core classes for restful binding module
-
-
- ${sos.groupid}
- api
-
-
- org.slf4j
- slf4j-api
-
-
- javax.servlet
- servlet-api
-
-
-
- ${project.groupId}
- rest-xml
-
-
- org.n52.sensorweb
- 52n-xml-sos-v20
-
-
- org.n52.sensorweb
- 52n-xml-ows-v110
-
-
- org.n52.sensorweb
- 52n-xml-gml-v321
-
-
- org.n52.sensorweb
- 52n-xml-sweCommon-v20
-
-
- org.n52.sensorweb
- 52n-xml-om-v20
-
-
- org.n52.sensorweb
- 52n-xml-sampling-v20
-
-
- ${project.groupId}
- coding-sos-v20
-
-
- ${project.groupId}
- coding-sensorML-v101
-
-
- ${project.groupId}
- do-xml
-
-
- ${project.groupId}
- do-core
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- true
-
-
-
-
-
-
+
+
+ 4.0.0
+
+ org.n52.sensorweb.sos
+ rest
+ 4.4.0
+
+ rest-code
+ 52°North SOS - Extension REST Binding - Core
+ Core classes for restful binding module
+
+
+ ${sos.groupid}
+ api
+
+
+ org.slf4j
+ slf4j-api
+
+
+ javax.servlet
+ javax.servlet-api
+
+
+
+ ${project.groupId}
+ rest-xml
+
+
+ org.n52.sensorweb
+ 52n-xml-sos-v20
+
+
+ org.n52.sensorweb
+ 52n-xml-ows-v110
+
+
+ org.n52.sensorweb
+ 52n-xml-gml-v321
+
+
+ org.n52.sensorweb
+ 52n-xml-sweCommon-v20
+
+
+ org.n52.sensorweb
+ 52n-xml-om-v20
+
+
+ org.n52.sensorweb
+ 52n-xml-sampling-v20
+
+
+ ${project.groupId}
+ coding-sos-v20
+
+
+ ${project.groupId}
+ coding-sensorML-v101
+
+
+ org.n52.sensorweb
+ 52n-xml-sosdo-v10
+
+
+ org.n52.sensorweb
+ 52n-xml-sosdo-v20
+
+
+ ${project.groupId}
+ do-core
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/Constants.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/Constants.java
deleted file mode 100644
index e6bbe550ec..0000000000
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/Constants.java
+++ /dev/null
@@ -1,931 +0,0 @@
-/**
- * Copyright (C) 2012-2017 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.binding.rest;
-
-import static org.n52.sos.binding.rest.RestSettings.*;
-
-import java.net.URI;
-
-import org.n52.sos.config.SettingsManager;
-import org.n52.sos.config.annotation.Configurable;
-import org.n52.sos.config.annotation.Setting;
-import org.n52.sos.exception.ConfigurationException;
-import org.n52.sos.ogc.sensorML.SensorMLConstants;
-import org.n52.sos.service.ServiceSettings;
-import org.n52.sos.util.Validation;
-import org.n52.sos.util.http.MediaType;
-
-/**
- * @author Eike Hinderk
- * Jürrens
- */
-@Configurable
-public final class Constants {
-
- private static Constants instance = null;
-
- public static synchronized Constants getInstance()
- {
- if (instance == null) {
- instance = new Constants();
- SettingsManager.getInstance().configure(instance);
- }
- return instance;
- }
-
- // configurable settings - for details see RestSettings class
- private String conformanceClass;
- private MediaType contentTypeDefault;
- private MediaType contentTypeUndefined;
- private int epsgCodeDefault;
- private String errorMessageBadGetRequest;
- private String errorMessageBadGetRequestById;
- private String errorMessageBadGetRequestGlobalResource;
- private String errorMessageBadGetRequestNoValidKvpParameter;
- private String errorMessageBadGetRequestSearch;
- private String errorMessageHttpMethodNotAllowedForResource;
- private String errorMessageWrongContentType;
- private String errorMessageWrongContentTypeInAcceptHeader;
- private String httpGetParameternameFoi;
- private String httpGetParameternameNamespaces;
- private String httpGetParameternameObservedproperty;
- private String httpGetParameternameOffering;
- private String httpGetParameternameProcedures;
- private String httpGetParameternameSpatialfilter;
- private String httpGetParameternameTemporalfilter;
- private String httpHeaderIdentifierXDeletedResourceId;
- private String httpOperationNotAllowedForResourceTypeMessageStart;
- private String kvpEncodingValuesplitter;
- private String landingPointResource;
- private String resourceCapabilities;
- private String resourceFeatures;
- private String resourceObservableproperties;
- private String resourceObservations;
- private String resourceOfferings;
- private String resourceRelationFeatureGet;
- private String resourceRelationFeaturesGet;
- private String resourceRelationObservablepropertyGet;
- private String resourceRelationObservationCreate;
- private String resourceRelationObservationDelete;
- private String resourceRelationObservationGet;
- private String resourceRelationObservationsGet;
- private String resourceRelationOfferingGet;
- private String resourceRelationOfferingsGet;
- private String resourceRelationSelf;
- private String resourceRelationSensorCreate;
- private String resourceRelationSensorDelete;
- private String resourceRelationSensorGet;
- private String resourceRelationSensorsGet;
- private String resourceRelationSensorUpdate;
- private String resourceSensors;
- private String resourceType;
- private String restEncodingNamespace;
- private String restEncodingPrefix;
- private String serviceUrl;
- private String smlCapabilityFeatureofinteresttypeName;
- private String smlCapabilityInsertionmetadataName;
- private String smlCapabilityObservationtypeName;
- private String sosCapabilitiesSectionNameContents;
- private String sosErrormessageOperationNotSupportedEnd;
- private String sosErrormessageOperationNotSupportedStart;
- private String sosService;
- private String sosTermsProcedureidentifier;
- private String sosVersion;
- private String urlEncoding;
- private String urlpattern;
- private URI encodingSchemaUrl;
-
- private Constants() {
- }
-
- public String getBindingEndPointResource()
- {
-// return properties.getProperty("default.landingpoint.resource","capabilities");
- return landingPointResource;
- }
-
- public String getConformanceClass()
- {
- return conformanceClass; //properties.getProperty("conformanceclass", "http://www.opengis.net/spec/SOS/2.0/conf/rest");
- }
-
- public MediaType getContentTypeDefault()
- {
- return contentTypeDefault; // properties.getProperty("default.content.type", "application/gml+xml");
- }
-
- public MediaType getContentTypeUndefined()
- {
- return contentTypeUndefined;//properties.getProperty("default.content.type.undefined", "unknown/unknown");
- }
-
- public String getDefaultDescribeSensorOutputFormat()
- {
- return SensorMLConstants.NS_SML;
- }
-
- public String getDefaultUrlEncoding()
- {
-// return properties.getProperty("default.url.encoding","UTF-8");
- return urlEncoding;
- }
-
- public String getEncodingNamespace()
- {
- return restEncodingNamespace;
-// return properties.getProperty("encoding.namespace", "http://www.opengis.net/sosREST/1.0");
- }
-
- public String getEncodingPrefix()
- {
-// return properties.getProperty("encoding.prefix", "sosREST");
- return restEncodingPrefix;
- }
-
- public String getErrorMessageBadGetRequest()
- {
-// return properties.getProperty("error.message.badGetRequest", "Received GET request invalid for resource type \"%s\". Try ");
- return errorMessageBadGetRequest;
- }
-
- public String getErrorMessageBadGetRequestById()
- {
-// return properties.getProperty("error.message.badGetRequestById", "\"../%s/$RESOURCE_ID\"");
- return errorMessageBadGetRequestById;
- }
-
- public String getErrorMessageBadGetRequestGlobalResource()
- {
-// return properties.getProperty("error.message.badGetRequestGlobalResource", "\"..%s\"");
- return errorMessageBadGetRequestGlobalResource;
- }
-
- public String getErrorMessageBadGetRequestNoValidKvpParameter()
- {
-// return properties.getProperty("error.message.badGetRequestNoValidKvpParameter", "No valid parameter at all.");
- return errorMessageBadGetRequestNoValidKvpParameter;
- }
-
- public String getErrorMessageBadGetRequestSearch()
- {
-// return properties.getProperty("error.message.badGetRequestSearch", "\"../%s?$SEARCH_REQUEST\". Please refer to the documentation regarding allowed parameters");
- return errorMessageBadGetRequestSearch;
- }
-
- public String getErrorMessageHttpMethodNotAllowedForResource()
- {
-// return properties.getProperty("error.message.HttpMethodNotAllowedForResource","HTTP method \"%s\" not allowed for \"%s\" resources.");
- return errorMessageHttpMethodNotAllowedForResource;
- }
-
- public String getErrorMessageWrongContentType()
- {
-// return properties.getProperty("error.message.wrongContentType", "request with wrong content type received.");
- return errorMessageWrongContentType;
- }
-
- public String getErrorMessageWrongContentTypeInAcceptHeader()
- {
-// return properties.getProperty("error.message.wrongContentTypeInAcceptHeader", "Requested content type as specified in Accept header not supported.");
- return errorMessageWrongContentTypeInAcceptHeader;
- }
-
- public String getHttpGetParameterNameFoi()
- {
-// return properties.getProperty("http.get.parametername.foi", "feature");
- return httpGetParameternameFoi;
- }
-
- public String getHttpGetParameterNameNamespaces()
- {
-// return properties.getProperty("http.get.parametername.namespaces","namespaces");
- return httpGetParameternameNamespaces;
- }
-
- public String getHttpGetParameterNameObservedProperty()
- {
-// return properties.getProperty("http.get.parametername.observedproperty","observedproperties");
- return httpGetParameternameObservedproperty;
- }
-
- public String getHttpGetParameterNameOffering()
- {
-// return properties.getProperty("http.get.parametername.offering","offering");
- return httpGetParameternameOffering;
- }
-
- public String getHttpGetParameterNameProcedure()
- {
-// return properties.getProperty("http.get.parametername.procedures","procedures");
- return httpGetParameternameProcedures;
- }
-
- public String getHttpGetParameterNameSpatialFilter()
- {
-// return properties.getProperty("http.get.parametername.spatialfilter","spatialfilter");
- return httpGetParameternameSpatialfilter;
- }
-
- public String getHttpGetParameterNameTemporalFilter()
- {
-// return properties.getProperty("http.get.parametername.temporalfilter","temporalfilter");
- return httpGetParameternameTemporalfilter;
- }
-
- public String getHttpHeaderIdentifierXDeletedResourceId()
- {
-// return properties.getProperty("http.header.identifier.XDeletedResourceId","X-Deleted-Resource-Id");
- return httpHeaderIdentifierXDeletedResourceId;
- }
-
- public String getHttpOperationNotAllowedForResourceTypeMessagePart()
- {
-// return properties.getProperty("http.operationNotAllowedForResourceType.message.start", "operation is not allowed for the resource type");
- return httpOperationNotAllowedForResourceTypeMessageStart;
- }
-
- public String getKvPEncodingValueSplitter()
- {
-// return properties.getProperty("kvp.encoding.valuesplitter", ",");
- return kvpEncodingValuesplitter;
- }
-
- public String getResourceCapabilities()
- {
-// return properties.getProperty("resource.capabilities", "capabilities");
- return resourceCapabilities;
- }
-
- public String getResourceFeatures()
- {
-// return properties.getProperty("resource.features", "features");
- return resourceFeatures;
- }
-
- public String getResourceObservableProperties()
- {
-// return properties.getProperty("resource.observableproperties", "properties");
- return resourceObservableproperties;
- }
-
- public String getResourceObservations()
- {
-// return properties.getProperty("resource.observations", "observations");
- return resourceObservations;
- }
-
- public String getResourceOfferings()
- {
-// return properties.getProperty("resource.offerings", "offerings");
- return resourceOfferings;
- }
-
- public String getResourceRelationFeatureGet()
- {
-// return properties.getProperty("resource.relation.feature.get", "feature-get");
- return resourceRelationFeatureGet;
- }
-
- public String getResourceRelationFeaturesGet()
- {
-// return properties.getProperty("resource.relation.features.get", "features-get");
- return resourceRelationFeaturesGet;
- }
-
- public String getResourceRelationObservablePropertyGet()
- {
-// return properties.getProperty("resource.relation.observableproperty.get", "property-get");
- return resourceRelationObservablepropertyGet;
- }
-
- public String getResourceRelationObservationCreate()
- {
-// return properties.getProperty("resource.relation.observation.create", "observation-create");
- return resourceRelationObservationCreate;
- }
-
- public String getResourceRelationObservationDelete()
- {
-// return properties.getProperty("resource.relation.observation.delete", "observation-delete");
- return resourceRelationObservationDelete;
- }
-
- public String getResourceRelationObservationGet()
- {
-// return properties.getProperty("resource.relation.observation.get", "observation-get");
- return resourceRelationObservationGet;
- }
-
- public String getResourceRelationObservationsGet()
- {
-// return properties.getProperty("resource.relation.observations.get", "observations-get");
- return resourceRelationObservationsGet;
- }
-
- public String getResourceRelationOfferingGet()
- {
-// return properties.getProperty("resource.relation.offering.get", "offering-get");
- return resourceRelationOfferingGet;
- }
-
- public String getResourceRelationOfferingsGet()
- {
-// return properties.getProperty("resource.relation.offerings.get", "offerings-get");
- return resourceRelationOfferingsGet;
- }
-
- public String getResourceRelationSelf()
- {
-// return properties.getProperty("resource.relation.self", "self");
- return resourceRelationSelf;
- }
-
- public String getResourceRelationSensorCreate()
- {
-// return properties.getProperty("resource.relation.sensor.create", "sensor-create");
- return resourceRelationSensorCreate;
- }
-
- public String getResourceRelationSensorDelete()
- {
-// return properties.getProperty("resource.relation.sensor.delete", "sensor-delete");
- return resourceRelationSensorDelete;
- }
-
- public String getResourceRelationSensorGet()
- {
-// return properties.getProperty("resource.relation.sensor.get", "sensor-get");
- return resourceRelationSensorGet;
- }
-
- public String getResourceRelationSensorsGet()
- {
-// return properties.getProperty("resource.relation.sensors.get", "sensors-get");
- return resourceRelationSensorsGet;
- }
-
- public String getResourceRelationSensorUpdate()
- {
-// return properties.getProperty("resource.relation.sensor.update", "sensor-update");
- return resourceRelationSensorUpdate;
- }
-
- public String getResourceSensors()
- {
-// return properties.getProperty("resource.sensors", "sensors");
- return resourceSensors;
- }
-
- public String getResourceType()
- {
-// return properties.getProperty("resource.type", "resource type");
- return resourceType;
- }
-
- public String getServiceUrl()
- {
- return serviceUrl;//properties.getProperty("service.url", "http://localhost:8080/SDC");
- }
-
- public String getSmlCapabilityFeatureOfInterestTypeName()
- {
-// return properties.getProperty("sml.capability.featureofinteresttype.name", "sos:FeatureOfInterestType");
- return smlCapabilityFeatureofinteresttypeName;
- }
-
- public String getSmlCapabilityInsertMetadataName()
- {
-// return properties.getProperty("sml.capability.insertionmetadata.name", "InsertionMetadata");
- return smlCapabilityInsertionmetadataName;
- }
-
- public String getSmlCapabilityObservationTypeName()
- {
-// return properties.getProperty("sml.capability.observationtype.name", "sos:ObservationType");
- return smlCapabilityObservationtypeName;
- }
-
- public String getSosCapabilitiesSectionNameContents()
- {
-// return properties.getProperty("sos.capabilities.section.name.contents", "Contents");
- return sosCapabilitiesSectionNameContents;
- }
-
- public String getSosErrorMessageOperationNotSupportedEnd()
- {
-// return properties.getProperty("sos.errormessage.operationNotSupported.end"," is not supported by this service!");
- return sosErrormessageOperationNotSupportedEnd;
- }
-
- public String getSosErrorMessageOperationNotSupportedStart()
- {
-// return properties.getProperty("sos.errormessage.operationNotSupported.start","The requested operation ");
- return sosErrormessageOperationNotSupportedStart;
- }
-
- public String getSosService()
- {
-// return properties.getProperty("sos.service", "SOS");
- return sosService;
- }
-
- public String getSosTermsProcedureIdentifier()
- {
-// return properties.getProperty("sos.terms.procedureidentifier", "procedure");
- return sosTermsProcedureidentifier;
- }
-
- public String getSosVersion()
- {
-// return properties.getProperty("sos.version", "2.0.0");
- return sosVersion;
- }
-
- public int getSpatialReferenceSystemEpsgIdDefault()
- {
-// int result;
-// String entryKey = "default.spatialreferencesystem.epsgid";
-// String idString = properties.getProperty(entryKey, "4326");
-// try {
-// result = Integer.parseInt(idString);
-// } catch (NumberFormatException nfe) {
-// LOGGER.debug(String.format("Could not parse value \"%s\" of entry with key \"%s\". Using default EPSG:4326. Exception: %s",
-// idString,
-// entryKey,
-// nfe.getLocalizedMessage()),
-// nfe);
-// result = 4326;
-// }
-// return result;
- return epsgCodeDefault;
- }
-
- public String getUrlPattern()
- {
-// return properties.getProperty("urlpattern", "/sos/rest");
- return urlpattern;
- }
-
- @Setting(REST_BINDING_END_POINT_RESOURCE)
- public void setBindingEndPointResource(final String landingPointResource)
- {
- Validation.notNullOrEmpty(REST_BINDING_END_POINT_RESOURCE, landingPointResource);
- this.landingPointResource = landingPointResource;
- }
-
- @Setting(REST_CONFORMANCE_CLASS)
- public void setConformanceClass(final String conformanceClass)
- {
- Validation.notNullOrEmpty(REST_CONFORMANCE_CLASS, conformanceClass);
- this.conformanceClass = conformanceClass;
- }
-
- @Setting(REST_CONTENT_TYPE_DEFAULT)
- public void setContentTypeDefault(final String defaultContentType)
- {
- contentTypeDefault= mediaType(REST_CONTENT_TYPE_DEFAULT, defaultContentType);
- }
-
- private MediaType mediaType(final String setting, final String mediaType) {
- Validation.notNullOrEmpty(setting, mediaType);
- try {
- return MediaType.parse(mediaType);
- } catch(final IllegalArgumentException e) {
- throw new ConfigurationException(String.format("%s is not a valid content type!", mediaType));
- }
- }
-
- public void setContentTypeUndefined(final String contentTypeUndefined)
- {
- this.contentTypeUndefined = mediaType(REST_CONTENT_TYPE_UNDEFINED, contentTypeUndefined);
- }
-
- @Setting(REST_EPSG_CODE_DEFAULT)
- public void setEpsgCodeDefault(final int epsgCodeDefault)
- {
- Validation.greaterZero(REST_EPSG_CODE_DEFAULT, epsgCodeDefault);
- this.epsgCodeDefault = epsgCodeDefault;
- }
-
- @Setting(REST_ERROR_MSG_BAD_GET_REQUEST)
- public void setErrorMessageBadGetRequest(final String errorMessageBadGetRequest)
- {
- Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST, errorMessageBadGetRequest);
- this.errorMessageBadGetRequest = errorMessageBadGetRequest;
- }
-
- @Setting(REST_ERROR_MSG_BAD_GET_REQUEST_BY_ID)
- public void setErrorMessageBadGetRequestById(final String errorMessageBadGetRequestById)
- {
- Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST_BY_ID, errorMessageBadGetRequestById);
- this.errorMessageBadGetRequestById = errorMessageBadGetRequestById;
- }
-
- @Setting(REST_ERROR_MSG_BAD_GET_REQUEST_GLOBAL_RESOURCE)
- public void setErrorMessageBadGetRequestGlobalResource(final String errorMessageBadGetRequestGlobalResource)
- {
- Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST_GLOBAL_RESOURCE, errorMessageBadGetRequestGlobalResource);
- this.errorMessageBadGetRequestGlobalResource = errorMessageBadGetRequestGlobalResource;
- }
-
- @Setting(REST_ERROR_MSG_BAD_GET_REQUEST_NO_VALID_KVP_PARAMETER)
- public void setErrorMessageBadGetRequestNoValidKvpParameter(final String errorMessageBadGetRequestNoValidKvpParameter)
- {
- Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST_NO_VALID_KVP_PARAMETER, errorMessageBadGetRequestNoValidKvpParameter);
- this.errorMessageBadGetRequestNoValidKvpParameter = errorMessageBadGetRequestNoValidKvpParameter;
- }
-
- @Setting(REST_ERROR_MSG_BAD_GET_REQUEST_SEARCH)
- public void setErrorMessageBadGetRequestSearch(final String errorMessageBadGetRequestSearch)
- {
- Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST_SEARCH, errorMessageBadGetRequestSearch);
- this.errorMessageBadGetRequestSearch = errorMessageBadGetRequestSearch;
- }
-
- @Setting(REST_ERROR_MSG_HTTP_METHOD_NOT_ALLOWED_FOR_RESOURCE)
- public void setErrorMessageHttpMethodNotAllowedForResource(final String errorMessageHttpMethodNotAllowedForResource)
- {
- Validation.notNullOrEmpty(REST_ERROR_MSG_HTTP_METHOD_NOT_ALLOWED_FOR_RESOURCE, errorMessageHttpMethodNotAllowedForResource);
- this.errorMessageHttpMethodNotAllowedForResource = errorMessageHttpMethodNotAllowedForResource;
- }
-
- @Setting(REST_ERROR_MSG_WRONG_CONTENT_TYPE)
- public void setErrorMessageWrongContentType(final String errorMessageWrongContentType)
- {
- Validation.notNullOrEmpty(REST_ERROR_MSG_WRONG_CONTENT_TYPE, errorMessageWrongContentType);
- this.errorMessageWrongContentType = errorMessageWrongContentType;
- }
-
- @Setting(REST_ERROR_MSG_WRONG_CONTENT_TYPE_IN_ACCEPT_HEADER)
- public void setErrorMessageWrongContentTypeInAcceptHeader(final String errorMessageWrongContentTypeInAcceptHeader)
- {
- Validation.notNullOrEmpty(REST_ERROR_MSG_WRONG_CONTENT_TYPE_IN_ACCEPT_HEADER, errorMessageWrongContentTypeInAcceptHeader);
- this.errorMessageWrongContentTypeInAcceptHeader = errorMessageWrongContentTypeInAcceptHeader;
- }
-
- @Setting(REST_HTTP_GET_PARAMETERNAME_FOI)
- public void setHttpGetParameternameFoi(final String httpGetParameternameFoi)
- {
- Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_FOI, httpGetParameternameFoi);
- this.httpGetParameternameFoi = httpGetParameternameFoi;
- }
-
- @Setting(REST_HTTP_GET_PARAMETERNAME_NAMESPACES)
- public void setHttpGetParameternameNamespaces(final String httpGetParameternameNamespaces)
- {
- Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_NAMESPACES, httpGetParameternameNamespaces);
- this.httpGetParameternameNamespaces = httpGetParameternameNamespaces;
- }
-
- @Setting(REST_HTTP_GET_PARAMETERNAME_OBSERVEDPROPERTY)
- public void setHttpGetParameternameObservedproperty(final String httpGetParameternameObservedproperty)
- {
- Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_OBSERVEDPROPERTY, httpGetParameternameObservedproperty);
- this.httpGetParameternameObservedproperty = httpGetParameternameObservedproperty;
- }
-
- @Setting(REST_HTTP_GET_PARAMETERNAME_OFFERING)
- public void setHttpGetParameternameOffering(final String httpGetParameternameOffering)
- {
- Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_OFFERING, httpGetParameternameOffering);
- this.httpGetParameternameOffering = httpGetParameternameOffering;
- }
-
- @Setting(REST_HTTP_GET_PARAMETERNAME_PROCEDURES)
- public void setHttpGetParameternameProcedures(final String httpGetParameternameProcedures)
- {
- Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_PROCEDURES, httpGetParameternameProcedures);
- this.httpGetParameternameProcedures = httpGetParameternameProcedures;
- }
-
- @Setting(REST_HTTP_GET_PARAMETERNAME_SPATIALFILTER)
- public void setHttpGetParameternameSpatialfilter(final String httpGetParameternameSpatialfilter)
- {
- Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_SPATIALFILTER, httpGetParameternameSpatialfilter);
- this.httpGetParameternameSpatialfilter = httpGetParameternameSpatialfilter;
- }
-
- @Setting(REST_HTTP_GET_PARAMETERNAME_TEMPORALFILTER)
- public void setHttpGetParameternameTemporalfilter(final String httpGetParameternameTemporalfilter)
- {
- Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_TEMPORALFILTER, httpGetParameternameTemporalfilter);
- this.httpGetParameternameTemporalfilter = httpGetParameternameTemporalfilter;
- }
-
- @Setting(REST_HTTP_HEADER_IDENTIFIER_XDELETEDRESOURCEID)
- public void setHttpHeaderIdentifierXDeletedResourceId(final String httpHeaderIdentifierXDeletedResourceId)
- {
- Validation.notNullOrEmpty(REST_HTTP_HEADER_IDENTIFIER_XDELETEDRESOURCEID, httpHeaderIdentifierXDeletedResourceId);
- this.httpHeaderIdentifierXDeletedResourceId = httpHeaderIdentifierXDeletedResourceId;
- }
-
- @Setting(REST_HTTP_OPERATIONNOTALLOWEDFORRESOURCETYPE_MESSAGE_START)
- public void setHttpOperationNotAllowedForResourceTypeMessageStart(final String httpOperationNotAllowedForResourceTypeMessageStart)
- {
- Validation.notNullOrEmpty(REST_HTTP_OPERATIONNOTALLOWEDFORRESOURCETYPE_MESSAGE_START, httpOperationNotAllowedForResourceTypeMessageStart);
- this.httpOperationNotAllowedForResourceTypeMessageStart = httpOperationNotAllowedForResourceTypeMessageStart;
- }
-
- @Setting(REST_KVP_ENCODING_VALUESPLITTER)
- public void setKvpEncodingValuesplitter(final String kvpEncodingValuesplitter)
- {
- Validation.notNullOrEmpty(REST_KVP_ENCODING_VALUESPLITTER, kvpEncodingValuesplitter);
- this.kvpEncodingValuesplitter = kvpEncodingValuesplitter;
- }
-
- @Setting(REST_RESOURCE_CAPABILITIES)
- public void setResourceCapabilities(final String resourceCapabilities)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_CAPABILITIES, resourceCapabilities);
- this.resourceCapabilities = resourceCapabilities;
- }
-
- @Setting(REST_RESOURCE_FEATURES)
- public void setResourceFeatures(final String resourceFeatures)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_FEATURES, resourceFeatures);
- this.resourceFeatures = resourceFeatures;
- }
-
- @Setting(REST_RESOURCE_OBSERVABLEPROPERTIES)
- public void setResourceObservableproperties(final String resourceObservableproperties)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_OBSERVABLEPROPERTIES, resourceObservableproperties);
- this.resourceObservableproperties = resourceObservableproperties;
- }
-
- @Setting(REST_RESOURCE_OBSERVATIONS)
- public void setResourceObservations(final String resourceObservations)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_OBSERVATIONS, resourceObservations);
- this.resourceObservations = resourceObservations;
- }
-
- @Setting(REST_RESOURCE_OFFERINGS)
- public void setResourceOfferings(final String resourceOfferings)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_OFFERINGS, resourceOfferings);
- this.resourceOfferings = resourceOfferings;
- }
-
- @Setting(REST_RESOURCE_RELATION_FEATURE_GET)
- public void setResourceRelationFeatureGet(final String resourceRelationFeatureGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_FEATURE_GET, resourceRelationFeatureGet);
- this.resourceRelationFeatureGet = resourceRelationFeatureGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_FEATURES_GET)
- public void setResourceRelationFeaturesGet(final String resourceRelationFeaturesGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_FEATURES_GET, resourceRelationFeaturesGet);
- this.resourceRelationFeaturesGet = resourceRelationFeaturesGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_OBSERVABLEPROPERTY_GET)
- public void setResourceRelationObservablepropertyGet(final String resourceRelationObservablepropertyGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVABLEPROPERTY_GET, resourceRelationObservablepropertyGet);
- this.resourceRelationObservablepropertyGet = resourceRelationObservablepropertyGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_OBSERVATION_CREATE)
- public void setResourceRelationObservationCreate(final String resourceRelationObservationCreate)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVATION_CREATE, resourceRelationObservationCreate);
- this.resourceRelationObservationCreate = resourceRelationObservationCreate;
- }
-
- @Setting(REST_RESOURCE_RELATION_OBSERVATION_DELETE)
- public void setResourceRelationObservationDelete(final String resourceRelationObservationDelete)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVATION_DELETE, resourceRelationObservationDelete);
- this.resourceRelationObservationDelete = resourceRelationObservationDelete;
- }
-
- @Setting(REST_RESOURCE_RELATION_OBSERVATION_GET)
- public void setResourceRelationObservationGet(final String resourceRelationObservationGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVATION_GET, resourceRelationObservationGet);
- this.resourceRelationObservationGet = resourceRelationObservationGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_OBSERVATIONS_GET)
- public void setResourceRelationObservationsGet(final String resourceRelationObservationsGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVATIONS_GET, resourceRelationObservationsGet);
- this.resourceRelationObservationsGet = resourceRelationObservationsGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_OFFERING_GET)
- public void setResourceRelationOfferingGet(final String resourceRelationOfferingGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OFFERING_GET, resourceRelationOfferingGet);
- this.resourceRelationOfferingGet = resourceRelationOfferingGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_OFFERINGS_GET)
- public void setResourceRelationOfferingsGet(final String resourceRelationOfferingsGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OFFERINGS_GET, resourceRelationOfferingsGet);
- this.resourceRelationOfferingsGet = resourceRelationOfferingsGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_SELF)
- public void setResourceRelationSelf(final String resourceRelationSelf)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SELF, resourceRelationSelf);
- this.resourceRelationSelf = resourceRelationSelf;
- }
-
- @Setting(REST_RESOURCE_RELATION_SENSOR_CREATE)
- public void setResourceRelationSensorCreate(final String resourceRelationSensorCreate)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSOR_CREATE, resourceRelationSensorCreate);
- this.resourceRelationSensorCreate = resourceRelationSensorCreate;
- }
-
- @Setting(REST_RESOURCE_RELATION_SENSOR_DELETE)
- public void setResourceRelationSensorDelete(final String resourceRelationSensorDelete)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSOR_DELETE, resourceRelationSensorDelete);
- this.resourceRelationSensorDelete = resourceRelationSensorDelete;
- }
-
- @Setting(REST_RESOURCE_RELATION_SENSOR_GET)
- public void setResourceRelationSensorGet(final String resourceRelationSensorGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSOR_GET, resourceRelationSensorGet);
- this.resourceRelationSensorGet = resourceRelationSensorGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_SENSORS_GET)
- public void setResourceRelationSensorsGet(final String resourceRelationSensorsGet)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSORS_GET, resourceRelationSensorsGet);
- this.resourceRelationSensorsGet = resourceRelationSensorsGet;
- }
-
- @Setting(REST_RESOURCE_RELATION_SENSOR_UPDATE)
- public void setResourceRelationSensorUpdate(final String resourceRelationSensorUpdate)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSOR_UPDATE, resourceRelationSensorUpdate);
- this.resourceRelationSensorUpdate = resourceRelationSensorUpdate;
- }
-
- @Setting(REST_RESOURCE_SENSORS)
- public void setResourceSensors(final String resourceSensors)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_SENSORS, resourceSensors);
- this.resourceSensors = resourceSensors;
- }
-
- @Setting(REST_RESOURCE_TYPE)
- public void setResourceType(final String resourceType)
- {
- Validation.notNullOrEmpty(REST_RESOURCE_TYPE, resourceType);
- this.resourceType = resourceType;
- }
-
- @Setting(REST_ENCODING_NAMESPACE)
- public void setRestEncodingNamespace(final URI restEncodingNamespace)
- {
- Validation.notNull(REST_ENCODING_NAMESPACE, restEncodingNamespace);
- this.restEncodingNamespace = restEncodingNamespace.toString();
- }
-
- @Setting(REST_ENCODING_PREFIX)
- public void setRestEncodingPrefix(final String restEncodingPrefix)
- {
- Validation.notNullOrEmpty(REST_ENCODING_PREFIX, restEncodingPrefix);
- this.restEncodingPrefix = restEncodingPrefix;
- }
-
- @Setting(ServiceSettings.SERVICE_URL)
- public void setServiceUrl(final URI serviceURL)
- {
- Validation.notNull("Service URL", serviceURL);
- String url = serviceURL.toString();
- if (url.contains("?")) {
- url = url.split("[?]")[0];
- }
- serviceUrl = url;
- }
-
- @Setting(REST_SML_CAPABILITY_FEATUREOFINTERESTTYPE_NAME)
- public void setSmlCapabilityFeatureofinteresttypeName(final String smlCapabilityFeatureofinteresttypeName)
- {
- Validation.notNullOrEmpty(REST_SML_CAPABILITY_FEATUREOFINTERESTTYPE_NAME, smlCapabilityFeatureofinteresttypeName);
- this.smlCapabilityFeatureofinteresttypeName = smlCapabilityFeatureofinteresttypeName;
- }
-
- @Setting(REST_SML_CAPABILITY_INSERTIONMETADATA_NAME)
- public void setSmlCapabilityInsertionmetadataName(final String smlCapabilityInsertionmetadataName)
- {
- Validation.notNullOrEmpty(REST_SML_CAPABILITY_INSERTIONMETADATA_NAME, smlCapabilityInsertionmetadataName);
- this.smlCapabilityInsertionmetadataName = smlCapabilityInsertionmetadataName;
- }
-
- @Setting(REST_SML_CAPABILITY_OBSERVATIONTYPE_NAME)
- public void setSmlCapabilityObservationtypeName(final String smlCapabilityObservationtypeName)
- {
- Validation.notNullOrEmpty(REST_SML_CAPABILITY_OBSERVATIONTYPE_NAME, smlCapabilityObservationtypeName);
- this.smlCapabilityObservationtypeName = smlCapabilityObservationtypeName;
- }
-
- @Setting(REST_SOS_CAPABILITIES_SECTION_NAME_CONTENTS)
- public void setSosCapabilitiesSectionNameContents(final String sosCapabilitiesSectionNameContents)
- {
- Validation.notNullOrEmpty(REST_SOS_CAPABILITIES_SECTION_NAME_CONTENTS, sosCapabilitiesSectionNameContents);
- this.sosCapabilitiesSectionNameContents = sosCapabilitiesSectionNameContents;
- }
-
- @Setting(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_END)
- public void setSosErrormessageOperationNotSupportedEnd(final String sosErrormessageOperationNotSupportedEnd)
- {
- Validation.notNullOrEmpty(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_END, sosErrormessageOperationNotSupportedEnd);
- this.sosErrormessageOperationNotSupportedEnd = sosErrormessageOperationNotSupportedEnd;
- }
-
- @Setting(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_START)
- public void setSosErrormessageOperationNotSupportedStart(final String sosErrormessageOperationNotSupportedStart)
- {
- Validation.notNullOrEmpty(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_START, sosErrormessageOperationNotSupportedStart);
- this.sosErrormessageOperationNotSupportedStart = sosErrormessageOperationNotSupportedStart;
- }
-
- @Setting(REST_SOS_SERVICE)
- public void setSosService(final String sosService)
- {
- Validation.notNullOrEmpty(REST_SOS_SERVICE, sosService);
- this.sosService = sosService;
- }
-
- @Setting(REST_SOS_TERMS_PROCEDUREIDENTIFIER)
- public void setSosTermsProcedureidentifier(final String sosTermsProcedureidentifier)
- {
- Validation.notNullOrEmpty(REST_SOS_TERMS_PROCEDUREIDENTIFIER, sosTermsProcedureidentifier);
- this.sosTermsProcedureidentifier = sosTermsProcedureidentifier;
- }
-
- @Setting(REST_SOS_VERSION)
- public void setSosVersion(final String sosVersion)
- {
- Validation.notNullOrEmpty(REST_SOS_VERSION, sosVersion);
- this.sosVersion = sosVersion;
- }
-
- @Setting(REST_URL_ENCODING)
- public void setUrlEncoding(final String urlEncoding)
- {
- Validation.notNull(REST_URL_ENCODING, urlEncoding);
- this.urlEncoding = urlEncoding;
- }
-
- @Setting(REST_URLPATTERN)
- public void setUrlpattern(final String urlpattern)
- {
- Validation.notNullOrEmpty(REST_URLPATTERN, urlpattern);
- this.urlpattern = urlpattern;
- }
-
- @Setting(RestSettings.REST_ENCODING_SCHEMA_URL)
- public void setEncodingSchemaUrl(final URI encodingSchemaUrl)
- {
- Validation.notNull(REST_ENCODING_SCHEMA_URL, encodingSchemaUrl);
- this.encodingSchemaUrl = encodingSchemaUrl;
- }
-
- public URI getEncodingSchemaUrl()
- {
- // https://svn.52north.org/svn/swe/main/SOS/Extensions/Binding/RESTful/trunk/xml/src/main/xsd/sosREST.xsd
- return encodingSchemaUrl;
- }
-
-}
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestBinding.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestBinding.java
index 20dde1f49a..9eb9af8330 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestBinding.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestBinding.java
@@ -94,10 +94,10 @@ public class RestBinding extends Binding {
private static final Logger LOGGER = LoggerFactory.getLogger(RestBinding.class);
private final Set conformanceClasses;
- private final Constants bindingConstants;
+ private final RestConstants bindingConstants;
public RestBinding() {
- bindingConstants = Constants.getInstance();
+ bindingConstants = RestConstants.getInstance();
conformanceClasses = new HashSet(0);
conformanceClasses.add(bindingConstants.getConformanceClass());
}
@@ -152,7 +152,17 @@ public void doGetOperation(HttpServletRequest request,
doOperation(request, response);
}
- /*
+ @Override
+ public ServiceResponse handleOwsExceptionReport(HttpServletRequest request, HttpServletResponse response,
+ OwsExceptionReport oer) throws HTTPException {
+ try {
+ return encodeOwsExceptionReport(oer);
+ } catch (IOException e) {
+ throw new HTTPException(HTTPStatus.INTERNAL_SERVER_ERROR, e);
+ }
+ }
+
+ /*
* (non-Javadoc)
*
* @see org.n52.sos.binding.rest.Binding#doGetOperation(javax.servlet.http.
@@ -176,7 +186,8 @@ protected void doOperation(HttpServletRequest request,
SosEventBus.fire(new ExceptionEvent(oer));
serviceResponse = encodeOwsExceptionReport(oer);
}
- HTTPUtils.writeObject(request, response, serviceResponse);
+ HTTPUtils.writeObject(request, response, serviceResponse, this);
+
}
private ServiceResponse encodeOwsExceptionReport(OwsExceptionReport oer) throws HTTPException, IOException {
@@ -316,7 +327,7 @@ private RequestHandler getRequestHandler(final RestRequest restRequest)
return new ServiceEndpointRequestHandler();
}
}
- throw new MissingParameterValueException(bindingConstants.getResourceType());
+ throw new MissingParameterValueException("resource type");
}
private RestDecoder getDecoder() throws OwsExceptionReport {
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestConstants.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestConstants.java
new file mode 100644
index 0000000000..11c5289471
--- /dev/null
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestConstants.java
@@ -0,0 +1,750 @@
+/**
+ * Copyright (C) 2012-2017 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.binding.rest;
+
+import static org.n52.sos.binding.rest.RestSettings.REST_BINDING_END_POINT_RESOURCE;
+import static org.n52.sos.binding.rest.RestSettings.REST_CONFORMANCE_CLASS;
+import static org.n52.sos.binding.rest.RestSettings.REST_CONTENT_TYPE_DEFAULT;
+import static org.n52.sos.binding.rest.RestSettings.REST_CONTENT_TYPE_UNDEFINED;
+import static org.n52.sos.binding.rest.RestSettings.REST_ENCODING_NAMESPACE;
+import static org.n52.sos.binding.rest.RestSettings.REST_ENCODING_PREFIX;
+import static org.n52.sos.binding.rest.RestSettings.REST_ENCODING_SCHEMA_URL;
+import static org.n52.sos.binding.rest.RestSettings.REST_EPSG_CODE_DEFAULT;
+import static org.n52.sos.binding.rest.RestSettings.REST_ERROR_MSG_BAD_GET_REQUEST;
+import static org.n52.sos.binding.rest.RestSettings.REST_ERROR_MSG_BAD_GET_REQUEST_BY_ID;
+import static org.n52.sos.binding.rest.RestSettings.REST_ERROR_MSG_BAD_GET_REQUEST_GLOBAL_RESOURCE;
+import static org.n52.sos.binding.rest.RestSettings.REST_ERROR_MSG_BAD_GET_REQUEST_NO_VALID_KVP_PARAMETER;
+import static org.n52.sos.binding.rest.RestSettings.REST_ERROR_MSG_BAD_GET_REQUEST_SEARCH;
+import static org.n52.sos.binding.rest.RestSettings.REST_ERROR_MSG_HTTP_METHOD_NOT_ALLOWED_FOR_RESOURCE;
+import static org.n52.sos.binding.rest.RestSettings.REST_ERROR_MSG_WRONG_CONTENT_TYPE;
+import static org.n52.sos.binding.rest.RestSettings.REST_ERROR_MSG_WRONG_CONTENT_TYPE_IN_ACCEPT_HEADER;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_GET_PARAMETERNAME_FOI;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_GET_PARAMETERNAME_NAMESPACES;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_GET_PARAMETERNAME_OBSERVEDPROPERTY;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_GET_PARAMETERNAME_OFFERING;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_GET_PARAMETERNAME_PROCEDURES;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_GET_PARAMETERNAME_SPATIALFILTER;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_GET_PARAMETERNAME_TEMPORALFILTER;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_HEADER_IDENTIFIER_XDELETEDRESOURCEID;
+import static org.n52.sos.binding.rest.RestSettings.REST_HTTP_OPERATIONNOTALLOWEDFORRESOURCETYPE_MESSAGE_START;
+import static org.n52.sos.binding.rest.RestSettings.REST_KVP_ENCODING_VALUESPLITTER;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_CAPABILITIES;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_FEATURES;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_OBSERVABLEPROPERTIES;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_OBSERVATIONS;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_OFFERINGS;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_FEATURES_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_FEATURE_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_OBSERVABLEPROPERTY_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_OBSERVATIONS_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_OBSERVATION_CREATE;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_OBSERVATION_DELETE;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_OBSERVATION_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_OFFERINGS_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_OFFERING_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_SELF;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_SENSORS_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_SENSOR_CREATE;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_SENSOR_DELETE;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_SENSOR_GET;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_RELATION_SENSOR_UPDATE;
+import static org.n52.sos.binding.rest.RestSettings.REST_RESOURCE_SENSORS;
+import static org.n52.sos.binding.rest.RestSettings.REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_END;
+import static org.n52.sos.binding.rest.RestSettings.REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_START;
+import static org.n52.sos.binding.rest.RestSettings.REST_SOS_SERVICE;
+import static org.n52.sos.binding.rest.RestSettings.REST_SOS_TERMS_PROCEDUREIDENTIFIER;
+import static org.n52.sos.binding.rest.RestSettings.REST_SOS_VERSION;
+import static org.n52.sos.binding.rest.RestSettings.REST_URLPATTERN;
+import static org.n52.sos.binding.rest.RestSettings.REST_URL_ENCODING;
+
+import java.net.URI;
+
+import org.n52.sos.config.SettingsManager;
+import org.n52.sos.config.annotation.Configurable;
+import org.n52.sos.config.annotation.Setting;
+import org.n52.sos.exception.ConfigurationException;
+import org.n52.sos.ogc.sensorML.SensorMLConstants;
+import org.n52.sos.service.ServiceSettings;
+import org.n52.sos.util.Validation;
+import org.n52.sos.util.http.MediaType;
+
+/**
+ * @author Eike Hinderk
+ * Jürrens
+ */
+@Configurable
+public final class RestConstants {
+
+ private static RestConstants instance = null;
+
+ public static synchronized RestConstants getInstance() {
+ if (instance == null) {
+ instance = new RestConstants();
+ SettingsManager.getInstance().configure(instance);
+ }
+ return instance;
+ }
+
+ // configurable settings - for details see RestSettings class
+ private String conformanceClass;
+ private MediaType contentTypeDefault;
+ private MediaType contentTypeUndefined;
+ private URI encodingSchemaUrl;
+ private int epsgCodeDefault;
+ private String errorMessageBadGetRequest;
+ private String errorMessageBadGetRequestById;
+ private String errorMessageBadGetRequestGlobalResource;
+ private String errorMessageBadGetRequestNoValidKvpParameter;
+ private String errorMessageBadGetRequestSearch;
+ private String errorMessageHttpMethodNotAllowedForResource;
+ private String errorMessageWrongContentType;
+ private String errorMessageWrongContentTypeInAcceptHeader;
+ private String httpGetParameternameFoi;
+ private String httpGetParameternameNamespaces;
+ private String httpGetParameternameObservedproperty;
+ private String httpGetParameternameOffering;
+ private String httpGetParameternameProcedures;
+ private String httpGetParameternameSpatialfilter;
+ private String httpGetParameternameTemporalfilter;
+ private String httpHeaderIdentifierXDeletedResourceId;
+ private String httpOperationNotAllowedForResourceTypeMessageStart;
+ private String kvpEncodingValuesplitter;
+ private String landingPointResource;
+ private String resourceCapabilities;
+ private String resourceFeatures;
+ private String resourceObservableproperties;
+ private String resourceObservations;
+ private String resourceOfferings;
+ private String resourceRelationFeatureGet;
+ private String resourceRelationFeaturesGet;
+ private String resourceRelationObservablepropertyGet;
+ private String resourceRelationObservationCreate;
+ private String resourceRelationObservationDelete;
+ private String resourceRelationObservationGet;
+ private String resourceRelationObservationsGet;
+ private String resourceRelationOfferingGet;
+ private String resourceRelationOfferingsGet;
+ private String resourceRelationSelf;
+ private String resourceRelationSensorCreate;
+ private String resourceRelationSensorDelete;
+ private String resourceRelationSensorGet;
+ private String resourceRelationSensorsGet;
+ private String resourceRelationSensorUpdate;
+ private String resourceSensors;
+ private String restEncodingNamespace;
+ private String restEncodingPrefix;
+ private String serviceUrl;
+ private String sosErrormessageOperationNotSupportedEnd;
+ private String sosErrormessageOperationNotSupportedStart;
+ private String sosService;
+ private String sosTermsProcedureidentifier;
+ private String sosVersion;
+ private String urlEncoding;
+ private String urlpattern;
+ public static final String SECTION_IDENTIFIER_CONTENTS = "Contents";
+
+ private RestConstants() {
+ }
+
+ public String getBindingEndPointResource() {
+ return landingPointResource;
+ }
+
+ public String getConformanceClass() {
+ return conformanceClass;
+ }
+
+ public MediaType getContentTypeDefault() {
+ return contentTypeDefault;
+ }
+
+ public MediaType getContentTypeUndefined() {
+ return contentTypeUndefined;
+ }
+
+ public String getDefaultDescribeSensorOutputFormat() {
+ return SensorMLConstants.NS_SML;
+ }
+
+ public String getDefaultUrlEncoding() {
+ return urlEncoding;
+ }
+
+ public String getEncodingNamespace() {
+ return restEncodingNamespace;
+ }
+
+ public String getEncodingPrefix() {
+ return restEncodingPrefix;
+ }
+
+ public URI getEncodingSchemaUrl() {
+ return encodingSchemaUrl;
+ }
+
+ public String getErrorMessageBadGetRequest() {
+ return errorMessageBadGetRequest;
+ }
+
+ public String getErrorMessageBadGetRequestById() {
+ return errorMessageBadGetRequestById;
+ }
+
+ public String getErrorMessageBadGetRequestGlobalResource() {
+ return errorMessageBadGetRequestGlobalResource;
+ }
+
+ public String getErrorMessageBadGetRequestNoValidKvpParameter() {
+ return errorMessageBadGetRequestNoValidKvpParameter;
+ }
+
+ public String getErrorMessageBadGetRequestSearch() {
+ return errorMessageBadGetRequestSearch;
+ }
+
+ public String getErrorMessageHttpMethodNotAllowedForResource() {
+ return errorMessageHttpMethodNotAllowedForResource;
+ }
+
+ public String getErrorMessageWrongContentType() {
+ return errorMessageWrongContentType;
+ }
+
+ public String getErrorMessageWrongContentTypeInAcceptHeader() {
+ return errorMessageWrongContentTypeInAcceptHeader;
+ }
+
+ public String getHttpGetParameterNameFoi() {
+ return httpGetParameternameFoi;
+ }
+
+ public String getHttpGetParameterNameNamespaces() {
+ return httpGetParameternameNamespaces;
+ }
+
+ public String getHttpGetParameterNameObservedProperty() {
+ return httpGetParameternameObservedproperty;
+ }
+
+ public String getHttpGetParameterNameOffering() {
+ return httpGetParameternameOffering;
+ }
+
+ public String getHttpGetParameterNameProcedure() {
+ return httpGetParameternameProcedures;
+ }
+
+ public String getHttpGetParameterNameSpatialFilter() {
+ return httpGetParameternameSpatialfilter;
+ }
+
+ public String getHttpGetParameterNameTemporalFilter() {
+ return httpGetParameternameTemporalfilter;
+ }
+
+ public String getHttpHeaderIdentifierXDeletedResourceId() {
+ return httpHeaderIdentifierXDeletedResourceId;
+ }
+
+ public String getHttpOperationNotAllowedForResourceTypeMessagePart() {
+ return httpOperationNotAllowedForResourceTypeMessageStart;
+ }
+
+ public String getKvPEncodingValueSplitter() {
+ return kvpEncodingValuesplitter;
+ }
+
+ public String getResourceCapabilities() {
+ return resourceCapabilities;
+ }
+
+ public String getResourceFeatures() {
+ return resourceFeatures;
+ }
+
+ public String getResourceObservableProperties() {
+ return resourceObservableproperties;
+ }
+
+ public String getResourceObservations() {
+ return resourceObservations;
+ }
+
+ public String getResourceOfferings() {
+ return resourceOfferings;
+ }
+
+ public String getResourceRelationFeatureGet() {
+ return resourceRelationFeatureGet;
+ }
+
+ public String getResourceRelationFeaturesGet() {
+ return resourceRelationFeaturesGet;
+ }
+
+ public String getResourceRelationObservablePropertyGet() {
+ return resourceRelationObservablepropertyGet;
+ }
+
+ public String getResourceRelationObservationCreate() {
+ return resourceRelationObservationCreate;
+ }
+
+ public String getResourceRelationObservationDelete() {
+ return resourceRelationObservationDelete;
+ }
+
+ public String getResourceRelationObservationGet() {
+ return resourceRelationObservationGet;
+ }
+
+ public String getResourceRelationObservationsGet() {
+ return resourceRelationObservationsGet;
+ }
+
+ public String getResourceRelationOfferingGet() {
+ return resourceRelationOfferingGet;
+ }
+
+ public String getResourceRelationOfferingsGet() {
+ return resourceRelationOfferingsGet;
+ }
+
+ public String getResourceRelationSelf() {
+ return resourceRelationSelf;
+ }
+
+ public String getResourceRelationSensorCreate() {
+ return resourceRelationSensorCreate;
+ }
+
+ public String getResourceRelationSensorDelete() {
+ return resourceRelationSensorDelete;
+ }
+
+ public String getResourceRelationSensorGet() {
+ return resourceRelationSensorGet;
+ }
+
+ public String getResourceRelationSensorsGet() {
+ return resourceRelationSensorsGet;
+ }
+
+ public String getResourceRelationSensorUpdate() {
+ return resourceRelationSensorUpdate;
+ }
+
+ public String getResourceSensors() {
+ return resourceSensors;
+ }
+
+ public String getServiceUrl() {
+ return serviceUrl;
+ }
+
+ public String getSosErrorMessageOperationNotSupportedEnd() {
+ return sosErrormessageOperationNotSupportedEnd;
+ }
+
+ public String getSosErrorMessageOperationNotSupportedStart() {
+ return sosErrormessageOperationNotSupportedStart;
+ }
+
+ public String getSosService() {
+ return sosService;
+ }
+
+ public String getSosTermsProcedureIdentifier() {
+ return sosTermsProcedureidentifier;
+ }
+
+ public String getSosVersion() {
+ return sosVersion;
+ }
+
+ public int getSpatialReferenceSystemEpsgIdDefault() {
+ return epsgCodeDefault;
+ }
+
+ public String getUrlPattern() {
+ return urlpattern;
+ }
+
+ @Setting(REST_BINDING_END_POINT_RESOURCE)
+ public void setBindingEndPointResource(final String landingPointResource) {
+ Validation.notNullOrEmpty(REST_BINDING_END_POINT_RESOURCE, landingPointResource);
+ this.landingPointResource = landingPointResource;
+ }
+
+ @Setting(REST_CONFORMANCE_CLASS)
+ public void setConformanceClass(final String conformanceClass) {
+ Validation.notNullOrEmpty(REST_CONFORMANCE_CLASS, conformanceClass);
+ this.conformanceClass = conformanceClass;
+ }
+
+ @Setting(REST_CONTENT_TYPE_DEFAULT)
+ public void setContentTypeDefault(final String defaultContentType) {
+ contentTypeDefault = mediaType(REST_CONTENT_TYPE_DEFAULT, defaultContentType);
+ }
+
+ public void setContentTypeUndefined(final String contentTypeUndefined) {
+ this.contentTypeUndefined = mediaType(REST_CONTENT_TYPE_UNDEFINED, contentTypeUndefined);
+ }
+
+ @Setting(RestSettings.REST_ENCODING_SCHEMA_URL)
+ public void setEncodingSchemaUrl(final URI encodingSchemaUrl) {
+ Validation.notNull(REST_ENCODING_SCHEMA_URL, encodingSchemaUrl);
+ this.encodingSchemaUrl = encodingSchemaUrl;
+ }
+
+ @Setting(REST_EPSG_CODE_DEFAULT)
+ public void setEpsgCodeDefault(final int epsgCodeDefault) {
+ Validation.greaterZero(REST_EPSG_CODE_DEFAULT, epsgCodeDefault);
+ this.epsgCodeDefault = epsgCodeDefault;
+ }
+
+ @Setting(REST_ERROR_MSG_BAD_GET_REQUEST)
+ public void setErrorMessageBadGetRequest(final String errorMessageBadGetRequest) {
+ Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST, errorMessageBadGetRequest);
+ this.errorMessageBadGetRequest = errorMessageBadGetRequest;
+ }
+
+ @Setting(REST_ERROR_MSG_BAD_GET_REQUEST_BY_ID)
+ public void setErrorMessageBadGetRequestById(final String errorMessageBadGetRequestById) {
+ Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST_BY_ID, errorMessageBadGetRequestById);
+ this.errorMessageBadGetRequestById = errorMessageBadGetRequestById;
+ }
+
+ @Setting(REST_ERROR_MSG_BAD_GET_REQUEST_GLOBAL_RESOURCE)
+ public void setErrorMessageBadGetRequestGlobalResource(final String errorMessageBadGetRequestGlobalResource) {
+ Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST_GLOBAL_RESOURCE,
+ errorMessageBadGetRequestGlobalResource);
+ this.errorMessageBadGetRequestGlobalResource = errorMessageBadGetRequestGlobalResource;
+ }
+
+ @Setting(REST_ERROR_MSG_BAD_GET_REQUEST_NO_VALID_KVP_PARAMETER)
+ public void setErrorMessageBadGetRequestNoValidKvpParameter(
+ final String errorMessageBadGetRequestNoValidKvpParameter) {
+ Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST_NO_VALID_KVP_PARAMETER,
+ errorMessageBadGetRequestNoValidKvpParameter);
+ this.errorMessageBadGetRequestNoValidKvpParameter = errorMessageBadGetRequestNoValidKvpParameter;
+ }
+
+ @Setting(REST_ERROR_MSG_BAD_GET_REQUEST_SEARCH)
+ public void setErrorMessageBadGetRequestSearch(final String errorMessageBadGetRequestSearch) {
+ Validation.notNullOrEmpty(REST_ERROR_MSG_BAD_GET_REQUEST_SEARCH, errorMessageBadGetRequestSearch);
+ this.errorMessageBadGetRequestSearch = errorMessageBadGetRequestSearch;
+ }
+
+ @Setting(REST_ERROR_MSG_HTTP_METHOD_NOT_ALLOWED_FOR_RESOURCE)
+ public void setErrorMessageHttpMethodNotAllowedForResource(
+ final String errorMessageHttpMethodNotAllowedForResource) {
+ Validation.notNullOrEmpty(REST_ERROR_MSG_HTTP_METHOD_NOT_ALLOWED_FOR_RESOURCE,
+ errorMessageHttpMethodNotAllowedForResource);
+ this.errorMessageHttpMethodNotAllowedForResource = errorMessageHttpMethodNotAllowedForResource;
+ }
+
+ @Setting(REST_ERROR_MSG_WRONG_CONTENT_TYPE)
+ public void setErrorMessageWrongContentType(final String errorMessageWrongContentType) {
+ Validation.notNullOrEmpty(REST_ERROR_MSG_WRONG_CONTENT_TYPE, errorMessageWrongContentType);
+ this.errorMessageWrongContentType = errorMessageWrongContentType;
+ }
+
+ @Setting(REST_ERROR_MSG_WRONG_CONTENT_TYPE_IN_ACCEPT_HEADER)
+ public void setErrorMessageWrongContentTypeInAcceptHeader(final String errorMessageWrongContentTypeInAcceptHeader) {
+ Validation.notNullOrEmpty(REST_ERROR_MSG_WRONG_CONTENT_TYPE_IN_ACCEPT_HEADER,
+ errorMessageWrongContentTypeInAcceptHeader);
+ this.errorMessageWrongContentTypeInAcceptHeader = errorMessageWrongContentTypeInAcceptHeader;
+ }
+
+ @Setting(REST_HTTP_GET_PARAMETERNAME_FOI)
+ public void setHttpGetParameternameFoi(final String httpGetParameternameFoi) {
+ Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_FOI, httpGetParameternameFoi);
+ this.httpGetParameternameFoi = httpGetParameternameFoi;
+ }
+
+ @Setting(REST_HTTP_GET_PARAMETERNAME_NAMESPACES)
+ public void setHttpGetParameternameNamespaces(final String httpGetParameternameNamespaces) {
+ Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_NAMESPACES, httpGetParameternameNamespaces);
+ this.httpGetParameternameNamespaces = httpGetParameternameNamespaces;
+ }
+
+ @Setting(REST_HTTP_GET_PARAMETERNAME_OBSERVEDPROPERTY)
+ public void setHttpGetParameternameObservedproperty(final String httpGetParameternameObservedproperty) {
+ Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_OBSERVEDPROPERTY, httpGetParameternameObservedproperty);
+ this.httpGetParameternameObservedproperty = httpGetParameternameObservedproperty;
+ }
+
+ @Setting(REST_HTTP_GET_PARAMETERNAME_OFFERING)
+ public void setHttpGetParameternameOffering(final String httpGetParameternameOffering) {
+ Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_OFFERING, httpGetParameternameOffering);
+ this.httpGetParameternameOffering = httpGetParameternameOffering;
+ }
+
+ @Setting(REST_HTTP_GET_PARAMETERNAME_PROCEDURES)
+ public void setHttpGetParameternameProcedures(final String httpGetParameternameProcedures) {
+ Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_PROCEDURES, httpGetParameternameProcedures);
+ this.httpGetParameternameProcedures = httpGetParameternameProcedures;
+ }
+
+ @Setting(REST_HTTP_GET_PARAMETERNAME_SPATIALFILTER)
+ public void setHttpGetParameternameSpatialfilter(final String httpGetParameternameSpatialfilter) {
+ Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_SPATIALFILTER, httpGetParameternameSpatialfilter);
+ this.httpGetParameternameSpatialfilter = httpGetParameternameSpatialfilter;
+ }
+
+ @Setting(REST_HTTP_GET_PARAMETERNAME_TEMPORALFILTER)
+ public void setHttpGetParameternameTemporalfilter(final String httpGetParameternameTemporalfilter) {
+ Validation.notNullOrEmpty(REST_HTTP_GET_PARAMETERNAME_TEMPORALFILTER, httpGetParameternameTemporalfilter);
+ this.httpGetParameternameTemporalfilter = httpGetParameternameTemporalfilter;
+ }
+
+ @Setting(REST_HTTP_HEADER_IDENTIFIER_XDELETEDRESOURCEID)
+ public void setHttpHeaderIdentifierXDeletedResourceId(final String httpHeaderIdentifierXDeletedResourceId) {
+ Validation.notNullOrEmpty(REST_HTTP_HEADER_IDENTIFIER_XDELETEDRESOURCEID,
+ httpHeaderIdentifierXDeletedResourceId);
+ this.httpHeaderIdentifierXDeletedResourceId = httpHeaderIdentifierXDeletedResourceId;
+ }
+
+ @Setting(REST_HTTP_OPERATIONNOTALLOWEDFORRESOURCETYPE_MESSAGE_START)
+ public void setHttpOperationNotAllowedForResourceTypeMessageStart(
+ final String httpOperationNotAllowedForResourceTypeMessageStart) {
+ Validation.notNullOrEmpty(REST_HTTP_OPERATIONNOTALLOWEDFORRESOURCETYPE_MESSAGE_START,
+ httpOperationNotAllowedForResourceTypeMessageStart);
+ this.httpOperationNotAllowedForResourceTypeMessageStart = httpOperationNotAllowedForResourceTypeMessageStart;
+ }
+
+ @Setting(REST_KVP_ENCODING_VALUESPLITTER)
+ public void setKvpEncodingValuesplitter(final String kvpEncodingValuesplitter) {
+ Validation.notNullOrEmpty(REST_KVP_ENCODING_VALUESPLITTER, kvpEncodingValuesplitter);
+ this.kvpEncodingValuesplitter = kvpEncodingValuesplitter;
+ }
+
+ @Setting(REST_RESOURCE_CAPABILITIES)
+ public void setResourceCapabilities(final String resourceCapabilities) {
+ Validation.notNullOrEmpty(REST_RESOURCE_CAPABILITIES, resourceCapabilities);
+ this.resourceCapabilities = resourceCapabilities;
+ }
+
+ @Setting(REST_RESOURCE_FEATURES)
+ public void setResourceFeatures(final String resourceFeatures) {
+ Validation.notNullOrEmpty(REST_RESOURCE_FEATURES, resourceFeatures);
+ this.resourceFeatures = resourceFeatures;
+ }
+
+ @Setting(REST_RESOURCE_OBSERVABLEPROPERTIES)
+ public void setResourceObservableproperties(final String resourceObservableproperties) {
+ Validation.notNullOrEmpty(REST_RESOURCE_OBSERVABLEPROPERTIES, resourceObservableproperties);
+ this.resourceObservableproperties = resourceObservableproperties;
+ }
+
+ @Setting(REST_RESOURCE_OBSERVATIONS)
+ public void setResourceObservations(final String resourceObservations) {
+ Validation.notNullOrEmpty(REST_RESOURCE_OBSERVATIONS, resourceObservations);
+ this.resourceObservations = resourceObservations;
+ }
+
+ @Setting(REST_RESOURCE_OFFERINGS)
+ public void setResourceOfferings(final String resourceOfferings) {
+ Validation.notNullOrEmpty(REST_RESOURCE_OFFERINGS, resourceOfferings);
+ this.resourceOfferings = resourceOfferings;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_FEATURE_GET)
+ public void setResourceRelationFeatureGet(final String resourceRelationFeatureGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_FEATURE_GET, resourceRelationFeatureGet);
+ this.resourceRelationFeatureGet = resourceRelationFeatureGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_FEATURES_GET)
+ public void setResourceRelationFeaturesGet(final String resourceRelationFeaturesGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_FEATURES_GET, resourceRelationFeaturesGet);
+ this.resourceRelationFeaturesGet = resourceRelationFeaturesGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_OBSERVABLEPROPERTY_GET)
+ public void setResourceRelationObservablepropertyGet(final String resourceRelationObservablepropertyGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVABLEPROPERTY_GET, resourceRelationObservablepropertyGet);
+ this.resourceRelationObservablepropertyGet = resourceRelationObservablepropertyGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_OBSERVATION_CREATE)
+ public void setResourceRelationObservationCreate(final String resourceRelationObservationCreate) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVATION_CREATE, resourceRelationObservationCreate);
+ this.resourceRelationObservationCreate = resourceRelationObservationCreate;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_OBSERVATION_DELETE)
+ public void setResourceRelationObservationDelete(final String resourceRelationObservationDelete) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVATION_DELETE, resourceRelationObservationDelete);
+ this.resourceRelationObservationDelete = resourceRelationObservationDelete;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_OBSERVATION_GET)
+ public void setResourceRelationObservationGet(final String resourceRelationObservationGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVATION_GET, resourceRelationObservationGet);
+ this.resourceRelationObservationGet = resourceRelationObservationGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_OBSERVATIONS_GET)
+ public void setResourceRelationObservationsGet(final String resourceRelationObservationsGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OBSERVATIONS_GET, resourceRelationObservationsGet);
+ this.resourceRelationObservationsGet = resourceRelationObservationsGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_OFFERING_GET)
+ public void setResourceRelationOfferingGet(final String resourceRelationOfferingGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OFFERING_GET, resourceRelationOfferingGet);
+ this.resourceRelationOfferingGet = resourceRelationOfferingGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_OFFERINGS_GET)
+ public void setResourceRelationOfferingsGet(final String resourceRelationOfferingsGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_OFFERINGS_GET, resourceRelationOfferingsGet);
+ this.resourceRelationOfferingsGet = resourceRelationOfferingsGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_SELF)
+ public void setResourceRelationSelf(final String resourceRelationSelf) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SELF, resourceRelationSelf);
+ this.resourceRelationSelf = resourceRelationSelf;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_SENSOR_CREATE)
+ public void setResourceRelationSensorCreate(final String resourceRelationSensorCreate) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSOR_CREATE, resourceRelationSensorCreate);
+ this.resourceRelationSensorCreate = resourceRelationSensorCreate;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_SENSOR_DELETE)
+ public void setResourceRelationSensorDelete(final String resourceRelationSensorDelete) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSOR_DELETE, resourceRelationSensorDelete);
+ this.resourceRelationSensorDelete = resourceRelationSensorDelete;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_SENSOR_GET)
+ public void setResourceRelationSensorGet(final String resourceRelationSensorGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSOR_GET, resourceRelationSensorGet);
+ this.resourceRelationSensorGet = resourceRelationSensorGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_SENSORS_GET)
+ public void setResourceRelationSensorsGet(final String resourceRelationSensorsGet) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSORS_GET, resourceRelationSensorsGet);
+ this.resourceRelationSensorsGet = resourceRelationSensorsGet;
+ }
+
+ @Setting(REST_RESOURCE_RELATION_SENSOR_UPDATE)
+ public void setResourceRelationSensorUpdate(final String resourceRelationSensorUpdate) {
+ Validation.notNullOrEmpty(REST_RESOURCE_RELATION_SENSOR_UPDATE, resourceRelationSensorUpdate);
+ this.resourceRelationSensorUpdate = resourceRelationSensorUpdate;
+ }
+
+ @Setting(REST_RESOURCE_SENSORS)
+ public void setResourceSensors(final String resourceSensors) {
+ Validation.notNullOrEmpty(REST_RESOURCE_SENSORS, resourceSensors);
+ this.resourceSensors = resourceSensors;
+ }
+
+ @Setting(REST_ENCODING_NAMESPACE)
+ public void setRestEncodingNamespace(final URI restEncodingNamespace) {
+ Validation.notNull(REST_ENCODING_NAMESPACE, restEncodingNamespace);
+ this.restEncodingNamespace = restEncodingNamespace.toString();
+ }
+
+ @Setting(REST_ENCODING_PREFIX)
+ public void setRestEncodingPrefix(final String restEncodingPrefix) {
+ Validation.notNullOrEmpty(REST_ENCODING_PREFIX, restEncodingPrefix);
+ this.restEncodingPrefix = restEncodingPrefix;
+ }
+
+ @Setting(ServiceSettings.SERVICE_URL)
+ public void setServiceUrl(final URI serviceURL) {
+ Validation.notNull("Service URL", serviceURL);
+ String url = serviceURL.toString();
+ if (url.contains("?")) {
+ url = url.split("[?]")[0];
+ }
+ serviceUrl = url;
+ }
+
+ @Setting(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_END)
+ public void setSosErrormessageOperationNotSupportedEnd(final String sosErrormessageOperationNotSupportedEnd) {
+ Validation.notNullOrEmpty(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_END,
+ sosErrormessageOperationNotSupportedEnd);
+ this.sosErrormessageOperationNotSupportedEnd = sosErrormessageOperationNotSupportedEnd;
+ }
+
+ @Setting(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_START)
+ public void setSosErrormessageOperationNotSupportedStart(final String sosErrormessageOperationNotSupportedStart) {
+ Validation.notNullOrEmpty(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_START,
+ sosErrormessageOperationNotSupportedStart);
+ this.sosErrormessageOperationNotSupportedStart = sosErrormessageOperationNotSupportedStart;
+ }
+
+ @Setting(REST_SOS_SERVICE)
+ public void setSosService(final String sosService) {
+ Validation.notNullOrEmpty(REST_SOS_SERVICE, sosService);
+ this.sosService = sosService;
+ }
+
+ @Setting(REST_SOS_TERMS_PROCEDUREIDENTIFIER)
+ public void setSosTermsProcedureidentifier(final String sosTermsProcedureidentifier) {
+ Validation.notNullOrEmpty(REST_SOS_TERMS_PROCEDUREIDENTIFIER, sosTermsProcedureidentifier);
+ this.sosTermsProcedureidentifier = sosTermsProcedureidentifier;
+ }
+
+ @Setting(REST_SOS_VERSION)
+ public void setSosVersion(final String sosVersion) {
+ Validation.notNullOrEmpty(REST_SOS_VERSION, sosVersion);
+ this.sosVersion = sosVersion;
+ }
+
+ @Setting(REST_URL_ENCODING)
+ public void setUrlEncoding(final String urlEncoding) {
+ Validation.notNull(REST_URL_ENCODING, urlEncoding);
+ this.urlEncoding = urlEncoding;
+ }
+
+ @Setting(REST_URLPATTERN)
+ public void setUrlpattern(final String urlpattern) {
+ Validation.notNullOrEmpty(REST_URLPATTERN, urlpattern);
+ this.urlpattern = urlpattern;
+ }
+
+ private MediaType mediaType(final String setting, final String mediaType) {
+ Validation.notNullOrEmpty(setting, mediaType);
+ try {
+ return MediaType.parse(mediaType);
+ } catch (final IllegalArgumentException e) {
+ throw new ConfigurationException(String.format("%s is not a valid content type!", mediaType));
+ }
+ }
+
+}
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestSettings.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestSettings.java
index 919d4a639a..25cc930c9e 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestSettings.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/RestSettings.java
@@ -65,7 +65,7 @@ public class RestSettings implements SettingDefinitionProvider {
public static final String REST_ERROR_MSG_BAD_GET_REQUEST_GLOBAL_RESOURCE = "rest.errorMsg.badGetRequest.globalResource";
public static final String REST_ERROR_MSG_BAD_GET_REQUEST_NO_VALID_KVP_PARAMETER = "rest.errorMsg.badGetRequest.noValidKvpParameter";
public static final String REST_ERROR_MSG_BAD_GET_REQUEST_SEARCH = "rest.errorMsg.badGetRequest.search";
- public static final String REST_ERROR_MSG_HTTP_METHOD_NOT_ALLOWED_FOR_RESOURCE = "rest.errorMsg.HttpMethodNotAllowedForResource";
+ public static final String REST_ERROR_MSG_HTTP_METHOD_NOT_ALLOWED_FOR_RESOURCE = "rest.errorMsg.HTTPMethodNotAllowedForResource";
public static final String REST_ERROR_MSG_WRONG_CONTENT_TYPE = "rest.errorMsg.wrongContentType";
public static final String REST_ERROR_MSG_WRONG_CONTENT_TYPE_IN_ACCEPT_HEADER = "rest.errorMSg.wrongContentType.inAcceptHeader";
public static final String REST_HTTP_GET_PARAMETERNAME_FOI = "rest.http.get.parametername.foi";
@@ -99,11 +99,6 @@ public class RestSettings implements SettingDefinitionProvider {
public static final String REST_RESOURCE_RELATION_SENSORS_GET = "rest.resource.relation.sensors.get";
public static final String REST_RESOURCE_RELATION_SENSOR_UPDATE = "rest.resource.relation.sensor.update";
public static final String REST_RESOURCE_SENSORS = "rest.resource.sensors";
- public static final String REST_RESOURCE_TYPE = "rest.resource.type";
- public static final String REST_SML_CAPABILITY_FEATUREOFINTERESTTYPE_NAME = "rest.sml.capability.featureofinteresttype.name";
- public static final String REST_SML_CAPABILITY_INSERTIONMETADATA_NAME = "rest.sml.capability.insertionmetadata.name";
- public static final String REST_SML_CAPABILITY_OBSERVATIONTYPE_NAME = "rest.sml.capability.observationtype.name";
- public static final String REST_SOS_CAPABILITIES_SECTION_NAME_CONTENTS = "rest.sos.capabilities.section.name.contents";
public static final String REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_END = "rest.sos.errormessage.operationNotSupported.end";
public static final String REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_START = "rest.sos.errormessage.operationNotSupported.start";
public static final String REST_SOS_SERVICE = "rest.sos.service";
@@ -119,7 +114,6 @@ public class RestSettings implements SettingDefinitionProvider {
setTitle("Conformance Class").
setDefaultValue("http://www.opengis.net/spec/SOS/2.0/conf/rest").
setDescription("The conformance class for the RESTful binding.").
- setOptional(false).
setOrder(0),
new StringSettingDefinition().
@@ -128,7 +122,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("application/gml+xml").
setTitle("Content type - default").
setDescription("Default content type returned by this binding").
- setOptional(false).
setOrder(1),
new StringSettingDefinition().
@@ -137,7 +130,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("unknown/unknown").
setTitle("Content type - undefined").
setDescription("Content type used in the case of not knowing the content type of a externally linked resource.").
- setOptional(false).
setOrder(2),
new StringSettingDefinition().
@@ -146,7 +138,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("capabilities").
setTitle("Binding Endpoint Resource").
setDescription("The resource any client is redirected to when accessing the binding endpoint.").
- setOptional(false).
setOrder(3),
new IntegerSettingDefinition().
@@ -155,7 +146,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue(4326).
setTitle("EPSG Code - default").
setDescription("The default value of the EPSG code.").
- setOptional(false).
setOrder(4),
new StringSettingDefinition().
@@ -164,7 +154,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("UTF-8").
setTitle("URL encoding - default").
setDescription("The default value fo the URL encoding.").
- setOptional(false).
setOrder(5),
new UriSettingDefinition().
@@ -182,7 +171,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("sosREST").
setTitle("RESTful encoding - prefix").
setDescription("The prefix of the RESTful encoding used within XML documents.").
- setOptional(false).
setOrder(7),
new StringSettingDefinition().
@@ -191,7 +179,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("Received GET request invalid for resource type \"%s\". Try ").
setTitle("Error Message - Bad GET request").
setDescription("The start of the bad GET request error message.").
- setOptional(false).
setOrder(8),
new StringSettingDefinition().
@@ -200,7 +187,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("\"../%s/$RESOURCE_ID\"").
setTitle("Error Message - Bad GET request by id").
setDescription("The bad GET request by id error message").
- setOptional(false).
setOrder(9),
new StringSettingDefinition().
@@ -209,7 +195,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("\"..%s\"").
setTitle("Error Message - Bad GET request global resource").
setDescription("The bad GET request global resource error message").
- setOptional(false).
setOrder(10),
new StringSettingDefinition().
@@ -218,7 +203,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("No valid parameter at all.").
setTitle("Error Message - No valid KVP parameter").
setDescription("The bad GET request error message when no valid KVP paramter is found.").
- setOptional(false).
setOrder(11),
new StringSettingDefinition().
@@ -227,7 +211,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("\"../%s?$SEARCH_REQUEST\". Please refer to the documentation regarding allowed parameters").
setTitle("Error Message - Bad search request").
setDescription("The bad GET request error message when the search request is not valid").
- setOptional(false).
setOrder(12),
new StringSettingDefinition().
@@ -236,7 +219,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("HTTP method \"%s\" not allowed for \"%s\" resources.").
setTitle("Error Message - HTTP method not allowed for resource").
setDescription("The error message when the used HTTP method is not allowed for the requested resource type.").
- setOptional(false).
setOrder(13),
new StringSettingDefinition().
@@ -245,7 +227,6 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("request with wrong content type received.").
setTitle("Error Message - wrong content type").
setDescription("The error message when using the wrong content type in the request body.").
- setOptional(false).
setOrder(14),
new StringSettingDefinition().
@@ -254,385 +235,318 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue("Requested content type as specified in Accept header not supported.").
setTitle("Error Message - not supported content type in accept header").
setDescription("The content type requested could not be supported.").
- setOptional(false).
setOrder(15),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_GET_PARAMETERNAME_FOI).
setDefaultValue("feature").
- setTitle("Http Get Parametername Foi").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP GET Parametername Foi ").
+ setDescription("The parameter name for features of interest in HTTP GET requests.").
setOrder(18),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_GET_PARAMETERNAME_NAMESPACES).
setDefaultValue("namespaces").
- setTitle("Http Get Parametername Namespaces").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP GET Parametername Namespaces ").
+ setDescription("The parameter name for namespaces in HTTP GET requests.").
setOrder(19),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_GET_PARAMETERNAME_OBSERVEDPROPERTY).
setDefaultValue("observedproperties").
- setTitle("Http Get Parametername Observedproperty").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP GET Parametername Observedproperty ").
+ setDescription("The parameter name for observed properties in HTTP GET requests.").
setOrder(20),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_GET_PARAMETERNAME_OFFERING).
setDefaultValue("offering").
- setTitle("Http Get Parametername Offering").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP GET Parametername Offering ").
+ setDescription("The parameter name for offerings in HTTP GET requests.").
setOrder(21),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_GET_PARAMETERNAME_PROCEDURES).
setDefaultValue("procedures").
- setTitle("Http Get Parametername Procedures").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP GET Parametername Procedures ").
+ setDescription("The parameter name for procedures in HTTP GET requests.").
setOrder(22),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_GET_PARAMETERNAME_SPATIALFILTER).
setDefaultValue("spatialfilter").
- setTitle("Http Get Parametername Spatialfilter").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP GET Parametername Spatialfilter ").
+ setDescription("The parameter name for spatial filters in HTTP GET requests.").
setOrder(23),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_GET_PARAMETERNAME_TEMPORALFILTER).
setDefaultValue("temporalfilter").
- setTitle("Http Get Parametername Temporalfilter").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP GET Parametername Temporalfilter ").
+ setDescription("The parameter name for temporal filter in HTTP GET requests.").
setOrder(24),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_HEADER_IDENTIFIER_XDELETEDRESOURCEID).
setDefaultValue("X-Deleted-Resource-Id").
- setTitle("Http Header Identifier XDeletedResourceId").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP Header Identifier XDeletedResourceId ").
+ setDescription("The identifier for the deleted resource id .").
setOrder(29),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_HTTP_OPERATIONNOTALLOWEDFORRESOURCETYPE_MESSAGE_START).
setDefaultValue("operation is not allowed for the resource type").
- setTitle("Http OperationNotAllowedForResourceType Message Start").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("HTTP OperationNotAllowedForResourceType Message Start").
+ setDescription("Identifier for HTTP method not allowed errors (HTTP error 405 ).").
setOrder(30),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_KVP_ENCODING_VALUESPLITTER).
setDefaultValue(",").
- setTitle("Kvp Encoding Valuesplitter").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("KVP Encoding Valuesplitter").
+ setDescription("Specify the character used for splitting KVP encoded values, e.g. ,
.").
setOrder(34),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_CAPABILITIES).
setDefaultValue("capabilities").
- setTitle("Resource Capabilities").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Capabilities ").
+ setDescription("The name of the root resource, service endpoint. Default is: capabilities
.").
setOrder(35),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_FEATURES).
setDefaultValue("features").
- setTitle("Resource Features").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Features ").
+ setDescription("The name of the features resource. Default is: features
.").
setOrder(36),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_OBSERVABLEPROPERTIES).
setDefaultValue("properties").
- setTitle("Resource Observableproperties").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Observableproperties ").
+ setDescription("The name of the observable properties resource. Default is properties
.").
setOrder(37),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_OBSERVATIONS).
setDefaultValue("observations").
- setTitle("Resource Observations").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Observations ").
+ setDescription("The name of the observations resource. Default is observations
.").
setOrder(38),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_OFFERINGS).
setDefaultValue("offerings").
- setTitle("Resource Offerings").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Offerings ").
+ setDescription("The name of the offerings resource. Default is offerings
.").
setOrder(39),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_FEATURE_GET).
setDefaultValue("feature-get").
- setTitle("Resource Relation Feature Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Feature Get ").
+ setDescription("The name of the relation between any resource instance and the related feature . "
+ + "Default is feature-get
.").
setOrder(40),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_FEATURES_GET).
setDefaultValue("features-get").
- setTitle("Resource Relation Features Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Features Get ").
+ setDescription("The name of the relation between any resource instance and the related "
+ + "features . Default is features -get
.").
setOrder(41),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_OBSERVABLEPROPERTY_GET).
setDefaultValue("property-get").
- setTitle("Resource Relation Observableproperty Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Observableproperty Get ").
+ setDescription("The name of the relation between any resource instance and the related observable "
+ + "property . Default is property-get
.").
setOrder(42),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_OBSERVATION_CREATE).
setDefaultValue("observation-create").
- setTitle("Resource Relation Observation Create").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Link Observation Create ").
+ setDescription("The name of the link to the resource for creating new observations . Default is "
+ + "observation-create
.").
setOrder(43),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_OBSERVATION_DELETE).
setDefaultValue("observation-delete").
- setTitle("Resource Relation Observation Delete").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Link Observation Delete ").
+ setDescription("The name of the link to the resource for deleting existing observations . Default "
+ + "is observation-delete
.").
setOrder(44),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_OBSERVATION_GET).
setDefaultValue("observation-get").
- setTitle("Resource Relation Observation Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Observation Get ").
+ setDescription("The name of the relation between any resource instance and the related "
+ + "observations . Default is observation-get
.").
setOrder(45),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_OBSERVATIONS_GET).
setDefaultValue("observations-get").
- setTitle("Resource Relation Observations Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Observations Get ").
+ setDescription("The name of the relation between any resource instance and the related "
+ + "observations . Default is "
+ + "observations -get
.").
setOrder(46),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_OFFERING_GET).
setDefaultValue("offering-get").
- setTitle("Resource Relation Offering Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Offering Get ").
+ setDescription("The name of the relation between any resource instance and the related offering . "
+ + "Default is offering-get
.").
setOrder(47),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_OFFERINGS_GET).
setDefaultValue("offerings-get").
- setTitle("Resource Relation Offerings Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Offerings Get ").
+ setDescription("The name of the relation between any resource instance and the related "
+ + "offerings . Default is offerings -get
.").
setOrder(48),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_SELF).
setDefaultValue("self").
- setTitle("Resource Relation Self").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Self ").
+ setDescription("The name of the relation between any resource instance and the resource itself . "
+ + "Default is self
.").
setOrder(49),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_SENSOR_CREATE).
setDefaultValue("sensor-create").
- setTitle("Resource Relation Sensor Create").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Sensor Create ").
+ setDescription("The name of the link to the resource for creating new sensors . Default "
+ + "is sensor-create
.").
setOrder(50),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_SENSOR_DELETE).
setDefaultValue("sensor-delete").
- setTitle("Resource Relation Sensor Delete").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Sensor Delete ").
+ setDescription("The name of the link to the resource for deleting existing sensors . Default "
+ + "is sensor-delete
.").
setOrder(51),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_SENSOR_GET).
setDefaultValue("sensor-get").
- setTitle("Resource Relation Sensor Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Sensor Get ").
+ setDescription("The name of the relation between any resource instance and the related sensor . "
+ + "Default is sensor-get
.").
setOrder(52),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_SENSORS_GET).
setDefaultValue("sensors-get").
- setTitle("Resource Relation Sensors Get").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Sensors Get ").
+ setDescription("The name of the relation between any resource instance and the related sensors . "
+ + "Default is sensors -get
.").
setOrder(53),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_RELATION_SENSOR_UPDATE).
setDefaultValue("sensor-update").
- setTitle("Resource Relation Sensor Update").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Relation Sensor Update ").
+ setDescription("The name of the link to the resource for updating existing sensors . Default "
+ + "is sensor-update
.").
setOrder(54),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_RESOURCE_SENSORS).
setDefaultValue("sensors").
- setTitle("Resource Sensors").
- setDescription("TODO: Add description.").
- setOptional(false).
+ setTitle("Resource Sensors ").
+ setDescription("The name of the sensors resource. Default is sensors
.").
setOrder(55),
- new StringSettingDefinition().
- setGroup(SETTINGS_GROUP).
- setKey(REST_RESOURCE_TYPE).
- setDefaultValue("resource type").
- setTitle("Resource Type").
- setDescription("TODO: Add description.").
- setOptional(false).
- setOrder(56),
-
- new StringSettingDefinition().
- setGroup(SETTINGS_GROUP).
- setKey(REST_SML_CAPABILITY_FEATUREOFINTERESTTYPE_NAME).
- setDefaultValue("sos:FeatureOfInterestType").
- setTitle("Sml Capability Featureofinteresttype Name").
- setDescription("TODO: Add description.").
- setOptional(false).
- setOrder(57),
-
- new StringSettingDefinition().
- setGroup(SETTINGS_GROUP).
- setKey(REST_SML_CAPABILITY_INSERTIONMETADATA_NAME).
- setDefaultValue("InsertionMetadata").
- setTitle("Sml Capability Insertionmetadata Name").
- setDescription("TODO: Add description.").
- setOptional(false).
- setOrder(58),
-
- new StringSettingDefinition().
- setGroup(SETTINGS_GROUP).
- setKey(REST_SML_CAPABILITY_OBSERVATIONTYPE_NAME).
- setDefaultValue("sos:ObservationType").
- setTitle("Sml Capability Observationtype Name").
- setDescription("TODO: Add description.").
- setOptional(false).
- setOrder(59),
-
- new StringSettingDefinition().
- setGroup(SETTINGS_GROUP).
- setKey(REST_SOS_CAPABILITIES_SECTION_NAME_CONTENTS).
- setDefaultValue("Contents").
- setTitle("Sos Capabilities Section Name Contents").
- setDescription("TODO: Add description.").
- setOptional(false).
- setOrder(60),
-
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_END).
setDefaultValue(" is not supported by this service!").
- setTitle("Sos Errormessage OperationNotSupported End").
+ setTitle("Service Errormessage OperationNotSupported End").
setDescription("TODO: Add description.").
- setOptional(false).
setOrder(61),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_SOS_ERRORMESSAGE_OPERATIONNOTSUPPORTED_START).
setDefaultValue("The requested operation ").
- setTitle("Sos Errormessage OperationNotSupported Start").
+ setTitle("Service Errormessage OperationNotSupported Start").
setDescription("TODO: Add description.").
- setOptional(false).
setOrder(62),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_SOS_SERVICE).
setDefaultValue("SOS").
- setTitle("Sos Service").
+ setTitle("Service Identifier ").
setDescription("TODO: Add description.").
- setOptional(false).
setOrder(63),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_SOS_TERMS_PROCEDUREIDENTIFIER).
setDefaultValue("procedure").
- setTitle("Sos Terms Procedureidentifier").
+ setTitle("Sos Terms Procedure Identifier ").
setDescription("TODO: Add description.").
- setOptional(false).
setOrder(64),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_SOS_VERSION).
setDefaultValue("2.0.0").
- setTitle("Sos Version").
+ setTitle("Service Version ").
setDescription("TODO: Add description.").
- setOptional(false).
setOrder(65),
new StringSettingDefinition().
setGroup(SETTINGS_GROUP).
setKey(REST_URLPATTERN).
setDefaultValue("/rest").
- setTitle("Urlpattern").
+ setTitle("Urlpattern ").
setDescription("The URL identifier of the RESTful binding.").
- setOptional(false).
setOrder(66),
new UriSettingDefinition().
@@ -641,15 +555,13 @@ public class RestSettings implements SettingDefinitionProvider {
setDefaultValue(URI.create("https://raw.githubusercontent.com/52North/SOS/master/bindings/rest/xml/src/main/xsd/sosREST.xsd")).
setTitle("Encoding Schema URL").
setDescription("The URL to the encoding schema. Should be a web accessible URL returning a XSD file").
- setOptional(false).
setOrder(67)
);
@Override
- public Set> getSettingDefinitions()
- {
+ public Set> getSettingDefinitions() {
return Collections.unmodifiableSet(DEFINITIONS);
}
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/decode/ResourceDecoder.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/decode/ResourceDecoder.java
index d6007d345e..0c231b5612 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/decode/ResourceDecoder.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/decode/ResourceDecoder.java
@@ -40,7 +40,7 @@
import javax.servlet.http.HttpServletRequest;
import org.joda.time.DateTime;
-import org.n52.sos.binding.rest.Constants;
+import org.n52.sos.binding.rest.RestConstants;
import org.n52.sos.binding.rest.requests.RestRequest;
import org.n52.sos.exception.ows.InvalidParameterValueException;
import org.n52.sos.exception.ows.MissingParameterValueException;
@@ -64,76 +64,78 @@
import org.slf4j.LoggerFactory;
/**
- * @author Eike Hinderk Jürrens
- * TODO Use KVP helper from 52n-sos-api module
+ * @author Eike Hinderk
+ * Jürrens TODO Use KVP helper from 52n-sos-api module
*/
public abstract class ResourceDecoder extends RestDecoder {
-
+
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceDecoder.class);
-
- protected Constants bindingConstants = Constants.getInstance();
-
- protected abstract RestRequest decodeGetRequest(HttpServletRequest httpRequest, String pathPayload) throws OwsExceptionReport, DateTimeException;
-
- protected abstract RestRequest decodeDeleteRequest(HttpServletRequest httpRequest, String pathPayload) throws OwsExceptionReport;
-
- protected abstract RestRequest decodePostRequest(HttpServletRequest httpRequest, String pathPayload) throws OwsExceptionReport;
-
- protected abstract RestRequest decodePutRequest(HttpServletRequest httpRequest, String pathPayload) throws OwsExceptionReport;
-
+
+ protected RestConstants bindingConstants = RestConstants.getInstance();
+
+ protected abstract RestRequest decodeGetRequest(HttpServletRequest httpRequest, String pathPayload)
+ throws OwsExceptionReport, DateTimeException;
+
+ protected abstract RestRequest decodeDeleteRequest(HttpServletRequest httpRequest, String pathPayload)
+ throws OwsExceptionReport;
+
+ protected abstract RestRequest decodePostRequest(HttpServletRequest httpRequest, String pathPayload)
+ throws OwsExceptionReport;
+
+ protected abstract RestRequest decodePutRequest(HttpServletRequest httpRequest, String pathPayload)
+ throws OwsExceptionReport;
+
protected abstract RestRequest decodeOptionsRequest(HttpServletRequest httpRequest, String pathPayload);
- protected RestRequest decodeRestRequest(final HttpServletRequest httpRequest) throws OwsExceptionReport, DateTimeException
- {
+ protected RestRequest decodeRestRequest(final HttpServletRequest httpRequest)
+ throws OwsExceptionReport, DateTimeException {
String resourceType = null;
String pathPayload = null;
-
+
if (httpRequest != null && httpRequest.getPathInfo() != null) {
-
- final String resourceTypeWithOrWithoutId = getResourceTypeFromPathInfoWithWorkingUrl(httpRequest.getPathInfo());
+
+ final String resourceTypeWithOrWithoutId = getResourceTypeFromPathInfoWithWorkingUrl(
+ httpRequest.getPathInfo());
final int indexOfPotentialSecondSlash = resourceTypeWithOrWithoutId.indexOf("/");
-
+
if (indexOfPotentialSecondSlash > 1) {
- resourceType = resourceTypeWithOrWithoutId.substring(0,indexOfPotentialSecondSlash);
+ resourceType = resourceTypeWithOrWithoutId.substring(0, indexOfPotentialSecondSlash);
pathPayload = resourceTypeWithOrWithoutId.substring(indexOfPotentialSecondSlash + 1);
} else {
resourceType = resourceTypeWithOrWithoutId;
}
-
- LOGGER.debug("resourceType: {}; pathPayload: {} ",resourceType,pathPayload);
-
- // delegate to HTTP method specific decoders for parsing this resource's request
- if (httpRequest.getMethod().equalsIgnoreCase(HTTPMethods.GET) ||
- httpRequest.getMethod().equalsIgnoreCase(HTTPMethods.HEAD)) {
+
+ LOGGER.debug("resourceType: {}; pathPayload: {} ", resourceType, pathPayload);
+
+ // delegate to HTTP method specific decoders for parsing this
+ // resource's request
+ if (httpRequest.getMethod().equalsIgnoreCase(HTTPMethods.GET)
+ || httpRequest.getMethod().equalsIgnoreCase(HTTPMethods.HEAD)) {
return decodeGetRequest(httpRequest, pathPayload);
} else if (httpRequest.getMethod().equalsIgnoreCase(HTTPMethods.DELETE)) {
- return decodeDeleteRequest(httpRequest,pathPayload);
+ return decodeDeleteRequest(httpRequest, pathPayload);
} else if (httpRequest.getMethod().equalsIgnoreCase(HTTPMethods.POST)) {
- return decodePostRequest(httpRequest,pathPayload);
+ return decodePostRequest(httpRequest, pathPayload);
} else if (httpRequest.getMethod().equalsIgnoreCase(HTTPMethods.PUT)) {
- return decodePutRequest(httpRequest,pathPayload);
+ return decodePutRequest(httpRequest, pathPayload);
} else if (httpRequest.getMethod().equalsIgnoreCase(HTTPMethods.OPTIONS)) {
- return decodeOptionsRequest(httpRequest,pathPayload);
+ return decodeOptionsRequest(httpRequest, pathPayload);
}
}
-
- final String exceptionText = String.format("The resource type \"%s\" via HTTP method \"%s\" is not supported by this IDecoder implementiation.",
- resourceType,
- httpRequest.getMethod());
+
+ final String exceptionText = String.format(
+ "The resource type \"%s\" via HTTP method \"%s\" is not supported by this IDecoder implementiation.",
+ resourceType, httpRequest.getMethod());
LOGGER.debug(exceptionText);
throw new OperationNotSupportedException(resourceType);
-
+
}
-
- protected String getRelationIdentifierWithNamespace(final String resourceRelationIdentifier)
- {
- return bindingConstants.getEncodingNamespace()
- .concat("/")
- .concat(resourceRelationIdentifier);
+
+ protected String getRelationIdentifierWithNamespace(final String resourceRelationIdentifier) {
+ return bindingConstants.getEncodingNamespace().concat("/").concat(resourceRelationIdentifier);
}
-
- protected GetCapabilitiesRequest createGetCapabilitiesRequest()
- {
+
+ protected GetCapabilitiesRequest createGetCapabilitiesRequest() {
final GetCapabilitiesRequest getCapabilitiesRequest = new GetCapabilitiesRequest();
getCapabilitiesRequest.setVersion(bindingConstants.getSosVersion());
getCapabilitiesRequest.setService(bindingConstants.getSosService());
@@ -142,36 +144,31 @@ protected GetCapabilitiesRequest createGetCapabilitiesRequest()
return getCapabilitiesRequest;
}
-
- protected String getResourceIdFromRestfulHref(final String restfulHref)
- {
- return restfulHref.substring(restfulHref.lastIndexOf("/")+1);
+
+ protected String getResourceIdFromRestfulHref(final String restfulHref) {
+ return restfulHref.substring(restfulHref.lastIndexOf("/") + 1);
}
-
- protected GetCapabilitiesRequest createGetCapabilitiesRequestWithContentSectionOnly()
- {
+
+ protected GetCapabilitiesRequest createGetCapabilitiesRequestWithContentSectionOnly() {
final GetCapabilitiesRequest getCapabilitiesRequestOnlyContents = createGetCapabilitiesRequest();
final ArrayList sections = new ArrayList();
- sections.add(bindingConstants.getSosCapabilitiesSectionNameContents());
+ sections.add(RestConstants.SECTION_IDENTIFIER_CONTENTS);
getCapabilitiesRequestOnlyContents.setSections(sections);
return getCapabilitiesRequestOnlyContents;
}
-
+
// TODO use this to return operation not allowed response
- protected OwsExceptionReport createHttpMethodForThisResourceNotSupportedException(final String httpMethod, final String resourceType)
- {
- final String exceptionText = String.format("The HTTP-%s %s \"%s\"!",
- httpMethod,
- bindingConstants.getHttpOperationNotAllowedForResourceTypeMessagePart(),
- resourceType);
+ protected OwsExceptionReport createHttpMethodForThisResourceNotSupportedException(final String httpMethod,
+ final String resourceType) {
+ final String exceptionText = String.format("The HTTP-%s %s \"%s\"!", httpMethod,
+ bindingConstants.getHttpOperationNotAllowedForResourceTypeMessagePart(), resourceType);
final OperationNotSupportedException onse = new OperationNotSupportedException(exceptionText);
return onse;
}
-
- protected Map getKvPEncodedParameters(final HttpServletRequest httpRequest)
- {
+
+ protected Map getKvPEncodedParameters(final HttpServletRequest httpRequest) {
final Map kvp = new HashMap();
final Enumeration> parameterNames = httpRequest.getParameterNames();
while (parameterNames.hasMoreElements()) {
@@ -181,31 +178,29 @@ protected Map getKvPEncodedParameters(final HttpServletRequest h
}
return kvp;
}
-
+
protected String checkParameterSingleValue(final String parameterValue, final String parameterName)
throws OwsExceptionReport {
if (!parameterValue.isEmpty() && (parameterValue.split(",").length == 1)) {
return parameterValue;
} else {
- final InvalidParameterValueException ipve = new InvalidParameterValueException(parameterName, parameterValue);
+ final InvalidParameterValueException ipve = new InvalidParameterValueException(parameterName,
+ parameterValue);
LOGGER.debug(ipve.getMessage());
throw ipve;
}
}
- protected List splitKvpParameterValueToList(final String value)
- {
+ protected List splitKvpParameterValueToList(final String value) {
return Arrays.asList(value.split(bindingConstants.getKvPEncodingValueSplitter()));
}
-
/**
* {@link org.n52.sos.decode.SosKvpDecoderv20#parseNamespaces(String)}
*/
protected Map parseNamespaces(final String values) {
final Map namespaces = new HashMap();
- final List array =
- Arrays.asList(values.replaceAll("\\),", "").replaceAll("\\)", "").split("xmlns\\("));
+ final List array = Arrays.asList(values.replaceAll("\\),", "").replaceAll("\\)", "").split("xmlns\\("));
for (final String string : array) {
if ((string != null) && !string.isEmpty()) {
final String[] s = string.split(",");
@@ -216,61 +211,61 @@ protected Map parseNamespaces(final String values) {
}
/*
- * {@link org.n52.sos.decode.kvp.v2.AbstractKvpDecoder#parseTemporalFilter(List, String)}
- * TODO move to KVP map decoder to share code
+ * {@link
+ * org.n52.sos.decode.kvp.v2.AbstractKvpDecoder#parseTemporalFilter(List<
+ * String>, String)} TODO move to KVP map decoder to share code
*/
protected List parseTemporalFilter(final List parameterValues)
throws DateTimeException, InvalidParameterValueException {
final List filterList = new ArrayList(1);
if (parameterValues.size() != 2) {
- throw new InvalidParameterValueException(
- bindingConstants.getHttpGetParameterNameTemporalFilter(),
- Arrays.toString(parameterValues.toArray()));
+ throw new InvalidParameterValueException(bindingConstants.getHttpGetParameterNameTemporalFilter(),
+ Arrays.toString(parameterValues.toArray()));
}
filterList.add(createTemporalFilterFromValue(parameterValues.get(1), parameterValues.get(0)));
return filterList;
}
-
-
+
/*
- * {@link org.n52.sos.decode.kvp.v2.AbstractKvpDecoder#createTemporalFilterFromValue(String, String)}
- * TODO move to KVP map decoder to share code
+ * {@link org.n52.sos.decode.kvp.v2.AbstractKvpDecoder#
+ * createTemporalFilterFromValue(String, String)} TODO move to KVP map
+ * decoder to share code
*/
- private TemporalFilter createTemporalFilterFromValue(final String value, final String valueReference) throws DateTimeException, InvalidParameterValueException {
- final TemporalFilter temporalFilter = new TemporalFilter();
- temporalFilter.setValueReference(valueReference);
- final String[] times = value.split("/");
-
- if (times.length == 1) {
- final TimeInstant ti = new TimeInstant();
- if (SosIndeterminateTime.contains(times[0])) {
- ti.setSosIndeterminateTime(SosIndeterminateTime.getEnumForString(times[0]));
- } else {
- final DateTime instant = DateTimeHelper.parseIsoString2DateTime(times[0]);
- ti.setValue(instant);
+ private TemporalFilter createTemporalFilterFromValue(final String value, final String valueReference)
+ throws DateTimeException, InvalidParameterValueException {
+ final TemporalFilter temporalFilter = new TemporalFilter();
+ temporalFilter.setValueReference(valueReference);
+ final String[] times = value.split("/");
+
+ if (times.length == 1) {
+ final TimeInstant ti = new TimeInstant();
+ if (SosIndeterminateTime.contains(times[0])) {
+ ti.setSosIndeterminateTime(SosIndeterminateTime.getEnumForString(times[0]));
+ } else {
+ final DateTime instant = DateTimeHelper.parseIsoString2DateTime(times[0]);
+ ti.setValue(instant);
ti.setRequestedTimeLength(DateTimeHelper.getTimeLengthBeforeTimeZone(times[0]));
- }
- temporalFilter.setOperator(TimeOperator.TM_Equals);
- temporalFilter.setTime(ti);
- } else if (times.length == 2) {
- final DateTime start = DateTimeHelper.parseIsoString2DateTime(times[0]);
- // check if end time is a full ISO 8106 string
+ }
+ temporalFilter.setOperator(TimeOperator.TM_Equals);
+ temporalFilter.setTime(ti);
+ } else if (times.length == 2) {
+ final DateTime start = DateTimeHelper.parseIsoString2DateTime(times[0]);
+ // check if end time is a full ISO 8106 string
int timeLength = DateTimeHelper.getTimeLengthBeforeTimeZone(times[1]);
DateTime origEnd = DateTimeHelper.parseIsoString2DateTime(times[1]);
- DateTime end = DateTimeHelper.setDateTime2EndOfMostPreciseUnit4RequestedEndPosition(
- origEnd, timeLength);
- final TimePeriod tp = new TimePeriod(start, end);
- temporalFilter.setOperator(TimeOperator.TM_During);
- temporalFilter.setTime(tp);
- } else {
- throw new InvalidParameterValueException(bindingConstants.getHttpGetParameterNameTemporalFilter(),value);
- }
- return temporalFilter;
+ DateTime end = DateTimeHelper.setDateTime2EndOfMostPreciseUnit4RequestedEndPosition(origEnd, timeLength);
+ final TimePeriod tp = new TimePeriod(start, end);
+ temporalFilter.setOperator(TimeOperator.TM_During);
+ temporalFilter.setTime(tp);
+ } else {
+ throw new InvalidParameterValueException(bindingConstants.getHttpGetParameterNameTemporalFilter(), value);
+ }
+ return temporalFilter;
}
/**
- * {@link org.n52.sos.decode.kvp.v2.AbstractKvpDecoder#parseSpatialFilter(List, String)}
- * TODO move to KVP map decoder to share code
+ * {@link org.n52.sos.decode.kvp.v2.AbstractKvpDecoder#parseSpatialFilter(List
+ * , String)} TODO move to KVP map decoder to share code
*/
protected SpatialFilter parseSpatialFilter(List parameterValues, final String parameterName)
throws OwsExceptionReport {
@@ -299,13 +294,15 @@ protected SpatialFilter parseSpatialFilter(List parameterValues, final S
}
if (coordinates.size() != 4) {
- throw new InvalidParameterValueException().
- at(parameterName).
- withMessage("The parameter value of '%s' is not valid!", parameterName);
+ throw new InvalidParameterValueException().at(parameterName)
+ .withMessage("The parameter value of '%s' is not valid!", parameterName);
}
- final String lowerCorner = String.format(Locale.US, "%f %f", new Float(coordinates.get(0)), new Float(coordinates.get(1)));
- final String upperCorner = String.format(Locale.US, "%f %f", new Float(coordinates.get(2)), new Float(coordinates.get(3)));
- spatialFilter.setGeometry(JTSHelper.createGeometryFromWKT(JTSHelper.createWKTPolygonFromEnvelope(lowerCorner, upperCorner), srid));
+ final String lowerCorner = String.format(Locale.US, "%f %f", new Float(coordinates.get(0)),
+ new Float(coordinates.get(1)));
+ final String upperCorner = String.format(Locale.US, "%f %f", new Float(coordinates.get(2)),
+ new Float(coordinates.get(3)));
+ spatialFilter.setGeometry(JTSHelper
+ .createGeometryFromWKT(JTSHelper.createWKTPolygonFromEnvelope(lowerCorner, upperCorner), srid));
spatialFilter.setOperator(SpatialOperator.BBOX);
return spatialFilter;
}
@@ -320,51 +317,39 @@ protected String getSrsNamePrefixSosV2() {
return ServiceConfiguration.getInstance().getSrsNamePrefixSosV2();
}
-
- protected boolean isContentOfPostRequestValid(final HttpServletRequest httpRequest) throws OwsExceptionReport
- {
- if ((httpRequest == null) || (httpRequest.getContentType() == null))
- {
+ protected boolean isContentOfPostRequestValid(final HttpServletRequest httpRequest) throws OwsExceptionReport {
+ if ((httpRequest == null) || (httpRequest.getContentType() == null)) {
final String errorMessage = "HTTP header 'Content-Type'";
LOGGER.debug("{} is missing", errorMessage);
throw new MissingParameterValueException(errorMessage);
}
- if (!httpRequest.getContentType().contains(bindingConstants.getContentTypeDefault().toString()))
- {
+ if (!httpRequest.getContentType().contains(bindingConstants.getContentTypeDefault().toString())) {
final String errorMessage = String.format("POST %s Type \"%s\" is not supported. Please use type \"%s\"",
- bindingConstants.getErrorMessageWrongContentType(),
- httpRequest.getContentType(),
+ bindingConstants.getErrorMessageWrongContentType(), httpRequest.getContentType(),
bindingConstants.getContentTypeDefault());
LOGGER.debug(errorMessage);
- throw new InvalidParameterValueException("Content-Type", httpRequest.getContentType()).
- withMessage(errorMessage);
+ throw new InvalidParameterValueException("Content-Type", httpRequest.getContentType())
+ .withMessage(errorMessage);
}
return true;
}
- protected String createBadGetRequestMessage(final String resourceType,
- final boolean globalResoureAllowed,
- final boolean byIdAllowed,
- final boolean searchAllowed)
- {
+ protected String createBadGetRequestMessage(final String resourceType, final boolean globalResoureAllowed,
+ final boolean byIdAllowed, final boolean searchAllowed) {
final StringBuilder errorMsgBuilder = new StringBuilder();
errorMsgBuilder.append(String.format(bindingConstants.getErrorMessageBadGetRequest(), resourceType));
- if (globalResoureAllowed)
- {
- errorMsgBuilder.append(String.format(bindingConstants.getErrorMessageBadGetRequestGlobalResource(), resourceType));
+ if (globalResoureAllowed) {
+ errorMsgBuilder
+ .append(String.format(bindingConstants.getErrorMessageBadGetRequestGlobalResource(), resourceType));
}
- if (byIdAllowed)
- {
- if (globalResoureAllowed)
- {
+ if (byIdAllowed) {
+ if (globalResoureAllowed) {
errorMsgBuilder.append(" or ");
}
errorMsgBuilder.append(String.format(bindingConstants.getErrorMessageBadGetRequestById(), resourceType));
}
- if (searchAllowed)
- {
- if (globalResoureAllowed || byIdAllowed)
- {
+ if (searchAllowed) {
+ if (globalResoureAllowed || byIdAllowed) {
errorMsgBuilder.append(" or ");
}
errorMsgBuilder.append(String.format(bindingConstants.getErrorMessageBadGetRequestSearch(), resourceType));
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/decode/RestDecoder.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/decode/RestDecoder.java
index 03e232b534..d061dacc8e 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/decode/RestDecoder.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/decode/RestDecoder.java
@@ -37,7 +37,7 @@
import javax.servlet.http.HttpServletRequest;
-import org.n52.sos.binding.rest.Constants;
+import org.n52.sos.binding.rest.RestConstants;
import org.n52.sos.binding.rest.requests.RestRequest;
import org.n52.sos.binding.rest.resources.ServiceEndpointDecoder;
import org.n52.sos.binding.rest.resources.capabilities.CapabilitiesDecoder;
@@ -73,9 +73,9 @@ public class RestDecoder implements Decoder {
@SuppressWarnings("unchecked")
private final Set DECODER_KEYS = decoderKeysForElements(
- Constants.getInstance().getEncodingNamespace(), HttpServletRequest.class);
+ RestConstants.getInstance().getEncodingNamespace(), HttpServletRequest.class);
// union(
-// decoderKeysForElements(Constants.getInstance().getEncodingNamespace(), HttpServletRequest.class),
+// decoderKeysForElements(RestConstants.getInstance().getEncodingNamespace(), HttpServletRequest.class),
// CodingHelper.xmlDecoderKeysForOperation(SOS, Sos2Constants.SERVICEVERSION,
// Sos2Constants.Operations.DeleteSensor,
// Sos2Constants.Operations.InsertSensor,
@@ -178,7 +178,7 @@ private ResourceDecoder getDecoderForResource(
private boolean isServiceDefaultEndpoint(final String pathInfo) {
return ((pathInfo != null) && pathInfo.isEmpty()) || ("/" + pathInfo)
- .startsWith(Constants.getInstance().getUrlPattern());
+ .startsWith(RestConstants.getInstance().getUrlPattern());
}
private boolean isOfferingsRequest(final String pathInfo) {
@@ -221,8 +221,8 @@ public Set getConformanceClasses() {
return Collections.emptySet();
}
- private Constants bindingConstants() {
- return Constants.getInstance();
+ private RestConstants bindingConstants() {
+ return RestConstants.getInstance();
}
}
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/encode/RestEncoder.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/encode/RestEncoder.java
index 49288c5ab8..204bf19017 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/encode/RestEncoder.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/encode/RestEncoder.java
@@ -34,7 +34,7 @@
import java.util.Map;
import java.util.Set;
-import org.n52.sos.binding.rest.Constants;
+import org.n52.sos.binding.rest.RestConstants;
import org.n52.sos.binding.rest.requests.ResourceNotFoundResponse;
import org.n52.sos.binding.rest.requests.RestResponse;
import org.n52.sos.binding.rest.resources.OptionsRestEncoder;
@@ -85,7 +85,7 @@
*/
public class RestEncoder implements Encoder {
- protected Constants bindingConstants = Constants.getInstance();
+ protected RestConstants bindingConstants = RestConstants.getInstance();
private static final Logger LOGGER = LoggerFactory.getLogger(RestEncoder.class);
@@ -224,7 +224,7 @@ public Map> getSupportedTypes() {
@Override
public MediaType getContentType()
{
- return Constants.getInstance().getContentTypeDefault();
+ return RestConstants.getInstance().getContentTypeDefault();
}
@Override
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/requests/RequestHandler.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/requests/RequestHandler.java
index 7534b7c0aa..8dce02e191 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/requests/RequestHandler.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/requests/RequestHandler.java
@@ -38,7 +38,7 @@
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
-import org.n52.sos.binding.rest.Constants;
+import org.n52.sos.binding.rest.RestConstants;
import org.n52.sos.encode.Encoder;
import org.n52.sos.encode.OperationEncoderKey;
import org.n52.sos.exception.ows.NoApplicableCodeException;
@@ -64,7 +64,7 @@ public abstract class RequestHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestHandler.class);
- protected Constants bindingConstants = Constants.getInstance();
+ protected RestConstants bindingConstants = RestConstants.getInstance();
public abstract RestResponse handleRequest(RestRequest request) throws OwsExceptionReport, XmlException, IOException;
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/observations/ObservationsDecoder.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/observations/ObservationsDecoder.java
index 4547fcb5a7..6134dcad10 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/observations/ObservationsDecoder.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/observations/ObservationsDecoder.java
@@ -51,6 +51,7 @@
import org.n52.sos.exception.ows.OperationNotSupportedException;
import org.n52.sos.exception.ows.concrete.DateTimeException;
import org.n52.sos.exception.ows.concrete.InvalidObservationTypeException;
+import org.n52.sos.ext.deleteobservation.DeleteObservationConstants;
import org.n52.sos.ext.deleteobservation.DeleteObservationRequest;
import org.n52.sos.ogc.om.OmObservation;
import org.n52.sos.ogc.ows.OwsExceptionReport;
@@ -126,11 +127,11 @@ protected RestRequest decodeDeleteRequest(HttpServletRequest httpRequest,
private RestRequest decodeObservationsDeleteRequest(String pathPayload)
{
- DeleteObservationRequest deleteObservationRequest = new DeleteObservationRequest();
+ DeleteObservationRequest deleteObservationRequest = new DeleteObservationRequest(DeleteObservationConstants.NS_SOSDO_1_0);
deleteObservationRequest.setService(bindingConstants.getSosService());
deleteObservationRequest.setVersion(bindingConstants.getSosVersion());
- deleteObservationRequest.setObservationIdentifier(pathPayload);
+ deleteObservationRequest.addObservationIdentifier(pathPayload);
return new ObservationsDeleteRequest(deleteObservationRequest);
}
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/observations/ObservationsDeleteRequestHandler.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/observations/ObservationsDeleteRequestHandler.java
index 9668da7868..74b8d5b460 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/observations/ObservationsDeleteRequestHandler.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/observations/ObservationsDeleteRequestHandler.java
@@ -56,7 +56,7 @@ public RestResponse handleRequest(RestRequest req) throws OwsExceptionReport, Xm
XmlObject xb_deleteObservationResponse = executeSosRequest(doReq);
if (xb_deleteObservationResponse instanceof DeleteObservationResponseDocument) {
DeleteObservationResponseType xb_delObsResponse = ((DeleteObservationResponseDocument) xb_deleteObservationResponse).getDeleteObservationResponse();
- if (xb_delObsResponse.getDeletedObservation().equalsIgnoreCase(doReq.getObservationIdentifier())) {
+ if (xb_delObsResponse.getDeletedObservation().equalsIgnoreCase(doReq.getObservationIdentifiers().iterator().next())) {
return new ObservationsDeleteRespone(xb_delObsResponse.getDeletedObservation());
}
}
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/sensors/SensorsDecoder.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/sensors/SensorsDecoder.java
index 3bb90466f8..2724c2a520 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/sensors/SensorsDecoder.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/sensors/SensorsDecoder.java
@@ -33,17 +33,8 @@
import javax.servlet.http.HttpServletRequest;
-import net.opengis.sensorML.x101.AbstractProcessType;
-import net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities;
-import net.opengis.sensorML.x101.IoComponentPropertyType;
-import net.opengis.sensorML.x101.SystemType;
-import net.opengis.sosREST.x10.SensorDocument;
-import net.opengis.sosREST.x10.SensorType;
-import net.opengis.swe.x101.AnyScalarPropertyType;
-import net.opengis.swe.x101.SimpleDataRecordType;
-
import org.apache.xmlbeans.XmlObject;
-import org.n52.sos.binding.rest.Constants;
+import org.n52.sos.binding.rest.RestConstants;
import org.n52.sos.binding.rest.decode.ResourceDecoder;
import org.n52.sos.binding.rest.requests.BadRequestException;
import org.n52.sos.binding.rest.requests.RestRequest;
@@ -64,6 +55,15 @@
import org.n52.sos.util.CodingHelper;
import org.n52.sos.util.XmlHelper;
+import net.opengis.sensorML.x101.AbstractProcessType;
+import net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities;
+import net.opengis.sensorML.x101.IoComponentPropertyType;
+import net.opengis.sensorML.x101.SystemType;
+import net.opengis.sosREST.x10.SensorDocument;
+import net.opengis.sosREST.x10.SensorType;
+import net.opengis.swe.x101.AnyScalarPropertyType;
+import net.opengis.swe.x101.SimpleDataRecordType;
+
/**
* @author Eike Hinderk
* Jürrens
@@ -72,7 +72,7 @@
public class SensorsDecoder extends ResourceDecoder {
public SensorsDecoder() {
- bindingConstants = Constants.getInstance();
+ bindingConstants = RestConstants.getInstance();
}
protected RestRequest decodeGetRequest(HttpServletRequest httpRequest,
@@ -155,9 +155,10 @@ private SosInsertionMetadata setInsertionMetadata(InsertSensorRequest insertSens
SosInsertionMetadata insertionMetadata = new SosInsertionMetadata();
Capabilities xb_insertionMetadata = null;
+ final String insertionMetadataTagName = "InsertionMetadata";
if (xb_system.getCapabilitiesArray().length > 0) {
for (Capabilities xb_Capability : xb_system.getCapabilitiesArray()) {
- if (xb_Capability.isSetName() && xb_Capability.getName().equalsIgnoreCase(bindingConstants.getSmlCapabilityInsertMetadataName())) {
+ if (xb_Capability.isSetName() && xb_Capability.getName().equalsIgnoreCase(insertionMetadataTagName)) {
xb_insertionMetadata = xb_Capability;
break;
}
@@ -165,7 +166,7 @@ private SosInsertionMetadata setInsertionMetadata(InsertSensorRequest insertSens
}
if (xb_insertionMetadata == null) {
- throw new MissingParameterValueException(bindingConstants.getSmlCapabilityInsertMetadataName());
+ throw new MissingParameterValueException(insertionMetadataTagName);
}
setAdditionalMetadata(insertionMetadata,xb_insertionMetadata);
@@ -185,9 +186,9 @@ private void setAdditionalMetadata(SosInsertionMetadata insertionMetadata,
if (xb_fieldElement.isSetText()) {
String name = xb_fieldElement.getName();
if (!xb_fieldElement.getText().getValue().isEmpty() && name != null) {
- if (name.equalsIgnoreCase(bindingConstants.getSmlCapabilityObservationTypeName())) {
+ if (name.equalsIgnoreCase("sos:ObservationType")) {
observationTypes.add(xb_fieldElement.getText().getValue());
- } else if (name.equalsIgnoreCase(bindingConstants.getSmlCapabilityFeatureOfInterestTypeName())) {
+ } else if (name.equalsIgnoreCase("sos:FeatureOfInterestType")) {
featureTypes.add(xb_fieldElement.getText().getValue());
}
}
diff --git a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/sensors/SensorsRequestHandler.java b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/sensors/SensorsRequestHandler.java
index 53787940df..26cd32e962 100644
--- a/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/sensors/SensorsRequestHandler.java
+++ b/bindings/rest/code/src/main/java/org/n52/sos/binding/rest/resources/sensors/SensorsRequestHandler.java
@@ -31,7 +31,7 @@
import java.io.IOException;
import org.apache.xmlbeans.XmlException;
-import org.n52.sos.binding.rest.Constants;
+import org.n52.sos.binding.rest.RestConstants;
import org.n52.sos.binding.rest.requests.RequestHandler;
import org.n52.sos.binding.rest.requests.RestRequest;
import org.n52.sos.binding.rest.requests.RestResponse;
@@ -44,7 +44,7 @@
*/
public class SensorsRequestHandler extends RequestHandler {
- Constants bindingConstants = Constants.getInstance();
+ RestConstants bindingConstants = RestConstants.getInstance();
@Override
public RestResponse handleRequest(RestRequest request) throws OwsExceptionReport, XmlException, IOException
diff --git a/bindings/rest/pom.xml b/bindings/rest/pom.xml
index 9abb4266f7..e4669342d7 100644
--- a/bindings/rest/pom.xml
+++ b/bindings/rest/pom.xml
@@ -1,72 +1,42 @@
-
-
-
- org.n52.sensorweb.sos
- bindings
- 4.3.14
-
- 4.0.0
- rest
- pom
- 4.3.14
- 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.4.0
+
+ 4.0.0
+ rest
+ pom
+ 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/
+
+
+
+ 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 d593dbbfdd..65fcf4c7b7 100644
--- a/bindings/rest/xml/pom.xml
+++ b/bindings/rest/xml/pom.xml
@@ -1,59 +1,59 @@
-
-
- 4.0.0
-
- org.n52.sensorweb.sos
- rest
- 4.3.14
-
- rest-xml
- 52°North SOS - Extension REST Binding - XML
- XMLBeans bindings for rest schema
-
-
- org.apache.xmlbeans
- xmlbeans
-
-
- org.n52.sensorweb
- 52n-xml-gml-v321
-
-
- org.n52.sensorweb
- 52n-xml-om-v20
-
-
- org.n52.sensorweb
- 52n-xml-sensorML-v101
-
-
- org.n52.sensorweb
- 52n-xml-sos-v20
-
-
-
-
-
- org.codehaus.mojo
- xmlbeans-maven-plugin
-
-
- main
-
- xmlbeans
-
-
-
-
-
- sosREST.xsd
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
-
-
+
+
+ 4.0.0
+
+ org.n52.sensorweb.sos
+ rest
+ 4.4.0
+
+ rest-xml
+ 52°North SOS - Extension REST Binding - XML
+ XMLBeans bindings for rest schema
+
+
+ org.apache.xmlbeans
+ xmlbeans
+
+
+ org.n52.sensorweb
+ 52n-xml-gml-v321
+
+
+ org.n52.sensorweb
+ 52n-xml-om-v20
+
+
+ org.n52.sensorweb
+ 52n-xml-sensorML-v101
+
+
+ org.n52.sensorweb
+ 52n-xml-sos-v20
+
+
+
+
+
+ org.codehaus.mojo
+ xmlbeans-maven-plugin
+
+
+ main
+
+ xmlbeans
+
+
+
+
+
+ sosREST.xsd
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
\ No newline at end of file
diff --git a/bindings/soap/pom.xml b/bindings/soap/pom.xml
index 9065d9c1ed..0490d28e2a 100644
--- a/bindings/soap/pom.xml
+++ b/bindings/soap/pom.xml
@@ -1,36 +1,36 @@
-
-
-
- org.n52.sensorweb.sos
- bindings
- 4.3.14
-
- 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.4.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
+ javax.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/binding/SoapBinding.java b/bindings/soap/src/main/java/org/n52/sos/binding/SoapBinding.java
index 154fa1fc45..8444a1482a 100644
--- a/bindings/soap/src/main/java/org/n52/sos/binding/SoapBinding.java
+++ b/bindings/soap/src/main/java/org/n52/sos/binding/SoapBinding.java
@@ -33,7 +33,6 @@
import java.io.IOException;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
@@ -208,7 +207,7 @@ private void writeOwsExceptionReport(SoapChain chain, OwsExceptionReport owse) t
}
checkSoapInjection(chain);
HTTPUtils.writeObject(chain.getHttpRequest(), chain.getHttpResponse(), checkMediaType(chain),
- encodeSoapResponse(chain));
+ encodeSoapResponse(chain), this);
} catch (OwsExceptionReport t) {
throw new HTTPException(HTTPStatus.INTERNAL_SERVER_ERROR, t);
}
@@ -222,10 +221,10 @@ private void writeResponse(SoapChain chain) throws IOException, HTTPException {
// TODO allow other bindings to encode response as soap messages
if (contentType.isCompatible(getDefaultContentType())) {
checkSoapInjection(chain);
- HTTPUtils.writeObject(chain.getHttpRequest(), chain.getHttpResponse(), checkMediaType(chain), chain);
+ HTTPUtils.writeObject(chain.getHttpRequest(), chain.getHttpResponse(), checkMediaType(chain), chain, this);
} else {
HTTPUtils.writeObject(chain.getHttpRequest(), chain.getHttpResponse(), contentType,
- chain.getBodyResponse());
+ chain.getBodyResponse(), this);
}
}
@@ -292,9 +291,10 @@ private List checkSoapHeaders(List headers) {
* @param chain
* @throws IOException
* @throws OwsExceptionReport
+ * @throws HTTPException
*/
@Deprecated
- private void writeSoapResponse(SoapChain chain) throws IOException, OwsExceptionReport {
+ private void writeSoapResponse(SoapChain chain) throws IOException, OwsExceptionReport, HTTPException {
Object encodedSoapResponse = encodeSoapResponse(chain);
if (chain.getSoapResponse().hasException() && chain.getSoapResponse().getException().hasStatus()) {
chain.getHttpResponse().setStatus(chain.getSoapResponse().getException().getStatus().getCode());
@@ -306,6 +306,6 @@ private void writeSoapResponse(SoapChain chain) throws IOException, OwsException
mt = MediaType.parse(r.getAcceptFormats().get(0));
}
}
- HTTPUtils.writeObject(chain.getHttpRequest(), chain.getHttpResponse(), mt, encodedSoapResponse);
+ HTTPUtils.writeObject(chain.getHttpRequest(), chain.getHttpResponse(), mt, encodedSoapResponse, this);
}
}
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 070b4e98c0..924142a91f 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
@@ -85,9 +85,9 @@
/**
* Encoder implementation for SOAP 1.2
- *
+ *
* @since 4.0.0
- *
+ *
*/
public class Soap12Encoder extends AbstractSoapEncoder implements
StreamingEncoder {
@@ -146,7 +146,7 @@ public void encode(Object element, OutputStream outputStream, EncodingValues enc
new Soap12XmlStreamWriter().write((SoapResponse) element, outputStream);
} else {
try {
- ((XmlObject) encode(element, encodingValues.getAdditionalValues())).save(outputStream, XmlOptionsHelper.getInstance().getXmlOptions());
+ encode(element, encodingValues.getAdditionalValues()).save(outputStream, XmlOptionsHelper.getInstance().getXmlOptions());
} catch (IOException ioe) {
throw new NoApplicableCodeException().causedBy(ioe).withMessage("Error while writing element to stream!");
}
diff --git a/bindings/soap/src/main/java/org/n52/sos/encode/SoapChainResponseWriter.java b/bindings/soap/src/main/java/org/n52/sos/encode/SoapChainResponseWriter.java
index 6723593c98..b1721969e7 100644
--- a/bindings/soap/src/main/java/org/n52/sos/encode/SoapChainResponseWriter.java
+++ b/bindings/soap/src/main/java/org/n52/sos/encode/SoapChainResponseWriter.java
@@ -36,6 +36,8 @@
import org.apache.xmlbeans.XmlObject;
import org.n52.sos.encode.streaming.StreamingEncoder;
+import org.n52.sos.exception.CodedException;
+import org.n52.sos.exception.ows.NoApplicableCodeException;
import org.n52.sos.exception.ows.concrete.NoEncoderForKeyException;
import org.n52.sos.ogc.ows.OwsExceptionReport;
import org.n52.sos.service.ServiceConfiguration;
@@ -53,7 +55,7 @@
public class SoapChainResponseWriter extends AbstractResponseWriter {
@Override
- public void write(SoapChain chain, OutputStream out, ResponseProxy responseProxy) throws IOException {
+ public void write(SoapChain chain, OutputStream out, ResponseProxy responseProxy) throws IOException, OwsExceptionReport {
try {
Object o = encodeSoapResponse(chain, out);
if (o != null) {
@@ -64,9 +66,7 @@ public void write(SoapChain chain, OutputStream out, ResponseProxy responseProxy
}
}
} catch (SOAPException soapex) {
- throw new IOException(soapex);
- } catch (OwsExceptionReport owsex) {
- throw new IOException(owsex);
+ throw new NoApplicableCodeException().causedBy(soapex);
}
}
diff --git a/bindings/soap/src/main/java/org/n52/sos/encode/SoapResponseWriter.java b/bindings/soap/src/main/java/org/n52/sos/encode/SoapResponseWriter.java
index 923a469ac0..82d90f4523 100644
--- a/bindings/soap/src/main/java/org/n52/sos/encode/SoapResponseWriter.java
+++ b/bindings/soap/src/main/java/org/n52/sos/encode/SoapResponseWriter.java
@@ -34,6 +34,8 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
+import org.n52.sos.exception.CodedException;
+import org.n52.sos.exception.ows.NoApplicableCodeException;
import org.n52.sos.util.http.MediaType;
import org.n52.sos.util.http.MediaTypes;
@@ -46,11 +48,11 @@
public class SoapResponseWriter extends AbstractResponseWriter {
@Override
- public void write(SOAPMessage t, OutputStream out, ResponseProxy responseProxy) throws IOException {
+ public void write(SOAPMessage t, OutputStream out, ResponseProxy responseProxy) throws IOException, CodedException {
try {
t.writeTo(out);
- } catch (SOAPException ex) {
- throw new IOException(ex);
+ } catch (SOAPException soapex) {
+ throw new NoApplicableCodeException().causedBy(soapex);
}
}
diff --git a/bindings/soap/src/main/java/org/n52/sos/encode/streaming/Soap12XmlStreamWriter.java b/bindings/soap/src/main/java/org/n52/sos/encode/streaming/Soap12XmlStreamWriter.java
index 4b94643653..2bbeb548e3 100644
--- a/bindings/soap/src/main/java/org/n52/sos/encode/streaming/Soap12XmlStreamWriter.java
+++ b/bindings/soap/src/main/java/org/n52/sos/encode/streaming/Soap12XmlStreamWriter.java
@@ -58,7 +58,7 @@
/**
* {@link XmlStreamWriter} implementation for SOAP 1.2
- *
+ *
* @author Carsten Hollmann
* @since 4.1.0
*
@@ -76,7 +76,7 @@ public Soap12XmlStreamWriter() {
/**
* constructor
- *
+ *
* @param response
* Service internal SOAP response to encode
*/
@@ -100,7 +100,7 @@ public void write(SoapResponse element, OutputStream out) throws OwsExceptionRep
}
@Override
- public void write(SoapResponse element, OutputStream out, EncodingValues encodingValues) throws
+ public void write(SoapResponse element, OutputStream out, EncodingValues encodingValues) throws
OwsExceptionReport {
try {
init(out);
@@ -115,7 +115,7 @@ public void write(SoapResponse element, OutputStream out, EncodingValues encodin
/**
* Set the response element to encode and write to stream
- *
+ *
* @param response
* Service internal response
*/
@@ -125,7 +125,7 @@ public void setResponse(SoapResponse response) {
/**
* Get the response element to encode and write to stream
- *
+ *
* @return The response element to encode and write to stream
*/
protected SoapResponse getResponse() {
@@ -134,7 +134,7 @@ protected SoapResponse getResponse() {
/**
* Write the SOAP 1.2. envelope element
- *
+ *
* @param response
* The response element to encode and write to stream
* @throws XMLStreamException
@@ -170,7 +170,7 @@ protected Set getSchemaLocation(SoapResponse response) throws Ow
/**
* Write the SOAP 1.2 body element
- *
+ *
* @param response
* The response element to encode and write to stream
* @throws XMLStreamException
@@ -198,7 +198,7 @@ protected void writeSoapBody(SoapResponse response) throws XMLStreamException, O
/**
* Encode and write the {@link AbstractServiceResponse} to stream
- *
+ *
* @param bodyResponse
* The service internal response to encode and write
* @throws XMLStreamException
@@ -225,7 +225,7 @@ protected void writeBodyContent(AbstractServiceResponse bodyResponse) throws XML
/**
* Encode and write SOAP 1.2 fault element to SOAP 1.2 body element
- *
+ *
* @param fault
* Service internal SOAP fault representation
* @throws OwsExceptionReport
@@ -235,7 +235,7 @@ protected void writeBodyContent(AbstractServiceResponse bodyResponse) throws XML
*/
protected void writeSoapFault(SoapFault fault) throws OwsExceptionReport, XMLStreamException {
Encoder encoder = CodingHelper.getEncoder(SoapConstants.NS_SOAP_12, fault);
- String soapFault = ((XmlObject) encoder.encode(fault)).xmlText(XmlOptionsHelper.getInstance().getXmlOptions());
+ String soapFault = encoder.encode(fault).xmlText(XmlOptionsHelper.getInstance().getXmlOptions());
if (soapFault.startsWith(" encoder = CodingHelper.getEncoder(SoapConstants.NS_SOAP_12, exception);
String soapFault =
- ((XmlObject) encoder.encode(exception)).xmlText(XmlOptionsHelper.getInstance().getXmlOptions());
+ encoder.encode(exception).xmlText(XmlOptionsHelper.getInstance().getXmlOptions());
if (soapFault.startsWith(" getEncoder(AbstractServiceRes
/**
* Get encoder for {@link EncoderKey}
- *
+ *
* @param key
* Encoder key to get encoder for
* @return Matching encoder
diff --git a/coding/cv-gml/.gitignore b/coding/cv-gml/.gitignore
new file mode 100644
index 0000000000..b83d22266a
--- /dev/null
+++ b/coding/cv-gml/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/coding/cv-gml/pom.xml b/coding/cv-gml/pom.xml
new file mode 100644
index 0000000000..89ec6d794f
--- /dev/null
+++ b/coding/cv-gml/pom.xml
@@ -0,0 +1,49 @@
+
+
+
+ org.n52.sensorweb.sos
+ coding
+ 4.4.0
+
+ 4.0.0
+ coding-cv-gml
+ jar
+ 52°North Svalbard - CV for GML 3.2.1 XML Request Coding
+ 52°North Svalbard XML CV for GML 3.2.1 Coding
+
+
+ ${project.groupId}
+ api
+
+
+
+ org.n52.sensorweb
+ 52n-xml-gml-v321
+
+
+ org.n52.sensorweb
+ 52n-xml-cv-v022
+
+
+ ${project.groupId}
+ test
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test-jar
+ test
+
+
+ javax.servlet
+ javax.servlet-api
+ test
+
+
+
diff --git a/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/AbstractCVDiscretePointCoverageTypeEncoder.java b/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/AbstractCVDiscretePointCoverageTypeEncoder.java
new file mode 100644
index 0000000000..ee3c305e7a
--- /dev/null
+++ b/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/AbstractCVDiscretePointCoverageTypeEncoder.java
@@ -0,0 +1,357 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.cv.v02.encode;
+
+import java.math.BigInteger;
+import java.util.EnumMap;
+import java.util.Map;
+
+import org.apache.xmlbeans.XmlBoolean;
+import org.apache.xmlbeans.XmlInteger;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlString;
+import org.n52.sos.encode.AbstractSpecificXmlEncoder;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.cv.CvConstants;
+import org.n52.sos.ogc.gml.GmlConstants;
+import org.n52.sos.ogc.om.PointValuePair;
+import org.n52.sos.ogc.om.values.BooleanValue;
+import org.n52.sos.ogc.om.values.CategoryValue;
+import org.n52.sos.ogc.om.values.ComplexValue;
+import org.n52.sos.ogc.om.values.CountValue;
+import org.n52.sos.ogc.om.values.CvDiscretePointCoverage;
+import org.n52.sos.ogc.om.values.ProfileValue;
+import org.n52.sos.ogc.om.values.GeometryValue;
+import org.n52.sos.ogc.om.values.HrefAttributeValue;
+import org.n52.sos.ogc.om.values.MultiPointCoverage;
+import org.n52.sos.ogc.om.values.NilTemplateValue;
+import org.n52.sos.ogc.om.values.QuantityValue;
+import org.n52.sos.ogc.om.values.RectifiedGridCoverage;
+import org.n52.sos.ogc.om.values.ReferenceValue;
+import org.n52.sos.ogc.om.values.SweDataArrayValue;
+import org.n52.sos.ogc.om.values.TLVTValue;
+import org.n52.sos.ogc.om.values.TVPValue;
+import org.n52.sos.ogc.om.values.TextValue;
+import org.n52.sos.ogc.om.values.UnknownValue;
+import org.n52.sos.ogc.om.values.Value;
+import org.n52.sos.ogc.om.values.XmlValue;
+import org.n52.sos.ogc.om.values.visitor.ValueVisitor;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+import org.n52.sos.ogc.swe.SweConstants;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.util.JavaHelper;
+
+import com.google.common.collect.Maps;
+import com.vividsolutions.jts.geom.Point;
+
+import net.opengis.cv.x02.gml32.CVDiscretePointCoverageType;
+import net.opengis.cv.x02.gml32.CVPointValuePairPropertyType;
+import net.opengis.cv.x02.gml32.CVPointValuePairType;
+import net.opengis.gml.x32.PointPropertyType;
+import net.opengis.gml.x32.PointType;
+
+/**
+ * Abstract {@link Encoder} class for CV_DiscretePointCoverage
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ * @param
+ */
+public abstract class AbstractCVDiscretePointCoverageTypeEncoder
+ extends AbstractSpecificXmlEncoder {
+
+ /**
+ * Encode {@link CvDiscretePointCoverage} to
+ * {@link CVDiscretePointCoverageType}
+ *
+ * @param cvDiscretePointCoverage
+ * The {@link CvDiscretePointCoverage} to encode
+ * @return The encoded {@link CvDiscretePointCoverage}
+ * @throws UnsupportedEncoderInputException
+ * If an element can not be encoded
+ * @throws OwsExceptionReport
+ * If an error occurs
+ */
+ protected CVDiscretePointCoverageType encodeCVDiscretePointCoverage(
+ CvDiscretePointCoverage cvDiscretePointCoverage)
+ throws UnsupportedEncoderInputException, OwsExceptionReport {
+ CVDiscretePointCoverageType cvdpct = CVDiscretePointCoverageType.Factory.newInstance(getXmlOptions());
+ cvdpct.setId(cvDiscretePointCoverage.getGmlId());
+ cvdpct.addNewDomainExtent().setHref(cvDiscretePointCoverage.getDomainExtent());
+ cvdpct.addNewRangeType().setHref(cvDiscretePointCoverage.getRangeType().getHref());
+ CVPointValuePairPropertyType cvpvppt = cvdpct.addNewElement();
+ cvpvppt.setCVPointValuePair(encodePointValuePair(cvDiscretePointCoverage.getValue()));
+ return cvdpct;
+ }
+
+ /**
+ * Encode {@link PointValuePair} to {@link CVPointValuePairType}
+ *
+ * @param value
+ * The {@link PointValuePair} to encode
+ * @return The encoded {@link PointValuePair}
+ * @throws UnsupportedEncoderInputException
+ * If an element can not be encoded
+ * @throws OwsExceptionReport
+ * If an error occurs
+ */
+ private CVPointValuePairType encodePointValuePair(PointValuePair value)
+ throws UnsupportedEncoderInputException, OwsExceptionReport {
+ CVPointValuePairType cvpvpt = CVPointValuePairType.Factory.newInstance(getXmlOptions());
+ cvpvpt.setGeometry(encodeGeometry(value.getPoint(), JavaHelper.generateID(value.toString())));
+ if (value.isSetValue()) {
+ cvpvpt.setValue(encodeValue(value.getValue()));
+ } else {
+ cvpvpt.addNewValue();
+ }
+ return cvpvpt;
+ }
+
+ /**
+ * Encode {@link Point} to {@link PointPropertyType}
+ *
+ * @param point
+ * The {@link Point} to encode
+ * @param gmlId
+ * The gml id for the point
+ * @return The encoded {@link Point}
+ * @throws UnsupportedEncoderInputException
+ * If an element can not be encoded
+ * @throws OwsExceptionReport
+ * If an error occurs
+ */
+ private PointPropertyType encodeGeometry(Point point, String gmlId)
+ throws UnsupportedEncoderInputException, OwsExceptionReport {
+ Map additionalValues = Maps.newHashMap();
+ additionalValues.put(HelperValues.GMLID, gmlId);
+ PointPropertyType ppt = PointPropertyType.Factory.newInstance(getXmlOptions());
+ ppt.setPoint((PointType) encodeGML(point, additionalValues));
+ return ppt;
+ }
+
+ /**
+ * Encode {@link Value} to an {@link XmlObject}
+ *
+ * @param value
+ * The {@link Value} to encode
+ * @return The encoded {@link Value}
+ * @throws UnsupportedEncoderInputException
+ * If an element can not be encoded
+ * @throws OwsExceptionReport
+ * If an error occurs
+ */
+ private XmlObject encodeValue(Value> value) throws UnsupportedEncoderInputException, OwsExceptionReport {
+ return value.accept(new ResultValueVisitor());
+ }
+
+ @Override
+ public void addNamespacePrefixToMap(Map nameSpacePrefixMap) {
+ super.addNamespacePrefixToMap(nameSpacePrefixMap);
+ nameSpacePrefixMap.put(CvConstants.NS_CV, CvConstants.NS_CV_PREFIX);
+ }
+
+ protected static XmlObject encodeGML(Object o, Map additionalValues)
+ throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(GmlConstants.NS_GML_32, o, additionalValues);
+ }
+
+ protected static XmlObject encodeGML(Object o) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(GmlConstants.NS_GML_32, o);
+ }
+
+ protected static XmlObject encodeSWE(Object o) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(SweConstants.NS_SWE_20, o);
+ }
+
+ protected static XmlObject encodeSWE(Object o, Map additionalValues)
+ throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(SweConstants.NS_SWE_20, o, additionalValues);
+ }
+
+ protected static XmlString createXmlString() {
+ return XmlString.Factory.newInstance(getXmlOptions());
+ }
+
+ protected static XmlInteger createXmlInteger() {
+ return XmlInteger.Factory.newInstance(getXmlOptions());
+ }
+
+ protected static XmlBoolean createXmlBoolean() {
+ return XmlBoolean.Factory.newInstance(getXmlOptions());
+ }
+
+ /**
+ * {@link ValueVisitor} implementation for the result
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ */
+ private static class ResultValueVisitor implements ValueVisitor {
+
+ ResultValueVisitor() {
+ }
+
+ @Override
+ public XmlObject visit(BooleanValue value) throws OwsExceptionReport {
+ XmlBoolean xbBoolean = createXmlBoolean();
+ if (value.isSetValue()) {
+ xbBoolean.setBooleanValue(value.getValue());
+ } else {
+ xbBoolean.setNil();
+ }
+ return xbBoolean;
+ }
+
+ @Override
+ public XmlObject visit(CategoryValue value) throws OwsExceptionReport {
+ if (value.isSetValue() && !value.getValue().isEmpty()) {
+ return encodeGML(value);
+ }
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(ComplexValue value) throws OwsExceptionReport {
+
+ if (value.isSetValue()) {
+ Map additionalValue = new EnumMap<>(HelperValues.class);
+ additionalValue.put(HelperValues.FOR_OBSERVATION, null);
+ return encodeSWE(value.getValue(), additionalValue);
+ }
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(CountValue value) throws OwsExceptionReport {
+ XmlInteger xbInteger = createXmlInteger();
+ if (value.isSetValue() && value.getValue() != Integer.MIN_VALUE) {
+ xbInteger.setBigIntegerValue(new BigInteger(value.getValue().toString()));
+ } else {
+ xbInteger.setNil();
+ }
+ return xbInteger;
+ }
+
+ @Override
+ public XmlObject visit(GeometryValue value) throws OwsExceptionReport {
+ if (value.isSetValue()) {
+ Map additionalValue = new EnumMap<>(HelperValues.class);
+ additionalValue.put(HelperValues.GMLID,
+ SosConstants.OBS_ID_PREFIX + JavaHelper.generateID(value.toString()));
+ additionalValue.put(HelperValues.PROPERTY_TYPE, null);
+ return encodeGML(value.getValue(), additionalValue);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public XmlObject visit(HrefAttributeValue value) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(NilTemplateValue value) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(QuantityValue value) throws OwsExceptionReport {
+ return encodeGML(value);
+ }
+
+ @Override
+ public XmlObject visit(ReferenceValue value) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(SweDataArrayValue value) throws OwsExceptionReport {
+ Map additionalValues = new EnumMap<>(HelperValues.class);
+ additionalValues.put(HelperValues.FOR_OBSERVATION, null);
+ return encodeSWE(value.getValue(), additionalValues);
+ }
+
+ @Override
+ public XmlObject visit(TVPValue value) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(TLVTValue value) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(TextValue value) throws OwsExceptionReport {
+ XmlString xbString = createXmlString();
+ if (value.isSetValue()) {
+ xbString.setStringValue(value.getValue());
+ } else {
+ xbString.setNil();
+ }
+ return xbString;
+ }
+
+ @Override
+ public XmlObject visit(XmlValue value) throws OwsExceptionReport {
+ return value.getValue();
+ }
+
+ @Override
+ public XmlObject visit(UnknownValue value) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(CvDiscretePointCoverage value) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(MultiPointCoverage multiPointCoverage) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(RectifiedGridCoverage rectifiedGridCoverage) throws OwsExceptionReport {
+ return null;
+ }
+
+ @Override
+ public XmlObject visit(ProfileValue value) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(value.getDefaultElementEncoding(), value);
+ }
+ }
+}
diff --git a/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/CVDiscretePointCoveragePropertyTypeEncoder.java b/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/CVDiscretePointCoveragePropertyTypeEncoder.java
new file mode 100644
index 0000000000..02787ba69d
--- /dev/null
+++ b/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/CVDiscretePointCoveragePropertyTypeEncoder.java
@@ -0,0 +1,82 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.cv.v02.encode;
+
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.n52.sos.encode.ClassToClassEncoderKey;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.XmlPropertyTypeEncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.cv.CvConstants;
+import org.n52.sos.ogc.om.values.CvDiscretePointCoverage;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+
+import com.google.common.collect.Sets;
+
+import net.opengis.cv.x02.gml32.CVDiscretePointCoveragePropertyType;
+
+/**
+ * {@link Encoder} for {@link CvDiscretePointCoverage} to encode to {@link CVDiscretePointCoveragePropertyType}
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ */
+public class CVDiscretePointCoveragePropertyTypeEncoder extends AbstractCVDiscretePointCoverageTypeEncoder {
+
+ protected static final Set ENCODER_KEYS = Sets.newHashSet(
+ new ClassToClassEncoderKey(CvDiscretePointCoverage.class, CVDiscretePointCoveragePropertyType.class),
+ new XmlPropertyTypeEncoderKey(CvConstants.NS_CV, CvDiscretePointCoverage.class));
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public CVDiscretePointCoveragePropertyType encode(CvDiscretePointCoverage cvDiscretePointCoverage)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ return encode(cvDiscretePointCoverage, new EnumMap(HelperValues.class));
+ }
+
+ @Override
+ public CVDiscretePointCoveragePropertyType encode(CvDiscretePointCoverage cvDiscretePointCoverage, Map additionalValues)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ // spatialObservation + measured value
+ CVDiscretePointCoveragePropertyType cvdpcpt = CVDiscretePointCoveragePropertyType.Factory.newInstance(getXmlOptions());
+ cvdpcpt.setCVDiscretePointCoverage(encodeCVDiscretePointCoverage(cvDiscretePointCoverage));
+ return cvdpcpt;
+ }
+
+}
diff --git a/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/CVDiscreteTimeInstantCoverageEncoder.java b/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/CVDiscreteTimeInstantCoverageEncoder.java
new file mode 100644
index 0000000000..d578d863ad
--- /dev/null
+++ b/coding/cv-gml/src/main/java/org/n52/svalbard/cv/v02/encode/CVDiscreteTimeInstantCoverageEncoder.java
@@ -0,0 +1,74 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.cv.v02.encode;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.AbstractXmlEncoder;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+
+import net.opengis.cv.x02.gml32.CVDiscreteTimeInstantCoveragePropertyType;
+import net.opengis.cv.x02.gml32.CVDiscreteTimeInstantCoverageType;
+import net.opengis.cv.x02.gml32.CVTimeInstantValuePairPropertyType;
+import net.opengis.cv.x02.gml32.CVTimeInstantValuePairType;
+import net.opengis.gml.x32.TimeInstantPropertyType;
+
+/**
+ * Encoder for {@link CVDiscreteTimeInstantCoveragePropertyType}
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ */
+public class CVDiscreteTimeInstantCoverageEncoder extends AbstractXmlEncoder {
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public XmlObject encode(Object objectToEncode, Map additionalValues)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ CVDiscreteTimeInstantCoveragePropertyType cvdticpt = CVDiscreteTimeInstantCoveragePropertyType.Factory.newInstance(getXmlOptions());
+ CVDiscreteTimeInstantCoverageType cvdtict = cvdticpt.addNewCVDiscreteTimeInstantCoverage();
+ CVTimeInstantValuePairPropertyType cvtivppt = cvdtict.addNewElement();
+ CVTimeInstantValuePairType cvtivpt = cvtivppt.addNewCVTimeInstantValuePair();
+ TimeInstantPropertyType tipt = cvtivpt.addNewGeometry();
+ XmlObject addNewValue = cvtivpt.addNewValue();
+ return cvdticpt;
+ }
+
+
+}
diff --git a/coding/cv-gml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder b/coding/cv-gml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder
new file mode 100644
index 0000000000..a5a1a42a71
--- /dev/null
+++ b/coding/cv-gml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder
@@ -0,0 +1,2 @@
+org.n52.svalbard.cv.v02.encode.CVDiscretePointCoveragePropertyTypeEncoder
+org.n52.svalbard.cv.v02.encode.CVDiscreteTimeInstantCoverageEncoder
\ No newline at end of file
diff --git a/coding/exi/pom.xml b/coding/exi/pom.xml
index 766790f877..a27b315c4e 100644
--- a/coding/exi/pom.xml
+++ b/coding/exi/pom.xml
@@ -1,42 +1,42 @@
-
-
-
- org.n52.sensorweb.sos
- coding
- 4.3.14
-
- 4.0.0
- coding-exi
- jar
- 52°North SOS - EXI Coding
- 52°North Sensor Observation Service EXI Coding
-
-
- ${project.groupId}
- api
-
-
- com.siemens.ct.exi
- exificient
-
-
- ${project.groupId}
- gda-operation
-
-
- javax.servlet
- servlet-api
- test
-
-
- ${project.groupId}
- sqlite-config
- test
-
-
- ${project.groupId}
- test
- test
-
-
-
+
+
+
+ org.n52.sensorweb.sos
+ coding
+ 4.4.0
+
+ 4.0.0
+ coding-exi
+ jar
+ 52°North SOS - EXI Coding
+ 52°North Sensor Observation Service EXI Coding
+
+
+ ${project.groupId}
+ api
+
+
+ com.siemens.ct.exi
+ exificient
+
+
+ ${project.groupId}
+ gda-operation
+
+
+ javax.servlet
+ javax.servlet-api
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test
+
+
+ ${project.groupId}
+ test
+ test
+
+
+
diff --git a/coding/exi/src/main/java/org/n52/sos/encode/EXIResponseWriter.java b/coding/exi/src/main/java/org/n52/sos/encode/EXIResponseWriter.java
index 364ed25d17..c74b14a186 100644
--- a/coding/exi/src/main/java/org/n52/sos/encode/EXIResponseWriter.java
+++ b/coding/exi/src/main/java/org/n52/sos/encode/EXIResponseWriter.java
@@ -33,6 +33,8 @@
import java.io.InputStream;
import java.io.OutputStream;
+import org.n52.sos.exception.CodedException;
+import org.n52.sos.exception.ows.NoApplicableCodeException;
import org.n52.sos.exi.EXIObject;
import org.n52.sos.exi.EXISettings;
import org.n52.sos.util.XmlOptionsHelper;
@@ -62,7 +64,7 @@ public class EXIResponseWriter extends AbstractResponseWriter {
private final static EXIUtils EXI_UTILS = EXIUtils.getInstance();
@Override
- public void write(EXIObject exiObject, OutputStream out, ResponseProxy responseProxy) throws IOException {
+ public void write(EXIObject exiObject, OutputStream out, ResponseProxy responseProxy) throws IOException, CodedException {
try (InputStream is =
new ByteArrayInputStream(exiObject.getDoc().xmlText(XmlOptionsHelper.getInstance().getXmlOptions())
.getBytes("UTF-8"))) {
@@ -75,7 +77,7 @@ public void write(EXIObject exiObject, OutputStream out, ResponseProxy responseP
xmlReader.setContentHandler(exiResult.getHandler());
xmlReader.parse(new InputSource(is));
} catch (EXIException | SAXException e) {
- throw new IOException(e);
+ throw new NoApplicableCodeException().causedBy(e);
}
}
diff --git a/coding/exi/src/main/java/org/n52/sos/exi/EXISettings.java b/coding/exi/src/main/java/org/n52/sos/exi/EXISettings.java
index 8921b70dfb..be4f8b8268 100644
--- a/coding/exi/src/main/java/org/n52/sos/exi/EXISettings.java
+++ b/coding/exi/src/main/java/org/n52/sos/exi/EXISettings.java
@@ -122,7 +122,7 @@ public class EXISettings implements SettingDefinitionProvider {
+ "performance and compression.Default"
+ " : uses some default options. If any of the other"
+ " options is selected, default options is skipped."
- + "Specific : uses the options activated"
+ + "Specific : uses the options activated "
+ "further down.Strict : "
+ "no namespace prefixes, comments etc are preserved nor"
+ " schema deviations are allowed. ").
diff --git a/coding/gml-cov/pom.xml b/coding/gml-cov/pom.xml
new file mode 100644
index 0000000000..6a61178b6f
--- /dev/null
+++ b/coding/gml-cov/pom.xml
@@ -0,0 +1,49 @@
+
+
+
+ org.n52.sensorweb.sos
+ coding
+ 4.4.0
+
+ 4.0.0
+ coding-gml-cov
+ jar
+ 52°North SOS - GMLCOV 1.0 XML Request Coding
+ 52°North Sensor Observation Service XML GML Coverage 1.0 Coding
+
+
+ ${project.groupId}
+ api
+
+
+
+ org.n52.sensorweb
+ 52n-xml-gml-v321
+
+
+ org.n52.sensorweb
+ 52n-xml-gmlcov-v10
+
+
+ ${project.groupId}
+ test
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test-jar
+ test
+
+
+ javax.servlet
+ javax.servlet-api
+ test
+
+
+
diff --git a/hibernate/common/src/main/java/org/n52/sos/ds/hibernate/entities/series/values/SeriesNumericValue.java b/coding/gml-cov/src/main/java/org/n52/svalbard/gmlcov/v10/encode/AbstractReverencableGridCoverageType.java
similarity index 62%
rename from hibernate/common/src/main/java/org/n52/sos/ds/hibernate/entities/series/values/SeriesNumericValue.java
rename to coding/gml-cov/src/main/java/org/n52/svalbard/gmlcov/v10/encode/AbstractReverencableGridCoverageType.java
index 290620b0ed..0c9c2d2724 100644
--- a/hibernate/common/src/main/java/org/n52/sos/ds/hibernate/entities/series/values/SeriesNumericValue.java
+++ b/coding/gml-cov/src/main/java/org/n52/svalbard/gmlcov/v10/encode/AbstractReverencableGridCoverageType.java
@@ -26,42 +26,29 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*/
-package org.n52.sos.ds.hibernate.entities.series.values;
+package org.n52.svalbard.gmlcov.v10.encode;
-import org.n52.sos.ds.hibernate.entities.interfaces.NumericValue;
+import java.util.Map;
+
+import org.n52.sos.encode.AbstractSpecificXmlEncoder;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.ogc.gmlcov.GmlCoverageConstants;
+import org.n52.sos.ogc.om.values.ReferencableGridCoverage;
/**
- * Concrete implementation of {@link SeriesValue} for series concept and numeric
- * values
+ * Abstract {@link Encoder} for {@link ReferencableGridCoverage}
*
- * @author Carsten Hollmann
- * @since 4.1.0
+ * @author Carsten Hollmann
+ * @since 4.4.0
*
+ * @param
*/
-public class SeriesNumericValue extends SeriesValue implements NumericValue {
-
- private static final long serialVersionUID = 7487419141361171658L;
-
- private Double value;
-
- @Override
- public Double getValue() {
- return value;
- }
+public abstract class AbstractReverencableGridCoverageType
+ extends AbstractSpecificXmlEncoder {
@Override
- public void setValue(Double value) {
- this.value = value;
+ public void addNamespacePrefixToMap(Map nameSpacePrefixMap) {
+ super.addNamespacePrefixToMap(nameSpacePrefixMap);
+ nameSpacePrefixMap.put(GmlCoverageConstants.NS_GML_COV, GmlCoverageConstants.NS_GML_COV_PREFIX);
}
-
- @Override
- public boolean isSetValue() {
- return getValue() != null;
- }
-
- @Override
- public String getValueAsString() {
- return getValue().toString();
- }
-
}
diff --git a/coding/gml-cov/src/main/java/org/n52/svalbard/gmlcov/v10/encode/ReverencableGridCoverageDocumentEncoder.java b/coding/gml-cov/src/main/java/org/n52/svalbard/gmlcov/v10/encode/ReverencableGridCoverageDocumentEncoder.java
new file mode 100644
index 0000000000..f337dd0642
--- /dev/null
+++ b/coding/gml-cov/src/main/java/org/n52/svalbard/gmlcov/v10/encode/ReverencableGridCoverageDocumentEncoder.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gmlcov.v10.encode;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.om.values.ReferencableGridCoverage;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+
+import net.opengis.gmlcov.x10.AbstractDiscreteCoverageType;
+import net.opengis.gmlcov.x10.ReferenceableGridCoverageDocument;
+
+/**
+ * {@link Encoder} implementation to encode {@link ReferencableGridCoverage} to
+ * {@link ReferenceableGridCoverageDocument}
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ */
+public class ReverencableGridCoverageDocumentEncoder
+ extends AbstractReverencableGridCoverageType {
+
+ @Override
+ public Set getEncoderKeyType() {
+ // TODO Auto-generated method stub
+ return Collections.emptySet();
+ }
+
+ @Override
+ public ReferenceableGridCoverageDocument encode(ReferencableGridCoverage objectToEncode)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ReferenceableGridCoverageDocument encode(ReferencableGridCoverage objectToEncode,
+ Map additionalValues) throws OwsExceptionReport, UnsupportedEncoderInputException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private XmlObject create() {
+ ReferenceableGridCoverageDocument rgcd = ReferenceableGridCoverageDocument.Factory.newInstance();
+ AbstractDiscreteCoverageType rgct = rgcd.addNewReferenceableGridCoverage();
+ return rgcd;
+ }
+
+}
diff --git a/coding/gml-cov/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder b/coding/gml-cov/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder
new file mode 100644
index 0000000000..c99ad0fe18
--- /dev/null
+++ b/coding/gml-cov/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder
@@ -0,0 +1 @@
+org.n52.svalbard.gmlcov.v10.encode.ReverencableGridCoverageDocumentEncoder
\ No newline at end of file
diff --git a/coding/gml-cov/src/main/resources/configured-context.xml b/coding/gml-cov/src/main/resources/configured-context.xml
new file mode 100644
index 0000000000..b757dbee5b
--- /dev/null
+++ b/coding/gml-cov/src/main/resources/configured-context.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/coding/gml/pom.xml b/coding/gml/pom.xml
new file mode 100644
index 0000000000..9d68306d65
--- /dev/null
+++ b/coding/gml/pom.xml
@@ -0,0 +1,53 @@
+
+
+
+ org.n52.sensorweb.sos
+ coding
+ 4.4.0
+
+ 4.0.0
+ coding-gml
+ jar
+ 52°North Svalbard - GML XML Request Coding
+ 52°North Svalbard XML GML Coding
+
+
+ ${project.groupId}
+ api
+
+
+
+ org.n52.sensorweb
+ 52n-xml-gml-v321
+
+
+ org.n52.sensorweb
+ 52n-xml-gml-v33
+
+
+ org.n52.sensorweb
+ 52n-xml-gmlcov-v10
+
+
+ ${project.groupId}
+ test
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test-jar
+ test
+
+
+ javax.servlet
+ javax.servlet-api
+ test
+
+
+
diff --git a/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractCoverageEncoder.java b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractCoverageEncoder.java
new file mode 100644
index 0000000000..1c4115b41f
--- /dev/null
+++ b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractCoverageEncoder.java
@@ -0,0 +1,139 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gml.v321.encode;
+
+import java.util.List;
+
+import org.n52.sos.encode.AbstractSpecificXmlEncoder;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.ogc.om.values.BooleanValue;
+import org.n52.sos.ogc.om.values.CategoryValue;
+import org.n52.sos.ogc.om.values.CountValue;
+import org.n52.sos.ogc.om.values.DiscreteCoverage;
+import org.n52.sos.ogc.om.values.QuantityValue;
+import org.n52.sos.ogc.om.values.Value;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+
+import com.google.common.collect.Lists;
+
+import net.opengis.gml.x32.BooleanListDocument;
+import net.opengis.gml.x32.CategoryListDocument;
+import net.opengis.gml.x32.CodeOrNilReasonListType;
+import net.opengis.gml.x32.CountListDocument;
+import net.opengis.gml.x32.DiscreteCoverageType;
+import net.opengis.gml.x32.MeasureOrNilReasonListType;
+import net.opengis.gml.x32.QuantityListDocument;
+import net.opengis.gml.x32.RangeSetType;
+
+/**
+ * Abstract {@link Encoder} implementation for {@link DiscreteCoverage}
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ * @param
+ * @param
+ */
+public abstract class AbstractCoverageEncoder extends AbstractSpecificXmlEncoder {
+
+ /**
+ * Encode range set of {@link DiscreteCoverageType} from
+ * {@link DiscreteCoverage}
+ *
+ * @param dct
+ * {@link DiscreteCoverageType} to encode range se for
+ * @param discreteCoverage
+ * The {@link DiscreteCoverage} with the range set
+ * @return {@link DiscreteCoverageType} with range set
+ * @throws OwsExceptionReport
+ */
+ protected RangeSetType encodeRangeSet(DiscreteCoverageType dct, DiscreteCoverage> discreteCoverage)
+ throws OwsExceptionReport {
+ RangeSetType rst = dct.addNewRangeSet();
+ encodeValueList(rst, discreteCoverage);
+ return dct.getRangeSet();
+ }
+
+ /**
+ * Encode value list of {@link RangeSetType} from {@link DiscreteCoverage}
+ *
+ * @param rst
+ * The {@link RangeSetType} to encode value list for
+ * @param discreteCoverage
+ * The {@link DiscreteCoverage} with the value list
+ * @throws OwsExceptionReport
+ * If an error occurs
+ */
+ protected void encodeValueList(RangeSetType rst, DiscreteCoverage> discreteCoverage) throws OwsExceptionReport {
+ List> list = getList(discreteCoverage);
+ Value> value = discreteCoverage.getRangeSet().iterator().next();
+ if (value instanceof BooleanValue) {
+ BooleanListDocument bld = BooleanListDocument.Factory.newInstance();
+ bld.setBooleanList(list);
+ rst.set(bld);
+ } else if (value instanceof CategoryValue) {
+ CategoryListDocument cld = CategoryListDocument.Factory.newInstance();
+ CodeOrNilReasonListType conrlt = cld.addNewCategoryList();
+ if (discreteCoverage.isSetUnit()) {
+ conrlt.setCodeSpace(discreteCoverage.getUnit());
+ } else if (value.isSetUnit()) {
+ conrlt.setCodeSpace(value.getUnit());
+ }
+ conrlt.setListValue(list);
+ rst.set(cld);
+ } else if (value instanceof CountValue) {
+ CountListDocument cld = CountListDocument.Factory.newInstance();
+ cld.setCountList(list);
+ rst.set(cld);
+ } else if (value instanceof QuantityValue) {
+ QuantityListDocument qld = QuantityListDocument.Factory.newInstance();
+ MeasureOrNilReasonListType monrlt = qld.addNewQuantityList();
+ if (discreteCoverage.isSetUnit()) {
+ monrlt.setUom(discreteCoverage.getUnit());
+ } else if (value.isSetUnit()) {
+ monrlt.setUom(value.getUnit());
+ }
+ monrlt.setListValue(list);
+ rst.set(qld);
+ } else {
+ rst.setNil();
+ }
+ }
+
+ private List> getList(DiscreteCoverage> discreteCoverage) {
+ List list = Lists.newArrayList();
+ for (Object value : discreteCoverage.getRangeSet()) {
+ if (value instanceof Value>) {
+ list.add(((Value>) value).getValue());
+ }
+ }
+ return list;
+ }
+
+}
diff --git a/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractMultiPointCoverageTypeEncoder.java b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractMultiPointCoverageTypeEncoder.java
new file mode 100644
index 0000000000..f6e9c674dd
--- /dev/null
+++ b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractMultiPointCoverageTypeEncoder.java
@@ -0,0 +1,107 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gml.v321.encode;
+
+import java.util.Map;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.ogc.gml.GmlConstants;
+import org.n52.sos.ogc.om.values.MultiPointCoverage;
+import org.n52.sos.ogc.om.values.MultiPointCoverage.PointValueLists;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.util.JavaHelper;
+import org.n52.sos.util.XmlHelper;
+
+import com.google.common.collect.Maps;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.MultiPoint;
+import com.vividsolutions.jts.geom.Point;
+
+import net.opengis.gml.x32.DiscreteCoverageType;
+import net.opengis.gml.x32.DomainSetType;
+import net.opengis.gml.x32.MultiPointDomainDocument;
+
+/**
+ * Abstract {@link Encoder} implementation to encode {@link MultiPointCoverage}
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ * @param
+ */
+public abstract class AbstractMultiPointCoverageTypeEncoder extends AbstractCoverageEncoder {
+
+ /**
+ * Encode {@link MultiPointCoverage} to {@link DiscreteCoverageType}
+ *
+ * @param dct
+ * {@link DiscreteCoverageType} to add values to
+ * @param multiPointCoverage
+ * {@link MultiPointCoverage} to encode
+ * @return
+ * @throws OwsExceptionReport
+ */
+ protected DiscreteCoverageType encodeMultiPointCoverageType(DiscreteCoverageType dct,
+ MultiPointCoverage multiPointCoverage) throws OwsExceptionReport {
+ dct.setId(multiPointCoverage.getGmlId());
+ PointValueLists pointValues = multiPointCoverage.getPointValue();
+ encodeMultiPointDomain(dct, pointValues);
+ encodeRangeSet(dct, multiPointCoverage);
+ return dct;
+ }
+
+ private void encodeMultiPointDomain(DiscreteCoverageType dct, PointValueLists pointValues)
+ throws OwsExceptionReport {
+ MultiPointDomainDocument mpdd = MultiPointDomainDocument.Factory.newInstance();
+ DomainSetType mpdst = mpdd.addNewMultiPointDomain();
+ GeometryFactory factory = pointValues.getPoints().get(0).getFactory();
+ MultiPoint multiPoint = factory.createMultiPoint(pointValues.getPoints().toArray(new Point[0]));
+ Map helperValues = Maps.newHashMap();
+ helperValues.put(HelperValues.GMLID, JavaHelper.generateID(multiPoint.toString()));
+ helperValues.put(HelperValues.PROPERTY_TYPE, "true");
+ XmlObject encodedGeometry = encodeGML(multiPoint);
+ mpdst.addNewAbstractGeometry().set(encodedGeometry);
+ XmlHelper.substituteElement(mpdst.getAbstractGeometry(), encodedGeometry);
+ dct.setDomainSet(mpdst);
+ }
+
+ @Override
+ public void addNamespacePrefixToMap(Map nameSpacePrefixMap) {
+ super.addNamespacePrefixToMap(nameSpacePrefixMap);
+ nameSpacePrefixMap.put(GmlConstants.NS_GML_32, GmlConstants.NS_GML_PREFIX);
+ }
+
+ protected static XmlObject encodeGML(Object o) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(GmlConstants.NS_GML_32, o);
+ }
+}
diff --git a/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractRectifiedGridCoverageTypeEncoder.java b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractRectifiedGridCoverageTypeEncoder.java
new file mode 100644
index 0000000000..c31b152a7a
--- /dev/null
+++ b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/AbstractRectifiedGridCoverageTypeEncoder.java
@@ -0,0 +1,90 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gml.v321.encode;
+
+import java.util.Map;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.ogc.gml.GmlConstants;
+import org.n52.sos.ogc.om.values.RectifiedGridCoverage;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+
+import net.opengis.gml.x32.DiscreteCoverageType;
+import net.opengis.gml.x33.ce.SimpleMultiPointDocument;
+import net.opengis.gml.x33.ce.SimpleMultiPointType;
+
+/**
+ * Abstract {@link Encoder} implementation for {@link RectifiedGridCoverage}
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ * @param
+ */
+public abstract class AbstractRectifiedGridCoverageTypeEncoder
+ extends AbstractCoverageEncoder {
+
+ /**
+ * Encodes the {@link RectifiedGridCoverage} to {@link DiscreteCoverageType}
+ *
+ * @param rectifiedGridCoverage
+ * The {@link RectifiedGridCoverage}
+ * @param additionalValues
+ * Helper values
+ * @return Encoded {@link RectifiedGridCoverage}
+ * @throws OwsExceptionReport
+ * If an error occurs
+ */
+ protected DiscreteCoverageType encodeRectifiedGridCoverage(RectifiedGridCoverage rectifiedGridCoverage,
+ Map additionalValues) throws OwsExceptionReport {
+ DiscreteCoverageType dct = DiscreteCoverageType.Factory.newInstance();
+ dct.setId(rectifiedGridCoverage.getGmlId());
+ XmlObject encodedGeometry = encodeDomainSet(rectifiedGridCoverage);
+ dct.addNewDomainSet().set(encodedGeometry);
+ dct.setRangeSet(encodeRangeSet(dct, rectifiedGridCoverage));
+ return dct;
+ }
+
+ private XmlObject encodeDomainSet(RectifiedGridCoverage rectifiedGridCoverage) {
+ SimpleMultiPointDocument smpd = SimpleMultiPointDocument.Factory.newInstance();
+ SimpleMultiPointType smpt = smpd.addNewSimpleMultiPoint();
+ smpt.setId("smp_" + rectifiedGridCoverage.getGmlId());
+ smpt.addNewPosList().setListValue(rectifiedGridCoverage.getDomainSet());
+ return smpd;
+ }
+
+ @Override
+ public void addNamespacePrefixToMap(Map nameSpacePrefixMap) {
+ super.addNamespacePrefixToMap(nameSpacePrefixMap);
+ nameSpacePrefixMap.put(GmlConstants.NS_GML_32, GmlConstants.NS_GML_PREFIX);
+ }
+
+}
diff --git a/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/MultiPointCoverageDocumentEncoder.java b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/MultiPointCoverageDocumentEncoder.java
new file mode 100644
index 0000000000..3d6cf394c5
--- /dev/null
+++ b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/MultiPointCoverageDocumentEncoder.java
@@ -0,0 +1,84 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gml.v321.encode;
+
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.n52.sos.encode.ClassToClassEncoderKey;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.XmlPropertyTypeEncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.gml.GmlConstants;
+import org.n52.sos.ogc.om.values.MultiPointCoverage;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+
+import com.google.common.collect.Sets;
+
+import net.opengis.gml.x32.MultiPointCoverageDocument;
+
+/**
+ * {@link Encoder} implementation for {@link MultiPointCoverage} to
+ * {@link MultiPointCoverageDocument}
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ */
+public class MultiPointCoverageDocumentEncoder
+ extends AbstractMultiPointCoverageTypeEncoder {
+
+ protected static final Set ENCODER_KEYS =
+ Sets.newHashSet(new ClassToClassEncoderKey(MultiPointCoverageDocument.class, MultiPointCoverage.class),
+ new XmlPropertyTypeEncoderKey(GmlConstants.NS_GML_32, MultiPointCoverage.class));
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public MultiPointCoverageDocument encode(MultiPointCoverage multiPointCoverage)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ return encode(multiPointCoverage, new EnumMap(HelperValues.class));
+ }
+
+ @Override
+ public MultiPointCoverageDocument encode(MultiPointCoverage multiPointCoverage,
+ Map additionalValues) throws OwsExceptionReport, UnsupportedEncoderInputException {
+ MultiPointCoverageDocument mpcd = MultiPointCoverageDocument.Factory.newInstance();
+ mpcd.setMultiPointCoverage(encodeMultiPointCoverageType(mpcd.addNewMultiPointCoverage(), multiPointCoverage));
+ return mpcd;
+ }
+
+}
diff --git a/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/PointPropertyTypeEncoder.java b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/PointPropertyTypeEncoder.java
new file mode 100644
index 0000000000..7b0870b902
--- /dev/null
+++ b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/PointPropertyTypeEncoder.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gml.v321.encode;
+
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.AbstractSpecificXmlEncoder;
+import org.n52.sos.encode.ClassToClassEncoderKey;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.XmlPropertyTypeEncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.gml.GmlConstants;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+import org.n52.sos.util.CodingHelper;
+
+import com.google.common.collect.Sets;
+import com.vividsolutions.jts.geom.Point;
+
+import net.opengis.gml.x32.PointPropertyType;
+import net.opengis.gml.x32.PointType;
+
+/**
+ * {@link Encoder} implementation for {@link Point} to {@link PointPropertyType}
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ */
+public class PointPropertyTypeEncoder extends AbstractSpecificXmlEncoder {
+
+ protected static final Set ENCODER_KEYS =
+ Sets.newHashSet(new ClassToClassEncoderKey(PointPropertyType.class, Point.class),
+ new XmlPropertyTypeEncoderKey(GmlConstants.NS_GML_32, Point.class));
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public PointPropertyType encode(Point point) throws OwsExceptionReport, UnsupportedEncoderInputException {
+ return encode(point, new EnumMap(HelperValues.class));
+ }
+
+ @Override
+ public PointPropertyType encode(Point point, Map additionalValues)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ PointPropertyType ppt = PointPropertyType.Factory.newInstance();
+ ppt.setPoint(encodePointType(point, additionalValues));
+ return ppt;
+ }
+
+ private PointType encodePointType(Point point, Map additionalValues)
+ throws OwsExceptionReport {
+ return (PointType) encodeGML(point, additionalValues);
+ }
+
+ protected static XmlObject encodeGML(Object o, Map additionalValues)
+ throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(GmlConstants.NS_GML_32, o, additionalValues);
+ }
+
+}
diff --git a/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/RectifiedGridCoverageDocumentEncoder.java b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/RectifiedGridCoverageDocumentEncoder.java
new file mode 100644
index 0000000000..6a4c60e4e5
--- /dev/null
+++ b/coding/gml/src/main/java/org/n52/svalbard/gml/v321/encode/RectifiedGridCoverageDocumentEncoder.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gml.v321.encode;
+
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.n52.sos.encode.ClassToClassEncoderKey;
+import org.n52.sos.encode.Encoder;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.XmlPropertyTypeEncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.gml.GmlConstants;
+import org.n52.sos.ogc.om.values.RectifiedGridCoverage;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+
+import com.google.common.collect.Sets;
+
+import net.opengis.gml.x32.RectifiedGridCoverageDocument;
+
+/**
+ * {@link Encoder} implementation for {@link RectifiedGridCoverage} to
+ * {@link RectifiedGridCoverageDocument}
+ *
+ * @author Carsten Hollmann
+ * @since 4.4.0
+ *
+ */
+public class RectifiedGridCoverageDocumentEncoder
+ extends AbstractRectifiedGridCoverageTypeEncoder {
+
+ protected static final Set ENCODER_KEYS = Sets.newHashSet(
+ new ClassToClassEncoderKey(RectifiedGridCoverageDocument.class, RectifiedGridCoverage.class),
+ new XmlPropertyTypeEncoderKey(GmlConstants.NS_GML_32, RectifiedGridCoverage.class));
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public RectifiedGridCoverageDocument encode(RectifiedGridCoverage rectifiedGridCoverage)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ return encode(rectifiedGridCoverage, new EnumMap(HelperValues.class));
+ }
+
+ @Override
+ public RectifiedGridCoverageDocument encode(RectifiedGridCoverage rectifiedGridCoverage,
+ Map additionalValues) throws OwsExceptionReport, UnsupportedEncoderInputException {
+ RectifiedGridCoverageDocument rgcd = RectifiedGridCoverageDocument.Factory.newInstance();
+ rgcd.setRectifiedGridCoverage(encodeRectifiedGridCoverage(rectifiedGridCoverage, additionalValues));
+ return rgcd;
+ }
+}
diff --git a/coding/gml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder b/coding/gml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder
new file mode 100644
index 0000000000..9b538c61ee
--- /dev/null
+++ b/coding/gml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder
@@ -0,0 +1,2 @@
+org.n52.svalbard.gml.v321.encode.MultiPointCoverageDocumentEncoder
+org.n52.svalbard.gml.v321.encode.RectifiedGridCoverageDocumentEncoder
\ No newline at end of file
diff --git a/coding/gml/src/main/resources/configured-context.xml b/coding/gml/src/main/resources/configured-context.xml
new file mode 100644
index 0000000000..8e227e12be
--- /dev/null
+++ b/coding/gml/src/main/resources/configured-context.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/coding/gml/src/test/java/org/n52/svalbard/gml/v321/encode/RectifiedGridCoverageDocumentEncoderTest.java b/coding/gml/src/test/java/org/n52/svalbard/gml/v321/encode/RectifiedGridCoverageDocumentEncoderTest.java
new file mode 100644
index 0000000000..bd22cf61bc
--- /dev/null
+++ b/coding/gml/src/test/java/org/n52/svalbard/gml/v321/encode/RectifiedGridCoverageDocumentEncoderTest.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gml.v321.encode;
+
+import static java.lang.Boolean.TRUE;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.SortedMap;
+
+import org.junit.Test;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.om.values.QuantityValue;
+import org.n52.sos.ogc.om.values.RectifiedGridCoverage;
+import org.n52.sos.ogc.om.values.Value;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.util.XmlHelper;
+
+import com.google.common.collect.Maps;
+
+import net.opengis.gml.x32.RectifiedGridCoverageDocument;
+
+public class RectifiedGridCoverageDocumentEncoderTest {
+
+ private RectifiedGridCoverageDocumentEncoder encoder = new RectifiedGridCoverageDocumentEncoder();
+
+ @Test
+ public void test_encoding() throws UnsupportedEncoderInputException, OwsExceptionReport {
+ RectifiedGridCoverageDocument encoded = encoder.encode(getRectifiedGridCoverage());
+
+ assertThat(XmlHelper.validateDocument(encoded), is(TRUE));
+ }
+
+ private RectifiedGridCoverage getRectifiedGridCoverage() {
+ RectifiedGridCoverage gridCoverage = new RectifiedGridCoverage("test");
+ SortedMap> values = Maps.newTreeMap();
+ values.put(2.5, new QuantityValue(10.0));
+ values.put(5.0, new QuantityValue(8.0));
+ values.put(10.0, new QuantityValue(3.0));
+ gridCoverage.setValue(values);
+ gridCoverage.setUnit("C");
+ return gridCoverage;
+ }
+}
diff --git a/coding/gwml/.gitignore b/coding/gwml/.gitignore
new file mode 100644
index 0000000000..b83d22266a
--- /dev/null
+++ b/coding/gwml/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/coding/gwml/pom.xml b/coding/gwml/pom.xml
new file mode 100644
index 0000000000..1f96869df1
--- /dev/null
+++ b/coding/gwml/pom.xml
@@ -0,0 +1,57 @@
+
+
+
+ org.n52.sensorweb.sos
+ coding
+ 4.4.0
+
+ 4.0.0
+ coding-gwml
+ jar
+ 52°North Svalbard - GWML 2.2 XML Coding
+ 52°North Svalbard XML GroundWaterML 2.2 Coding
+
+
+ ${project.groupId}
+ api
+
+
+
+ org.n52.sensorweb
+ 52n-xml-gml-v321
+
+
+ org.n52.sensorweb
+ 52n-xml-sweCommon-v20
+
+
+ org.n52.sensorweb
+ 52n-xml-gwml-v22
+
+
+ ${project.groupId}
+ coding-sos-v20
+
+
+ ${project.groupId}
+ test
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test-jar
+ test
+
+
+ javax.servlet
+ javax.servlet-api
+ test
+
+
+
diff --git a/coding/gwml/src/main/java/org/n52/sos/convert/GwmlObservationModifier.java b/coding/gwml/src/main/java/org/n52/sos/convert/GwmlObservationModifier.java
new file mode 100644
index 0000000000..8f7b287613
--- /dev/null
+++ b/coding/gwml/src/main/java/org/n52/sos/convert/GwmlObservationModifier.java
@@ -0,0 +1,126 @@
+/**
+ * Copyright (C) 2012-2017 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.convert;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.n52.sos.ogc.gwml.GWMLConstants;
+import org.n52.sos.ogc.om.NamedValue;
+import org.n52.sos.ogc.om.OmObservation;
+import org.n52.sos.ogc.om.SingleObservationValue;
+import org.n52.sos.ogc.om.values.BooleanValue;
+import org.n52.sos.ogc.om.values.CategoryValue;
+import org.n52.sos.ogc.om.values.CountValue;
+import org.n52.sos.ogc.om.values.ProfileLevel;
+import org.n52.sos.ogc.om.values.ProfileValue;
+import org.n52.sos.ogc.om.values.QuantityValue;
+import org.n52.sos.ogc.om.values.TextValue;
+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.ogc.sos.SosConstants;
+import org.n52.sos.request.AbstractServiceRequest;
+import org.n52.sos.request.GetObservationByIdRequest;
+import org.n52.sos.response.AbstractServiceResponse;
+import org.n52.sos.response.GetObservationByIdResponse;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+public class GwmlObservationModifier extends AbstractRequestResponseModifier, AbstractServiceResponse> {
+
+ private static final Set REQUEST_RESPONSE_MODIFIER_KEY_TYPES = getKeyTypes();
+
+ private static Set getKeyTypes() {
+ Set services = Sets.newHashSet(SosConstants.SOS);
+ Set versions = Sets.newHashSet(Sos1Constants.SERVICEVERSION, Sos2Constants.SERVICEVERSION);
+ Map, AbstractServiceResponse> requestResponseMap = Maps.newHashMap();
+ requestResponseMap.put(new GetObservationByIdRequest(), new GetObservationByIdResponse());
+ Set keys = Sets.newHashSet();
+ for (String service : services) {
+ for (String version : versions) {
+ for (AbstractServiceRequest> request : requestResponseMap.keySet()) {
+ keys.add(new RequestResponseModifierKeyType(service, version, request));
+ keys.add(new RequestResponseModifierKeyType(service, version, request, requestResponseMap
+ .get(request)));
+ }
+ }
+ }
+ return keys;
+ }
+
+ @Override
+ public Set getRequestResponseModifierKeyTypes() {
+ return Collections.unmodifiableSet(REQUEST_RESPONSE_MODIFIER_KEY_TYPES);
+ }
+
+ @Override
+ public AbstractServiceResponse modifyResponse(AbstractServiceRequest> request, AbstractServiceResponse response)
+ throws OwsExceptionReport {
+ if (response instanceof GetObservationByIdResponse) {
+ return checkGetObservationByIdResponse((GetObservationByIdResponse)response);
+ }
+ return super.modifyResponse(request, response);
+ }
+
+ private AbstractServiceResponse checkGetObservationByIdResponse(GetObservationByIdResponse response) {
+ for (OmObservation o : response.getObservationCollection()) {
+ if (o.getObservationConstellation().isSetObservationType()
+ && (GWMLConstants.OBS_TYPE_GEOLOGY_LOG.equals(o.getObservationConstellation().getObservationType())
+ || GWMLConstants.OBS_TYPE_GEOLOGY_LOG_COVERAGE.equals(o.getObservationConstellation().getObservationType()))) {
+ if (o.isSetValue() && o.getValue() instanceof SingleObservationValue) {
+ if (o.getValue().getValue() instanceof BooleanValue || o.getValue().getValue() instanceof CategoryValue
+ || o.getValue().getValue() instanceof CountValue || o.getValue().getValue() instanceof QuantityValue
+ || o.getValue().getValue() instanceof TextValue) {
+ ProfileLevel pl = new ProfileLevel().addValue(o.getValue().getValue());
+ if (o.isSetParameter()) {
+ for (NamedValue> param : o.getParameter()) {
+ if (param.getName().isSetHref() && param.getValue() instanceof QuantityValue) {
+ if (GWMLConstants.PARAM_FROM_DEPTH.equals(param.getName().getHref())) {
+ pl.setLevelStart((QuantityValue)param.getValue());
+ } else if (GWMLConstants.PARAM_TO_DEPTH.equals(param.getName().getHref())) {
+ pl.setLevelEnd((QuantityValue)param.getValue());
+ }
+ }
+ }
+ }
+ SingleObservationValue> sov = new SingleObservationValue<>(new ProfileValue().addValue(pl));
+ sov.setPhenomenonTime(o.getValue().getPhenomenonTime());
+ o.setValue(sov);
+ }
+ }
+ }
+ }
+ return response;
+ }
+
+}
diff --git a/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractGWGeologyLogCoverageType.java b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractGWGeologyLogCoverageType.java
new file mode 100644
index 0000000000..3ee577d6f3
--- /dev/null
+++ b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractGWGeologyLogCoverageType.java
@@ -0,0 +1,92 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gwml.v22.encode;
+
+import org.n52.sos.ogc.gml.CodeType;
+import org.n52.sos.ogc.om.values.ProfileValue;
+import org.n52.sos.ogc.om.values.ProfileLevel;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.util.JavaHelper;
+
+import net.opengis.gwmlWell.x22.GWGeologyLogCoverageType;
+
+public abstract class AbstractGWGeologyLogCoverageType
+ extends AbstractGroundWaterMLEncoder {
+
+ protected GWGeologyLogCoverageType encodeGWGeologyLogCoverage(ProfileValue gwGeologyLogCoverage)
+ throws OwsExceptionReport {
+ GWGeologyLogCoverageType gwglct = GWGeologyLogCoverageType.Factory.newInstance();
+ setGmlId(gwglct, gwGeologyLogCoverage);
+ setIdentifier(gwglct, gwGeologyLogCoverage);
+ setDescription(gwglct, gwGeologyLogCoverage);
+ setNames(gwglct, gwGeologyLogCoverage);
+ setElements(gwglct, gwGeologyLogCoverage);
+ return gwglct;
+ }
+
+ private void setGmlId(GWGeologyLogCoverageType gwglct, ProfileValue gwGeologyLogCoverage) {
+ if (!gwGeologyLogCoverage.isSetGmlID()) {
+ gwGeologyLogCoverage.setGmlId(JavaHelper.generateID(Double.toString(System.currentTimeMillis()
+ * Math.random())));
+ }
+ gwGeologyLogCoverage.setGmlId("gwglc_" + gwGeologyLogCoverage.getGmlId());
+ gwglct.setId(gwGeologyLogCoverage.getGmlId());
+ }
+
+ private void setIdentifier(GWGeologyLogCoverageType gwglct, ProfileValue gwGeologyLogCoverage)
+ throws OwsExceptionReport {
+ if (gwGeologyLogCoverage.isSetIdentifier()) {
+ gwglct.addNewIdentifier().set(encodeGML(gwGeologyLogCoverage.getIdentifierCodeWithAuthority()));
+ }
+ }
+
+ private void setDescription(GWGeologyLogCoverageType gwglct, ProfileValue gwGeologyLogCoverage) {
+ if (gwGeologyLogCoverage.isSetDescription()) {
+ gwglct.addNewDescription().setStringValue(gwGeologyLogCoverage.getDescription());
+ }
+ }
+
+ private void setNames(GWGeologyLogCoverageType gwglct, ProfileValue gwGeologyLogCoverage)
+ throws OwsExceptionReport {
+ if (gwGeologyLogCoverage.isSetName()) {
+ for (CodeType name : gwGeologyLogCoverage.getName()) {
+ gwglct.addNewName().set(encodeGML(name));
+ }
+ }
+ }
+
+ private void setElements(GWGeologyLogCoverageType gwglct, ProfileValue gwGeologyLogCoverage)
+ throws OwsExceptionReport {
+ if (gwGeologyLogCoverage.isSetValue()) {
+ for (ProfileLevel logValue : gwGeologyLogCoverage.getValue()) {
+ gwglct.addNewElement().set(encodeGWMLProperty(logValue));
+ }
+ }
+ }
+}
diff --git a/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractGroundWaterMLEncoder.java b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractGroundWaterMLEncoder.java
new file mode 100644
index 0000000000..2c220aec1f
--- /dev/null
+++ b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractGroundWaterMLEncoder.java
@@ -0,0 +1,89 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gwml.v22.encode;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.AbstractSpecificXmlEncoder;
+import org.n52.sos.ogc.gml.GmlConstants;
+import org.n52.sos.ogc.gwml.GWMLConstants;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+import org.n52.sos.ogc.swe.SweConstants;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.w3c.SchemaLocation;
+
+import com.google.common.collect.Sets;
+
+public abstract class AbstractGroundWaterMLEncoder extends AbstractSpecificXmlEncoder {
+
+ @Override
+ public void addNamespacePrefixToMap(Map nameSpacePrefixMap) {
+ nameSpacePrefixMap.put(GWMLConstants.NS_GWML_22, GWMLConstants.NS_GWML_2_PREFIX);
+ }
+
+ @Override
+ public Set getSchemaLocations() {
+ return Sets.newHashSet(GWMLConstants.GWML_22_SCHEMA_LOCATION);
+ }
+
+ protected static XmlObject encodeGML(Object o) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(GmlConstants.NS_GML_32, o);
+ }
+
+ protected static XmlObject encodeGML(Object o, Map helperValues) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(GmlConstants.NS_GML_32, o, helperValues);
+ }
+
+ protected static XmlObject encodeSweCommon(Object o) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(SweConstants.NS_SWE_20, o);
+ }
+
+ protected static XmlObject encodeSweCommon(Object o, Map helperValues) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(SweConstants.NS_SWE_20, o, helperValues);
+ }
+
+ protected static XmlObject encodeGWML(Object o) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(GWMLConstants.NS_GWML_22, o);
+ }
+
+ protected static XmlObject encodeGWML(Object o, Map helperValues) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXml(GWMLConstants.NS_GWML_22, o, helperValues);
+ }
+
+ protected static XmlObject encodeGWMLProperty(Object o) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXmlPropertyType(GWMLConstants.NS_GWML_22, o);
+ }
+
+ protected static XmlObject encodeGWMLProperty(Object o, Map helperValues) throws OwsExceptionReport {
+ return CodingHelper.encodeObjectToXmlPropertyType(GWMLConstants.NS_GWML_22, o, helperValues);
+ }
+}
diff --git a/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractLogValueTypeEncoder.java b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractLogValueTypeEncoder.java
new file mode 100644
index 0000000000..5a4f6c628a
--- /dev/null
+++ b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/AbstractLogValueTypeEncoder.java
@@ -0,0 +1,63 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gwml.v22.encode;
+
+import org.n52.sos.ogc.om.values.ProfileLevel;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+
+import net.opengis.gwmlWell.x22.LogValueType;
+
+public abstract class AbstractLogValueTypeEncoder extends AbstractGroundWaterMLEncoder {
+
+ protected LogValueType encodeLogValue(ProfileLevel profileLevel) throws OwsExceptionReport {
+ LogValueType lvt = LogValueType.Factory.newInstance();
+ setFromDepth(lvt, profileLevel);
+ setToDepth(lvt, profileLevel);
+ setValue(lvt, profileLevel);
+ return lvt;
+ }
+
+ private void setFromDepth(LogValueType lvt, ProfileLevel profileLevel) throws OwsExceptionReport {
+ if (profileLevel.isSetLevelStart()) {
+ lvt.addNewFromDepth().addNewQuantity().set(encodeSweCommon(profileLevel.getLevelStart()));
+ }
+ }
+
+ private void setToDepth(LogValueType lvt, ProfileLevel profileLevel) throws OwsExceptionReport {
+ if (profileLevel.isSetLevelEnd()) {
+ lvt.addNewToDepth().addNewQuantity().set(encodeSweCommon(profileLevel.getLevelEnd()));
+ }
+ }
+
+ private void setValue(LogValueType lvt, ProfileLevel profileLevel) throws OwsExceptionReport {
+ if (profileLevel.isSetValue()) {
+ lvt.addNewValue().addNewDataRecord().set(encodeSweCommon(profileLevel.valueAsDataRecord()));
+ }
+ }
+}
diff --git a/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GWGeologyLogCoveragePropertyTypeEncoder.java b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GWGeologyLogCoveragePropertyTypeEncoder.java
new file mode 100644
index 0000000000..2a3861f949
--- /dev/null
+++ b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GWGeologyLogCoveragePropertyTypeEncoder.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gwml.v22.encode;
+
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.n52.sos.encode.ClassToClassEncoderKey;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.XmlPropertyTypeEncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.gwml.GWMLConstants;
+import org.n52.sos.ogc.om.values.ProfileValue;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+
+import com.google.common.collect.Sets;
+
+import net.opengis.gwmlWell.x22.GWGeologyLogCoveragePropertyType;
+
+
+public class GWGeologyLogCoveragePropertyTypeEncoder extends AbstractGWGeologyLogCoverageType {
+
+ private static final Set ENCODER_KEYS = Sets.newHashSet(
+ new ClassToClassEncoderKey(ProfileValue.class, GWGeologyLogCoveragePropertyType.class),
+ new XmlPropertyTypeEncoderKey(GWMLConstants.NS_GWML_22, ProfileValue.class));
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+
+ @Override
+ public GWGeologyLogCoveragePropertyType encode(ProfileValue gwGeologyLogCoverage)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ return encode(gwGeologyLogCoverage, new EnumMap(HelperValues.class));
+ }
+
+ @Override
+ public GWGeologyLogCoveragePropertyType encode(ProfileValue gwGeologyLogCoverage,
+ Map additionalValues) throws OwsExceptionReport, UnsupportedEncoderInputException {
+ GWGeologyLogCoveragePropertyType gwglcpt = GWGeologyLogCoveragePropertyType.Factory.newInstance();
+ gwglcpt.setGWGeologyLogCoverage(encodeGWGeologyLogCoverage(gwGeologyLogCoverage));
+ return gwglcpt;
+ }
+
+}
diff --git a/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GWGeologyLogObservationTypeEncoder.java b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GWGeologyLogObservationTypeEncoder.java
new file mode 100644
index 0000000000..292ead8a58
--- /dev/null
+++ b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GWGeologyLogObservationTypeEncoder.java
@@ -0,0 +1,173 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gwml.v22.encode;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.OmEncoderv20;
+import org.n52.sos.ogc.gwml.GWMLConstants;
+import org.n52.sos.ogc.om.OmConstants;
+import org.n52.sos.ogc.om.OmObservation;
+import org.n52.sos.ogc.om.values.ProfileValue;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.Sos2Constants;
+import org.n52.sos.ogc.sos.SosConstants;
+import org.n52.sos.ogc.swe.simpleType.SweQuantity;
+import org.n52.sos.service.ServiceConstants.SupportedTypeKey;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.w3c.SchemaLocation;
+
+import com.google.common.collect.Sets;
+
+import net.opengis.gwmlWell.x22.GWGeologyLogType;
+import net.opengis.gwmlWell.x22.GWGeologyLogType.EndDepth;
+import net.opengis.gwmlWell.x22.GWGeologyLogType.StartDepth;
+import net.opengis.om.x20.OMObservationType;
+
+public class GWGeologyLogObservationTypeEncoder extends OmEncoderv20 {
+
+ private static final Set ENCODER_KEYS =
+ CodingHelper.encoderKeysForElements(GWMLConstants.NS_GWML_22, OmObservation.class);
+
+ private static final Map> SUPPORTED_TYPES = Collections.singletonMap(
+ SupportedTypeKey.ObservationType, (Set) Sets.newHashSet(GWMLConstants.OBS_TYPE_GEOLOGY_LOG,
+ GWMLConstants.OBS_TYPE_GEOLOGY_LOG, OmConstants.OBS_TYPE_CATEGORY_OBSERVATION,
+ OmConstants.OBS_TYPE_TEXT_OBSERVATION));
+
+ private static final Map>> SUPPORTED_RESPONSE_FORMATS = Collections.singletonMap(
+ SosConstants.SOS,
+ Collections.singletonMap(Sos2Constants.SERVICEVERSION, Collections.singleton(GWMLConstants.NS_GWML_22)));
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public Map> getSupportedTypes() {
+ return Collections.unmodifiableMap(SUPPORTED_TYPES);
+ }
+
+ @Override
+ public Map> getSupportedResponseFormatObservationTypes() {
+ return Collections.singletonMap(GWMLConstants.NS_GWML_22, getSupportedTypes().get(SupportedTypeKey.ObservationType));
+ }
+
+ @Override
+ public boolean isObservationAndMeasurmentV20Type() {
+ return true;
+ }
+
+ @Override
+ protected XmlObject createResult(OmObservation sosObservation) throws OwsExceptionReport {
+ return super.createResult(sosObservation);
+ }
+
+
+ @Override
+ public boolean shouldObservationsWithSameXBeMerged() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsResultStreamingForMergedValues() {
+ return false;
+ }
+
+ @Override
+ public Set getSupportedResponseFormats(String service, String version) {
+ if (SUPPORTED_RESPONSE_FORMATS.get(service) != null
+ && SUPPORTED_RESPONSE_FORMATS.get(service).get(version) != null) {
+ return SUPPORTED_RESPONSE_FORMATS.get(service).get(version);
+ }
+ return new HashSet<>(0);
+ }
+
+ @Override
+ public String getDefaultFeatureEncodingNamespace() {
+ return super.getDefaultFeatureEncodingNamespace();
+ }
+
+ @Override
+ protected String getDefaultProcedureEncodingNamspace() {
+ return super.getDefaultProcedureEncodingNamspace();
+ }
+
+ @Override
+ protected boolean convertEncodedProcedure() {
+ return false;
+ }
+
+ @Override
+ protected OMObservationType createOmObservationType() {
+ return GWGeologyLogType.Factory.newInstance(getXmlOptions());
+ }
+
+ @Override
+ protected void addObservationType(OMObservationType xbObservation, String observationType) {
+ xbObservation.addNewType().setHref(GWMLConstants.OBS_TYPE_GEOLOGY_LOG);
+ }
+
+ @Override
+ protected void addAddtitionalInformation(OMObservationType omot, OmObservation observation) throws OwsExceptionReport {
+ if (omot instanceof GWGeologyLogType && observation.getValue().getValue() instanceof ProfileValue) {
+ ProfileValue value = (ProfileValue)observation.getValue().getValue();
+ if (value.isSetFromLevel()) {
+ encodeStartDepth(((GWGeologyLogType)omot).addNewStartDepth(), value.getFromLevel());
+ }
+ if (value.isSetToLevel()) {
+ encodeEndDepth(((GWGeologyLogType)omot).addNewEndDepth(), value.getToLevel());
+ }
+ }
+ }
+
+ @Override
+ public void addNamespacePrefixToMap(Map nameSpacePrefixMap) {
+ nameSpacePrefixMap.put(GWMLConstants.NS_GWML_22, GWMLConstants.NS_GWML_2_PREFIX);
+ }
+
+ @Override
+ public Set getSchemaLocations() {
+ return Sets.newHashSet(GWMLConstants.GWML_22_SCHEMA_LOCATION);
+ }
+
+ private void encodeStartDepth(StartDepth sd, SweQuantity sweQuantity) throws OwsExceptionReport {
+ sd.addNewQuantity().set(encodeSweCommon(sweQuantity));
+ }
+
+ private void encodeEndDepth(EndDepth ed, SweQuantity sweQuantity) throws OwsExceptionReport {
+ ed.addNewQuantity().set(encodeSweCommon(sweQuantity));
+ }
+
+}
diff --git a/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GwmlEncoderv22.java b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GwmlEncoderv22.java
new file mode 100644
index 0000000000..23262d18da
--- /dev/null
+++ b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/GwmlEncoderv22.java
@@ -0,0 +1,158 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gwml.v22.encode;
+
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.EncodingValues;
+import org.n52.sos.encode.OmEncoderv20;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Sets;
+
+import net.opengis.om.x20.OMObservationType;
+
+import org.n52.sos.exception.ows.NoApplicableCodeException;
+import org.n52.sos.ogc.gwml.GWMLConstants;
+import org.n52.sos.ogc.om.MultiObservationValues;
+import org.n52.sos.ogc.om.NamedValue;
+import org.n52.sos.ogc.om.OmConstants;
+import org.n52.sos.ogc.om.OmObservation;
+import org.n52.sos.ogc.om.SingleObservationValue;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.Sos2Constants;
+import org.n52.sos.ogc.sos.SosConstants;
+import org.n52.sos.service.ServiceConstants.SupportedTypeKey;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.util.http.MediaType;
+import org.n52.sos.w3c.SchemaLocation;
+import org.n52.svalbard.gwml.v22.encode.streaming.GwmlV22XmlStreamWriter;
+
+public class GwmlEncoderv22 extends OmEncoderv20 {
+ /**
+ * logger, used for logging while initializing the constants from config
+ * file
+ */
+ private static final Logger LOGGER = LoggerFactory.getLogger(GwmlEncoderv22.class);
+
+ private static final Set ENCODER_KEYS = CodingHelper.encoderKeysForElements(GWMLConstants.NS_GWML_22,
+ OmObservation.class, NamedValue.class, SingleObservationValue.class, MultiObservationValues.class);
+
+ private static final Map> SUPPORTED_TYPES = Collections.singletonMap(
+ SupportedTypeKey.ObservationType, (Set) Sets.newHashSet(GWMLConstants.OBS_TYPE_GEOLOGY_LOG));
+
+ private static final Map>> SUPPORTED_RESPONSE_FORMATS = Collections.singletonMap(
+ SosConstants.SOS,
+ Collections.singletonMap(Sos2Constants.SERVICEVERSION, Collections.singleton(GWMLConstants.NS_GWML_22)));
+
+ public GwmlEncoderv22() {
+ LOGGER.debug("Encoder for the following keys initialized successfully: {}!", Joiner.on(", ")
+ .join(ENCODER_KEYS));
+ }
+
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public Map> getSupportedTypes() {
+ return Collections.unmodifiableMap(SUPPORTED_TYPES);
+ }
+
+ @Override
+ public Map> getSupportedResponseFormatObservationTypes() {
+ return Collections.singletonMap(GWMLConstants.NS_GWML_22, getSupportedTypes().get(SupportedTypeKey.ObservationType));
+ }
+
+ @Override
+ public boolean isObservationAndMeasurmentV20Type() {
+ return true;
+ }
+
+ @Override
+ public Set getSupportedResponseFormats(String service, String version) {
+ if (SUPPORTED_RESPONSE_FORMATS.get(service) != null
+ && SUPPORTED_RESPONSE_FORMATS.get(service).get(version) != null) {
+ return SUPPORTED_RESPONSE_FORMATS.get(service).get(version);
+ }
+ return new HashSet<>(0);
+ }
+
+ @Override
+ public boolean shouldObservationsWithSameXBeMerged() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsResultStreamingForMergedValues() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public MediaType getContentType() {
+ return OmConstants.CONTENT_TYPE_OM_2;
+ }
+
+ @Override
+ public Set getSchemaLocations() {
+ return Sets.newHashSet(OmConstants.OM_20_SCHEMA_LOCATION);
+ }
+
+ @Override
+ protected OMObservationType createOmObservationType() {
+ return super.createOmObservationType();
+ }
+
+ @Override
+ public void encode(Object objectToEncode, OutputStream outputStream, EncodingValues encodingValues)
+ throws OwsExceptionReport {
+ encodingValues.setEncoder(this);
+ if (objectToEncode instanceof OmObservation) {
+ try {
+ new GwmlV22XmlStreamWriter().write((OmObservation)objectToEncode, outputStream, encodingValues);
+ } catch (XMLStreamException xmlse) {
+ throw new NoApplicableCodeException().causedBy(xmlse).withMessage("Error while writing element to stream!");
+ }
+ } else {
+ super.encode(objectToEncode, outputStream, encodingValues);
+ }
+ }
+}
diff --git a/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/LogValuePropertyTypeEncoder.java b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/LogValuePropertyTypeEncoder.java
new file mode 100644
index 0000000000..26e7e548ae
--- /dev/null
+++ b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/LogValuePropertyTypeEncoder.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gwml.v22.encode;
+
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.n52.sos.encode.ClassToClassEncoderKey;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.XmlPropertyTypeEncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.gwml.GWMLConstants;
+import org.n52.sos.ogc.om.values.ProfileLevel;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+
+import com.google.common.collect.Sets;
+
+import net.opengis.gwmlWell.x22.LogValuePropertyType;
+
+public class LogValuePropertyTypeEncoder extends AbstractLogValueTypeEncoder {
+
+ private static final Set ENCODER_KEYS = Sets.newHashSet(
+ new ClassToClassEncoderKey(ProfileLevel.class, LogValuePropertyType.class),
+ new XmlPropertyTypeEncoderKey(GWMLConstants.NS_GWML_22, ProfileLevel.class));
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public LogValuePropertyType encode(ProfileLevel logValue)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ return encode(logValue, new EnumMap(HelperValues.class));
+ }
+
+ @Override
+ public LogValuePropertyType encode(ProfileLevel logValue, Map additionalValues)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ LogValuePropertyType lvpt = LogValuePropertyType.Factory.newInstance();
+ if (logValue.isSetValue()) {
+ lvpt.setLogValue(encodeLogValue(logValue));
+ } else {
+ lvpt.setNil();
+ }
+ return lvpt;
+ }
+}
diff --git a/hibernate/common/src/main/java/org/n52/sos/ds/hibernate/entities/interfaces/CountObservation.java b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/streaming/GwmlV22XmlStreamWriter.java
similarity index 82%
rename from hibernate/common/src/main/java/org/n52/sos/ds/hibernate/entities/interfaces/CountObservation.java
rename to coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/streaming/GwmlV22XmlStreamWriter.java
index b7a64a3e35..a3841e133d 100644
--- a/hibernate/common/src/main/java/org/n52/sos/ds/hibernate/entities/interfaces/CountObservation.java
+++ b/coding/gwml/src/main/java/org/n52/svalbard/gwml/v22/encode/streaming/GwmlV22XmlStreamWriter.java
@@ -26,16 +26,10 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*/
-package org.n52.sos.ds.hibernate.entities.interfaces;
+package org.n52.svalbard.gwml.v22.encode.streaming;
-import org.n52.sos.ds.hibernate.entities.HibernateRelations.HasValue;
+import org.n52.sos.encode.streaming.OmV20XmlStreamWriter;
-/**
- * Interface for Hibernate count observations entities
- *
- * @since 4.0.0
- *
- */
-public interface CountObservation extends HasValue {
+public class GwmlV22XmlStreamWriter extends OmV20XmlStreamWriter {
}
diff --git a/coding/gwml/src/main/resources/META-INF/services/org.n52.sos.convert.RequestResponseModifier b/coding/gwml/src/main/resources/META-INF/services/org.n52.sos.convert.RequestResponseModifier
new file mode 100644
index 0000000000..68f72d4954
--- /dev/null
+++ b/coding/gwml/src/main/resources/META-INF/services/org.n52.sos.convert.RequestResponseModifier
@@ -0,0 +1 @@
+org.n52.sos.convert.GwmlObservationModifier
\ No newline at end of file
diff --git a/coding/gwml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder b/coding/gwml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder
new file mode 100644
index 0000000000..c984898b89
--- /dev/null
+++ b/coding/gwml/src/main/resources/META-INF/services/org.n52.sos.encode.Encoder
@@ -0,0 +1,3 @@
+org.n52.svalbard.gwml.v22.encode.GWGeologyLogCoveragePropertyTypeEncoder
+org.n52.svalbard.gwml.v22.encode.LogValuePropertyTypeEncoder
+org.n52.svalbard.gwml.v22.encode.GWGeologyLogObservationTypeEncoder
\ No newline at end of file
diff --git a/coding/gwml/src/test/java/org/n52/svalbard/gwml/v21/encode/GWGeologyLogCoveragePropertyEncoderTest.java b/coding/gwml/src/test/java/org/n52/svalbard/gwml/v21/encode/GWGeologyLogCoveragePropertyEncoderTest.java
new file mode 100644
index 0000000000..0d29a0e2b0
--- /dev/null
+++ b/coding/gwml/src/test/java/org/n52/svalbard/gwml/v21/encode/GWGeologyLogCoveragePropertyEncoderTest.java
@@ -0,0 +1,142 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.gwml.v21.encode;
+
+import static java.lang.Boolean.TRUE;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.apache.xmlbeans.XmlObject;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.n52.sos.config.SettingsManager;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.gml.CodeType;
+import org.n52.sos.ogc.gwml.GWMLConstants;
+import org.n52.sos.ogc.om.values.ProfileValue;
+import org.n52.sos.ogc.om.values.QuantityValue;
+import org.n52.sos.ogc.om.values.TextValue;
+import org.n52.sos.ogc.om.values.Value;
+import org.n52.sos.ogc.om.values.CategoryValue;
+import org.n52.sos.ogc.om.values.ProfileLevel;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.util.XmlHelper;
+
+import com.google.common.collect.Lists;
+
+import net.opengis.gwmlWell.x22.GWGeologyLogCoveragePropertyType;
+
+public class GWGeologyLogCoveragePropertyEncoderTest {
+
+ @BeforeClass
+ public static void initSettingsManager() {
+ SettingsManager.getInstance();
+ }
+
+ @AfterClass
+ public static void cleanupSettingManager() {
+ SettingsManager.getInstance().cleanup();
+ }
+
+ @Test
+ public void should_encode_GWGeologyLogCoverage_only_value() throws UnsupportedEncoderInputException, OwsExceptionReport {
+ ProfileValue coverage = createGWGeologyLogCoverage(false, false);
+ XmlObject encodedObject = CodingHelper.encodeObjectToXmlPropertyType(GWMLConstants.NS_GWML_22, coverage);
+ assertThat(XmlHelper.validateDocument(encodedObject), is(TRUE));
+ assertThat(encodedObject, instanceOf(GWGeologyLogCoveragePropertyType.class));
+ }
+
+ @Test
+ public void should_encode_GWGeologyLogCoverage_full() throws UnsupportedEncoderInputException, OwsExceptionReport {
+ ProfileValue coverage = createGWGeologyLogCoverage(true, true);
+ XmlObject encodedObject = CodingHelper.encodeObjectToXmlPropertyType(GWMLConstants.NS_GWML_22, coverage);
+ assertThat(XmlHelper.validateDocument(encodedObject), is(TRUE));
+ assertThat(encodedObject, instanceOf(GWGeologyLogCoveragePropertyType.class));
+ }
+
+ @Test
+ public void should_encode_GWGeologyLogCoverage_fromDepth() throws UnsupportedEncoderInputException, OwsExceptionReport {
+ ProfileValue coverage = createGWGeologyLogCoverage(true, false);
+ XmlObject encodedObject = CodingHelper.encodeObjectToXmlPropertyType(GWMLConstants.NS_GWML_22, coverage);
+ assertThat(XmlHelper.validateDocument(encodedObject), is(TRUE));
+ assertThat(encodedObject, instanceOf(GWGeologyLogCoveragePropertyType.class));
+ }
+
+ @Test
+ public void should_encode_GWGeologyLogCoverage_toDepth() throws UnsupportedEncoderInputException, OwsExceptionReport {
+ ProfileValue coverage = createGWGeologyLogCoverage(false, true);
+ XmlObject encodedObject = CodingHelper.encodeObjectToXmlPropertyType(GWMLConstants.NS_GWML_22, coverage);
+ assertThat(XmlHelper.validateDocument(encodedObject), is(TRUE));
+ assertThat(encodedObject, instanceOf(GWGeologyLogCoveragePropertyType.class));
+ }
+
+ private ProfileValue createGWGeologyLogCoverage(boolean fromDepth, boolean toDepth) {
+ ProfileValue coverage = new ProfileValue();
+ coverage.addValue(createLogValue(fromDepth, toDepth, 0.0));
+ coverage.addValue(createLogValue(fromDepth, toDepth, 10.0));
+ return coverage;
+ }
+
+ private ProfileLevel createLogValue(boolean fromDepth, boolean toDepth, double start) {
+ ProfileLevel profileLevel = new ProfileLevel();
+ if (fromDepth) {
+ profileLevel.setLevelStart(createQuantity("fromDepth", start, "m"));
+ }
+ if (toDepth) {
+ profileLevel.setLevelEnd(createQuantity("toDepth", start + 10.0, "m"));
+ }
+ profileLevel.setValue(createProfileLevel());
+ return profileLevel;
+ }
+
+ private QuantityValue createQuantity(String definition, double value, String unit) {
+ QuantityValue quantity = new QuantityValue(value, unit);
+ quantity.setValue(value).setUom(unit).setDefinition(definition);
+ return quantity;
+ }
+
+ private List> createProfileLevel() {
+ List> list = Lists.newArrayList();
+ CategoryValue category = new CategoryValue("weathered grey brown basalt", "unknown");
+ category.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
+ category.addName(new CodeType("lithology"));
+ list.add(category);
+ TextValue text = new TextValue("weathered grey brown basalt");
+ text.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
+ text.addName(new CodeType("text"));
+ list.add(text);
+ return list;
+ }
+
+}
diff --git a/coding/inspire/ompr/.gitignore b/coding/inspire/ompr/.gitignore
new file mode 100644
index 0000000000..b83d22266a
--- /dev/null
+++ b/coding/inspire/ompr/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/coding/inspire/ompr/pom.xml b/coding/inspire/ompr/pom.xml
new file mode 100644
index 0000000000..57613aea89
--- /dev/null
+++ b/coding/inspire/ompr/pom.xml
@@ -0,0 +1,65 @@
+
+
+
+ org.n52.sensorweb.sos
+ coding-inspire
+ 4.4.0
+
+ 4.0.0
+ coding-inspire-ompr
+ jar
+ 52°North Svalbard - INSPIRE XML OMPR Coding
+ 52°North Svalbard XML INSPIRE XML OM Process Coding
+
+
+ ${project.groupId}
+ api
+
+
+ ${project.groupId}
+ inspire-code
+
+
+
+ org.n52.sensorweb
+ 52n-xml-inspire-ompr-v30
+
+
+ org.n52.sensorweb
+ 52n-xml-inspire-base2-v20
+
+
+ org.n52.sensorweb
+ 52n-xml-inspire-base-v33
+
+
+ org.n52.sensorweb
+ 52n-xml-gml-v321
+
+
+ ${project.groupId}
+ coding-sos-v20
+
+
+ ${project.groupId}
+ test
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test
+
+
+ ${project.groupId}
+ sqlite-config
+ test-jar
+ test
+
+
+ javax.servlet
+ javax.servlet-api
+ test
+
+
+
diff --git a/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/AbstractProcessDecoder.java b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/AbstractProcessDecoder.java
new file mode 100644
index 0000000000..0e0bd87e75
--- /dev/null
+++ b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/AbstractProcessDecoder.java
@@ -0,0 +1,100 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.inspire.ompr.v30.decode;
+
+import static java.util.Collections.singletonMap;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.n52.sos.decode.ProcedureDecoder;
+import org.n52.sos.ogc.gml.CodeWithAuthority;
+import org.n52.sos.service.ServiceConstants.SupportedTypeKey;
+import org.n52.svalbard.inspire.ompr.InspireOMPRConstants;
+import org.n52.svalbard.inspire.ompr.Process;
+
+import com.google.common.collect.ImmutableSet;
+
+import eu.europa.ec.inspire.schemas.base.x33.IdentifierType;
+import eu.europa.ec.inspire.schemas.ompr.x30.ProcessType;
+
+public abstract class AbstractProcessDecoder implements ProcedureDecoder {
+
+ private static final Map> SUPPORTED_TYPES =
+ singletonMap(SupportedTypeKey.ProcedureDescriptionFormat,
+ (Set) ImmutableSet.of(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_URL,
+ InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_MIME_TYPE));
+
+ @Override
+ public Set getConformanceClasses() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Map> getSupportedTypes() {
+ return Collections.unmodifiableMap(SUPPORTED_TYPES);
+ }
+
+ @Override
+ public Set getSupportedProcedureDescriptionFormats(final String service, final String version) {
+ return Collections.emptySet();
+ }
+
+ protected Process parseProcessType(ProcessType pt) {
+ Process process = new Process();
+ parseInspireId(pt, process);
+ return process;
+ }
+
+ private void parseInspireId(ProcessType pt, Process process) {
+ IdentifierType identifier = pt.getInspireId().getIdentifier();
+ String localId = identifier.getLocalId();
+ String namespace = identifier.getNamespace();
+ CodeWithAuthority codeWithAuthority;
+ if (localId.contains(namespace)) {
+ codeWithAuthority = new CodeWithAuthority(localId, namespace);
+ } else {
+ codeWithAuthority = new CodeWithAuthority(getIdentifier(localId, namespace), namespace);
+ }
+ process.setIdentifier(codeWithAuthority);
+ }
+
+ private String getIdentifier(String localId, String namespace) {
+ if (namespace.endsWith("=")) {
+ return namespace + localId;
+ }
+ if (namespace.startsWith("urn")) {
+ return namespace + ":" + localId;
+ } else if (namespace.startsWith("http")) {
+ return namespace + "/" + localId;
+ }
+ return namespace + "-" + localId;
+ }
+}
diff --git a/hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/cache/base/CompositePhenomenonCacheUpdate.java b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessDocumentDecoder.java
similarity index 50%
rename from hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/cache/base/CompositePhenomenonCacheUpdate.java
rename to coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessDocumentDecoder.java
index 4dba923e1e..0aa832a5dc 100644
--- a/hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/cache/base/CompositePhenomenonCacheUpdate.java
+++ b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessDocumentDecoder.java
@@ -26,43 +26,51 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*/
-package org.n52.sos.ds.hibernate.cache.base;
+package org.n52.svalbard.inspire.ompr.v30.decode;
-import java.util.HashSet;
+import java.util.Collections;
import java.util.Set;
-import org.n52.sos.ds.hibernate.cache.AbstractThreadableDatasourceCacheUpdate;
-import org.n52.sos.ds.hibernate.entities.ObservableProperty;
+import org.n52.sos.decode.DecoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedDecoderInputException;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.util.XmlOptionsHelper;
+import org.n52.svalbard.inspire.ompr.InspireOMPRConstants;
+import org.n52.svalbard.inspire.ompr.Process;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- * @author Christian Autermann
- *
- * @since 4.0.0
- */
-public class CompositePhenomenonCacheUpdate extends AbstractThreadableDatasourceCacheUpdate {
- private static final Logger LOGGER = LoggerFactory.getLogger(CompositePhenomenonCacheUpdate.class);
+import com.google.common.base.Joiner;
+
+import eu.europa.ec.inspire.schemas.ompr.x30.ProcessDocument;
+import eu.europa.ec.inspire.schemas.ompr.x30.ProcessType;
+
+public class ProcessDocumentDecoder extends AbstractProcessDecoder {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ProcessDocumentDecoder.class);
+
+ private static final Set DECODER_KEYS = CodingHelper.decoderKeysForElements(
+ InspireOMPRConstants.NS_OMPR_30, ProcessDocument.class);
+
+
+ public ProcessDocumentDecoder() {
+ LOGGER.debug("Encoder for the following keys initialized successfully: {}!",
+ Joiner.on(", ").join(DECODER_KEYS));
+ }
+
@Override
- public void execute() {
- LOGGER.debug("Executing CompositePhenomenonCacheUpdate");
- startStopwatch();
- // for (CompositePhenomenon cp :
- // getCompositePhenomenonObjects(getSession())) {
- // getCache().setObservablePropertiesForCompositePhenomenon(
- // cp.getIdentifier(),
- // getObservablePropertyIdentifiers(cp.getObservableProperties()));
- // }
- // FIXME: getCache().setCompositePhenomenonsForOfferings(null);
- LOGGER.debug("Finished executing CompositePhenomenonCacheUpdate ({})", getStopwatchResult());
+ public Set getDecoderKeyTypes() {
+ return Collections.unmodifiableSet(DECODER_KEYS);
}
- protected Set getObservablePropertyIdentifiers(Set observableProperties) {
- Set observablePropertyIdentifiers = new HashSet(observableProperties.size());
- for (ObservableProperty observableProperty : observableProperties) {
- observablePropertyIdentifiers.add(observableProperty.getIdentifier());
- }
- return observablePropertyIdentifiers;
+ @Override
+ public Process decode(ProcessDocument pd) throws OwsExceptionReport, UnsupportedDecoderInputException {
+ Process process = parseProcessType(pd.getProcess());
+ process.setSensorDescriptionXmlString(pd.xmlText(XmlOptionsHelper.getInstance().getXmlOptions()));
+ return process;
}
+
+
}
diff --git a/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessPropertyTypeDecoder.java b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessPropertyTypeDecoder.java
new file mode 100644
index 0000000000..70f580e71d
--- /dev/null
+++ b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessPropertyTypeDecoder.java
@@ -0,0 +1,279 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.inspire.ompr.v30.decode;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.n52.sos.decode.DecoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedDecoderInputException;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.util.XmlOptionsHelper;
+import org.n52.svalbard.inspire.ompr.InspireOMPRConstants;
+import org.n52.svalbard.inspire.ompr.Process;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Joiner;
+
+import eu.europa.ec.inspire.schemas.ompr.x30.ProcessPropertyType;
+
+public class ProcessPropertyTypeDecoder extends AbstractProcessDecoder {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ProcessPropertyTypeDecoder.class);
+
+ private static final Set DECODER_KEYS = CodingHelper.decoderKeysForElements(
+ InspireOMPRConstants.NS_OMPR_30, ProcessPropertyType.class);
+
+
+ public ProcessPropertyTypeDecoder() {
+ LOGGER.debug("Encoder for the following keys initialized successfully: {}!",
+ Joiner.on(", ").join(DECODER_KEYS));
+ }
+
+ @Override
+ public Set getDecoderKeyTypes() {
+ return Collections.unmodifiableSet(DECODER_KEYS);
+ }
+
+
+ @Override
+ public Process decode(ProcessPropertyType ppt) throws OwsExceptionReport, UnsupportedDecoderInputException {
+ Process process = parseProcessType(ppt.getProcess());
+ process.setSensorDescriptionXmlString(ppt.xmlText(XmlOptionsHelper.getInstance().getXmlOptions()));
+ return process;
+ }
+
+// private static final Logger LOGGER = LoggerFactory.getLogger(ProcessTypeDecoder.class);
+//
+// private static final Map> SUPPORTED_TYPES =
+// singletonMap(SupportedTypeKey.ProcedureDescriptionFormat,
+// (Set) ImmutableSet.of(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_URL,
+// InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_MIME_TYPE));
+//
+// private static final Map>> SUPPORTED_PROCEDURE_DESCRIPTION_FORMATS =
+// ImmutableMap.of(SosConstants.SOS,
+// ImmutableMap.> builder()
+// .put(Sos2Constants.SERVICEVERSION,
+// ImmutableSet.of(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_URL))
+// .put(Sos1Constants.SERVICEVERSION,
+// ImmutableSet.of(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_MIME_TYPE))
+// .build());
+//
+// @SuppressWarnings("unchecked")
+// private static final Set ENCODER_KEYS = union(
+// encoderKeysForElements(InspireOMPRConstants.NS_OMPR_30, SosProcedureDescription.class, Process.class),
+// encoderKeysForElements(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_MIME_TYPE, SosProcedureDescription.class,
+// Process.class));
+//
+// public ProcessTypeDecoder() {
+// LOGGER.debug("Encoder for the following keys initialized successfully: {}!",
+// Joiner.on(", ").join(ENCODER_KEYS));
+// }
+//
+// @Override
+// public Set getEncoderKeyType() {
+// return Collections.unmodifiableSet(ENCODER_KEYS);
+// }
+//
+// @Override
+// public Map> getSupportedTypes() {
+// return Collections.unmodifiableMap(SUPPORTED_TYPES);
+// }
+//
+// @Override
+// public void addNamespacePrefixToMap(final Map nameSpacePrefixMap) {
+// nameSpacePrefixMap.put(InspireOMPRConstants.NS_OMPR_30, InspireOMPRConstants.NS_OMPR_PREFIX);
+// }
+//
+// @Override
+// public MediaType getContentType() {
+// return InspireOMPRConstants.OMPR_30_CONTENT_TYPE;
+// }
+//
+// @Override
+// public Set getSchemaLocations() {
+// return Sets.newHashSet(InspireOMPRConstants.OMPR_SCHEMA_LOCATION);
+// }
+//
+// @Override
+// public Set getSupportedProcedureDescriptionFormats(final String service, final String version) {
+// if (SUPPORTED_PROCEDURE_DESCRIPTION_FORMATS.containsKey(service)
+// && SUPPORTED_PROCEDURE_DESCRIPTION_FORMATS.get(service).containsKey(version)) {
+// return SUPPORTED_PROCEDURE_DESCRIPTION_FORMATS.get(service).get(version);
+// }
+// return Collections.emptySet();
+// }
+//
+// @Override
+// public Set getConformanceClasses() {
+// return Collections.emptySet();
+// }
+//
+// @Override
+// public XmlObject encode(Process process) throws OwsExceptionReport, UnsupportedEncoderInputException {
+// return encode(process, Collections. emptyMap());
+// }
+//
+// @Override
+// public XmlObject encode(Process process, Map additionalValues)
+// throws OwsExceptionReport, UnsupportedEncoderInputException {
+// return createProcess(process);
+// }
+//
+// protected ProcessType createProcess(Process process) throws OwsExceptionReport {
+// if (process.isSetSensorDescriptionXmlString()) {
+// XmlObject encodedObject = null;
+// try {
+// encodedObject = XmlObject.Factory.parse(process.getSensorDescriptionXmlString());
+// if (encodedObject instanceof ProcessType) {
+// return (ProcessType) encodedObject;
+// } else if (encodedObject instanceof ProcessDocument) {
+// return ((ProcessDocument) encodedObject).getProcess();
+// } else if (encodedObject instanceof ProcessPropertyType) {
+// return ((ProcessPropertyType) encodedObject).getProcess();
+// } else {
+// throw new UnsupportedEncoderInputException(this, process);
+// }
+// } catch (final XmlException xmle) {
+// throw new NoApplicableCodeException().causedBy(xmle);
+// }
+// } else {
+// ProcessType pt = ProcessType.Factory.newInstance();
+// pt.setId(process.getGmlId());
+//
+// addInspireId(pt, process);
+// addName(pt, process);
+// addType(pt, process);
+// addDocumentation(pt, process);
+// addProcessParameter(pt, process);
+// addResponsibleParty(pt, process);
+// return pt;
+// }
+// }
+//
+// private void addInspireId(ProcessType pt, Process process) throws OwsExceptionReport {
+// pt.addNewInspireId().set(encodeBASEPropertyType(process.getInspireId()));
+// }
+//
+// private void addName(ProcessType pt, Process process) {
+// if (process.isSetName()) {
+// pt.addNewName2().setStringValue(process.getFirstName().getValue());
+// }
+// }
+//
+// private void addType(ProcessType pt, Process process) {
+// if (process.isSetType()) {
+// pt.addNewType().setStringValue(process.getType());
+// } else {
+// pt.addNewType().setNil();
+// }
+// }
+//
+// private void addDocumentation(ProcessType pt, Process process) throws OwsExceptionReport {
+// if (process.isSetDocumentation()) {
+// for (DocumentCitation documentCitation : process.getDocumentation()) {
+// pt.addNewDocumentation().addNewDocumentCitation().set(encodeBASE2(documentCitation));
+// }
+// }
+// }
+//
+// private void addProcessParameter(ProcessType pt, Process process) throws OwsExceptionReport {
+// if (process.isSetProcessParameter()) {
+// for (ProcessParameter processParameter : process.getProcessParameter()) {
+// pt.addNewProcessParameter().addNewProcessParameter().set(encodeOMPR(processParameter));
+// }
+// }
+// }
+//
+// private void addResponsibleParty(ProcessType pt, Process process) throws OwsExceptionReport {
+// if (process.isSetResponsiblePartyn()) {
+// for (RelatedParty relatedParty : process.getResponsibleParty()) {
+// pt.addNewResponsibleParty().addNewRelatedParty().set(encodeBASE2(relatedParty));
+// }
+// }
+// }
+//
+// @Override
+// protected XmlObject createFeature(FeaturePropertyType featurePropertyType, AbstractFeature abstractFeature,
+// Map additionalValues) throws OwsExceptionReport {
+// if (additionalValues.containsKey(HelperValues.ENCODE)
+// && additionalValues.get(HelperValues.ENCODE).equals("false")) {
+// featurePropertyType.setHref(abstractFeature.getIdentifierCodeWithAuthority().getValue());
+// if (abstractFeature.isSetName()) {
+// featurePropertyType.setTitle(abstractFeature.getFirstName().getValue());
+// }
+// return featurePropertyType;
+// }
+// return encodeOMPRDocument(abstractFeature);
+// }
+//
+// protected static XmlObject encodeOMPR(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireOMPRConstants.NS_OMPR_30, o);
+// }
+//
+// protected static XmlObject encodeOMPRDocument(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlDocument(InspireBaseConstants.NS_BASE, o);
+// }
+//
+// protected static XmlObject encodeBASE(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireBaseConstants.NS_BASE, o);
+// }
+//
+// protected static XmlObject encodeBASEPropertyType(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlPropertyType(InspireBaseConstants.NS_BASE, o);
+// }
+//
+// protected static XmlObject encodeBASEDocument(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlDocument(InspireBaseConstants.NS_BASE, o);
+// }
+//
+// protected static XmlObject encodeBASE(Object o, Map helperValues) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireBaseConstants.NS_BASE, o, helperValues);
+// }
+//
+// protected static XmlObject encodeBASE2(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireBase2Constants.NS_BASE2, o);
+// }
+//
+// protected static XmlObject encodeBASE2PropertyType(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlPropertyType(InspireBase2Constants.NS_BASE2, o);
+// }
+//
+// protected static XmlObject encodeBASE2Document(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlDocument(InspireBase2Constants.NS_BASE2, o);
+// }
+//
+// protected static XmlObject encodeBASE2(Object o, Map helperValues)
+// throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireBase2Constants.NS_BASE2, o, helperValues);
+// }
+
+}
diff --git a/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessTypeDecoder.java b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessTypeDecoder.java
new file mode 100644
index 0000000000..33f86eea33
--- /dev/null
+++ b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/decode/ProcessTypeDecoder.java
@@ -0,0 +1,279 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.inspire.ompr.v30.decode;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.n52.sos.decode.DecoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedDecoderInputException;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.util.CodingHelper;
+import org.n52.sos.util.XmlOptionsHelper;
+import org.n52.svalbard.inspire.ompr.InspireOMPRConstants;
+import org.n52.svalbard.inspire.ompr.Process;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Joiner;
+
+import eu.europa.ec.inspire.schemas.ompr.x30.ProcessType;
+
+public class ProcessTypeDecoder extends AbstractProcessDecoder {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ProcessTypeDecoder.class);
+
+ private static final Set DECODER_KEYS = CodingHelper.decoderKeysForElements(
+ InspireOMPRConstants.NS_OMPR_30, ProcessType.class);
+
+
+ public ProcessTypeDecoder() {
+ LOGGER.debug("Encoder for the following keys initialized successfully: {}!",
+ Joiner.on(", ").join(DECODER_KEYS));
+ }
+
+ @Override
+ public Set getDecoderKeyTypes() {
+ return Collections.unmodifiableSet(DECODER_KEYS);
+ }
+
+
+ @Override
+ public Process decode(ProcessType pt) throws OwsExceptionReport, UnsupportedDecoderInputException {
+ Process process = parseProcessType(pt);
+ process.setSensorDescriptionXmlString(pt.xmlText(XmlOptionsHelper.getInstance().getXmlOptions()));
+ return process;
+ }
+
+// private static final Logger LOGGER = LoggerFactory.getLogger(ProcessTypeDecoder.class);
+//
+// private static final Map> SUPPORTED_TYPES =
+// singletonMap(SupportedTypeKey.ProcedureDescriptionFormat,
+// (Set) ImmutableSet.of(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_URL,
+// InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_MIME_TYPE));
+//
+// private static final Map>> SUPPORTED_PROCEDURE_DESCRIPTION_FORMATS =
+// ImmutableMap.of(SosConstants.SOS,
+// ImmutableMap.> builder()
+// .put(Sos2Constants.SERVICEVERSION,
+// ImmutableSet.of(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_URL))
+// .put(Sos1Constants.SERVICEVERSION,
+// ImmutableSet.of(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_MIME_TYPE))
+// .build());
+//
+// @SuppressWarnings("unchecked")
+// private static final Set ENCODER_KEYS = union(
+// encoderKeysForElements(InspireOMPRConstants.NS_OMPR_30, SosProcedureDescription.class, Process.class),
+// encoderKeysForElements(InspireOMPRConstants.OMPR_30_OUTPUT_FORMAT_MIME_TYPE, SosProcedureDescription.class,
+// Process.class));
+//
+// public ProcessTypeDecoder() {
+// LOGGER.debug("Encoder for the following keys initialized successfully: {}!",
+// Joiner.on(", ").join(ENCODER_KEYS));
+// }
+//
+// @Override
+// public Set getEncoderKeyType() {
+// return Collections.unmodifiableSet(ENCODER_KEYS);
+// }
+//
+// @Override
+// public Map> getSupportedTypes() {
+// return Collections.unmodifiableMap(SUPPORTED_TYPES);
+// }
+//
+// @Override
+// public void addNamespacePrefixToMap(final Map nameSpacePrefixMap) {
+// nameSpacePrefixMap.put(InspireOMPRConstants.NS_OMPR_30, InspireOMPRConstants.NS_OMPR_PREFIX);
+// }
+//
+// @Override
+// public MediaType getContentType() {
+// return InspireOMPRConstants.OMPR_30_CONTENT_TYPE;
+// }
+//
+// @Override
+// public Set getSchemaLocations() {
+// return Sets.newHashSet(InspireOMPRConstants.OMPR_SCHEMA_LOCATION);
+// }
+//
+// @Override
+// public Set getSupportedProcedureDescriptionFormats(final String service, final String version) {
+// if (SUPPORTED_PROCEDURE_DESCRIPTION_FORMATS.containsKey(service)
+// && SUPPORTED_PROCEDURE_DESCRIPTION_FORMATS.get(service).containsKey(version)) {
+// return SUPPORTED_PROCEDURE_DESCRIPTION_FORMATS.get(service).get(version);
+// }
+// return Collections.emptySet();
+// }
+//
+// @Override
+// public Set getConformanceClasses() {
+// return Collections.emptySet();
+// }
+//
+// @Override
+// public XmlObject encode(Process process) throws OwsExceptionReport, UnsupportedEncoderInputException {
+// return encode(process, Collections. emptyMap());
+// }
+//
+// @Override
+// public XmlObject encode(Process process, Map additionalValues)
+// throws OwsExceptionReport, UnsupportedEncoderInputException {
+// return createProcess(process);
+// }
+//
+// protected ProcessType createProcess(Process process) throws OwsExceptionReport {
+// if (process.isSetSensorDescriptionXmlString()) {
+// XmlObject encodedObject = null;
+// try {
+// encodedObject = XmlObject.Factory.parse(process.getSensorDescriptionXmlString());
+// if (encodedObject instanceof ProcessType) {
+// return (ProcessType) encodedObject;
+// } else if (encodedObject instanceof ProcessDocument) {
+// return ((ProcessDocument) encodedObject).getProcess();
+// } else if (encodedObject instanceof ProcessPropertyType) {
+// return ((ProcessPropertyType) encodedObject).getProcess();
+// } else {
+// throw new UnsupportedEncoderInputException(this, process);
+// }
+// } catch (final XmlException xmle) {
+// throw new NoApplicableCodeException().causedBy(xmle);
+// }
+// } else {
+// ProcessType pt = ProcessType.Factory.newInstance();
+// pt.setId(process.getGmlId());
+//
+// addInspireId(pt, process);
+// addName(pt, process);
+// addType(pt, process);
+// addDocumentation(pt, process);
+// addProcessParameter(pt, process);
+// addResponsibleParty(pt, process);
+// return pt;
+// }
+// }
+//
+// private void addInspireId(ProcessType pt, Process process) throws OwsExceptionReport {
+// pt.addNewInspireId().set(encodeBASEPropertyType(process.getInspireId()));
+// }
+//
+// private void addName(ProcessType pt, Process process) {
+// if (process.isSetName()) {
+// pt.addNewName2().setStringValue(process.getFirstName().getValue());
+// }
+// }
+//
+// private void addType(ProcessType pt, Process process) {
+// if (process.isSetType()) {
+// pt.addNewType().setStringValue(process.getType());
+// } else {
+// pt.addNewType().setNil();
+// }
+// }
+//
+// private void addDocumentation(ProcessType pt, Process process) throws OwsExceptionReport {
+// if (process.isSetDocumentation()) {
+// for (DocumentCitation documentCitation : process.getDocumentation()) {
+// pt.addNewDocumentation().addNewDocumentCitation().set(encodeBASE2(documentCitation));
+// }
+// }
+// }
+//
+// private void addProcessParameter(ProcessType pt, Process process) throws OwsExceptionReport {
+// if (process.isSetProcessParameter()) {
+// for (ProcessParameter processParameter : process.getProcessParameter()) {
+// pt.addNewProcessParameter().addNewProcessParameter().set(encodeOMPR(processParameter));
+// }
+// }
+// }
+//
+// private void addResponsibleParty(ProcessType pt, Process process) throws OwsExceptionReport {
+// if (process.isSetResponsiblePartyn()) {
+// for (RelatedParty relatedParty : process.getResponsibleParty()) {
+// pt.addNewResponsibleParty().addNewRelatedParty().set(encodeBASE2(relatedParty));
+// }
+// }
+// }
+//
+// @Override
+// protected XmlObject createFeature(FeaturePropertyType featurePropertyType, AbstractFeature abstractFeature,
+// Map additionalValues) throws OwsExceptionReport {
+// if (additionalValues.containsKey(HelperValues.ENCODE)
+// && additionalValues.get(HelperValues.ENCODE).equals("false")) {
+// featurePropertyType.setHref(abstractFeature.getIdentifierCodeWithAuthority().getValue());
+// if (abstractFeature.isSetName()) {
+// featurePropertyType.setTitle(abstractFeature.getFirstName().getValue());
+// }
+// return featurePropertyType;
+// }
+// return encodeOMPRDocument(abstractFeature);
+// }
+//
+// protected static XmlObject encodeOMPR(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireOMPRConstants.NS_OMPR_30, o);
+// }
+//
+// protected static XmlObject encodeOMPRDocument(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlDocument(InspireBaseConstants.NS_BASE, o);
+// }
+//
+// protected static XmlObject encodeBASE(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireBaseConstants.NS_BASE, o);
+// }
+//
+// protected static XmlObject encodeBASEPropertyType(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlPropertyType(InspireBaseConstants.NS_BASE, o);
+// }
+//
+// protected static XmlObject encodeBASEDocument(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlDocument(InspireBaseConstants.NS_BASE, o);
+// }
+//
+// protected static XmlObject encodeBASE(Object o, Map helperValues) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireBaseConstants.NS_BASE, o, helperValues);
+// }
+//
+// protected static XmlObject encodeBASE2(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireBase2Constants.NS_BASE2, o);
+// }
+//
+// protected static XmlObject encodeBASE2PropertyType(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlPropertyType(InspireBase2Constants.NS_BASE2, o);
+// }
+//
+// protected static XmlObject encodeBASE2Document(Object o) throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXmlDocument(InspireBase2Constants.NS_BASE2, o);
+// }
+//
+// protected static XmlObject encodeBASE2(Object o, Map helperValues)
+// throws OwsExceptionReport {
+// return CodingHelper.encodeObjectToXml(InspireBase2Constants.NS_BASE2, o, helperValues);
+// }
+
+}
diff --git a/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/encode/ProcessDocumentEncoder.java b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/encode/ProcessDocumentEncoder.java
new file mode 100644
index 0000000000..77310fff24
--- /dev/null
+++ b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/encode/ProcessDocumentEncoder.java
@@ -0,0 +1,85 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.inspire.ompr.v30.encode;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.ClassToClassEncoderKey;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.XmlDocumentEncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosProcedureDescription;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+import org.n52.svalbard.inspire.ompr.InspireOMPRConstants;
+import org.n52.svalbard.inspire.ompr.Process;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Sets;
+
+import eu.europa.ec.inspire.schemas.ompr.x30.ProcessDocument;
+
+public class ProcessDocumentEncoder extends ProcessTypeEncoder {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ProcessDocumentEncoder.class);
+
+ protected static final Set ENCODER_KEYS =
+ Sets.newHashSet(new ClassToClassEncoderKey(Process.class, ProcessDocument.class),
+ new XmlDocumentEncoderKey(InspireOMPRConstants.NS_OMPR_30, Process.class),
+ new XmlDocumentEncoderKey(InspireOMPRConstants.NS_OMPR_30, SosProcedureDescription.class));
+
+ public ProcessDocumentEncoder() {
+ LOGGER.debug("Encoder for the following keys initialized successfully: {}!",
+ Joiner.on(", ").join(ENCODER_KEYS));
+ }
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public XmlObject encode(Process process) throws OwsExceptionReport, UnsupportedEncoderInputException {
+ return encode(process, Collections. emptyMap());
+ }
+
+ @Override
+ public XmlObject encode(Process process, Map additionalValues)
+ throws OwsExceptionReport, UnsupportedEncoderInputException {
+ ProcessDocument pd = ProcessDocument.Factory.newInstance();
+ pd.setProcess(createProcess(process));
+ return pd;
+ }
+
+}
diff --git a/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/encode/ProcessParameterTypeEncoder.java b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/encode/ProcessParameterTypeEncoder.java
new file mode 100644
index 0000000000..385f20e89a
--- /dev/null
+++ b/coding/inspire/ompr/src/main/java/org/n52/svalbard/inspire/ompr/v30/encode/ProcessParameterTypeEncoder.java
@@ -0,0 +1,119 @@
+/**
+ * Copyright (C) 2012-2017 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.svalbard.inspire.ompr.v30.encode;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.xmlbeans.XmlObject;
+import org.n52.sos.encode.AbstractXmlEncoder;
+import org.n52.sos.encode.ClassToClassEncoderKey;
+import org.n52.sos.encode.EncoderKey;
+import org.n52.sos.encode.XmlDocumentEncoderKey;
+import org.n52.sos.exception.ows.concrete.UnsupportedEncoderInputException;
+import org.n52.sos.ogc.ows.OwsExceptionReport;
+import org.n52.sos.ogc.sos.SosConstants.HelperValues;
+import org.n52.sos.service.ServiceConstants.SupportedTypeKey;
+import org.n52.sos.util.http.MediaType;
+import org.n52.sos.w3c.SchemaLocation;
+import org.n52.svalbard.inspire.ompr.InspireOMPRConstants;
+import org.n52.svalbard.inspire.ompr.ProcessParameter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Sets;
+
+import eu.europa.ec.inspire.schemas.ompr.x30.ProcessParameterType;
+
+public class ProcessParameterTypeEncoder extends AbstractXmlEncoder {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ProcessParameterTypeEncoder.class);
+
+ private static final Set ENCODER_KEYS = Sets.newHashSet(
+ new ClassToClassEncoderKey(ProcessParameterType.class, ProcessParameter.class),
+ new XmlDocumentEncoderKey(InspireOMPRConstants.NS_OMPR_30, ProcessParameter.class));
+
+ public ProcessParameterTypeEncoder() {
+ LOGGER.debug("Encoder for the following keys initialized successfully: {}!",
+ Joiner.on(", ").join(ENCODER_KEYS));
+ }
+
+ @Override
+ public Set getEncoderKeyType() {
+ return Collections.unmodifiableSet(ENCODER_KEYS);
+ }
+
+ @Override
+ public Map> getSupportedTypes() {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public void addNamespacePrefixToMap(final Map