Define Historic request API
diff --git a/platform/sensinact-historic-api/pom.xml b/platform/sensinact-historic-api/pom.xml
new file mode 100644
index 0000000..e4a032b
--- /dev/null
+++ b/platform/sensinact-historic-api/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2020 Kentyou.
+ ~ All rights reserved. This program and the accompanying materials
+ ~ are made available under the terms of the Eclipse Public License v1.0
+ ~ which accompanies this distribution, and is available at
+ ~ http://www.eclipse.org/legal/epl-v10.html
+ ~
+ ~ Contributors:
+* Kentyou - initial API and implementation
+ -->
+
+<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>org.eclipse.sensinact.gateway</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>sensinact-historic-api</artifactId>
+ <packaging>bundle</packaging>
+ <name>sensiNact IoT Gateway - sensiNact Historic API</name>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricProvider.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricProvider.java
new file mode 100644
index 0000000..fe6f7b3
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricProvider.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+/**
+ * @author christophe
+ *
+ */
+public interface HistoricProvider {
+
+ HistoricTemporalRequest newTemporalRequest();
+
+ HistoricSpatialRequest newSpatialRequest();
+
+ HistoricSpatioTemporalRequest newSpatioTemporalRequest();
+}
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricRequest.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricRequest.java
new file mode 100644
index 0000000..6a39303
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricRequest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * HistoricRequest allows to collect a set of points from a connected
+ * historic database depending on a targeted path and a time window defined
+ * using a {@link LocalDateTime} start time and a {@link LocalDateTime} end time
+ */
+public interface HistoricRequest<T> {
+
+ void setServiceProviderIdentifier(String providerId);
+
+ void setServiceIdentifier(String serviceId);
+
+ void setResourceIdentifier(String resourceId);
+
+ void setHistoricStartTime(LocalDateTime fromTime);
+
+ void setHistoricEndTime(LocalDateTime toTime);
+
+ List<T> execute();
+
+}
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricRequestHandler.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricRequestHandler.java
new file mode 100644
index 0000000..12619b2
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricRequestHandler.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+public interface HistoricRequestHandler {
+
+ HistoricTemporalRequest newTemporalRequest();
+
+ HistoricSpatialRequest newSpatialRequest();
+
+ HistoricSpatioTemporalRequest newSpatioTemporalRequest();
+}
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricSpatialRequest.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricSpatialRequest.java
new file mode 100644
index 0000000..7132188
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricSpatialRequest.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+/**
+ *
+ */
+public interface HistoricSpatialRequest extends HistoricRequest<SpatialDTO> {
+
+ void setRegion(String region);
+}
+
+
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricSpatioTemporalRequest.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricSpatioTemporalRequest.java
new file mode 100644
index 0000000..ba84320
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricSpatioTemporalRequest.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+/**
+ *
+ */
+public interface HistoricSpatioTemporalRequest extends HistoricRequest<SpatioTemporalDTO> {
+
+ void setFunction(String function);
+
+ void setTemporalWindow(long period);
+
+ void setRegion(String region);
+
+}
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricTemporalRequest.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricTemporalRequest.java
new file mode 100644
index 0000000..0faf6d2
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/HistoricTemporalRequest.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+/**
+ *
+ */
+public interface HistoricTemporalRequest extends HistoricRequest<TemporalDTO> {
+
+ void setFunction(String function);
+
+ void setTemporalWindow(long period);
+
+}
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/SpatialDTO.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/SpatialDTO.java
new file mode 100644
index 0000000..1816584
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/SpatialDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+import java.time.Instant;
+
+import org.osgi.dto.DTO;
+
+/**
+ * A simple object representing a spatial data point available in the database.
+ * Each spatial point is described by its timestamp, unique tagID and coordinates.
+ * Any database error during the retrieval of the spatial point is hold in the
+ * error field.
+ */
+public class SpatialDTO extends DTO {
+
+ public String error;
+
+ public Instant timestamp;
+
+ public int tagID;
+
+ public String latitude, longitude;
+
+
+}
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/SpatioTemporalDTO.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/SpatioTemporalDTO.java
new file mode 100644
index 0000000..12641b2
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/SpatioTemporalDTO.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+import java.time.Instant;
+
+import org.osgi.dto.DTO;
+
+/**
+ * A simple object representing a spatio-temporal data point available in the database.
+ * Each spatial point is described by its timestamp, unique tagID, coordinates and value.
+ * Any database error during the retrieval of the spatio-temporal point is hold in the
+ * error field.
+ */
+public class SpatioTemporalDTO extends DTO{
+
+ public String error;
+
+ public Instant timestamp;
+
+ public int tagID;
+
+ public String latitude, longitude;
+
+ public String value;
+
+}
diff --git a/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/TemporalDTO.java b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/TemporalDTO.java
new file mode 100644
index 0000000..8de6350
--- /dev/null
+++ b/platform/sensinact-historic-api/src/main/java/org/eclipse/sensinact/gateway/historic/storage/reader/api/TemporalDTO.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2021 Kentyou.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+* Kentyou - initial API and implementation
+ */
+package org.eclipse.sensinact.gateway.historic.storage.reader.api;
+
+import org.osgi.dto.DTO;
+
+/**
+ * A simple object representing a temporal data point available in the database.
+ * Each temporal point is described by its timestamp, unique tagID and value.
+ * Any database error during the retrieval of the temporal point is hold in the error field.
+ */
+public class TemporalDTO extends DTO {
+
+ public String error;
+
+ public long timestamp;
+
+ public int tagID;
+
+ public String value;
+
+}