Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>
<groupId>com.sap.iotservices.gateway.extension</groupId>
<artifactId>edgeApiExtensionInterface</artifactId>
<name>edgeApiExtensionInterface</name>
<version>1.0.0</version>
<properties>
<bundle.symbolicName>${project.artifactId}</bundle.symbolicName>
<bundle.version>${project.version}</bundle.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<!-- the versions plugin can be used to check for new plugin versions
like this: mvn versions:Display-plugin-updates -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<!-- Configure extra execution of 'manifest' in process-classes
phase to make sure SCR metadata is generated before unit test runs -->
<execution>
<id>scr-metadata</id>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<supportIncrementalBuild>true</supportIncrementalBuild>
</configuration>
</execution>
</executions>
<configuration>
<exportScr>true</exportScr>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Bundle-Version>${bundle.version}</Bundle-Version>
<!-- Enable processing of OSGI DS component annotations -->
<_dsannotations>*</_dsannotations>
<!-- Enable processing of OSGI metatype annotations -->
<_metatypeannotations>*</_metatypeannotations>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.sap.iotservices.gateway.extension;

public interface IEdgeApiExtension {

long getUptime();

long getDowntime();

float getNoisePower(float signal, float variance);

}
103 changes: 103 additions & 0 deletions custom-services-additional-apis-messagebus/edgeApiExtension/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>
<groupId>com.sap.iotservices.gateway.extension</groupId>
<artifactId>edgeApiExtension</artifactId>
<name>edgeApiExtension</name>
<version>1.0.0</version>
<properties>
<bundle.symbolicName>${project.artifactId}</bundle.symbolicName>
<bundle.version>${project.version}</bundle.version>
</properties>
<dependencies>
<dependency>
<groupId>com.sap.iotservices.gateway.extension</groupId>
<artifactId>edgeApiExtensionInterface</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
<version>6.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.29</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.5.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<!-- the versions plugin can be used to check for new plugin versions
like this: mvn versions:Display-plugin-updates -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<!-- Configure extra execution of 'manifest' in process-classes
phase to make sure SCR metadata is generated before unit test runs -->
<execution>
<id>scr-metadata</id>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<supportIncrementalBuild>true</supportIncrementalBuild>
</configuration>
</execution>
</executions>
<configuration>
<exportScr>true</exportScr>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Bundle-Version>${bundle.version}</Bundle-Version>
<!-- Enable processing of OSGI DS component annotations -->
<_dsannotations>*</_dsannotations>
<!-- Enable processing of OSGI metatype annotations -->
<_metatypeannotations>*</_metatypeannotations>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.sap.iotservices.gateway.extension.impl;

import java.lang.management.ManagementFactory;
import java.util.Date;
import java.util.Random;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sap.iotservices.gateway.extension.IEdgeApiExtension;

import oshi.SystemInfo;

@Component(immediate = true, service = IEdgeApiExtension.class)
public class EdgeApiExtension
implements IEdgeApiExtension {

private static final Logger LOGGER = LoggerFactory.getLogger(EdgeApiExtension.class);
Random r = new java.util.Random();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better use a private access


@Activate
public void startService() {
LOGGER.info("Starting Edge API Extension service");
}

@Deactivate
public void stopService() {
LOGGER.info("Stopping Edge API Extension service");
}

@Override
public long getUptime() {
Date now = new Date();
return (now.getTime() - ManagementFactory.getRuntimeMXBean().getStartTime()) / 1000;
}

@Override
public long getDowntime() {
long uptime = getUptime();
return new SystemInfo().getOperatingSystem().getSystemUptime() - (uptime / 1000);
}

@Override public float getNoisePower(float signal, float variance) {
double noise = r.nextGaussian() * Math.sqrt(variance) + signal;
return (float) noise;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"businessPartner": "8FA7D41CD4C448BF9A27962E9055C141",
"earliestStartDateTime": "2019-12-05T12:28:57.550000Z",
"dueDateTime": "2019-12-05T14:28:57.550000Z",
"durationInMinutes": "60",
"priority": "HIGH",
"subject": "High temperature on robot_t1",
"status": "-5",
"problemType": "-1",
"origin": "-1",
"remarks": "High temperature on robot_t1"
}
149 changes: 149 additions & 0 deletions custom-services-additional-apis-messagebus/extendedOperations/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>
<groupId>com.sap.iot.edge</groupId>
<artifactId>extendedOperations</artifactId>
<name>extendedOperations</name>
<version>1.0.0</version>
<properties>
<bundle.symbolicName>${project.artifactId}</bundle.symbolicName>
<bundle.version>${project.version}</bundle.version>
<gateway.version>4.51.0</gateway.version>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
<version>6.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sap.iotservices.gateway</groupId>
<artifactId>gateway-topology-edge-api-interface</artifactId>
<version>${gateway.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sap.iotservices.gateway.extension</groupId>
<artifactId>edgeApiExtensionInterface</artifactId>
<version>${bundle.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sap.iotservices.gateway</groupId>
<artifactId>netty-server-bundle</artifactId>
<version>${gateway.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-osgi</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.29</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>2.0.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.0.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0-m10</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<!-- the versions plugin can be used to check for new plugin versions
like this: mvn versions:Display-plugin-updates -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<!-- Configure extra execution of 'manifest' in process-classes
phase to make sure SCR metadata is generated before unit test runs -->
<execution>
<id>scr-metadata</id>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<supportIncrementalBuild>true</supportIncrementalBuild>
</configuration>
</execution>
</executions>
<configuration>
<exportScr>true</exportScr>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Bundle-Version>${bundle.version}</Bundle-Version>
<!-- Enable processing of OSGI DS component annotations -->
<_dsannotations>*</_dsannotations>
<!-- Enable processing of OSGI metatype annotations -->
<_metatypeannotations>*</_metatypeannotations>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading