Skip to content

Commit

Permalink
feat(sparkplug): added Sparkplug cloud connection boilerplate (#5059)
Browse files Browse the repository at this point in the history
* feat(sparkplug): added Sparkplug cloud connection factory

Signed-off-by: Marcello Martina <[email protected]>

* build: fixed coverage report path

Signed-off-by: Marcello Martina <[email protected]>

* feat(CloudEndpoint): added default implementation for CloudConnectionListener, CloudDeliveryListener, and DataServiceListener

Signed-off-by: Marcello Martina <[email protected]>

* chore: added missing copyright header

Signed-off-by: Marcello Martina <[email protected]>

* build: added DP in distrib

Signed-off-by: Marcello Martina <[email protected]>

---------

Signed-off-by: Marcello Martina <[email protected]>
  • Loading branch information
marcellorinaldo authored Dec 15, 2023
1 parent 145f109 commit 9480be5
Show file tree
Hide file tree
Showing 30 changed files with 1,676 additions and 7 deletions.
2 changes: 2 additions & 0 deletions kura/distrib/config/kura.build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ org.eclipse.kura.event.publisher.version=1.3.0-SNAPSHOT
org.eclipse.kura.db.sqlite.provider.version=1.2.0-SNAPSHOT
org.eclipse.kura.rest.network.status.provider.version=1.2.0-SNAPSHOT
org.eclipse.kura.wire.script.tools.version=1.2.0-SNAPSHOT
org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider.version=1.0.0-SNAPSHOT

## features versions
org.eclipse.kura.driver.opcua.version=1.5.0-SNAPSHOT
Expand All @@ -145,3 +146,4 @@ org.eclipse.kura.driver.ble.xdk.version=1.5.0-SNAPSHOT
org.eclipse.kura.wire.script.filter.version=1.5.0-SNAPSHOT
org.eclipse.kura.wire.script.tools.feature.version=1.2.0-SNAPSHOT
org.eclipse.kura.db.sqlite.feature.version=1.2.0-SNAPSHOT
org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider.feature.version=1.0.0-SNAPSHOT
6 changes: 6 additions & 0 deletions kura/distrib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2918,6 +2918,12 @@
<version>${org.eclipse.kura.db.sqlite.feature.version}</version>
<type>dp</type>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.kura.feature</groupId>
<artifactId>org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider</artifactId>
<version>${org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider.feature.version}</version>
<type>dp</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
###############################################################################
# Copyright (c) 2023 Eurotech and/or its affiliates 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
#
# Contributors:
# Eurotech
###############################################################################

bin.includes = feature.xml,\
feature.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
###############################################################################
# Copyright (c) 2023 Eurotech and/or its affiliates 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
#
# Contributors:
# Eurotech
###############################################################################

featureName=Eclipse Kura - Sparkplug MQTT Cloud Connection Provider
providerName=Eclipse Kura
description=Eclipse Kura Cloud Connection compliant with the Sparkplug v3.0.0 specification

copyright=\
Copyright (c) 2023 Eurotech and/or its affiliates and others\n\
\n\
This program and the accompanying materials are made\n\
available under the terms of the Eclipse Public License 2.0\n\
which accompanies this distribution, and is available at\n\
which is available at https://www.eclipse.org/legal/epl-2.0/\n\
\n\
SPDX-License-Identifier: EPL-2.0\n
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider"
label="%featureName"
version="1.0.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">

<description>
%description
</description>

<copyright>
%copyright
</copyright>

<license url="%licenseURL">
%license
</license>

<plugin
id="org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Red Hat Inc 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
Contributors:
Eurotech
-->
<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.kura.feature</groupId>
<artifactId>features</artifactId>
<version>5.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<artifactId>org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>

<build>
<plugins>
<plugin>
<groupId>de.dentrassi.maven</groupId>
<artifactId>osgi-dp</artifactId>
<version>${osgi-dp-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
11 changes: 6 additions & 5 deletions kura/features/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
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:
Eurotech
SPDX-License-Identifier: EPL-2.0
Contributors:
Eurotech
Red Hat Inc
-->
Expand Down Expand Up @@ -65,6 +65,7 @@
<module>org.eclipse.kura.ai.triton.server</module>
<module>org.eclipse.kura.wire.script.tools</module>
<module>org.eclipse.kura.db.sqlite.provider</module>
<module>org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider</module>
</modules>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sparkplug MQTT Cloud Connection Provider
Bundle-SymbolicName: org.eclipse.kura.cloudconnection.sparkplug.mqtt.provider
Bundle-Version: 1.0.0.qualifier
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Import-Package: org.eclipse.kura;version="[1.0,2.0)",
org.eclipse.kura.configuration;version="[1.1,2.0)",
org.eclipse.kura.cloud;version="[1.1,2.0)",
org.eclipse.kura.cloudconnection;version="[1.0,1.1)",
org.eclipse.kura.cloudconnection.factory;version="[1.0,1.1)",
org.eclipse.kura.cloudconnection.listener;version="[1.0,2.0)",
org.eclipse.kura.cloudconnection.message;version="[1.0,2.0)",
org.eclipse.kura.cloudconnection.publisher;version="[1.0,1.1)",
org.eclipse.kura.cloudconnection.subscriber;version="[1.0,1.1)",
org.eclipse.kura.cloudconnection.subscriber.listener;version="[1.0,2.0)",
org.eclipse.kura.data;version="[1.0,2.0)",
org.eclipse.kura.data.listener;version="[1.0,2.0)",
org.eclipse.kura.data.transport.listener;version="[1.0,2.0)",
org.osgi.framework;version="1.8.0",
org.osgi.service.component;version="1.2.0",
org.osgi.service.event;version="1.3.1",
org.slf4j;version="[1.7,2.0]"
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/*.xml
Bundle-Vendor: Eclipse Kura
Bundle-License: Eclipse Public License v2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Eurotech and/or its affiliates 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
Contributors:
Eurotech
-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="org.eclipse.kura.cloudconnection.sparkplug.mqtt.factory.SparkplugCloudConnectionFactory">

<implementation class="org.eclipse.kura.cloudconnection.sparkplug.mqtt.factory.SparkplugCloudConnectionFactory"/>

<reference interface="org.eclipse.kura.configuration.ConfigurationService"
bind="setConfigurationService"
cardinality="1..1"
name="ConfigurationService"
policy="static"/>

<service>
<provide interface="org.eclipse.kura.cloudconnection.factory.CloudConnectionFactory"/>
</service>

<property name="kura.ui.csf.pid.default" type="String" value="org.eclipse.kura.cloudconnection.sparkplug.mqtt.endpoint.SparkplugCloudEndpoint[-optionalSuffix]"/>
<property name="kura.ui.csf.pid.regex" type="String" value="^org.eclipse.kura.cloudconnection.sparkplug.mqtt.endpoint.SparkplugCloudEndpoint(\-[a-zA-Z0-9]+)?$"/>
<property name="service.pid" type="String" value="org.eclipse.kura.cloudconnection.sparkplug.mqtt.factory.SparkplugCloudConnectionFactory"/>
</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Eurotech and/or its affiliates 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
Contributors:
Eurotech
-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
activate="activate"
deactivate="deactivate"
modified="update"
configuration-policy="require"
enabled="true"
immediate="false"
name="org.eclipse.kura.cloudconnection.sparkplug.mqtt.endpoint.SparkplugCloudEndpoint">

<implementation class="org.eclipse.kura.cloudconnection.sparkplug.mqtt.endpoint.SparkplugCloudEndpoint"/>

<service>
<provide interface="org.eclipse.kura.configuration.ConfigurableComponent"/>
<provide interface="org.eclipse.kura.cloudconnection.CloudConnectionManager"/>
<provide interface="org.eclipse.kura.cloudconnection.CloudEndpoint"/>
</service>

<reference interface="org.eclipse.kura.data.DataService"
name="DataService"
policy="static"
cardinality="1..1"
bind="setDataService"/>

<reference interface="org.osgi.service.event.EventAdmin"
name="EventAdmin"
policy="static"
cardinality="1..1"
bind="setEventAdmin"/>

<property name="kura.ui.service.hide" type="Boolean" value="true"/>
<property name="kura.ui.factory.hide" type="Boolean" value="true"/>

</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Eurotech and/or its affiliates 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
Contributors:
Eurotech
-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0"
configuration-policy="require"
activate="activate"
deactivate="deactivate"
modified="update"
enabled="true"
immediate="true"
name="org.eclipse.kura.cloudconnection.sparkplug.mqtt.transport.SparkplugDataTransport">

<implementation class="org.eclipse.kura.cloudconnection.sparkplug.mqtt.transport.SparkplugDataTransport"/>

<service>
<provide interface="org.eclipse.kura.data.DataTransportService"/>
<provide interface="org.eclipse.kura.configuration.ConfigurableComponent"/>
</service>

<property name="kura.ui.service.hide" type="Boolean" value="true"/>
<property name="kura.ui.factory.hide" type="Boolean" value="true"/>

</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Eurotech and/or its affiliates 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
Contributors:
Eurotech
-->
<MetaData xmlns="http://www.osgi.org/xmlns/metatype/v1.2.0" localization="en_us">

<OCD id="org.eclipse.kura.cloudconnection.sparkplug.mqtt.endpoint.SparkplugCloudEndpoint"
name="SparkplugCloudEndpoint"
description="Cloud Endpoint layer configuration.">

</OCD>

<Designate pid="org.eclipse.kura.cloudconnection.sparkplug.mqtt.endpoint.SparkplugCloudEndpoint"
factoryPid="org.eclipse.kura.cloudconnection.sparkplug.mqtt.endpoint.SparkplugCloudEndpoint">
<Object ocdref="org.eclipse.kura.cloudconnection.sparkplug.mqtt.endpoint.SparkplugCloudEndpoint"/>
</Designate>
</MetaData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Eurotech and/or its affiliates 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
Contributors:
Eurotech
-->
<MetaData xmlns="http://www.osgi.org/xmlns/metatype/v1.2.0" localization="en_us">

<OCD id="org.eclipse.kura.cloudconnection.sparkplug.mqtt.transport.SparkplugDataTransport"
name="SparkplugDataTransport"
description="Data Transport layer configuration.">

</OCD>

<Designate pid="org.eclipse.kura.cloudconnection.sparkplug.mqtt.transport.SparkplugDataTransport"
factoryPid="org.eclipse.kura.cloudconnection.sparkplug.mqtt.transport.SparkplugDataTransport">
<Object ocdref="org.eclipse.kura.cloudconnection.sparkplug.mqtt.transport.SparkplugDataTransport"/>
</Designate>
</MetaData>
Loading

0 comments on commit 9480be5

Please sign in to comment.