├── etc
├── NOTICE.template
├── license-mappings.xml
└── 52N_GPLv2_License.xt
├── webapp
└── src
│ └── main
│ ├── resources
│ ├── version
│ │ └── version-info.txt
│ ├── banner.txt
│ ├── logback.xml
│ └── META-INF
│ │ └── sta-vanilla.xml
│ └── java
│ └── org
│ └── n52
│ └── sta
│ └── webapp
│ └── Application.java
├── extension
├── extended-sensor-encodingtype.md
├── server-properties.md
├── server-version.md
├── create-via-mqtt.md
└── sensorML20-encodingtype.md
├── dao-ufz
└── pom.xml
├── .gitignore
├── app
└── src
│ ├── main
│ ├── resources
│ │ ├── banner.txt
│ │ └── META-INF
│ │ │ └── sta-vanilla.xml
│ └── java
│ │ └── org
│ │ └── n52
│ │ └── sta
│ │ ├── VanillaLoader.java
│ │ ├── UFZAggregataLoader.java
│ │ └── Application.java
│ └── test
│ └── java
│ └── org
│ └── n52
│ └── sta
│ ├── STAPostgresContainer.java
│ └── ITRootResponseTest.java
├── .github
└── workflows
│ ├── pull.yml
│ ├── pull_maintenance.yml
│ ├── pull_java_8.yml
│ ├── push.yml
│ ├── push_java_8.yml
│ ├── push_maintenance.yml
│ ├── dockerhub-push.yml
│ └── codeql.yml
├── Dockerfile
├── docker-compose.yml
├── dao
├── src
│ └── main
│ │ └── java
│ │ └── org
│ │ └── n52
│ │ └── sta
│ │ ├── api
│ │ ├── dto
│ │ │ ├── EntityPatch.java
│ │ │ ├── StaDTO.java
│ │ │ ├── HistoricalLocationDTO.java
│ │ │ ├── ObservedPropertyDTO.java
│ │ │ ├── SensorDTO.java
│ │ │ ├── FeatureOfInterestDTO.java
│ │ │ ├── ThingDTO.java
│ │ │ ├── impl
│ │ │ │ ├── HistoricalLocation.java
│ │ │ │ ├── ObservedProperty.java
│ │ │ │ ├── FeatureOfInterest.java
│ │ │ │ └── Sensor.java
│ │ │ ├── LocationDTO.java
│ │ │ └── ObservationDTO.java
│ │ ├── EntityServiceFactory.java
│ │ ├── STAEventHandler.java
│ │ └── CollectionWrapper.java
│ │ ├── serdes
│ │ └── json
│ │ │ ├── JSONSensorVariableEncoding.java
│ │ │ └── AbstractJSONEntity.java
│ │ ├── SpringApplicationContext.java
│ │ ├── VersionInfoConfig.java
│ │ └── utils
│ │ └── TimeUtil.java
└── pom.xml
├── STATISTICS.md
├── dao-postgres
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── n52
│ │ └── sta
│ │ └── data
│ │ └── vanilla
│ │ ├── repositories
│ │ ├── OfferingRepository.java
│ │ ├── LocationEncodingRepository.java
│ │ ├── AbstractStaRepository.java
│ │ ├── HistoricalLocationRepository.java
│ │ ├── ThingRepository.java
│ │ ├── ProcedureHistoryRepository.java
│ │ ├── FormatRepository.java
│ │ ├── IdentifierNameRepository.java
│ │ ├── DatastreamParameterRepository.java
│ │ ├── LocationParameterRepository.java
│ │ ├── PlatformParameterRepository.java
│ │ ├── ProcedureParameterRepository.java
│ │ ├── PhenomenonParameterRepository.java
│ │ ├── FeatureOfInterestParameterRepository.java
│ │ ├── ObservationParameterRepository.java
│ │ ├── FeatureOfInterestRepository.java
│ │ ├── PhenomenonRepository.java
│ │ ├── NameRepository.java
│ │ ├── CategoryRepository.java
│ │ ├── LocationRepository.java
│ │ ├── ProcedureRepository.java
│ │ ├── DatastreamRepository.java
│ │ ├── ObservationRepository.java
│ │ ├── UnitRepository.java
│ │ ├── IdentifierRepository.java
│ │ ├── StaIdentifierRepository.java
│ │ └── RepositoryConstants.java
│ │ ├── DaoSemaphore.java
│ │ ├── query
│ │ └── SpatialQuerySpecifications.java
│ │ ├── service
│ │ ├── CategoryService.java
│ │ ├── util
│ │ │ └── HibernateSpatialCriteriaBuilder.java
│ │ ├── OfferingService.java
│ │ └── ServiceUtils.java
│ │ ├── MutexFactory.java
│ │ └── SerDesConfig.java
│ └── test
│ └── java
│ └── org
│ └── n52
│ └── sta
│ └── ApplicationTests.java
├── mqtt
├── src
│ └── main
│ │ └── java
│ │ └── org
│ │ └── n52
│ │ └── sta
│ │ └── mqtt
│ │ ├── MqttHandlerException.java
│ │ └── vanilla
│ │ ├── MqttPublishMessageHandler.java
│ │ ├── MqttSubscriptionEventHandler.java
│ │ └── subscription
│ │ └── MqttSelectSubscription.java
└── pom.xml
└── http
├── src
├── main
│ └── java
│ │ └── org
│ │ └── n52
│ │ └── sta
│ │ └── http
│ │ ├── MvcConfiguration.java
│ │ ├── CORSFilter.java
│ │ └── ExtendableUrlPathHelper.java
└── test
│ └── java
│ └── org
│ └── n52
│ └── sta
│ └── http
│ └── STARequestUtilsTest.java
└── pom.xml
/etc/NOTICE.template:
--------------------------------------------------------------------------------
1 | Copyright (C) 2018-2019 52°North Initiative for Geospatial Open Source Software GmbH
2 |
3 | Licensed under GNU General Public License, Version 2.0
4 |
5 | This project includes:
6 |
7 | #GENERATED_NOTICES#
--------------------------------------------------------------------------------
/webapp/src/main/resources/version/version-info.txt:
--------------------------------------------------------------------------------
1 | General Infos:
2 | ==============
3 | project = 52North SensorThingsAPI Reference Implementation (${artifactId})
4 | version = ${project.version}
5 | builddate = ${git.build.time}
6 |
7 | Git Infos:
8 | =================
9 | repository = ${git.remote.origin.url}
10 | path = ${git.branch}
11 | revision = ${git.commit.id.full}
12 | lastCommitMessage = ${git.commit.message.short}
13 | lastCommitDate = ${git.commit.time}
14 |
--------------------------------------------------------------------------------
/extension/extended-sensor-encodingtype.md:
--------------------------------------------------------------------------------
1 | ## Extended Sensor EncodingType
2 |
3 | By default the STA only allows `Sensor->encodingType` to have the values `http://www.opengis.net/doc/IS/SensorML/2.0` or `application/pdf` as of Section 8.2.5 of the Specification.
4 | This extension removes this limitation and allows arbitrary encodingTypes to be used, e.g. `plain/text`.
5 |
6 | ### Example:
7 | ```(type=json)
8 | {
9 | "name": "DS18B20",
10 | "description": "DS18B20 is an air temperature sensor",
11 | "encodingType": "plain/text",
12 | "metadata": "This is plaintext metadata"
13 | }
14 | ```
15 |
--------------------------------------------------------------------------------
/extension/server-properties.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Server Properties Extension
4 |
5 | Provides information about any configurable Properties of the Server, e.g. for features that extend the standard or define previously undefined behaviour (e.g. interaction of `$expand` with `$select` in STA 1.0)
6 | ### Example:
7 | ```(type=json)
8 | "serverSettings": {
9 | "https://github.com/52North/sensorweb-server-sta/extension/server-properties.md": {
10 | "escapeId":true,
11 | "implicitExpand":false,
12 | "updateFOI":false,
13 | "variableEncodingType":false
14 | }
15 | }
16 | ```
17 |
--------------------------------------------------------------------------------
/dao-ufz/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | org.n52.sensorweb-server.sta
6 | sta-parent
7 | 4.0.0-SNAPSHOT
8 |
9 | sta-dao-ufz
10 |
11 |
12 |
13 | org.n52.sensorweb-server.sta
14 | sta-dao-postgres
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | pom.xml.tag
3 | pom.xml.releaseBackup
4 | pom.xml.versionsBackup
5 | pom.xml.next
6 | release.properties
7 | dependency-reduced-pom.xml
8 | buildNumber.properties
9 | .mvn/timing.properties
10 |
11 | # Ignore Moquette persistent storage
12 | *.h2
13 |
14 | # Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
15 | !/.mvn/wrapper/maven-wrapper.jar
16 |
17 | # Eclipse IDE Files
18 | .classpath
19 | .project
20 | .settings/*
21 | */.settings/*
22 | *.factorypath
23 |
24 | sensor-things-api-app/.settings/
25 | sensor-things-api-core/.settings/
26 | sensor-things-api-webapp/.settings/
27 | sensor-things-api-http/.settings/
28 | sensor-things-api-mqtt/.settings/
29 |
30 | sensor-things-api-app/console.log
31 |
32 | # IntelliJ IDE Files
33 | .idea/*
34 | *.iml
35 | *.checkstyle
36 |
--------------------------------------------------------------------------------
/etc/license-mappings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | com.bugsnag
5 | bugsnag
6 | 3.4.6
7 | MIT license
8 |
9 |
10 | io.moquette
11 | moquette-broker
12 | 0.12.1
13 | The Apache Software License, Version 2.0
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/resources/banner.txt:
--------------------------------------------------------------------------------
1 | _____ ___ _ _ _____ _______ _ _ _____ _____
2 | | ____|__ \| \ | | / ____| |__ __| | (_) /\ | __ \_ _|
3 | | |__ ) | \| | | (___ ___ _ __ ___ ___ _ __ | | | |__ _ _ __ __ _ ___ / \ | |__) || |
4 | |___ \ / /| . ` | \___ \ / _ \ '_ \/ __|/ _ \| '__| | | | '_ \| | '_ \ / _` / __| / /\ \ | ___/ | |
5 | ___) |/ /_| |\ | ____) | __/ | | \__ \ (_) | | | | | | | | | | | | (_| \__ \ / ____ \| | _| |_
6 | |____/|____|_| \_| |_____/ \___|_| |_|___/\___/|_| |_| |_| |_|_|_| |_|\__, |___/ /_/ \_\_| |_____|
7 | __/ |
8 | |___/
--------------------------------------------------------------------------------
/webapp/src/main/resources/banner.txt:
--------------------------------------------------------------------------------
1 | _____ ___ _ _ _____ _______ _ _ _____ _____
2 | | ____|__ \| \ | | / ____| |__ __| | (_) /\ | __ \_ _|
3 | | |__ ) | \| | | (___ ___ _ __ ___ ___ _ __ | | | |__ _ _ __ __ _ ___ / \ | |__) || |
4 | |___ \ / /| . ` | \___ \ / _ \ '_ \/ __|/ _ \| '__| | | | '_ \| | '_ \ / _` / __| / /\ \ | ___/ | |
5 | ___) |/ /_| |\ | ____) | __/ | | \__ \ (_) | | | | | | | | | | | | (_| \__ \ / ____ \| | _| |_
6 | |____/|____|_| \_| |_____/ \___|_| |_|___/\___/|_| |_| |_| |_|_|_| |_|\__, |___/ /_/ \_\_| |_____|
7 | __/ |
8 | |___/
--------------------------------------------------------------------------------
/.github/workflows/pull.yml:
--------------------------------------------------------------------------------
1 | name: Java CI on Pull Request
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - 'sta-slicing'
7 | workflow_dispatch:
8 |
9 |
10 | jobs:
11 | build:
12 | strategy:
13 | matrix:
14 | java: [ 11 ]
15 | runs-on: ubuntu-latest
16 | name: Java ${{ matrix.java }} compile
17 |
18 | steps:
19 | - uses: actions/checkout@v3
20 | - name: Set up JDK ${{ matrix.java }}
21 | uses: actions/setup-java@v3
22 | with:
23 | distribution: 'temurin'
24 | java-version: ${{ matrix.java }}
25 | cache: 'maven'
26 |
27 | - name: Cache Maven Repo
28 | uses: actions/cache@v2
29 | with:
30 | path: ~/.m2/repository
31 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: |
33 | ${{ runner.os }}-maven-
34 |
35 | - name: Build with Maven
36 | run: mvn -fae -U -B clean license:check install -DskipTests --file pom.xml
37 |
--------------------------------------------------------------------------------
/.github/workflows/pull_maintenance.yml:
--------------------------------------------------------------------------------
1 | name: Java CI on Pull Request
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - 'maintenance/3.x'
7 | workflow_dispatch:
8 |
9 |
10 | jobs:
11 | build:
12 | strategy:
13 | matrix:
14 | java: [ 11 ]
15 | runs-on: ubuntu-latest
16 | name: Java ${{ matrix.java }} compile
17 |
18 | steps:
19 | - uses: actions/checkout@v3
20 | - name: Set up JDK ${{ matrix.java }}
21 | uses: actions/setup-java@v3
22 | with:
23 | distribution: 'temurin'
24 | java-version: ${{ matrix.java }}
25 | cache: 'maven'
26 |
27 | - name: Cache Maven Repo
28 | uses: actions/cache@v2
29 | with:
30 | path: ~/.m2/repository
31 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
32 | restore-keys: |
33 | ${{ runner.os }}-maven-
34 |
35 | - name: Build with Maven
36 | run: mvn -fae -U -B clean license:check install -P check --file pom.xml
37 |
--------------------------------------------------------------------------------
/.github/workflows/pull_java_8.yml:
--------------------------------------------------------------------------------
1 | name: Java CI on Pull Request Java 8
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - 'master'
7 | - 'develop'
8 | workflow_dispatch:
9 |
10 |
11 | jobs:
12 | build:
13 | strategy:
14 | matrix:
15 | java: [ 8, 11, 17 ]
16 | runs-on: ubuntu-latest
17 | name: Java ${{ matrix.java }} compile
18 |
19 | steps:
20 | - uses: actions/checkout@v3
21 | - name: Set up JDK ${{ matrix.java }}
22 | uses: actions/setup-java@v3
23 | with:
24 | distribution: 'temurin'
25 | java-version: ${{ matrix.java }}
26 | cache: 'maven'
27 |
28 | - name: Cache Maven Repo
29 | uses: actions/cache@v2
30 | with:
31 | path: ~/.m2/repository
32 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
33 | restore-keys: |
34 | ${{ runner.os }}-maven-
35 |
36 | - name: Build with Maven
37 | run: mvn -fae -U -B clean license:check install -P check --file pom.xml
--------------------------------------------------------------------------------
/extension/server-version.md:
--------------------------------------------------------------------------------
1 | ## Server Version Extension
2 |
3 | Provides information about the specific implementation currently running on this Endpoint, providing more specific information than just the STA Version.
4 |
5 | ### Example:
6 | ```(type=json)
7 | "serverSettings": {
8 | "https://github.com/52North/sensorweb-server-sta/extension/server-properties.md": {
9 | "git.repository":"https://github.com/52North/sensorweb-server-sta",
10 | "git.lastCommitDate":"2020-09-24 15:47:37+0200",
11 | "git.path":"feature/db-model-upgrade-2",
12 | "git.lastCommitMessage":"Merge branch 'feature/db-model-upgrade-2' of https://github.com/52North/sensorweb-server-sta into feature/db-model-upgrade-2",
13 | "git.revision":"1f36716b73652cb30f26ba61bb268d72c45f6b4f",
14 | "project.name":"52North SensorThingsAPI",
15 | "project.version":"2.2.2-SNAPSHOT",
16 | "project.time":"2020-09-24T14:11:57.601Z",
17 | "git.builddate":"2020-09-24 16:11:31+0200"
18 | }
19 | }
20 | ```
21 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | #FROM alpine/git as gitstage
2 | #WORKDIR /app
3 |
4 | #RUN git clone https://github.com/52north/arctic-sea \
5 | # && cd arctic-sea \
6 | # && git checkout master
7 |
8 | #RUN git clone https://github.com/52north/sensorweb-server-db-model \
9 | # && cd sensorweb-server-db-model \
10 | # && git checkout develop
11 |
12 | FROM maven:3.6.1-jdk-8-slim as buildstage
13 | WORKDIR /app
14 | #COPY --from=gitstage /app /app
15 | COPY . /app/sensorweb-server-sta/
16 |
17 | #RUN cd arctic-sea \
18 | # && mvn clean install
19 |
20 | #RUN cd sensorweb-server-db-model \
21 | # && mvn clean install
22 |
23 | RUN cd sensorweb-server-sta \
24 | && mvn package
25 |
26 | FROM adoptopenjdk/openjdk8:alpine-slim as runstage
27 |
28 | ARG DEPENDENCY=/app/sensorweb-server-sta/app/target/unpacked
29 | COPY --from=buildstage ${DEPENDENCY}/BOOT-INF/lib /app/lib
30 | COPY --from=buildstage ${DEPENDENCY}/META-INF /app/META-INF
31 | COPY --from=buildstage ${DEPENDENCY}/BOOT-INF/classes /app
32 | ENTRYPOINT ["java","-cp","app:app/lib/*","org.n52.sta.Application"]
33 |
--------------------------------------------------------------------------------
/extension/create-via-mqtt.md:
--------------------------------------------------------------------------------
1 |
2 | ## create via MQTT
3 |
4 | This Extension extends the functionality of `http://www.opengis.net/spec/iot_sensing/1.1/req/create-observations-via-mqtt/observations-creation` to all Entities.
5 | The functionality equals the functionality available via HTTP, all restrictions from `http://www.opengis.net/spec/iot_sensing/1.1/req/datamodel` and `http://www.opengis.net/spec/iot_sensing/1.1/req/create-update-delete` apply to the published Entities.
6 |
7 | ### Structure
8 | The Object extends the JSON structure of `http://www.opengis.net/spec/iot_sensing/1.1/req/create-observations-via-mqtt/observations-creation` with a new key `entities`, listing all the Entities that can be posted via MQTT.
9 |
10 | ### Example
11 | ```(type=json)
12 | "serverSettings": {
13 | "https://github.com/52North/sensorweb-server-sta/extension/create-via-mqtt.md": {
14 | "entities": [
15 | "Observations",
16 | "Locations"
17 | ]
18 | "endpoints": [
19 | "mqtt://localhost:1883",
20 | "ws://localhost:8883"
21 | ]
22 | }
23 | }
24 | ```
25 |
--------------------------------------------------------------------------------
/extension/sensorML20-encodingtype.md:
--------------------------------------------------------------------------------
1 | ## Extended Sensor EncodingType
2 |
3 | By default the STA only allows `Datastream->encodingType` to have the values `OM_CategoryObservation`, `OM_CountObservation`, `OM_Measurement`, `OM_Observation`, `OM_TruthObservation` as of Section 8.2.4 of the Specification.
4 | To handle use-cases where the `Observation->result` is a XML-encoded SensorML20 document, e.g. if the Observation is an SensorML20 `swe:event` this Extension adds an additional ObservationType `OM_SensorML20Observation` with valueCode `http://www.52north.org/def/observationType/OGC-OM/2.0/OM_SensorML20Observation`.
5 |
6 | Seperating these Observations from other observations allows for special handling to be applied when returning these Observations.
7 |
8 | Specifically, as the result is guaranteed to be SensorML 2.0, it can be transcoded to JSON encoding in accordance with [OGC Best Practice 17-011r2: JSON Encoding Rules SWE Common / SensorML](https://docs.opengeospatial.org/bp/17-011r2/17-011r2.html).
9 |
10 | Note: This transcoding only applies to returned entities! When `POST`ing or `PATCH`ing entities the result is exspected as an (escaped) XML String.
11 |
12 | ### Example:
13 | TODO
14 |
--------------------------------------------------------------------------------
/etc/52N_GPLv2_License.xt:
--------------------------------------------------------------------------------
1 | Copyright (C) ${year} 52°North Initiative for Geospatial Open Source
2 | Software GmbH
3 |
4 | This program is free software; you can redistribute it and/or modify it
5 | under the terms of the GNU General Public License version 2 as published
6 | by the Free Software Foundation.
7 |
8 | If the program is linked with libraries which are licensed under one of
9 | the following licenses, the combination of the program with the linked
10 | library is not considered a "derivative work" of the program:
11 |
12 | - Apache License, version 2.0
13 | - Apache Software License, version 1.0
14 | - GNU Lesser General Public License, version 3
15 | - Mozilla Public License, versions 1.0, 1.1 and 2.0
16 | - Common Development and Distribution License (CDDL), version 1.0
17 |
18 | Therefore the distribution of the program linked with libraries licensed
19 | under the aforementioned licenses, is permitted by the copyright holders
20 | if the distribution is compliant with both the GNU General Public
21 | License version 2 and the aforementioned licenses.
22 |
23 | This program is distributed in the hope that it will be useful, but
24 | WITHOUT ANY WARRANTY; without even the implied warranty of
25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
26 | Public License for more details.
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | sta:
4 | image: 52north/sensorweb-server-sta:latest
5 | # build: https://github.com/52North/sensorweb-server-sta.git#develop
6 | ports:
7 | - 8081:8081
8 | - 1883:1883
9 | - 8883:8883
10 | environment:
11 | LOGGING_LEVEL_ROOT: INFO
12 | LOGGING_LEVEL_ORG_N52: TRACE
13 | SPRING_DATASOURCE_URL: jdbc:postgresql://database:5432/sta
14 | SPING_JPA_PROPERTIES_HIBERNATE_HBM2DDL: update
15 | MQTT_BROKER_PLAINTCP_ENABLED: "true"
16 | MQTT_BROKER_WEBSOCKET_ENABLED: "true"
17 | MQTT_BROKER_PERSISTENCE_ENABLED: "false"
18 | SERVER_ROOTURL: http://localhost:8081/sta/
19 | SERVER_SERVLET_CONTEXT_PATH: /sta
20 | SERVER_FEATURE_UPDATEFOI: "false"
21 | SERVER_FEATURE_MQTTPUBLISHTOPICS: Observations
22 | SERVER_FEATURE_VARIABLEENCODINGTYPE: "false"
23 | SERVER_FEATURE_ISMOBILE: "false"
24 | restart: on-failure:10
25 | depends_on:
26 | - database
27 |
28 | database:
29 | image: postgis/postgis:12-master
30 | restart: on-failure
31 | environment:
32 | - POSTGRES_DB=sta
33 | - POSTGRES_USER=postgres
34 | - POSTGRES_PASSWORD=postgres
35 | - ALLOW_IP_RANGE=0.0.0.0/0
36 | - POSTGRES_MULTIPLE_EXTENSIONS=postgis
37 |
38 | # For debug/show purposes!
39 | ports:
40 | - 5000:5432
41 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/EntityPatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | /**
32 | * @author Jan Speckamp
33 | */
34 | public interface EntityPatch {
35 |
36 | T getEntity();
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/.github/workflows/push.yml:
--------------------------------------------------------------------------------
1 | name: Java CI on Push
2 |
3 | on:
4 | push:
5 | branches:
6 | - 'sta-slicing'
7 | workflow_dispatch:
8 |
9 | jobs:
10 | build:
11 | strategy:
12 | matrix:
13 | java: [ 11 ]
14 | runs-on: ubuntu-latest
15 | name: Java ${{ matrix.java }} compile
16 |
17 | steps:
18 | - uses: actions/checkout@v3
19 | - name: Set up JDK ${{ matrix.java }}
20 | uses: actions/setup-java@v3
21 | with:
22 | distribution: 'temurin'
23 | java-version: ${{ matrix.java }}
24 | cache: 'maven'
25 |
26 | - name: Cache Maven Repo
27 | uses: actions/cache@v2
28 | with:
29 | path: ~/.m2/repository
30 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
31 | restore-keys: |
32 | ${{ runner.os }}-maven-
33 |
34 | - name: Build with Maven
35 | run: mvn -fae -U -B clean license:check install -DskipTests --file pom.xml
36 |
37 | publish-snapshot:
38 | needs: build
39 | runs-on: ubuntu-latest
40 |
41 | steps:
42 | - uses: actions/checkout@v3
43 | - name: Set up settings.xml for GitHub Packages
44 | uses: actions/setup-java@v3
45 | with:
46 | distribution: 'temurin'
47 | java-version: 11
48 | cache: 'maven'
49 | server-id: sonatype-nexus-snapshots
50 | server-username: MAVEN_USERNAME
51 | server-password: MAVEN_PASSWORD
52 | - name: Publish SNAPSHOT version Maven Central
53 | run: mvn -B --no-transfer-progress deploy -DskipTests
54 | env:
55 | MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
56 | MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
57 |
--------------------------------------------------------------------------------
/.github/workflows/push_java_8.yml:
--------------------------------------------------------------------------------
1 | name: Java CI on Push Java 8
2 |
3 | on:
4 | push:
5 | branches:
6 | - 'develop'
7 | workflow_dispatch:
8 |
9 | jobs:
10 | build:
11 | strategy:
12 | matrix:
13 | java: [ 8, 11, 17 ]
14 | runs-on: ubuntu-latest
15 | name: Java ${{ matrix.java }} compile
16 |
17 | steps:
18 | - uses: actions/checkout@v3
19 | - name: Set up JDK ${{ matrix.java }}
20 | uses: actions/setup-java@v3
21 | with:
22 | distribution: 'temurin'
23 | java-version: ${{ matrix.java }}
24 | cache: 'maven'
25 |
26 | - name: Cache Maven Repo
27 | uses: actions/cache@v2
28 | with:
29 | path: ~/.m2/repository
30 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
31 | restore-keys: |
32 | ${{ runner.os }}-maven-
33 |
34 | - name: Build with Maven
35 | run: mvn -fae -U -B clean license:check install -P check --file pom.xml
36 |
37 | publish-snapshot:
38 | needs: build
39 | runs-on: ubuntu-latest
40 |
41 | steps:
42 | - uses: actions/checkout@v3
43 | - name: Set up settings.xml for GitHub Packages
44 | uses: actions/setup-java@v3
45 | with:
46 | distribution: 'temurin'
47 | java-version: 8
48 | cache: 'maven'
49 | server-id: sonatype-nexus-snapshots
50 | server-username: MAVEN_USERNAME
51 | server-password: MAVEN_PASSWORD
52 | - name: Publish SNAPSHOT version Maven Central
53 | run: mvn -B --no-transfer-progress deploy -DskipTests
54 | env:
55 | MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
56 | MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
57 |
--------------------------------------------------------------------------------
/.github/workflows/push_maintenance.yml:
--------------------------------------------------------------------------------
1 | name: Java CI on Push
2 |
3 | on:
4 | push:
5 | branches:
6 | - 'maintenance/3.x'
7 | workflow_dispatch:
8 |
9 | jobs:
10 | build:
11 | strategy:
12 | matrix:
13 | java: [ 11 ]
14 | runs-on: ubuntu-latest
15 | name: Java ${{ matrix.java }} compile
16 |
17 | steps:
18 | - uses: actions/checkout@v3
19 | - name: Set up JDK ${{ matrix.java }}
20 | uses: actions/setup-java@v3
21 | with:
22 | distribution: 'temurin'
23 | java-version: ${{ matrix.java }}
24 | cache: 'maven'
25 |
26 | - name: Cache Maven Repo
27 | uses: actions/cache@v2
28 | with:
29 | path: ~/.m2/repository
30 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
31 | restore-keys: |
32 | ${{ runner.os }}-maven-
33 |
34 | - name: Build with Maven
35 | run: mvn -fae -U -B clean license:check install -P check --file pom.xml
36 |
37 | publish-snapshot:
38 | needs: build
39 | runs-on: ubuntu-latest
40 |
41 | steps:
42 | - uses: actions/checkout@v3
43 | - name: Set up settings.xml for GitHub Packages
44 | uses: actions/setup-java@v3
45 | with:
46 | distribution: 'temurin'
47 | java-version: 11
48 | cache: 'maven'
49 | server-id: sonatype-nexus-snapshots
50 | server-username: MAVEN_USERNAME
51 | server-password: MAVEN_PASSWORD
52 | - name: Publish SNAPSHOT version Maven Central
53 | run: mvn -B --no-transfer-progress deploy -DskipTests
54 | env:
55 | MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
56 | MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
57 |
--------------------------------------------------------------------------------
/.github/workflows/dockerhub-push.yml:
--------------------------------------------------------------------------------
1 | # Adapted from https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
2 |
3 | name: Publish Docker image
4 |
5 | env:
6 | TITLE: "52°North SensorThingsAPI"
7 | VENDOR: "52°North GmbH"
8 | AUTHORS: "https://github.com/52North/sensorweb-server-sta/graphs/contributors"
9 | DESCRIPTION: "Implementation of the OGC SensorThings API Part I: Sensing Version 1.1 (18-088)"
10 |
11 | on:
12 | push:
13 | tags:
14 | - 'v*'
15 |
16 | jobs:
17 | push_to_registry:
18 | name: Push Docker image to Docker Hub
19 | runs-on: ubuntu-latest
20 | steps:
21 | - name: Checkout Repository
22 | uses: actions/checkout@v3
23 |
24 | - name: Set up Docker Buildkit env
25 | uses: docker/setup-buildx-action@v2
26 |
27 | - name: Extract metadata (tags, labels) for tagging Docker Image
28 | id: meta
29 | uses: docker/metadata-action@v4
30 | with:
31 | images: 52north/sensorweb-server-sta
32 | labels: |
33 | - org.opencontainers.image.authors=$AUTHORS
34 | - org.opencontainers.image.vendor=$VENDOR
35 | - org.opencontainers.image.description=$DESCRIPTION
36 | - org.opencontainers.image.title=$TITLE
37 | - name: Log in to Docker Hub
38 | if: github.event_name != 'pull_request'
39 | uses: docker/login-action@v2
40 | with:
41 | username: ${{ secrets.DOCKER_USERNAME }}
42 | password: ${{ secrets.DOCKER_TOKEN }}
43 |
44 | - name: Build and push Docker image
45 | uses: docker/build-push-action@v4
46 | with:
47 | context: .
48 | push: ${{ github.event_name != 'pull_request' }}
49 | tags: ${{ steps.meta.outputs.tags }}
50 | labels: ${{ steps.meta.outputs.labels }}
51 |
--------------------------------------------------------------------------------
/STATISTICS.md:
--------------------------------------------------------------------------------
1 | # Downloads
2 |
3 | ## Docker
4 |
5 | [](https://hub.docker.com/r/52north/sensorweb-server-sta)
6 |
7 | ## Releases
8 |
9 | ### 2.2.x
10 |
11 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v2.2.1)
12 |
13 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v2.2.0)
14 |
15 | ### 2.1.x
16 |
17 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v2.1.2)
18 |
19 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v2.1.1)
20 |
21 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v2.1.0)
22 |
23 | ### 2.0.x
24 |
25 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v2.0.2)
26 |
27 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v2.0.1)
28 |
29 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v2.0.0)
30 |
31 | ### 1.0.x
32 |
33 | [](https://github.com/52North/sensorweb-server-sta/releases/tag/v1.0.0)
34 |
35 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/OfferingRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.OfferingEntity;
32 | import org.springframework.stereotype.Repository;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | @Repository
36 | @Transactional
37 | public interface OfferingRepository extends IdentifierNameRepository {
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/LocationEncodingRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.FormatEntity;
32 | import org.springframework.stereotype.Repository;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | @Transactional
36 | @Repository
37 | public interface LocationEncodingRepository extends EntityGraphRepository {
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/mqtt/src/main/java/org/n52/sta/mqtt/MqttHandlerException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.mqtt;
30 |
31 | /**
32 | * @author Sebastian Drost
33 | */
34 | public class MqttHandlerException extends Exception {
35 |
36 | public MqttHandlerException(String message) {
37 | super(message);
38 | }
39 |
40 | public MqttHandlerException(String message, Throwable cause) {
41 | super(message, cause);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/dao-postgres/src/test/java/org/n52/sta/ApplicationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | //package org.n52.sta;
30 | //
31 | //import org.junit.Test;
32 | //import org.junit.runner.RunWith;
33 | //import org.springframework.boot.test.context.SpringBootTest;
34 | //import org.springframework.test.context.junit4.SpringRunner;
35 | //
36 | //@RunWith(SpringRunner.class)
37 | //@SpringBootTest
38 | //public class ApplicationTests {
39 | //
40 | // @Test
41 | // public void contextLoads() {
42 | // }
43 | //
44 | //}
45 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/AbstractStaRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.springframework.data.repository.NoRepositoryBean;
32 | import org.springframework.transaction.annotation.Transactional;
33 |
34 | /**
35 | * @author Jan Speckamp
36 | */
37 | @NoRepositoryBean
38 | @Transactional
39 | public interface AbstractStaRepository extends StaIdentifierRepository {
40 |
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/HistoricalLocationRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.sta.HistoricalLocationEntity;
32 | import org.springframework.transaction.annotation.Transactional;
33 |
34 | /**
35 | * @author Jan Speckamp
36 | */
37 | @Transactional
38 | public interface HistoricalLocationRepository extends AbstractStaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/mqtt/src/main/java/org/n52/sta/mqtt/vanilla/MqttPublishMessageHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.mqtt.vanilla;
30 |
31 | import io.moquette.interception.messages.InterceptPublishMessage;
32 | import org.n52.sta.api.RequestUtils;
33 | import org.n52.sta.api.dto.StaDTO;
34 |
35 | /**
36 | * @author Jan Speckamp
37 | */
38 | public interface MqttPublishMessageHandler extends RequestUtils {
39 |
40 | void processPublishMessage(InterceptPublishMessage msg);
41 | }
42 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/ThingRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.PlatformEntity;
32 | import org.springframework.stereotype.Repository;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | /**
36 | * @author Jan Speckamp
37 | */
38 | @Transactional
39 | @Repository
40 | public interface ThingRepository extends NameRepository {
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/ProcedureHistoryRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.ProcedureHistoryEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface ProcedureHistoryRepository extends JpaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/EntityServiceFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api;
30 |
31 | /**
32 | * @author Jan Speckamp
33 | */
34 | public interface EntityServiceFactory {
35 |
36 | /**
37 | * Provides an entity data service for a entity type
38 | *
39 | * @param entityTypeName the type name of the requested entity service
40 | * @return the requested entity data service
41 | */
42 | AbstractSensorThingsEntityService> getEntityService(String entityTypeName);
43 | }
44 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/FormatRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.FormatEntity;
32 | import org.springframework.stereotype.Repository;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | @Transactional
36 | @Repository
37 | public interface FormatRepository extends EntityGraphRepository {
38 |
39 | boolean existsByFormat(String format);
40 |
41 | FormatEntity findByFormat(String format);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/IdentifierNameRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.DescribableEntity;
32 | import org.springframework.data.repository.NoRepositoryBean;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | @NoRepositoryBean
36 | @Transactional
37 | public interface IdentifierNameRepository
38 | extends IdentifierRepository {
39 |
40 | boolean existsByName(String name);
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/DatastreamParameterRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.parameter.dataset.DatasetParameterEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface DatastreamParameterRepository extends JpaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/LocationParameterRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.parameter.location.LocationParameterEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface LocationParameterRepository extends JpaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/PlatformParameterRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.parameter.platform.PlatformParameterEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface PlatformParameterRepository extends JpaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/ProcedureParameterRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.parameter.procedure.ProcedureParameterEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface ProcedureParameterRepository extends JpaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/PhenomenonParameterRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.parameter.phenomenon.PhenomenonParameterEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface PhenomenonParameterRepository extends JpaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/FeatureOfInterestParameterRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.parameter.feature.FeatureParameterEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface FeatureOfInterestParameterRepository extends JpaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/ObservationParameterRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.parameter.observation.ObservationParameterEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface ObservationParameterRepository extends JpaRepository {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/FeatureOfInterestRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.AbstractFeatureEntity;
32 | import org.springframework.stereotype.Repository;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | @Transactional
36 | @Repository
37 | public interface FeatureOfInterestRepository extends IdentifierNameRepository>,
38 | StaIdentifierRepository> {
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/org/n52/sta/VanillaLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 |
30 | package org.n52.sta;
31 |
32 | import org.springframework.context.annotation.ComponentScan;
33 | import org.springframework.context.annotation.Configuration;
34 | import org.springframework.context.annotation.Profile;
35 |
36 | /**
37 | * @author Jan Speckamp
38 | */
39 | @Profile("vanilla")
40 | @Configuration
41 | @ComponentScan(basePackages = {
42 | "org.n52.sta.http.vanilla",
43 | "org.n52.sta.mqtt.vanilla",
44 | "org.n52.sta.data.vanilla",
45 | })
46 | public class VanillaLoader {
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/PhenomenonRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.PhenomenonEntity;
32 | import org.springframework.context.annotation.DependsOn;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @DependsOn("DatastreamRepository")
38 | @Repository
39 | public interface PhenomenonRepository
40 | extends IdentifierNameRepository, StaIdentifierRepository {
41 |
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/NameRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.HibernateRelations;
32 | import org.springframework.data.repository.NoRepositoryBean;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | import java.util.Optional;
36 |
37 | @NoRepositoryBean
38 | @Transactional
39 | public interface NameRepository extends AbstractStaRepository {
40 |
41 | boolean existsByName(String name);
42 |
43 | Optional findByName(String name);
44 | }
45 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/CategoryRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.CategoryEntity;
32 | import org.springframework.stereotype.Repository;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | import java.util.Optional;
36 |
37 | @Transactional
38 | @Repository
39 | public interface CategoryRepository extends EntityGraphRepository {
40 |
41 | boolean existsByIdentifier(String identifier);
42 |
43 | Optional findByIdentifier(String identifier);
44 | }
45 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/LocationRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.sta.LocationEntity;
32 | import org.springframework.stereotype.Repository;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | import java.util.Set;
36 |
37 | /**
38 | * @author Jan Speckamp
39 | */
40 | @Transactional
41 | @Repository
42 | public interface LocationRepository extends NameRepository {
43 |
44 | Set findAllByPlatformsIdEquals(Long id);
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/ProcedureRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.ProcedureEntity;
32 | import org.springframework.context.annotation.DependsOn;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @DependsOn("DatastreamRepository")
38 | @Repository
39 | public interface ProcedureRepository extends IdentifierNameRepository,
40 | StaIdentifierRepository {
41 | }
42 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/serdes/json/JSONSensorVariableEncoding.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.serdes.json;
30 |
31 |
32 | /**
33 | * Extends the STA Standard spec by allowing more diverse encodingTypes (e.g. html links) for Sensors
34 | *
35 | * @author Jan Speckamp
36 | */
37 | public class JSONSensorVariableEncoding extends JSONSensor {
38 |
39 | public JSONSensorVariableEncoding() {
40 | super();
41 | }
42 |
43 | /**
44 | * We skip validating the encodingType
45 | */
46 | @Override
47 | protected void handleEncodingType() {
48 | self.setEncodingType(encodingType);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/http/src/main/java/org/n52/sta/http/MvcConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.http;
30 |
31 | import org.springframework.context.annotation.Configuration;
32 | import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
33 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
34 |
35 | /**
36 | * @author Jan Speckamp
37 | */
38 | @Configuration
39 | public class MvcConfiguration implements WebMvcConfigurer {
40 |
41 | @Override
42 | public void configurePathMatch(PathMatchConfigurer configurer) {
43 | configurer.setUrlPathHelper(new CustomUrlPathHelper());
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/StaDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | import org.n52.shetland.oasis.odata.query.option.QueryOptions;
32 |
33 | import java.util.Map;
34 | import java.util.Set;
35 |
36 | /**
37 | * @author Jan Speckamp
38 | */
39 | public interface StaDTO {
40 |
41 | String getId();
42 |
43 | void setId(String id);
44 |
45 | QueryOptions getQueryOptions();
46 |
47 | void setAndParseQueryOptions(QueryOptions qo);
48 |
49 | Set getFieldsToSerialize();
50 |
51 | Map getFieldsToExpand();
52 |
53 | boolean hasSelectOption();
54 |
55 | boolean hasExpandOption();
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/DatastreamRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.AbstractDatasetEntity;
32 | import org.springframework.stereotype.Repository;
33 | import org.springframework.transaction.annotation.Transactional;
34 |
35 | import java.util.Set;
36 |
37 | /**
38 | * @author Jan Speckamp
39 | */
40 | @Transactional
41 | @Repository
42 | public interface DatastreamRepository
43 | extends NameRepository, StaIdentifierRepository {
44 |
45 | Set findAllByAggregationId(Long id);
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/http/src/test/java/org/n52/sta/http/STARequestUtilsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.http;
30 |
31 | public class STARequestUtilsTest {
32 |
33 | /*
34 | @Test
35 | public void identifiedByDatastreamRegex() {
36 | Assertions.("Datastreams(?:\\()['\\-0-9a-zA-Z]+(?:\\))/(Sensor|ObservedProperty|Thing|Observations)",
37 | STARequestUtils.IDENTIFIED_BY_DATASTREAM_REGEX);
38 | }
39 |
40 | @Test
41 | public void entityIdentifiedByDatastreamPath() {
42 | assertEquals("{entity:Datastreams(?:\\()['\\-0-9a-zA-Z]+(?:\\))}/{target:Sensor|ObservedProperty|Thing}",
43 | STARequestUtils.ENTITY_IDENTIFIED_BY_DATASTREAM_PATH_VARIABLE);
44 | }
45 | */
46 | }
47 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/HistoricalLocationDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | import org.n52.shetland.ogc.gml.time.Time;
32 |
33 | import java.util.Set;
34 |
35 | /**
36 | * Data Transfer Object for handling a HistoricalLocation as specified in 18-088 OGC SensorThingsAPI Part I Section
37 | * 8.2.3
38 | *
39 | * @author Jan Speckamp
40 | */
41 | public interface HistoricalLocationDTO extends StaDTO {
42 |
43 | Time getTime();
44 |
45 | void setTime(Time time);
46 |
47 | Set getLocations();
48 |
49 | void setLocations(Set locations);
50 |
51 | ThingDTO getThing();
52 |
53 | void setThing(ThingDTO thing);
54 | }
55 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/DaoSemaphore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla;
30 |
31 | import org.springframework.beans.factory.annotation.Value;
32 | import org.springframework.stereotype.Service;
33 |
34 | import java.util.concurrent.Semaphore;
35 |
36 | /**
37 | * Semaphore controlling access to the Persistence Service Layer. The Persistence Layer can currently only handle as
38 | * many running threads as there are database connections available, as each thread uses a separate Transaction.
39 | *
40 | * @author Jan Speckamp
41 | */
42 | @Service
43 | public class DaoSemaphore extends Semaphore {
44 |
45 | public DaoSemaphore(@Value("${spring.datasource.hikari.maximum-pool-size:10}") int permits) {
46 | super(permits, true);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/serdes/json/AbstractJSONEntity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.serdes.json;
30 |
31 | public interface AbstractJSONEntity {
32 |
33 | String INVALID_REFERENCED_ENTITY =
34 | "Cannot parse as Reference: Only @iot.id may be present when referencing an existing entity!";
35 |
36 | String INVALID_INLINE_ENTITY_MISSING =
37 | "Cannot parse Entity: Not all required properties present! Missing: ";
38 |
39 | String INVALID_INLINE_ENTITY_INVALID_VALUE =
40 | "Invalid Entity. Invalid Value: ";
41 |
42 | String INVALID_BACKREFERENCE =
43 | "Invalid nesting of Entities!";
44 |
45 | String INVALID_DUPLICATE_REFERENCE =
46 | "Duplicate references to related Entity provided! Either specify reference to related Entity in JSON " +
47 | "Payload OR inside Request URL";
48 | }
49 |
--------------------------------------------------------------------------------
/mqtt/src/main/java/org/n52/sta/mqtt/vanilla/MqttSubscriptionEventHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.mqtt.vanilla;
30 |
31 | import io.moquette.broker.Server;
32 | import io.moquette.interception.messages.InterceptSubscribeMessage;
33 | import io.moquette.interception.messages.InterceptUnsubscribeMessage;
34 | import org.n52.sta.api.RequestUtils;
35 | import org.n52.sta.api.STAEventHandler;
36 | import org.n52.sta.mqtt.MqttHandlerException;
37 |
38 | /**
39 | * @author Jan Speckamp
40 | */
41 | public interface MqttSubscriptionEventHandler extends RequestUtils, STAEventHandler {
42 |
43 | void processSubscribeMessage(InterceptSubscribeMessage msg) throws MqttHandlerException;
44 |
45 | void processUnsubscribeMessage(InterceptUnsubscribeMessage msg) throws MqttHandlerException;
46 |
47 | void setMqttBroker(Server mqttBroker);
48 | }
49 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/ObservationRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.DataEntity;
32 | import org.springframework.context.annotation.DependsOn;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | import java.util.Set;
37 |
38 | @Transactional
39 | @DependsOn("DatastreamRepository")
40 | @Repository
41 | public interface ObservationRepository>
42 | extends IdentifierRepository, StaIdentifierRepository {
43 |
44 | DataEntity findFirstByDataset_idOrderBySamplingTimeStartAsc(Long datasetIdentifier);
45 |
46 | DataEntity findFirstByDataset_idOrderBySamplingTimeEndDesc(Long datasetIdentifier);
47 |
48 | void deleteAllByDatasetIdIn(Set datasetId);
49 | }
50 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/UnitRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.n52.series.db.beans.UnitEntity;
32 | import org.springframework.data.jpa.repository.JpaRepository;
33 | import org.springframework.stereotype.Repository;
34 | import org.springframework.transaction.annotation.Transactional;
35 |
36 | @Transactional
37 | @Repository
38 | public interface UnitRepository extends JpaRepository, EntityGraphRepository {
39 |
40 | boolean existsByIdentifier(String identifier);
41 |
42 | UnitEntity findByIdentifier(String identifier);
43 |
44 | default boolean existsBySymbol(String symbol) {
45 | return existsByIdentifier(symbol);
46 | }
47 |
48 | default UnitEntity findBySymbol(String symbol) {
49 | return findByIdentifier(symbol);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/SpringApplicationContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta;
30 |
31 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
32 | import org.springframework.beans.BeansException;
33 | import org.springframework.context.ApplicationContext;
34 | import org.springframework.context.ApplicationContextAware;
35 | import org.springframework.stereotype.Component;
36 |
37 | /**
38 | * Wrapper to always return a reference to the Spring Application Context from
39 | **/
40 | @Component
41 | public class SpringApplicationContext implements ApplicationContextAware {
42 |
43 | private static ApplicationContext CONTEXT;
44 |
45 | public static Object getBean(Class> bean) {
46 | return CONTEXT.getBean(bean);
47 | }
48 |
49 | @Override
50 | @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
51 | public void setApplicationContext(ApplicationContext context) throws BeansException {
52 | CONTEXT = context;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/VersionInfoConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta;
30 |
31 | import org.springframework.context.annotation.Bean;
32 | import org.springframework.context.annotation.Configuration;
33 | import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
34 | import org.springframework.core.io.ClassPathResource;
35 |
36 | /**
37 | *
38 | * TODO: javadoc
39 | *
40 | * @author Jan Speckamp
41 | */
42 | @Configuration
43 | public class VersionInfoConfig {
44 |
45 | @Bean
46 | public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
47 | PropertySourcesPlaceholderConfigurer propsConfig
48 | = new PropertySourcesPlaceholderConfigurer();
49 | propsConfig.setLocation(new ClassPathResource("git.properties"));
50 | propsConfig.setIgnoreResourceNotFound(true);
51 | propsConfig.setIgnoreUnresolvablePlaceholders(true);
52 | return propsConfig;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/ObservedPropertyDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 |
33 | import java.util.Set;
34 |
35 | /**
36 | * Data Transfer Object for handling an ObservedProperty as specified in 18-088 OGC SensorThingsAPI Part I Section 8.2.6
37 | *
38 | * @author Jan Speckamp
39 | */
40 | public interface ObservedPropertyDTO extends StaDTO {
41 |
42 | String getName();
43 |
44 | void setName(String name);
45 |
46 | String getDescription();
47 |
48 | void setDescription(String description);
49 |
50 | String getDefinition();
51 |
52 | void setDefinition(String definition);
53 |
54 | ObjectNode getProperties();
55 |
56 | void setProperties(ObjectNode properties);
57 |
58 | Set getDatastreams();
59 |
60 | void setDatastreams(Set datastreams);
61 |
62 | void addDatastreams(DatastreamDTO datastream);
63 | }
64 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/SensorDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 |
33 | import java.util.Set;
34 |
35 | /**
36 | * Data Transfer Object for handling a Sensor as specified in 18-088 OGC SensorThingsAPI Part I Section 8.2.5
37 | *
38 | * @author Jan Speckamp
39 | */
40 | public interface SensorDTO extends StaDTO {
41 |
42 | String getName();
43 |
44 | void setName(String name);
45 |
46 | String getDescription();
47 |
48 | void setDescription(String description);
49 |
50 | String getEncodingType();
51 |
52 | void setEncodingType(String encodingType);
53 |
54 | String getMetadata();
55 |
56 | void setMetadata(String metadata);
57 |
58 | ObjectNode getProperties();
59 |
60 | void setProperties(ObjectNode properties);
61 |
62 | Set getDatastreams();
63 |
64 | void setDatastreams(Set datastreams);
65 |
66 | void addDatastream(DatastreamDTO datastream);
67 | }
68 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/FeatureOfInterestDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 | import org.locationtech.jts.geom.Geometry;
33 |
34 | import java.util.Set;
35 |
36 | /**
37 | * Data Transfer Object for handling a FeatureOfInterest as specified in 18-088 OGC SensorThingsAPI Part I Section 8.2.8
38 | *
39 | * @author Jan Speckamp
40 | */
41 | public interface FeatureOfInterestDTO extends StaDTO {
42 |
43 | String getName();
44 |
45 | void setName(String name);
46 |
47 | String getDescription();
48 |
49 | void setDescription(String description);
50 |
51 | String getEncodingType();
52 |
53 | void setEncodingType(String encodingType);
54 |
55 | Geometry getFeature();
56 |
57 | void setFeature(Geometry feature);
58 |
59 | ObjectNode getProperties();
60 |
61 | void setProperties(ObjectNode properties);
62 |
63 | Set getObservations();
64 |
65 | void setObservations(Set observations);
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/org/n52/sta/UFZAggregataLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 |
30 | package org.n52.sta;
31 |
32 | import org.springframework.context.annotation.ComponentScan;
33 | import org.springframework.context.annotation.Configuration;
34 | import org.springframework.context.annotation.FilterType;
35 | import org.springframework.context.annotation.Profile;
36 |
37 | /**
38 | * @author Jan Speckamp
39 | */
40 | @Profile("ufzaggregata")
41 | @Configuration
42 | @ComponentScan(
43 | excludeFilters = {
44 | @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*service.ObservationService.*")
45 | },
46 | basePackages = {
47 | "org.n52.sta.http.vanilla",
48 | "org.n52.sta.mqtt.vanilla",
49 | "org.n52.sta.data.vanilla",
50 | "org.n52.sta.data.ufzaggregata"
51 | })
52 | public class UFZAggregataLoader {
53 |
54 | // Loads the basic vanilla profile excluding the default ObservationService Implementation
55 | // an alternate ObservationService Implementation is provided by
56 | // org.n52.sta.data.ufzaggregata.UfzAggregataObservationService
57 | }
58 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/query/SpatialQuerySpecifications.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.query;
30 |
31 | import org.n52.sta.data.vanilla.service.util.HibernateSpatialCriteriaBuilder;
32 | import org.n52.svalbard.odata.core.expr.GeoValueExpr;
33 | import org.springframework.data.jpa.domain.Specification;
34 |
35 | import javax.persistence.criteria.Expression;
36 | import javax.persistence.criteria.Root;
37 |
38 | /**
39 | * Interface providing functions for handling spatial
40 | *
41 | * @author Jan Speckamp
42 | */
43 | public interface SpatialQuerySpecifications {
44 |
45 | Specification handleGeoSpatialPropertyFilter(
46 | String propertyName,
47 | String spatialFunctionName,
48 | String... arguments);
49 |
50 | Expression handleGeospatial(GeoValueExpr expr,
51 | String spatialFunctionName,
52 | String argument,
53 | HibernateSpatialCriteriaBuilder builder,
54 | Root root);
55 | }
56 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/ThingDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 |
33 | import java.util.Set;
34 |
35 | /**
36 | * Data Transfer Object for handling a Thing as specified in 18-088 OGC SensorThingsAPI Part I Section 8.2.1
37 | *
38 | * @author Jan Speckamp
39 | */
40 | public interface ThingDTO extends StaDTO {
41 |
42 | String getName();
43 |
44 | void setName(String name);
45 |
46 | String getDescription();
47 |
48 | void setDescription(String description);
49 |
50 | ObjectNode getProperties();
51 |
52 | void setProperties(ObjectNode properties);
53 |
54 | Set getHistoricalLocations();
55 |
56 | void setHistoricalLocations(Set historicalLocations);
57 |
58 | void addHistoricalLocation(HistoricalLocationDTO historicalLocation);
59 |
60 | Set getLocations();
61 |
62 | void setLocations(Set locations);
63 |
64 | void addLocations(LocationDTO location);
65 |
66 | Set getDatastream();
67 |
68 | void setDatastreams(Set datastream);
69 | }
70 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/impl/HistoricalLocation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto.impl;
30 |
31 | import org.n52.shetland.ogc.gml.time.Time;
32 | import org.n52.sta.api.dto.HistoricalLocationDTO;
33 | import org.n52.sta.api.dto.LocationDTO;
34 | import org.n52.sta.api.dto.ThingDTO;
35 |
36 | import java.util.Set;
37 |
38 | /**
39 | * @author Jan Speckamp
40 | */
41 | public class HistoricalLocation extends Entity implements HistoricalLocationDTO {
42 |
43 | private Time time;
44 |
45 | private Set locations;
46 |
47 | private ThingDTO thing;
48 |
49 | @Override public Time getTime() {
50 | return time;
51 | }
52 |
53 | public void setTime(Time time) {
54 | this.time = time;
55 | }
56 |
57 | @Override public Set getLocations() {
58 | return locations;
59 | }
60 |
61 | @Override public void setLocations(Set locations) {
62 | this.locations = locations;
63 | }
64 |
65 | @Override public ThingDTO getThing() {
66 | return thing;
67 | }
68 |
69 | public void setThing(ThingDTO thing) {
70 | this.thing = thing;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/LocationDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 | import org.locationtech.jts.geom.Geometry;
33 |
34 | import java.util.Set;
35 |
36 | /**
37 | * Data Transfer Object for handling a Location as specified in 18-088 OGC SensorThingsAPI Part I Section 8.2.2
38 | *
39 | * @author Jan Speckamp
40 | */
41 | public interface LocationDTO extends StaDTO {
42 |
43 | String getName();
44 |
45 | void setName(String name);
46 |
47 | String getDescription();
48 |
49 | void setDescription(String description);
50 |
51 | String getEncodingType();
52 |
53 | Geometry getGeometry();
54 |
55 | void setGeometry(Geometry geometry);
56 |
57 | ObjectNode getProperties();
58 |
59 | void setProperties(ObjectNode properties);
60 |
61 | void addHistoricalLocation(HistoricalLocationDTO historicalLocations);
62 |
63 | Set getHistoricalLocations();
64 |
65 | void setHistoricalLocations(Set historicalLocations);
66 |
67 | Set getThings();
68 |
69 | void setThings(Set things);
70 | }
71 |
--------------------------------------------------------------------------------
/http/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | org.n52.sensorweb-server.sta
6 | sta-parent
7 | 4.0.0-SNAPSHOT
8 |
9 | sta-http
10 | jar
11 |
12 |
13 |
14 | ${project.groupId}
15 | sta-dao
16 |
17 |
18 |
19 | org.springframework
20 | spring-core
21 |
22 |
23 | org.springframework
24 | spring-web
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-web
29 |
30 |
31 | org.springframework
32 | spring-context
33 |
34 |
35 | org.springframework
36 | spring-beans
37 |
38 |
39 |
40 | javax.servlet
41 | javax.servlet-api
42 |
43 |
44 | org.n52.arctic-sea
45 | shetland
46 |
47 |
48 | org.n52.arctic-sea
49 | svalbard-odata
50 |
51 |
52 | com.fasterxml.jackson.core
53 | jackson-core
54 |
55 |
56 | org.n52.sensorweb-server.db-model
57 | db-model-entities
58 |
59 |
60 |
61 | org.antlr
62 | antlr4-runtime
63 | runtime
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/app/src/main/java/org/n52/sta/Application.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 |
30 | package org.n52.sta;
31 |
32 | import org.springframework.boot.SpringApplication;
33 | import org.springframework.boot.autoconfigure.SpringBootApplication;
34 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
35 | import org.springframework.context.annotation.ComponentScan;
36 | import org.springframework.context.annotation.FilterType;
37 | import org.springframework.scheduling.annotation.EnableAsync;
38 |
39 | @SpringBootApplication
40 | @EnableConfigurationProperties
41 | @EnableAsync
42 | @SuppressWarnings("uncommentedmain")
43 | @ComponentScan(excludeFilters = {
44 | @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*vanilla.*"),
45 | @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*citsci.*"),
46 | @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*ufzaggregata.*")
47 | }
48 | )
49 | public class Application {
50 |
51 | static {
52 | String TRUE = "true";
53 | System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow", "%");
54 | System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", TRUE);
55 | System.setProperty("org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH", TRUE);
56 | }
57 |
58 | public static void main(String[] args) {
59 | SpringApplication.run(Application.class, args);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/IdentifierRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.springframework.data.repository.NoRepositoryBean;
32 | import org.springframework.transaction.annotation.Transactional;
33 |
34 | import java.util.Optional;
35 |
36 | @NoRepositoryBean
37 | @Transactional
38 | public interface IdentifierRepository extends EntityGraphRepository {
39 |
40 | /**
41 | * Checks whether Entity with given id exists.
42 | *
43 | * @param identifier Identifier of the Entity
44 | * @return true if Entity exists. false otherwise
45 | */
46 | boolean existsByIdentifier(String identifier);
47 |
48 | /**
49 | * Finds Entity by identifier. Fetches Entity and all related Entities given by EntityGraphs
50 | *
51 | * @param identifier Identifier of the wanted Entity
52 | * @param relatedEntities EntityGraphs describing related Entities to be fetched. All graphs are merged into one
53 | * graph internally. may be null.
54 | * @return Entity found in Database. Optional.empty() otherwise
55 | */
56 | Optional findByIdentifier(String identifier, FetchGraph... relatedEntities);
57 |
58 | /**
59 | * Deletes Entity with given Identifier
60 | *
61 | * @param identifier Identifier of the Entity
62 | */
63 | void deleteByIdentifier(String identifier);
64 | }
65 |
--------------------------------------------------------------------------------
/dao/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | sta-parent
5 | org.n52.sensorweb-server.sta
6 | 4.0.0-SNAPSHOT
7 |
8 | 4.0.0
9 |
10 | sta-dao
11 | API to access STA Persistence Layer
12 |
13 |
14 |
15 | org.n52.arctic-sea
16 | shetland
17 |
18 |
19 |
20 | org.springframework.boot
21 | spring-boot-autoconfigure
22 |
23 |
24 | org.springframework
25 | spring-beans
26 |
27 |
28 | org.springframework
29 | spring-core
30 |
31 |
32 | org.springframework
33 | spring-context
34 |
35 |
36 | org.springframework
37 | spring-web
38 |
39 |
40 |
41 | com.fasterxml.jackson.core
42 | jackson-core
43 |
44 |
45 | com.fasterxml.jackson.core
46 | jackson-databind
47 |
48 |
49 | com.fasterxml.jackson.module
50 | jackson-module-afterburner
51 |
52 |
53 |
54 | org.locationtech.jts
55 | jts-core
56 |
57 |
58 | org.locationtech.jts.io
59 | jts-io-common
60 |
61 |
62 |
63 | com.github.spotbugs
64 | spotbugs-annotations
65 | true
66 |
67 |
68 | org.n52.arctic-sea
69 | svalbard-odata
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/STAEventHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api;
30 |
31 | import org.n52.sta.api.dto.StaDTO;
32 | import org.springframework.scheduling.annotation.Async;
33 |
34 | import java.util.Map;
35 | import java.util.Set;
36 |
37 | /**
38 | * Interface to be implemented by Handlers responding to Entity Creation (e.g. Handler for MQTT Subscription).
39 | *
40 | * @author Jan Speckamp
41 | */
42 | public interface STAEventHandler {
43 |
44 | /**
45 | * Handles a Create/Update Event emitted by the Database.
46 | *
47 | * @param entity base entity
48 | * @param entityType java class name of entity
49 | * @param differenceMap names of properties that changed. null if all properties changed (e.g. new entity)
50 | * @param relatedCollections List of related Collections
51 | */
52 | @Async
53 | void handleEvent(StaDTO entity,
54 | String entityType,
55 | Set differenceMap,
56 | Map> relatedCollections);
57 |
58 | /**
59 | * Lists all Entity types that are monitored by this Handler. Directly matched with getJavaType().getName().
60 | *
61 | * @return Set of all watched Entity Types. Empty if Handler is inactive.
62 | */
63 | Set getWatchedEntityTypes();
64 |
65 | void setServiceRepository(EntityServiceFactory serviceRepository);
66 | }
67 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/ObservationDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 | import org.n52.shetland.ogc.gml.time.Time;
33 |
34 | /**
35 | * Data Transfer Object for handling an Observation as specified in 18-088 OGC SensorThingsAPI Part I Section 8.2.7
36 | *
37 | * @author Jan Speckamp
38 | */
39 | public interface ObservationDTO extends StaDTO {
40 |
41 | Time getPhenomenonTime();
42 |
43 | void setPhenomenonTime(Time phenomenonTimeEnd);
44 |
45 | Time getResultTime();
46 |
47 | void setResultTime(Time resultTime);
48 |
49 | Object getResult();
50 |
51 | void setResult(Object result);
52 |
53 | /**
54 | * It is currently unclear what this element actually contains, so it is omitted for now.
55 | * See: https://github.com/opengeospatial/sensorthings/issues/68
56 | *
57 | * @return DQ_Element
58 | */
59 | default Object getResultQuality() {
60 | return null;
61 | }
62 |
63 | Time getValidTime();
64 |
65 | void setValidTime(Time validTime);
66 |
67 | ObjectNode getParameters();
68 |
69 | void setParameters(ObjectNode parameters);
70 |
71 | FeatureOfInterestDTO getFeatureOfInterest();
72 |
73 | void setFeatureOfInterest(FeatureOfInterestDTO featureOfInterest);
74 |
75 | DatastreamDTO getDatastream();
76 |
77 | void setDatastream(DatastreamDTO datastream);
78 | }
79 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/CollectionWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api;
30 |
31 | import org.n52.sta.api.dto.StaDTO;
32 |
33 | import java.util.List;
34 |
35 | /**
36 | * @author Jan Speckamp
37 | */
38 | public class CollectionWrapper {
39 |
40 | /**
41 | * Count of total entities. Value -1 indicates that $count=true was not included in the url and is therefore not
42 | * returned by the API
43 | */
44 | private final long totalEntityCount;
45 |
46 | private final List extends StaDTO> entities;
47 |
48 | private final boolean hasNextPage;
49 |
50 | private String requestURL;
51 |
52 | public CollectionWrapper(long entityCount,
53 | List extends StaDTO> entity,
54 | boolean hasNextPage) {
55 | this.totalEntityCount = entityCount;
56 | this.entities = entity;
57 | this.hasNextPage = hasNextPage;
58 | }
59 |
60 | public long getTotalEntityCount() {
61 | return totalEntityCount;
62 | }
63 |
64 | public List extends StaDTO> getEntities() {
65 | return entities;
66 | }
67 |
68 | public boolean hasNextPage() {
69 | return hasNextPage;
70 | }
71 |
72 | public String getRequestURL() {
73 | return requestURL;
74 | }
75 |
76 | public CollectionWrapper setRequestURL(String requestURL) {
77 | this.requestURL = requestURL;
78 | return this;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/webapp/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 | ${logFile}.log
20 |
21 |
22 | return message.contains("HHH90000022") || message.contains("HHH000179");
23 |
24 | NEUTRAL
25 | DENY
26 |
27 |
28 |
29 | ${logFile}/%d{yyyy-MM-dd}-%i.log
30 |
31 | ${config.logger.history.max}
32 |
33 | ${config.logger.maxFileSize}
34 |
35 |
36 |
37 | %date %level [%thread] [%file:%line] %msg%n
38 |
39 |
40 |
41 |
42 |
43 |
44 | return message.contains("HHH90000022") || message.contains("HHH000179");
45 |
46 | NEUTRAL
47 | DENY
48 |
49 |
50 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} - %msg%n
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/service/CategoryService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.service;
30 |
31 | import org.n52.series.db.beans.CategoryEntity;
32 | import org.n52.sta.data.vanilla.repositories.CategoryRepository;
33 | import org.slf4j.Logger;
34 | import org.slf4j.LoggerFactory;
35 | import org.springframework.context.annotation.DependsOn;
36 | import org.springframework.stereotype.Component;
37 | import org.springframework.transaction.annotation.Propagation;
38 | import org.springframework.transaction.annotation.Transactional;
39 |
40 | /**
41 | * @author Jan Speckamp
42 | */
43 | @Component
44 | @DependsOn({"springApplicationContext"})
45 | @Transactional(propagation = Propagation.REQUIRES_NEW)
46 | public class CategoryService {
47 |
48 | public static final String DEFAULT_CATEGORY = "DEFAULT_STA_CATEGORY";
49 |
50 | private static final Logger logger = LoggerFactory.getLogger(CategoryService.class);
51 |
52 | public CategoryService(CategoryRepository categoryRepository) {
53 | if (!categoryRepository.existsByIdentifier(DEFAULT_CATEGORY)) {
54 | CategoryEntity category = new CategoryEntity();
55 | category.setIdentifier(DEFAULT_CATEGORY);
56 | category.setName(DEFAULT_CATEGORY);
57 | category.setDescription("Default STA category");
58 | logger.debug("Persisting default CategoryEntity: " + category.getName());
59 | categoryRepository.save(category);
60 | }
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/webapp/src/main/java/org/n52/sta/webapp/Application.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.webapp;
30 |
31 | import org.n52.sta.data.vanilla.repositories.MessageBusRepository;
32 | import org.springframework.boot.SpringApplication;
33 | import org.springframework.boot.autoconfigure.SpringBootApplication;
34 | import org.springframework.boot.builder.SpringApplicationBuilder;
35 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
36 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
37 | import org.springframework.context.annotation.ComponentScan;
38 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
39 | import org.springframework.scheduling.annotation.EnableAsync;
40 | import org.springframework.transaction.annotation.EnableTransactionManagement;
41 |
42 | @SpringBootApplication
43 | @EnableJpaRepositories(repositoryBaseClass = MessageBusRepository.class,
44 | basePackages = {"org.n52.series.db"})
45 | @EnableConfigurationProperties
46 | @EnableAsync
47 | @ComponentScan(basePackages = {"org.n52.series.db", "org.n52.sta"})
48 | @EnableTransactionManagement
49 | @SuppressWarnings("uncommentedmain")
50 | public class Application extends SpringBootServletInitializer {
51 |
52 | public static void main(String[] args) throws Exception {
53 | SpringApplication.run(Application.class, args);
54 | }
55 |
56 | @Override
57 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
58 | return application.sources(Application.class);
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/test/java/org/n52/sta/STAPostgresContainer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta;
30 |
31 | import org.testcontainers.containers.PostgreSQLContainer;
32 | import org.testcontainers.utility.DockerImageName;
33 |
34 | /**
35 | * Starts a Postgis Container to be used in IT Tests
36 | *
37 | * @author Jan Speckamp
38 | */
39 | public class STAPostgresContainer extends PostgreSQLContainer {
40 |
41 | private static final DockerImageName DEFAULT_IMAGE_NAME =
42 | DockerImageName.parse("postgis/postgis").asCompatibleSubstituteFor("postgres");
43 | private static final String DEFAULT_TAG = "12-3.0";
44 | private static STAPostgresContainer container;
45 |
46 | private STAPostgresContainer() {
47 | super(DEFAULT_IMAGE_NAME.withTag(DEFAULT_TAG));
48 | }
49 |
50 | public static STAPostgresContainer instance() {
51 | if (container == null) {
52 | container = new STAPostgresContainer();
53 | }
54 | return container;
55 | }
56 |
57 | @Override
58 | public void start() {
59 | super.start();
60 | System.setProperty("DB_URL", container.getJdbcUrl());
61 | System.setProperty("DB_USERNAME", container.getUsername());
62 | System.setProperty("DB_PASSWORD", container.getPassword());
63 | System.setProperty("ALLOW_IP_RANGE", "0.0.0.0/0");
64 | System.setProperty("POSTGRES_MULTIPLE_EXTENSIONS", "postgis");
65 | }
66 |
67 | @Override
68 | public void stop() {
69 | //do nothing, JVM handles shut down
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/MutexFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla;
30 |
31 | import org.n52.shetland.ogc.sta.exception.STACRUDException;
32 | import org.slf4j.Logger;
33 | import org.slf4j.LoggerFactory;
34 | import org.springframework.stereotype.Component;
35 | import org.springframework.util.ConcurrentReferenceHashMap;
36 |
37 | /**
38 | * @author Jan Speckamp
39 | */
40 | @Component
41 | public class MutexFactory {
42 |
43 | private static final Logger LOGGER = LoggerFactory.getLogger(MutexFactory.class);
44 |
45 | // MutexMap used for locking during thread-bound in-memory computations on database entities
46 | private ConcurrentReferenceHashMap lock;
47 |
48 | public MutexFactory() {
49 | this.lock = new ConcurrentReferenceHashMap<>();
50 | }
51 |
52 | /**
53 | * Gets a lock with given name from global lockMap. Name is unique per EntityType.
54 | * Uses weak references so Map is automatically cleared by GC.
55 | *
56 | * @param key name of the lock
57 | * @return Object used for holding the lock
58 | * @throws STACRUDException If the lock can not be obtained.
59 | */
60 | public synchronized Object getLock(String key) throws STACRUDException {
61 | if (key != null) {
62 | LOGGER.trace("Locking:" + key);
63 | return this.lock.compute(key, (k, v) -> v == null ? new Object() : v);
64 | } else {
65 | throw new STACRUDException("Unable to obtain Lock. No name specified!");
66 | }
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/StaIdentifierRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | import org.springframework.data.repository.NoRepositoryBean;
32 | import org.springframework.transaction.annotation.Transactional;
33 |
34 | import java.util.Optional;
35 |
36 | /**
37 | * @author Jan Speckamp
38 | */
39 | @NoRepositoryBean
40 | @Transactional
41 | public interface StaIdentifierRepository extends EntityGraphRepository {
42 |
43 | /**
44 | * Checks whether Entity with given id exists.
45 | *
46 | * @param identifier Identifier of the Entity
47 | * @return true if Entity exists. false otherwise
48 | */
49 | boolean existsByStaIdentifier(String identifier);
50 |
51 | /**
52 | * Finds Entity by identifier. Fetches Entity and all related Entities given by EntityGraphs
53 | *
54 | * @param identifier Identifier of the wanted Entity
55 | * @param relatedEntities EntityGraphs describing related Entities to be fetched. All graphs are merged into one
56 | * graph internally. may be null.
57 | * @return Entity found in Database. Optional.empty() otherwise
58 | */
59 | Optional findByStaIdentifier(String identifier, EntityGraphRepository.FetchGraph... relatedEntities);
60 |
61 | /**
62 | * Deletes Entity with given Identifier
63 | *
64 | * @param identifier Identifier of the Entity
65 | */
66 | void deleteByStaIdentifier(String identifier);
67 |
68 | T intermediateSave(T entity);
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/resources/META-INF/sta-vanilla.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | SensorThings Mappings
9 | /hbm/transactional/core/CategoryResource.hbm.xml
10 | /hbm/transactional/core/CodespaceResource.hbm.xml
11 | /hbm/transactional/core/FeatureResource.hbm.xml
12 | /hbm/transactional/core/FormatResource.hbm.xml
13 | /hbm/transactional/core/OfferingResource.hbm.xml
14 | /hbm/transactional/core/PhenomenonResource.hbm.xml
15 |
16 | /hbm/transactional/core/ProcedureHistoryResource.hbm.xml
17 | /hbm/transactional/core/ProcedureResource.hbm.xml
18 | /hbm/transactional/core/RelatedDataResource.hbm.xml
19 | /hbm/transactional/core/RelatedDatasetResource.hbm.xml
20 | /hbm/transactional/core/RelatedFeatureResource.hbm.xml
21 | /hbm/transactional/core/ResultTemplateResource.hbm.xml
22 | /hbm/transactional/core/UnitResource.hbm.xml
23 | /hbm/transactional/core/VerticalMetadataResource.hbm.xml
24 |
25 | /hbm/transactional/dataset/DataResource.hbm.xml
26 | /hbm/transactional/dataset/DatasetResource.hbm.xml
27 | /hbm/transactional/core/TagResource.hbm.xml
28 |
29 | /hbm/transactional/core/LocationResource.hbm.xml
30 | /hbm/transactional/core/PlatformResource.hbm.xml
31 |
32 | /hbm/parameter/PlatformParameterResource.hbm.xml
33 | /hbm/parameter/DatasetParameterResource.hbm.xml
34 | /hbm/parameter/ObservationParameterResource.hbm.xml
35 | /hbm/parameter/LocationParameterResource.hbm.xml
36 | /hbm/parameter/PhenomenonParameterResource.hbm.xml
37 | /hbm/parameter/ProcedureParameterResource.hbm.xml
38 | /hbm/parameter/FeatureParameterResource.hbm.xml
39 | true
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/service/util/HibernateSpatialCriteriaBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.service.util;
30 |
31 | import org.hibernate.query.criteria.HibernateCriteriaBuilder;
32 | import org.locationtech.jts.geom.Geometry;
33 |
34 | import javax.persistence.criteria.Expression;
35 | import javax.persistence.criteria.Predicate;
36 | import java.io.Serializable;
37 |
38 | /**
39 | * Implements Spatial operations as defined in SensorThingsAPI 15-078r6 Section 9.3.3.5.2
40 | *
41 | * @author Jan Speckamp
42 | */
43 | public interface HibernateSpatialCriteriaBuilder extends HibernateCriteriaBuilder, Serializable {
44 |
45 | Predicate st_equals(Expression x, String wktWithType);
46 |
47 | Predicate st_disjoint(Expression x, String wktWithType);
48 |
49 | Predicate st_touches(Expression x, String wktWithType);
50 |
51 | Predicate st_within(Expression x, String wktWithType);
52 |
53 | Predicate st_overlaps(Expression x, String wktWithType);
54 |
55 | Predicate st_crosses(Expression x, String wktWithType);
56 |
57 | Predicate st_contains(Expression x, String wktWithType);
58 |
59 | Predicate st_intersects(Expression x, String wktWithType);
60 |
61 | Predicate st_relate(Expression x, String wktWithType, String mask);
62 |
63 | Expression st_length(Expression x);
64 |
65 | Expression st_length(String wkt);
66 |
67 | Expression st_distance(Expression x, String wktWithType);
68 |
69 | Expression st_distance(String x, String wktWithType);
70 | }
71 |
--------------------------------------------------------------------------------
/webapp/src/main/resources/META-INF/sta-vanilla.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | SensorThings Mappings
9 | /hbm/transactional/core/CategoryResource.hbm.xml
10 | /hbm/transactional/core/CodespaceResource.hbm.xml
11 | /hbm/transactional/core/FeatureResource.hbm.xml
12 | /hbm/transactional/core/FormatResource.hbm.xml
13 | /hbm/transactional/core/OfferingResource.hbm.xml
14 | /hbm/transactional/core/PhenomenonResource.hbm.xml
15 |
16 | /hbm/transactional/core/ProcedureHistoryResource.hbm.xml
17 | /hbm/transactional/core/ProcedureResource.hbm.xml
18 | /hbm/transactional/core/RelatedDataResource.hbm.xml
19 | /hbm/transactional/core/RelatedDatasetResource.hbm.xml
20 | /hbm/transactional/core/RelatedFeatureResource.hbm.xml
21 | /hbm/transactional/core/ResultTemplateResource.hbm.xml
22 | /hbm/transactional/core/UnitResource.hbm.xml
23 | /hbm/transactional/core/VerticalMetadataResource.hbm.xml
24 |
25 | /hbm/transactional/dataset/DataResource.hbm.xml
26 | /hbm/transactional/dataset/DatasetResource.hbm.xml
27 | /hbm/transactional/core/TagResource.hbm.xml
28 |
29 | /hbm/transactional/core/LocationResource.hbm.xml
30 | /hbm/transactional/core/PlatformResource.hbm.xml
31 |
32 | /hbm/parameter/PlatformParameterResource.hbm.xml
33 | /hbm/parameter/DatasetParameterResource.hbm.xml
34 | /hbm/parameter/ObservationParameterResource.hbm.xml
35 | /hbm/parameter/LocationParameterResource.hbm.xml
36 | /hbm/parameter/PhenomenonParameterResource.hbm.xml
37 | /hbm/parameter/ProcedureParameterResource.hbm.xml
38 | /hbm/parameter/FeatureParameterResource.hbm.xml
39 | true
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ "develop", "maintenance/3.x", "sta-slicing" ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ "develop", "maintenance/3.x", "sta-slicing" ]
20 | schedule:
21 | - cron: '45 15 * * 1'
22 | workflow_dispatch:
23 |
24 | jobs:
25 | analyze:
26 | name: Analyze
27 | runs-on: ubuntu-latest
28 | permissions:
29 | actions: read
30 | contents: read
31 | security-events: write
32 |
33 | strategy:
34 | fail-fast: false
35 | matrix:
36 | language: [ 'java' ]
37 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
38 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
39 |
40 | steps:
41 | - name: Checkout repository
42 | uses: actions/checkout@v3
43 |
44 | # Initializes the CodeQL tools for scanning.
45 | - name: Initialize CodeQL
46 | uses: github/codeql-action/init@v2
47 | with:
48 | languages: ${{ matrix.language }}
49 | # If you wish to specify custom queries, you can do so here or in a config file.
50 | # By default, queries listed here will override any specified in a config file.
51 | # Prefix the list here with "+" to use these queries and those in the config file.
52 |
53 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
54 | # queries: security-extended,security-and-quality
55 |
56 |
57 | # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
58 | # If this step fails, then you should remove it and run the build manually (see below)
59 | - name: Autobuild
60 | uses: github/codeql-action/autobuild@v2
61 |
62 | # ℹ️ Command-line programs to run using the OS shell.
63 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
64 |
65 | # If the Autobuild fails above, remove it and uncomment the following three lines.
66 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
67 |
68 | # - run: |
69 | # echo "Run, Build Application using script"
70 | # ./location_of_script_within_repo/buildscript.sh
71 |
72 | - name: Perform CodeQL Analysis
73 | uses: github/codeql-action/analyze@v2
74 | with:
75 | category: "/language:${{matrix.language}}"
76 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/utils/TimeUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.utils;
30 |
31 | import org.joda.time.DateTime;
32 | import org.joda.time.DateTimeZone;
33 | import org.n52.shetland.ogc.gml.time.Time;
34 | import org.n52.shetland.ogc.gml.time.TimeInstant;
35 | import org.n52.shetland.ogc.gml.time.TimePeriod;
36 |
37 | import java.sql.Timestamp;
38 | import java.util.Date;
39 |
40 | public class TimeUtil {
41 |
42 | public static DateTime createDateTime(Date date) {
43 | return new DateTime(date, DateTimeZone.UTC);
44 | }
45 |
46 | public static Time createTime(DateTime time) {
47 | return new TimeInstant(time);
48 | }
49 |
50 | /**
51 | * Create {@link Time} from {@link DateTime}s
52 | *
53 | * @param start Start {@link DateTime}
54 | * @param end End {@link DateTime}
55 | * @return Resulting {@link Time}
56 | */
57 | public static Time createTime(DateTime start, DateTime end) {
58 | if (start.equals(end)) {
59 | return createTime(start);
60 | } else {
61 | return new TimePeriod(start, end);
62 | }
63 | }
64 |
65 | public static Time parseTime(Object object) {
66 | if (object == null) {
67 | return null;
68 | } else if (object instanceof Timestamp) {
69 | Timestamp timestamp = (Timestamp) object;
70 | return new TimeInstant(timestamp);
71 | } else {
72 | String obj = object.toString();
73 | if (obj.contains("/")) {
74 | String[] split = obj.split("/");
75 | return createTime(DateTime.parse(split[0]),
76 | DateTime.parse(split[1]));
77 | } else {
78 | return new TimeInstant(DateTime.parse(obj));
79 | }
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/mqtt/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | org.n52.sensorweb-server.sta
6 | sta-parent
7 | 4.0.0-SNAPSHOT
8 |
9 | sta-mqtt
10 | jar
11 |
12 |
13 |
14 | org.springframework
15 | spring-beans
16 |
17 |
18 | org.springframework
19 | spring-context
20 |
21 |
22 |
23 | ${project.groupId}
24 | sta-dao
25 |
26 |
27 | org.n52.arctic-sea
28 | shetland
29 |
30 |
31 |
32 | org.n52.sensorweb-server.db-model
33 | db-model-entities
34 |
35 |
36 | org.antlr
37 | antlr4-runtime
38 | runtime
39 |
40 |
41 |
42 | io.moquette
43 | moquette-broker
44 | 0.12.1
45 |
46 |
47 | org.slf4j
48 | slf4j-log4j12
49 |
50 |
51 | com.bugsnag
52 | bugsnag
53 |
54 |
55 |
56 |
57 | io.netty
58 | netty-codec-mqtt
59 |
60 |
61 | io.netty
62 | netty-buffer
63 |
64 |
65 |
66 | com.h2database
67 | h2-mvstore
68 |
69 |
70 |
71 | org.slf4j
72 | slf4j-api
73 |
74 |
75 |
76 |
77 |
78 | bintray
79 | https://jcenter.bintray.com
80 |
81 | true
82 |
83 |
84 | false
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/repositories/RepositoryConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.repositories;
30 |
31 | /**
32 | * @author Jan Speckamp
33 | */
34 | public interface RepositoryConstants {
35 |
36 | String DESCRIPTION = "description";
37 | String NAME = "name";
38 | String ENCODINGTYPE = "encodingType";
39 | String LOCATION = "location";
40 | String PHENOMENONTIME = "phenomenonTime";
41 | String SAMPLINGTIMESTART = "samplingTimeStart";
42 | String SAMPLINGTIMEEND = "samplingTimeEnd";
43 | String RESULTTIMESTART = "resultTimeStart";
44 | String RESULTTIMEEND = "resultTimeEnd";
45 | String VALIDTIMESTART = "validTimeStart";
46 | String VALIDTIMEEND = "validTimeEnd";
47 | String RESULTTIME = "resultTime";
48 | String VALIDTIME = "validTime";
49 | String METADATA = "metadata";
50 | String PROPERTIES = "properties";
51 | String OBSERVATIONTYPE = "observationType";
52 | String UOM = "unitOfMeasurement";
53 | String OBSERVEDAREA = "observedArea";
54 | String TIME = "time";
55 | String FEATURE = "feature";
56 | String DEFINITION = "definition";
57 | String PARAMETERS = "parameters";
58 | String RESULT = "result";
59 |
60 | String ENTITYNAME_OBSERVATION = "DataEntity";
61 | String ENTITYNAME_ABSTRACT_DATASET = "AbstractDatasetEntity";
62 | String ENTITYNAME_DATASET = "DatasetEntity";
63 | String ENTITYNAME_DATASET_AGGREGATION = "DatasetAggregationEntity";
64 | String ENTITYNAME_AFEATURE_OF_INTEREST = "AbstractFeatureEntity";
65 | String ENTITYNAME_FEATURE_OF_INTEREST = "FeatureEntity";
66 | String ENTITYNAME_HIST_LOCATION = "HistoricalLocationEntity";
67 | String ENTITYNAME_LOCATION = "LocationEntity";
68 | String ENTITYNAME_OBSERVED_PROPERTY = "PhenomenonEntity";
69 | String ENTITYNAME_SENSOR = "ProcedureEntity";
70 | String ENTITYNAME_THING = "PlatformEntity";
71 | }
72 |
--------------------------------------------------------------------------------
/http/src/main/java/org/n52/sta/http/CORSFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.http;
30 |
31 | import org.springframework.beans.factory.annotation.Value;
32 | import org.springframework.stereotype.Component;
33 |
34 | import javax.servlet.Filter;
35 | import javax.servlet.FilterChain;
36 | import javax.servlet.FilterConfig;
37 | import javax.servlet.ServletException;
38 | import javax.servlet.ServletRequest;
39 | import javax.servlet.ServletResponse;
40 | import javax.servlet.http.HttpServletResponse;
41 | import java.io.IOException;
42 |
43 | /**
44 | * Implements a simple CORS Filter.
45 | */
46 | @Component
47 | public class CORSFilter implements Filter {
48 |
49 | @Value("${http.cors.allowOrigin:*}")
50 | private String CORSOrigin;
51 |
52 | @Value("${http.cors.allowMethods:POST, GET, OPTIONS, DELETE, PATCH}")
53 | private String CORSMethods;
54 |
55 | @Value("${http.cors.maxAge:3600}")
56 | private String CORSMaxAge;
57 |
58 | @Value("${http.cors.allowHeaders:" +
59 | "Access-Control-Allow-Headers," +
60 | "Content-Type, Access-Control-Allow-Headers," +
61 | "Authorization," +
62 | "X-Requested-With}")
63 | private String CORSHeaders;
64 |
65 | @Override
66 | public void init(FilterConfig filterConfig) {
67 |
68 | }
69 |
70 | @Override
71 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
72 | throws IOException, ServletException {
73 | HttpServletResponse res = (HttpServletResponse) response;
74 |
75 | res.setHeader("Access-Control-Allow-Origin", CORSOrigin);
76 | res.setHeader("Access-Control-Allow-Methods", CORSMethods);
77 | res.setHeader("Access-Control-Max-Age", CORSMaxAge);
78 | res.setHeader("Access-Control-Allow-Headers", CORSHeaders);
79 |
80 | chain.doFilter(request, res);
81 | }
82 |
83 | @Override
84 | public void destroy() {
85 |
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/SerDesConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla;
30 |
31 | import org.springframework.beans.factory.annotation.Value;
32 | import org.springframework.stereotype.Component;
33 |
34 | /**
35 | * @author Jan Speckamp
36 | */
37 | @Component
38 | public class SerDesConfig {
39 |
40 | private final String samplingGeometryMapping;
41 | private final String verticalFromMapping;
42 | private final String verticalToMapping;
43 | private final String verticalFromToMapping;
44 | private final boolean includeDatastreamCategory;
45 |
46 | public SerDesConfig(
47 | @Value("${server.feature.observation.samplingGeometry}") String samplingGeometryMapping,
48 | @Value("${server.feature.observation.verticalFrom}") String verticalFromMapping,
49 | @Value("${server.feature.observation.verticalTo}") String verticalToMapping,
50 | @Value("${server.feature.observation.verticalFromTo}") String verticalFromToMapping,
51 | @Value("${server.feature.includeDatastreamCategory:false}") boolean includeDatastreamCategory
52 | ) {
53 | this.samplingGeometryMapping = samplingGeometryMapping;
54 | this.verticalFromMapping = verticalFromMapping;
55 | this.verticalToMapping = verticalToMapping;
56 | this.verticalFromToMapping = verticalFromToMapping;
57 | this.includeDatastreamCategory = includeDatastreamCategory;
58 | }
59 |
60 | public String getSamplingGeometryMapping() {
61 | return samplingGeometryMapping;
62 | }
63 |
64 | public String getVerticalFromMapping() {
65 | return verticalFromMapping;
66 | }
67 |
68 | public String getVerticalToMapping() {
69 | return verticalToMapping;
70 | }
71 |
72 | public String getVerticalFromToMapping() {
73 | return verticalFromToMapping;
74 | }
75 |
76 | public boolean isIncludeDatastreamCategory() {
77 | return includeDatastreamCategory;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/test/java/org/n52/sta/ITRootResponseTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | //@SpringBootConfiguration
30 | //@EnableAutoConfiguration
31 | //@AutoConfigureTestDatabase
32 | //@DataJpaTest
33 |
34 | package org.n52.sta;
35 |
36 | import com.fasterxml.jackson.databind.JsonNode;
37 | import com.fasterxml.jackson.databind.ObjectMapper;
38 | import org.apache.http.HttpResponse;
39 | import org.apache.http.client.methods.HttpGet;
40 | import org.apache.http.client.methods.HttpUriRequest;
41 | import org.apache.http.entity.ContentType;
42 | import org.apache.http.impl.client.HttpClientBuilder;
43 | import org.junit.jupiter.api.Assertions;
44 | import org.junit.jupiter.api.Test;
45 | import org.springframework.beans.factory.annotation.Value;
46 | import org.springframework.boot.test.context.SpringBootTest;
47 | import org.testcontainers.junit.jupiter.Testcontainers;
48 |
49 | import java.io.IOException;
50 |
51 | /**
52 | * This class tests various different things not covered directly by the official cite tests
53 | */
54 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
55 | @Testcontainers
56 | public class ITRootResponseTest extends ConformanceTests {
57 |
58 | protected final static String jsonMimeType = "application/json";
59 |
60 | private ObjectMapper mapper = new ObjectMapper();
61 |
62 | ITRootResponseTest(@Value("${server.rootUrl}") String rootUrl) {
63 | super(rootUrl);
64 | }
65 |
66 | @Test
67 | public void rootResponseIsCorrect() throws IOException {
68 | HttpUriRequest request = new HttpGet(rootUrl);
69 | HttpResponse response = HttpClientBuilder.create().build().execute(request);
70 |
71 | // Check Response MIME Type
72 | String mimeType = ContentType.getOrDefault(response.getEntity()).getMimeType();
73 | Assertions.assertEquals(jsonMimeType, mimeType);
74 |
75 | // Check Response
76 | JsonNode root = mapper.readTree(response.getEntity().getContent());
77 | Assertions.assertTrue(root.hasNonNull("value"));
78 |
79 | //TODO: expand tests to actually be useful
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/impl/ObservedProperty.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto.impl;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 | import org.n52.sta.api.dto.DatastreamDTO;
33 | import org.n52.sta.api.dto.ObservedPropertyDTO;
34 |
35 | import java.util.HashSet;
36 | import java.util.Set;
37 |
38 | /**
39 | * @author Jan Speckamp
40 | */
41 | public class ObservedProperty extends Entity implements ObservedPropertyDTO {
42 |
43 | private String name;
44 |
45 | private String description;
46 |
47 | private String definition;
48 |
49 | private ObjectNode properties;
50 |
51 | private Set datastreams;
52 |
53 | @Override public String getName() {
54 | return name;
55 | }
56 |
57 | public void setName(String name) {
58 | this.name = name;
59 | }
60 |
61 | @Override public String getDescription() {
62 | return description;
63 | }
64 |
65 | public void setDescription(String description) {
66 | this.description = description;
67 | }
68 |
69 | @Override public String getDefinition() {
70 | return definition;
71 | }
72 |
73 | public void setDefinition(String definition) {
74 | this.definition = definition;
75 | }
76 |
77 | @Override public ObjectNode getProperties() {
78 | return properties;
79 | }
80 |
81 | public void setProperties(ObjectNode properties) {
82 | this.properties = properties;
83 | }
84 |
85 | @Override public Set getDatastreams() {
86 | return datastreams;
87 | }
88 |
89 | public void setDatastreams(Set datastreams) {
90 | this.datastreams = datastreams;
91 | }
92 |
93 | @Override public void addDatastreams(DatastreamDTO datastream) {
94 | if (this.datastreams == null) {
95 | this.datastreams = new HashSet<>();
96 | }
97 | this.datastreams.add(datastream);
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/impl/FeatureOfInterest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto.impl;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 | import org.locationtech.jts.geom.Geometry;
33 | import org.n52.sta.api.dto.FeatureOfInterestDTO;
34 | import org.n52.sta.api.dto.ObservationDTO;
35 |
36 | import java.util.Set;
37 |
38 | /**
39 | * @author Jan Speckamp
40 | */
41 | public class FeatureOfInterest extends Entity implements FeatureOfInterestDTO {
42 |
43 | private String name;
44 |
45 | private String description;
46 |
47 | private String encodingType;
48 |
49 | private Geometry feature;
50 |
51 | private ObjectNode properties;
52 |
53 | private Set observations;
54 |
55 | @Override public String getName() {
56 | return name;
57 | }
58 |
59 | public void setName(String name) {
60 | this.name = name;
61 | }
62 |
63 | @Override public String getDescription() {
64 | return description;
65 | }
66 |
67 | public void setDescription(String description) {
68 | this.description = description;
69 | }
70 |
71 | @Override public String getEncodingType() {
72 | return encodingType;
73 | }
74 |
75 | public void setEncodingType(String encodingType) {
76 | this.encodingType = encodingType;
77 | }
78 |
79 | @Override public Geometry getFeature() {
80 | return feature;
81 | }
82 |
83 | public void setFeature(Geometry feature) {
84 | this.feature = feature;
85 | }
86 |
87 | @Override public ObjectNode getProperties() {
88 | return properties;
89 | }
90 |
91 | public void setProperties(ObjectNode properties) {
92 | this.properties = properties;
93 | }
94 |
95 | @Override public Set getObservations() {
96 | return observations;
97 | }
98 |
99 | public void setObservations(Set observations) {
100 | this.observations = observations;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/http/src/main/java/org/n52/sta/http/ExtendableUrlPathHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.http;
30 |
31 | import org.springframework.web.util.UrlPathHelper;
32 |
33 | /**
34 | * @author Jan Speckamp
35 | * @author Christian Autermann
36 | */
37 | public class ExtendableUrlPathHelper extends UrlPathHelper {
38 |
39 | /**
40 | * Copied from {@link UrlPathHelper}.
41 | */
42 | protected String getRemainingPath(String requestUri, String mapping, boolean ignoreCase) {
43 | int index1 = 0;
44 | int index2 = 0;
45 | for (; (index1 < requestUri.length()) && (index2 < mapping.length()); index1++, index2++) {
46 | char c1 = requestUri.charAt(index1);
47 | char c2 = mapping.charAt(index2);
48 | if (c1 == ';') {
49 | index1 = requestUri.indexOf('/', index1);
50 | if (index1 == -1) {
51 | return null;
52 | }
53 | c1 = requestUri.charAt(index1);
54 | }
55 | if (c1 == c2 || (ignoreCase && (Character.toLowerCase(c1) == Character.toLowerCase(c2)))) {
56 | continue;
57 | }
58 | return null;
59 | }
60 | if (index2 != mapping.length()) {
61 | return null;
62 | } else if (index1 == requestUri.length()) {
63 | return "";
64 | } else if (requestUri.charAt(index1) == ';') {
65 | index1 = requestUri.indexOf('/', index1);
66 | }
67 | return index1 != -1 ? requestUri.substring(index1) : "";
68 | }
69 |
70 | /**
71 | * Copied from {@link UrlPathHelper}.
72 | */
73 | protected String getSanitizedPath(final String path) {
74 | String sanitized = path;
75 | while (true) {
76 | int index = sanitized.indexOf("//");
77 | if (index < 0) {
78 | break;
79 | } else {
80 | sanitized = sanitized.substring(0, index) + sanitized.substring(index + 1);
81 | }
82 | }
83 | return sanitized;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/mqtt/src/main/java/org/n52/sta/mqtt/vanilla/subscription/MqttSelectSubscription.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.mqtt.vanilla.subscription;
30 |
31 | import org.n52.shetland.filter.SelectFilter;
32 | import org.n52.shetland.oasis.odata.query.option.QueryOptions;
33 | import org.n52.shetland.ogc.filter.FilterClause;
34 | import org.n52.sta.api.RequestUtils;
35 | import org.n52.svalbard.odata.core.QueryOptionsFactory;
36 | import org.slf4j.Logger;
37 | import org.slf4j.LoggerFactory;
38 | import org.springframework.util.Assert;
39 |
40 | import java.util.Collections;
41 | import java.util.HashSet;
42 | import java.util.regex.Matcher;
43 |
44 | /**
45 | * @author Jan Speckamp
46 | */
47 | public class MqttSelectSubscription extends MqttEntityCollectionSubscription {
48 |
49 | private static final Logger LOGGER = LoggerFactory.getLogger(MqttSelectSubscription.class);
50 |
51 | private String selectOption;
52 |
53 | private QueryOptions queryOptions;
54 |
55 | public MqttSelectSubscription(String topic, Matcher mt) {
56 | super(topic, mt, true);
57 |
58 | selectOption = mt.group(RequestUtils.GROUPNAME_SELECT);
59 | Assert.notNull(selectOption, "Unable to parse topic. Could not extract selectOption");
60 |
61 | QueryOptionsFactory qof = new QueryOptionsFactory();
62 | HashSet filters = new HashSet<>();
63 | HashSet filterItems = new HashSet<>();
64 | Collections.addAll(filterItems, mt.group(RequestUtils.GROUPNAME_SELECT).split(","));
65 | filters.add(new SelectFilter(filterItems));
66 | queryOptions = qof.createQueryOptions(filters);
67 | LOGGER.debug(this.toString());
68 | }
69 |
70 | @Override
71 | public String toString() {
72 | String base = super.toString();
73 | return new StringBuilder()
74 | .append(base)
75 | .deleteCharAt(base.length() - 1)
76 | .append(",selectOption=")
77 | .append(selectOption)
78 | .append("]")
79 | .toString();
80 | }
81 |
82 | public QueryOptions getQueryOptions() {
83 | return queryOptions;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/service/OfferingService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.service;
30 |
31 | import org.n52.series.db.beans.OfferingEntity;
32 | import org.n52.series.db.beans.ProcedureEntity;
33 | import org.n52.shetland.ogc.sta.exception.STACRUDException;
34 | import org.n52.sta.data.vanilla.MutexFactory;
35 | import org.n52.sta.data.vanilla.repositories.OfferingRepository;
36 | import org.slf4j.Logger;
37 | import org.slf4j.LoggerFactory;
38 | import org.springframework.context.annotation.DependsOn;
39 | import org.springframework.stereotype.Component;
40 | import org.springframework.transaction.annotation.Transactional;
41 |
42 | /**
43 | * @author Jan Speckamp
44 | */
45 | @Component
46 | @DependsOn({"springApplicationContext"})
47 | public class OfferingService {
48 |
49 | public static final String DEFAULT_CATEGORY = "DEFAULT_STA_CATEGORY";
50 |
51 | private static final Logger logger = LoggerFactory.getLogger(OfferingService.class);
52 | private final MutexFactory mutexFactory;
53 | private final OfferingRepository offeringRepository;
54 |
55 | public OfferingService(MutexFactory mutexFactory,
56 | OfferingRepository offeringRepository) {
57 | this.mutexFactory = mutexFactory;
58 | this.offeringRepository = offeringRepository;
59 | }
60 |
61 | @Transactional
62 | public OfferingEntity createOrFetchOffering(ProcedureEntity procedure) throws STACRUDException {
63 | synchronized (mutexFactory.getLock(procedure.getIdentifier())) {
64 | if (!offeringRepository.existsByIdentifier(procedure.getIdentifier())) {
65 | OfferingEntity offering = new OfferingEntity();
66 | offering.setIdentifier(procedure.getIdentifier());
67 | offering.setStaIdentifier(procedure.getStaIdentifier());
68 | offering.setName(procedure.getName());
69 | offering.setDescription(procedure.getDescription());
70 | return offeringRepository.save(offering);
71 | } else {
72 | return offeringRepository.findByIdentifier(procedure.getIdentifier()).get();
73 | }
74 | }
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/dao/src/main/java/org/n52/sta/api/dto/impl/Sensor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.api.dto.impl;
30 |
31 | import com.fasterxml.jackson.databind.node.ObjectNode;
32 | import org.n52.sta.api.dto.DatastreamDTO;
33 | import org.n52.sta.api.dto.SensorDTO;
34 |
35 | import java.util.HashSet;
36 | import java.util.Set;
37 |
38 | /**
39 | * @author Jan Speckamp
40 | */
41 | public class Sensor extends Entity implements SensorDTO {
42 |
43 | private String name;
44 |
45 | private String description;
46 |
47 | private String encodingType;
48 |
49 | private String metadata;
50 |
51 | private ObjectNode properties;
52 |
53 | private Set datastreams;
54 |
55 | @Override public String getName() {
56 | return name;
57 | }
58 |
59 | public void setName(String name) {
60 | this.name = name;
61 | }
62 |
63 | @Override public String getDescription() {
64 | return description;
65 | }
66 |
67 | public void setDescription(String description) {
68 | this.description = description;
69 | }
70 |
71 | @Override public String getEncodingType() {
72 | return encodingType;
73 | }
74 |
75 | public void setEncodingType(String encodingType) {
76 | this.encodingType = encodingType;
77 | }
78 |
79 | @Override public String getMetadata() {
80 | return metadata;
81 | }
82 |
83 | public void setMetadata(String metadata) {
84 | this.metadata = metadata;
85 | }
86 |
87 | @Override public ObjectNode getProperties() {
88 | return properties;
89 | }
90 |
91 | public void setProperties(ObjectNode properties) {
92 | this.properties = properties;
93 | }
94 |
95 | @Override public Set getDatastreams() {
96 | return datastreams;
97 | }
98 |
99 | public void setDatastreams(Set datastreams) {
100 | this.datastreams = datastreams;
101 | }
102 |
103 | @Override public void addDatastream(DatastreamDTO datastream) {
104 | if (this.datastreams == null) {
105 | this.datastreams = new HashSet<>();
106 | }
107 | this.datastreams.add(datastream);
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/dao-postgres/src/main/java/org/n52/sta/data/vanilla/service/ServiceUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018-2021 52°North Initiative for Geospatial Open Source
3 | * Software GmbH
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 as published
7 | * by the Free Software Foundation.
8 | *
9 | * If the program is linked with libraries which are licensed under one of
10 | * the following licenses, the combination of the program with the linked
11 | * library is not considered a "derivative work" of the program:
12 | *
13 | * - Apache License, version 2.0
14 | * - Apache Software License, version 1.0
15 | * - GNU Lesser General Public License, version 3
16 | * - Mozilla Public License, versions 1.0, 1.1 and 2.0
17 | * - Common Development and Distribution License (CDDL), version 1.0
18 | *
19 | * Therefore the distribution of the program linked with libraries licensed
20 | * under the aforementioned licenses, is permitted by the copyright holders
21 | * if the distribution is compliant with both the GNU General Public
22 | * License version 2 and the aforementioned licenses.
23 | *
24 | * This program is distributed in the hope that it will be useful, but
25 | * WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 | * Public License for more details.
28 | */
29 | package org.n52.sta.data.vanilla.service;
30 |
31 | import org.locationtech.jts.geom.Geometry;
32 | import org.n52.series.db.beans.AbstractFeatureEntity;
33 | import org.n52.series.db.beans.FeatureEntity;
34 | import org.n52.series.db.beans.FormatEntity;
35 | import org.n52.series.db.beans.sta.LocationEntity;
36 | import org.n52.shetland.ogc.om.features.SfConstants;
37 |
38 | public class ServiceUtils {
39 |
40 | static final String AUTOGENERATED_KEY = "autogenerated";
41 |
42 | static AbstractFeatureEntity> createFeatureOfInterest(LocationEntity location) {
43 | FeatureEntity featureOfInterest = new FeatureEntity();
44 | featureOfInterest.setIdentifier(location.getIdentifier());
45 | featureOfInterest.setStaIdentifier(location.getStaIdentifier());
46 | // Used to distinguish in FeatureOfInterestService
47 | featureOfInterest.setXml(AUTOGENERATED_KEY);
48 | featureOfInterest.setName(location.getName());
49 | featureOfInterest.setDescription(location.getDescription());
50 | featureOfInterest.setGeometryEntity(location.getGeometryEntity());
51 | featureOfInterest.setFeatureType(createFeatureType(location.getGeometry()));
52 | return featureOfInterest;
53 | }
54 |
55 | public static FormatEntity createFeatureType(Geometry geometry) {
56 | FormatEntity formatEntity = new FormatEntity();
57 | if (geometry != null) {
58 | switch (geometry.getGeometryType()) {
59 | case "Point":
60 | formatEntity.setFormat(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_POINT);
61 | break;
62 | case "LineString":
63 | formatEntity.setFormat(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_CURVE);
64 | break;
65 | case "Polygon":
66 | formatEntity.setFormat(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_SURFACE);
67 | break;
68 | default:
69 | formatEntity.setFormat(SfConstants.SAMPLING_FEAT_TYPE_SF_SPATIAL_SAMPLING_FEATURE);
70 | break;
71 | }
72 | return formatEntity;
73 | }
74 | return formatEntity.setFormat(SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_FEATURE);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------