Skip to content

Commit

Permalink
Merge pull request #523 from gathanase/snapshot
Browse files Browse the repository at this point in the history
Snapshot
  • Loading branch information
timothyjward authored Dec 19, 2024
2 parents 5a6799e + 00ec1b2 commit 3fc7625
Show file tree
Hide file tree
Showing 21 changed files with 454 additions and 2 deletions.
10 changes: 10 additions & 0 deletions distribution/features/northbound-rest-feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
<artifactId>filters.core</artifactId>
<version>${rest.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.sensinact.gateway.filters</groupId>
<artifactId>resource.selector</artifactId>
<version>${rest.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.sensinact.gateway.filters</groupId>
<artifactId>resource.selector.impl</artifactId>
<version>${rest.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"bundles":[
{ "id": "org.eclipse.sensinact.gateway.northbound:rest:${gateway.version}" },
{ "id": "org.eclipse.sensinact.gateway.filters:filters.core:${gateway.version}" },
{ "id": "org.eclipse.sensinact.gateway.filters:resource.selector:${gateway.version}" },
{ "id": "org.eclipse.sensinact.gateway.filters:resource.selector.impl:${gateway.version}" },
{ "id": "org.antlr:antlr4-runtime:4.12.0" },
{ "id": "org.eclipse.sensinact.gateway.filters:ldap:${gateway.version}" },
{ "id": "org.eclipse.sensinact.gateway.northbound:query-handler:${gateway.version}" },
Expand Down
2 changes: 2 additions & 0 deletions northbound/query-handler/integration-test.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
org.eclipse.sensinact.gateway.core.models.metadata;version='[0.0.2,0.0.3)',\
org.eclipse.sensinact.gateway.core.models.provider;version='[0.0.2,0.0.3)',\
org.eclipse.sensinact.gateway.filters.filters.core;version='[0.0.2,0.0.3)',\
org.eclipse.sensinact.gateway.filters.resource.selector;version='[0.0.2,0.0.3)',\
org.eclipse.sensinact.gateway.filters.resource.selector.impl;version='[0.0.2,0.0.3)',\
org.eclipse.sensinact.gateway.northbound.query-handler;version='[0.0.2,0.0.3)',\
org.eclipse.sensinact.gateway.northbound.query-handler-tests;version='[0.0.2,0.0.3)',\
org.eclipse.sensinact.gateway.northbound.security.security-api;version='[0.0.2,0.0.3)',\
Expand Down
11 changes: 11 additions & 0 deletions northbound/query-handler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
<artifactId>filters.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.sensinact.gateway.filters</groupId>
<artifactId>resource.selector</artifactId>
<version>${project.version}</version>
</dependency>

<!-- SL4J -->
<dependency>
Expand Down Expand Up @@ -81,6 +86,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.sensinact.gateway.filters</groupId>
<artifactId>resource.selector.impl</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<!-- OSGi -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.eclipse.sensinact.northbound.query.dto.notification.ResultResourceNotificationDTO;
import org.eclipse.sensinact.northbound.query.dto.result.ErrorResultDTO;
import org.eclipse.sensinact.northbound.query.dto.result.ResponseSnapshotDTO;
import org.eclipse.sensinact.northbound.query.dto.result.ResultActDTO;
import org.eclipse.sensinact.northbound.query.dto.result.ResultDescribeProvidersDTO;
import org.eclipse.sensinact.northbound.query.dto.result.ResultListProvidersDTO;
Expand All @@ -40,6 +41,7 @@
@Type(value = ResultListProvidersDTO.class, name = "PROVIDERS_LIST"),
@Type(value = ResultListServicesDTO.class, name = "SERVICES_LIST"),
@Type(value = ResultListResourcesDTO.class, name = "RESOURCES_LIST"),
@Type(value = ResponseSnapshotDTO.class, name = "SNAPSHOT_RESPONSE"),
@Type(value = TypedResponse.class, names = { "DESCRIBE_PROVIDER", "DESCRIBE_SERVICE", "DESCRIBE_RESOURCE",
"GET_RESPONSE", "SET_RESPONSE" }),
@Type(value = ResultActDTO.class, name = "ACT_RESPONSE"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public enum EQueryType {
*/
SET,

/**
* Get a snapshot
*/
GET_SNAPSHOT,

/**
* Acts on a resource (path must describe a unique resource)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum EResultType {
PROVIDERS_LIST,
SERVICES_LIST,
RESOURCES_LIST,
SNAPSHOT_RESPONSE,
DESCRIBE_PROVIDER,
DESCRIBE_SERVICE,
DESCRIBE_RESOURCE,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*********************************************************************
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Kentyou - initial implementation
**********************************************************************/
package org.eclipse.sensinact.northbound.query.dto.query;

import java.util.List;

import org.eclipse.sensinact.filters.resource.selector.api.ResourceSelector;
import org.eclipse.sensinact.northbound.query.api.AbstractQueryDTO;
import org.eclipse.sensinact.northbound.query.api.EQueryType;

/**
*
*/
public class QuerySnapshotDTO extends AbstractQueryDTO {

/**
* If set, include metadata in the result
*/
public boolean includeMetadata = false;

public List<ResourceSelector> filter;

public QuerySnapshotDTO() {
super(EQueryType.GET_SNAPSHOT);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*********************************************************************
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Kentyou - initial implementation
**********************************************************************/
package org.eclipse.sensinact.northbound.query.dto.result;

import java.util.Map;

import org.eclipse.sensinact.northbound.query.api.AbstractResultDTO;
import org.eclipse.sensinact.northbound.query.api.EResultType;


public class ResponseSnapshotDTO extends AbstractResultDTO {

public Map<String, SnapshotProviderDTO> providers;

public ResponseSnapshotDTO() {
super(EResultType.SNAPSHOT_RESPONSE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*********************************************************************
* Copyright (c) 2022 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Kentyou - initial implementation
**********************************************************************/
package org.eclipse.sensinact.northbound.query.dto.result;

import java.util.Map;

public class SnapshotProviderDTO {

/**
* Provider ID
*/
public String name;

/**
* Model Name
*/
public String modelName;

/**
* List of services
*/
public Map<String, SnapshotServiceDTO> services;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*********************************************************************
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Kentyou - initial implementation
**********************************************************************/
package org.eclipse.sensinact.northbound.query.dto.result;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

public class SnapshotResourceDTO {

/**
* Resource ID
*/
public String name;

/**
* Value milliseconds timestamp
*/
public long timestamp;

/**
* Value type
*/
public String type;

/**
* Value value
*/
public Object value;

/**
* Metadata, if requested
*/
@JsonInclude(Include.NON_NULL)
public List<MetadataDTO> attributes;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*********************************************************************
* Copyright (c) 2022 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Kentyou - initial implementation
**********************************************************************/
package org.eclipse.sensinact.northbound.query.dto.result;

import java.util.Map;

public class SnapshotServiceDTO {

/**
* Provider ID
*/
public String name;

/**
* List of resources
*/
public Map<String, SnapshotResourceDTO> resources;
}
Loading

0 comments on commit 3fc7625

Please sign in to comment.