Skip to content

Commit

Permalink
Merge pull request #524 from eclipse-sensinact/thomas/wot
Browse files Browse the repository at this point in the history
Initial version of the southbound Web of Things provider
  • Loading branch information
tcalmant authored Jan 6, 2025
2 parents 3fc7625 + 266e267 commit c3eeda8
Show file tree
Hide file tree
Showing 65 changed files with 5,071 additions and 0 deletions.
1 change: 1 addition & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ header:
- '**/*.javajet'
- '**/*.javajetinc'
- '**/*.json'
- '**/*.jsonld'
- '**/*.csv'
- '**/*.properties'
- '**/*.maven'
Expand Down
6 changes: 6 additions & 0 deletions southbound/wot/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Web of Things API

## Source of test files

- [basic-td.td.jsonld](https://github.com/eclipse-thingweb/playground/blob/master/examples/td/1-simple-default/basic-td.td.jsonld)
- [smart-coffee-machine.jsonld](https://github.com/eclipse-thingweb/node-wot/blob/master/packages/examples/src/scripts/smart-coffee-machine.ts)
50 changes: 50 additions & 0 deletions southbound/wot/api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*********************************************************************
* Copyright (c) 2024 Kentyou and others
*
* 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
**********************************************************************/
-->
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.sensinact.gateway.southbound.wot</groupId>
<artifactId>wot</artifactId>
<version>${revision}${changelist}</version>
</parent>
<artifactId>wot-api</artifactId>

<name>Web of Things API</name>
<description>APIs and classes to describe Things</description>

<dependencies>
<dependency>
<groupId>org.eclipse.sensinact.gateway.core</groupId>
<artifactId>api</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-testing-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-resolver-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*********************************************************************
* Copyright (c) 2024 Kentyou.
*
* 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:
* Thomas Calmant (Kentyou) - Initial contribution
**********************************************************************/

package org.eclipse.sensinact.gateway.southbound.wot.api;

import org.eclipse.sensinact.gateway.southbound.wot.api.dataschema.DataSchema;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class ActionAffordance extends InteractionAffordance {

public DataSchema input;
public DataSchema output;

public Boolean safe = false;
public Boolean idempotent = false;
public Boolean synchronous;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*********************************************************************
* Copyright (c) 2024 Kentyou.
*
* 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:
* Thomas Calmant (Kentyou) - Initial contribution
**********************************************************************/

package org.eclipse.sensinact.gateway.southbound.wot.api;

public class AdditionalExpectedResponse {

public boolean success = false;

public String contentType;

public String schema;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*********************************************************************
* Copyright (c) 2024 Kentyou.
*
* 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:
* Thomas Calmant (Kentyou) - Initial contribution
**********************************************************************/

package org.eclipse.sensinact.gateway.southbound.wot.api;

import org.eclipse.sensinact.gateway.southbound.wot.api.dataschema.DataSchema;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class EventAffordance extends InteractionAffordance {

public DataSchema subscription;
public DataSchema data;
public DataSchema dataResponse;
public DataSchema cancellation;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*********************************************************************
* Copyright (c) 2024 Kentyou.
*
* 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:
* Thomas Calmant (Kentyou) - Initial contribution
**********************************************************************/

package org.eclipse.sensinact.gateway.southbound.wot.api;

public class ExpectedResponse {

public String contentType;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*********************************************************************
* Copyright (c) 2024 Kentyou.
*
* 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:
* Thomas Calmant (Kentyou) - Initial contribution
**********************************************************************/

package org.eclipse.sensinact.gateway.southbound.wot.api;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class Form {

public String href;

public String contentType = "application/json";

public String contentCoding;

@JsonFormat(with = { JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
JsonFormat.Feature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED })
public List<String> security;

@JsonFormat(with = { JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
JsonFormat.Feature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED })
public List<String> scopes;

public ExpectedResponse response;

public List<AdditionalExpectedResponse> additionalResponses;

public String subprotocol;

@JsonFormat(with = { JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
JsonFormat.Feature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED })
public List<String> op = new ArrayList<>();

private final Map<String, Object> extraProperties = new HashMap<>();

@JsonAnySetter
public void addAdditionalProperty(String name, Object value) {
extraProperties.put(name, value);
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return extraProperties;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*********************************************************************
* Copyright (c) 2024 Kentyou.
*
* 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:
* Thomas Calmant (Kentyou) - Initial contribution
**********************************************************************/

package org.eclipse.sensinact.gateway.southbound.wot.api;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class InteractionAffordance {

@JsonProperty("@type")
@JsonFormat(with = { JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
JsonFormat.Feature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED })
public List<String> semanticType;

public String title;
public String description;

public List<Form> forms;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*********************************************************************
* Copyright (c) 2024 Kentyou.
*
* 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:
* Thomas Calmant (Kentyou) - Initial contribution
**********************************************************************/

package org.eclipse.sensinact.gateway.southbound.wot.api;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class Link {

public String href;

public String type;

public String rel;

public String anchor;

public String sizes;

@JsonProperty("hreflang")
@JsonFormat(with = { JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY,
JsonFormat.Feature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED })
public List<String> hrefLang;
}
Loading

0 comments on commit c3eeda8

Please sign in to comment.