-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
667 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project-shared-configuration> | ||
<!-- | ||
This file contains additional configuration written by modules in the NetBeans IDE. | ||
The configuration is intended to be shared among all the users of project and | ||
therefore it is assumed to be part of version control checkout. | ||
Without this configuration present, some functionality in the IDE may be limited or fail altogether. | ||
--> | ||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> | ||
<!-- | ||
Properties that influence various parts of the IDE, especially code formatting and the like. | ||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. | ||
That way multiple projects can share the same settings (useful for formatting rules for example). | ||
Any value defined here will override the pom.xml file value but is only applicable to the current project. | ||
--> | ||
<netbeans.hint.licensePath>${project.parent.basedir}/../license-header</netbeans.hint.licensePath> | ||
</properties> | ||
</project-shared-configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>de.fraunhofer.iosb.ilt.FROST-Server</groupId> | ||
<artifactId>FROST-Server.Plugins</artifactId> | ||
<version>2.4.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>FROST-Server.Plugin.ModelOM</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>FROST-Server.Plugin.ModelOM</name> | ||
<description>The SensorThings API Version 2.0 OM Data Model.</description> | ||
<url>https://github.com/FraunhoferIOSB/FROST-Server</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<root.basedir>${project.parent.parent.basedir}</root.basedir> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>FROST-Server.Core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>FROST-Server.Core.Model</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>FROST-Server.Plugin.ModelLoader</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>FROST-Server.Util</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
71 changes: 71 additions & 0 deletions
71
...odelOM/src/main/java/de/fraunhofer/iosb/ilt/frostserver/plugin/modelom/PluginModelOM.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright (C) 2023 Fraunhofer Institut IOSB, Fraunhoferstr. 1, D 76131 | ||
* Karlsruhe, Germany. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package de.fraunhofer.iosb.ilt.frostserver.plugin.modelom; | ||
|
||
import de.fraunhofer.iosb.ilt.frostserver.plugin.modelloader.PluginModelLoader; | ||
import de.fraunhofer.iosb.ilt.frostserver.service.Plugin; | ||
import de.fraunhofer.iosb.ilt.frostserver.service.PluginManager; | ||
import de.fraunhofer.iosb.ilt.frostserver.settings.ConfigDefaults; | ||
import de.fraunhofer.iosb.ilt.frostserver.settings.CoreSettings; | ||
import de.fraunhofer.iosb.ilt.frostserver.settings.Settings; | ||
import de.fraunhofer.iosb.ilt.frostserver.settings.annotation.DefaultValueBoolean; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* | ||
* @author scf | ||
*/ | ||
public class PluginModelOM implements Plugin, ConfigDefaults { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(PluginModelOM.class.getName()); | ||
private static final String INIT_FAILED = "PluginModelLoader must be enabled and initialised before the ModelOM plugin!"; | ||
|
||
@DefaultValueBoolean(false) | ||
public static final String TAG_ENABLE_PDQ = "modelOM.enable"; | ||
|
||
private boolean enabled; | ||
|
||
public PluginModelOM() { | ||
LOGGER.info("Creating new ModelOM Plugin."); | ||
} | ||
|
||
@Override | ||
public void init(CoreSettings settings) { | ||
Settings pluginSettings = settings.getPluginSettings(); | ||
enabled = pluginSettings.getBoolean(TAG_ENABLE_PDQ, PluginModelOM.class); | ||
if (enabled) { | ||
final PluginManager pluginManager = settings.getPluginManager(); | ||
pluginManager.registerPlugin(this); | ||
PluginModelLoader pml = pluginManager.getPlugin(PluginModelLoader.class); | ||
if (pml == null || !pml.isEnabled()) { | ||
LOGGER.error(INIT_FAILED); | ||
throw new IllegalArgumentException(INIT_FAILED); | ||
} | ||
pml.addLiquibaseFile("pluginmodelom/liquibase/tables.xml"); | ||
pml.addModelFile("pluginmodelom/model/Deployment.json"); | ||
pml.addModelFile("pluginmodelom/model/ObservingProcedure.json"); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return enabled; | ||
} | ||
|
||
} |
201 changes: 201 additions & 0 deletions
201
Plugins/ModelOM/src/main/resources/pluginmodelom/liquibase/tables.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
<?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" | ||
xmlns:pro="http://www.liquibase.org/xml/ns/pro" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd | ||
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd | ||
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
|
||
<!-- Table for Deployment --> | ||
<changeSet author="IOSB" id="2024-05-05_Deployment-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<preConditions onFail="MARK_RAN"> | ||
<changeLogPropertyDefined property="id-Deployment" value="LONG" /> | ||
</preConditions> | ||
<createTable tableName="deployments"> | ||
<column name="id" type="${idTypeLong}" autoIncrement="true"> | ||
<constraints primaryKey="true" primaryKeyName="pk_deployments" /> | ||
</column> | ||
</createTable> | ||
</changeSet> | ||
<changeSet author="IOSB" id="2024-05-05_Deployment-2" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<preConditions onFail="MARK_RAN"> | ||
<or> | ||
<changeLogPropertyDefined property="id-Deployment" value="STRING" /> | ||
<changeLogPropertyDefined property="id-Deployment" value="UUID" /> | ||
</or> | ||
</preConditions> | ||
<createTable tableName="deployments"> | ||
<column name="id" type="${idType-Deployment}" defaultValueComputed="${defaultValueComputed-Deployment}"> | ||
<constraints primaryKey="true" primaryKeyName="pk_deployments" /> | ||
</column> | ||
</createTable> | ||
</changeSet> | ||
<changeSet author="IOSB" id="2024-05-05_Deployment-3" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<addColumn tableName="deployments"> | ||
<column name="sensor_id" type="${idType-Sensor}" /> | ||
<column name="thing_id" type="${idType-Thing}" /> | ||
<column name="name" type="TEXT" /> | ||
<column name="description" type="TEXT" /> | ||
<column name="properties" type="JSONB" /> | ||
<column name="reason" type="TEXT" /> | ||
<column name="encoding_type" type="TEXT"/> | ||
<column name="position" type="TEXT"/> | ||
<column name="geom" type="geometry(Geometry,4326)"/> | ||
<column name="time_start" type="TIMESTAMP WITH TIME ZONE" /> | ||
<column name="time_end" type="TIMESTAMP WITH TIME ZONE" /> | ||
</addColumn> | ||
<createIndex tableName="deployments" indexName="deployments_sensor_id"> | ||
<column name="sensor_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_deployments_sensor_id" | ||
baseTableName="deployments" baseColumnNames="sensor_id" | ||
referencedTableName="sensors" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
<createIndex tableName="deployments" indexName="deployments_thing_id"> | ||
<column name="thing_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_deployments_thing_id" | ||
baseTableName="deployments" baseColumnNames="thing_id" | ||
referencedTableName="things" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
</changeSet> | ||
|
||
|
||
<!-- Table for ObservingProcedure --> | ||
<changeSet author="IOSB" id="2024-05-05_ObservingProcedure-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<preConditions onFail="MARK_RAN"> | ||
<changeLogPropertyDefined property="id-ObservingProcedure" value="LONG" /> | ||
</preConditions> | ||
<createTable tableName="observing_procedures"> | ||
<column name="id" type="${idTypeLong}" autoIncrement="true"> | ||
<constraints primaryKey="true" primaryKeyName="pk_observing_procedures" /> | ||
</column> | ||
</createTable> | ||
</changeSet> | ||
<changeSet author="IOSB" id="2024-05-05_ObservingProcedure-2" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<preConditions onFail="MARK_RAN"> | ||
<or> | ||
<changeLogPropertyDefined property="id-ObservingProcedure" value="STRING" /> | ||
<changeLogPropertyDefined property="id-ObservingProcedure" value="UUID" /> | ||
</or> | ||
</preConditions> | ||
<createTable tableName="observing_procedures"> | ||
<column name="id" type="${idType-ObservingProcedure}" defaultValueComputed="${defaultValueComputed-ObservingProcedure}"> | ||
<constraints primaryKey="true" primaryKeyName="pk_observing_procedures" /> | ||
</column> | ||
</createTable> | ||
</changeSet> | ||
<changeSet author="IOSB" id="2024-05-05_ObservingProcedure-3" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<addColumn tableName="observing_procedures"> | ||
<column name="name" type="TEXT" /> | ||
<column name="description" type="TEXT" /> | ||
<column name="definition" type="TEXT" /> | ||
<column name="properties" type="JSONB" /> | ||
</addColumn> | ||
<addColumn tableName="datastreams"> | ||
<column name="observing_procedure_id" type="${idType-ObservingProcedure}" /> | ||
</addColumn> | ||
|
||
<createIndex tableName="datastreams" indexName="datastreams_observing_procedure_id"> | ||
<column name="observing_procedure_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_datastreams_observing_procedure_id" | ||
baseTableName="datastreams" baseColumnNames="observing_procedure_id" | ||
referencedTableName="observing_procedures" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
</changeSet> | ||
|
||
<!-- LinkTable ObservingProcedure - Sensor --> | ||
<changeSet author="IOSB" id="2024-05-05_ObservingProcedure-Sensor" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<createTable tableName="sensor_observing_procedure"> | ||
<column name="sensor_id" type="${idType-Sensor}"> | ||
<constraints nullable="false" /> | ||
</column> | ||
<column name="procedure_id" type="${idType-ObservingProcedure}"> | ||
<constraints nullable="false" /> | ||
</column> | ||
</createTable> | ||
<addPrimaryKey columnNames="sensor_id, procedure_id" constraintName="pk_sensor_observing_procedure" tableName="sensor_observing_procedure" /> | ||
|
||
<createIndex tableName="sensor_observing_procedure" indexName="sensor_observing_procedure_sensor_id"> | ||
<column name="sensor_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_sensor_observing_procedure_sensor_id" | ||
baseTableName="sensor_observing_procedure" baseColumnNames="sensor_id" | ||
referencedTableName="sensors" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
|
||
<createIndex tableName="sensor_observing_procedure" indexName="sensor_observing_procedure_procedure_id"> | ||
<column name="procedure_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_sensor_observing_procedure_procedure_id" | ||
baseTableName="sensor_observing_procedure" baseColumnNames="procedure_id" | ||
referencedTableName="observing_procedures" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
</changeSet> | ||
|
||
|
||
<!-- LinkTable ObservingProcedure - ObservedProperty --> | ||
<changeSet author="IOSB" id="2024-05-05_ObservingProcedure-ObservedProperty" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<createTable tableName="observed_property_observing_procedure"> | ||
<column name="observed_property_id" type="${idType-ObservedProperty}"> | ||
<constraints nullable="false" /> | ||
</column> | ||
<column name="procedure_id" type="${idType-ObservingProcedure}"> | ||
<constraints nullable="false" /> | ||
</column> | ||
</createTable> | ||
<addPrimaryKey columnNames="observed_property_id, procedure_id" constraintName="pk_observed_property_observing_procedure" tableName="observed_property_observing_procedure" /> | ||
|
||
<createIndex tableName="observed_property_observing_procedure" indexName="observed_property_observing_procedure_observed_property_id"> | ||
<column name="observed_property_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_observed_property_observing_procedure_observed_property_id" | ||
baseTableName="observed_property_observing_procedure" baseColumnNames="observed_property_id" | ||
referencedTableName="observed_properties" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
|
||
<createIndex tableName="observed_property_observing_procedure" indexName="observed_property_observing_procedure_procedure_id"> | ||
<column name="procedure_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_observed_property_observing_procedure_procedure_id" | ||
baseTableName="observed_property_observing_procedure" baseColumnNames="procedure_id" | ||
referencedTableName="observing_procedures" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
</changeSet> | ||
|
||
|
||
|
||
<!-- LinkTable Deployment - Datastream --> | ||
<changeSet author="IOSB" id="2024-05-05_Deployment-Datastream" objectQuotingStrategy="QUOTE_ALL_OBJECTS"> | ||
<createTable tableName="deployment_datastream"> | ||
<column name="datastream_id" type="${idType-Datastream}"> | ||
<constraints nullable="false" /> | ||
</column> | ||
<column name="deployment_id" type="${idType-Deployment}"> | ||
<constraints nullable="false" /> | ||
</column> | ||
</createTable> | ||
<addPrimaryKey columnNames="deployment_id, datastream_id" constraintName="pk_deployment_datastream" tableName="deployment_datastream" /> | ||
|
||
<createIndex tableName="deployment_datastream" indexName="deployment_datastream_deployment_id"> | ||
<column name="deployment_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_deployment_datastream_deployment_id" | ||
baseTableName="deployment_datastream" baseColumnNames="deployment_id" | ||
referencedTableName="observed_properties" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
|
||
<createIndex tableName="deployment_datastream" indexName="deployment_datastream_procedure_id"> | ||
<column name="procedure_id" /> | ||
</createIndex> | ||
<addForeignKeyConstraint constraintName="fk_deployment_datastream_datastream_id" | ||
baseTableName="deployment_datastream" baseColumnNames="datastream_id" | ||
referencedTableName="datastreams" referencedColumnNames="id" | ||
deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="CASCADE" validate="true" /> | ||
</changeSet> | ||
|
||
|
||
</databaseChangeLog> |
Oops, something went wrong.