Skip to content

Commit

Permalink
Merge branch 'release/2021.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier committed Mar 11, 2021
2 parents 7a4e205 + 617c208 commit 5c9a9c5
Show file tree
Hide file tree
Showing 351 changed files with 7,613 additions and 5,870 deletions.
2 changes: 1 addition & 1 deletion cnf/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
</module>
<module name="MissingJavadocMethod">
<property name="allowedAnnotations" value="Before,Test,After,Override"/>
<property name="ignoreMethodNamesRegex" value="doc"/>
<property name="ignoreMethodNamesRegex" value="doc|set.+"/>
<property name="tokens" value="METHOD_DEF,ANNOTATION_FIELD_DEF"/>
</module>
</module>
Expand Down
2 changes: 1 addition & 1 deletion doc/modules/ROOT/pages/single_document.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= OpenEMS - Open Energy Management System
ifndef::toc[]
(c) 2020 OpenEMS Association e.V.
Version 2021.4.0
Version 2021.5.0
:sectnums:
:sectnumlevels: 4
:toc:
Expand Down
19 changes: 10 additions & 9 deletions io.openems.backend.application/BackendApp.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@

-runproperties: \
org.osgi.service.http.port=8079,\
felix.cm.dir=c:/openems-backend-config
felix.cm.dir=c:/openems-backend-config,\
org.ops4j.pax.logging.DefaultServiceLog.level=INFO

-runsystempackages: \
sun.misc

-runbundles+: \
org.apache.felix.scr;startlevel=10,\
org.ops4j.pax.logging.pax-logging-log4j1;startlevel=12

-runrequires: \
bnd.identity;id='org.ops4j.pax.logging.pax-logging-api',\
bnd.identity;id='org.ops4j.pax.logging.pax-logging-log4j1',\
Expand All @@ -24,13 +29,13 @@
bnd.identity;id='io.openems.backend.b2bwebsocket',\
bnd.identity;id='io.openems.backend.common',\
bnd.identity;id='io.openems.backend.core',\
bnd.identity;id='io.openems.backend.edgewebsocket.impl',\
bnd.identity;id='io.openems.backend.edgewebsocket',\
bnd.identity;id='io.openems.backend.metadata.dummy',\
bnd.identity;id='io.openems.backend.metadata.file',\
bnd.identity;id='io.openems.backend.metadata.odoo',\
bnd.identity;id='io.openems.backend.timedata.dummy',\
bnd.identity;id='io.openems.backend.timedata.influx',\
bnd.identity;id='io.openems.backend.uiwebsocket.impl',\
bnd.identity;id='io.openems.backend.uiwebsocket',\

-runbundles: \
Java-WebSocket;version='[1.5.1,1.5.2)',\
Expand All @@ -43,17 +48,13 @@
io.openems.backend.b2bwebsocket;version=snapshot,\
io.openems.backend.common;version=snapshot,\
io.openems.backend.core;version=snapshot,\
io.openems.backend.edgewebsocket.api;version=snapshot,\
io.openems.backend.edgewebsocket.impl;version=snapshot,\
io.openems.backend.metadata.api;version=snapshot,\
io.openems.backend.edgewebsocket;version=snapshot,\
io.openems.backend.metadata.dummy;version=snapshot,\
io.openems.backend.metadata.file;version=snapshot,\
io.openems.backend.metadata.odoo;version=snapshot,\
io.openems.backend.timedata.api;version=snapshot,\
io.openems.backend.timedata.dummy;version=snapshot,\
io.openems.backend.timedata.influx;version=snapshot,\
io.openems.backend.uiwebsocket.api;version=snapshot,\
io.openems.backend.uiwebsocket.impl;version=snapshot,\
io.openems.backend.uiwebsocket;version=snapshot,\
io.openems.common;version=snapshot,\
io.openems.shared.influxdb;version=snapshot,\
io.openems.wrapper.fastexcel;version=snapshot,\
Expand Down
6 changes: 1 addition & 5 deletions io.openems.backend.application/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ Bundle-Version: 1.0.0.${tstamp}
-buildpath: \
${buildpath},\
io.openems.backend.common,\
io.openems.backend.edgewebsocket.api,\
io.openems.backend.metadata.api,\
io.openems.backend.timedata.api,\
io.openems.backend.uiwebsocket.api,\
io.openems.common,\
Java-WebSocket;version=1.4.1
Java-WebSocket;version='1.4.1'

-testpath: \
${testpath}
3 changes: 1 addition & 2 deletions io.openems.backend.b2brest/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ Bundle-Version: 1.0.0.${tstamp}
-buildpath: \
${buildpath},\
io.openems.backend.common,\
io.openems.backend.metadata.api,\
io.openems.common,\
Java-WebSocket;version=1.4.1,\
Java-WebSocket;version='1.4.1',\
javax.servlet-api,\
org.apache.felix.http.jetty

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import io.openems.backend.common.component.AbstractOpenemsBackendComponent;
import io.openems.backend.common.jsonrpc.JsonRpcRequestHandler;
import io.openems.backend.metadata.api.Metadata;
import io.openems.backend.common.metadata.Metadata;
import io.openems.common.exceptions.OpenemsException;

@Designate(ocd = Config.class, factory = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

import io.openems.backend.metadata.api.BackendUser;
import io.openems.backend.common.metadata.BackendUser;
import io.openems.common.exceptions.OpenemsError;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.exceptions.OpenemsException;
Expand Down
4 changes: 1 addition & 3 deletions io.openems.backend.b2bwebsocket/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ Bundle-Version: 1.0.0.${tstamp}
-buildpath: \
${buildpath},\
io.openems.backend.common,\
io.openems.backend.metadata.api,\
io.openems.backend.timedata.api,\
io.openems.common,\
Java-WebSocket;version=1.4.1
Java-WebSocket;version='1.4.1'

-testpath: \
${testpath}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import io.openems.backend.common.component.AbstractOpenemsBackendComponent;
import io.openems.backend.common.jsonrpc.JsonRpcRequestHandler;
import io.openems.backend.metadata.api.Metadata;
import io.openems.backend.timedata.api.Timedata;
import io.openems.backend.common.metadata.Metadata;
import io.openems.backend.common.timedata.Timedata;

@Designate(ocd = Config.class, factory = true)
@Component(//
Expand All @@ -40,23 +40,33 @@ public B2bWebsocket() {
super("Backend2Backend.Websocket");
}

private Config config;

private final Runnable startServerWhenMetadataIsInitialized = () -> {
this.startServer(config.port(), config.poolSize(), config.debugMode());
};

@Activate
void activate(Config config) {
this.startServer(config.port());
this.config = config;
this.metadata.addOnIsInitializedListener(this.startServerWhenMetadataIsInitialized);
}

@Deactivate
void deactivate() {
this.metadata.removeOnIsInitializedListener(this.startServerWhenMetadataIsInitialized);
this.stopServer();
}

/**
* Create and start new server.
*
* @param port the port
* @param port the port
* @param poolSize number of threads dedicated to handle the tasks
* @param debugMode activate a regular debug log about the state of the tasks
*/
private synchronized void startServer(int port) {
this.server = new WebsocketServer(this, this.getName(), port);
private synchronized void startServer(int port, int poolSize, boolean debugMode) {
this.server = new WebsocketServer(this, this.getName(), port, poolSize, debugMode);
this.server.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
@AttributeDefinition(name = "Port", description = "The port of the websocket server.")
int port() default B2bWebsocket.DEFAULT_PORT;

@AttributeDefinition(name = "Number of Threads", description = "Pool-Size: the number of threads dedicated to handle the tasks")
int poolSize() default 10;

@AttributeDefinition(name = "Debug Mode", description = "Activates the debug mode")
boolean debugMode() default false;

String webconsole_configurationFactory_nameHint() default "Backend2Backend Websocket";

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.openems.backend.metadata.api.BackendUser;
import io.openems.backend.common.metadata.BackendUser;
import io.openems.common.exceptions.OpenemsException;

public class OnClose implements io.openems.common.websocket.OnClose {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.google.gson.JsonObject;

import io.openems.backend.metadata.api.BackendUser;
import io.openems.backend.common.metadata.BackendUser;
import io.openems.common.exceptions.OpenemsError;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.utils.JsonUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.java_websocket.WebSocket;

import io.openems.backend.b2bwebsocket.jsonrpc.request.SubscribeEdgesChannelsRequest;
import io.openems.backend.metadata.api.BackendUser;
import io.openems.backend.common.metadata.BackendUser;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.exceptions.OpenemsException;
import io.openems.common.jsonrpc.base.GenericJsonrpcResponseSuccess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import io.openems.backend.b2bwebsocket.jsonrpc.notification.EdgesCurrentDataNotification;
import io.openems.backend.b2bwebsocket.jsonrpc.request.SubscribeEdgesChannelsRequest;
import io.openems.backend.metadata.api.BackendUser;
import io.openems.backend.common.metadata.BackendUser;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.session.Role;
import io.openems.common.types.ChannelAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class WebsocketServer extends AbstractWebsocketServer<WsData> {
private final OnError onError;
private final OnClose onClose;

public WebsocketServer(B2bWebsocket parent, String name, int port) {
super(name, port);
public WebsocketServer(B2bWebsocket parent, String name, int port, int poolSize, boolean debugMode) {
super(name, port, poolSize, debugMode);
this.parent = parent;
this.onOpen = new OnOpen(parent);
this.onRequest = new OnRequest(parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import io.openems.backend.metadata.api.BackendUser;
import io.openems.backend.common.metadata.BackendUser;
import io.openems.common.exceptions.OpenemsError;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.openems.backend.b2bwebsocket.jsonrpc.request;

import java.util.TreeSet;
import java.util.UUID;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
Expand Down Expand Up @@ -36,7 +35,7 @@ public class SubscribeEdgesChannelsRequest extends JsonrpcRequest {
public static SubscribeEdgesChannelsRequest from(JsonrpcRequest r) throws OpenemsNamedException {
JsonObject p = r.getParams();
int count = JsonUtils.getAsInt(p, "count");
SubscribeEdgesChannelsRequest result = new SubscribeEdgesChannelsRequest(r.getId(), count);
SubscribeEdgesChannelsRequest result = new SubscribeEdgesChannelsRequest(r, count);
JsonArray edgeIds = JsonUtils.getAsJsonArray(p, "ids");
for (JsonElement edgeId : edgeIds) {
result.addEdgeId(JsonUtils.getAsString(edgeId));
Expand All @@ -57,13 +56,14 @@ public static SubscribeEdgesChannelsRequest from(JsonObject j) throws OpenemsNam
private final TreeSet<String> edgeIds = new TreeSet<>();
private final TreeSet<ChannelAddress> channels = new TreeSet<>();

public SubscribeEdgesChannelsRequest(UUID id, int count) {
super(id, METHOD);
private SubscribeEdgesChannelsRequest(JsonrpcRequest request, int count) {
super(request, METHOD);
this.count = count;
}

public SubscribeEdgesChannelsRequest(int count) {
this(UUID.randomUUID(), count);
super(METHOD);
this.count = count;
}

public void addEdgeId(String edgeId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
eclipse.preferences.version=1
encoding//src/io/openems/backend/common/edgewebsocket/package-info.java=UTF-8
encoding//src/io/openems/backend/common/metadata/package-info.java=UTF-8
encoding//src/io/openems/backend/common/timedata/package-info.java=UTF-8
encoding//src/io/openems/backend/common/uiwebsocket/package-info.java=UTF-8
encoding//test/.gitignore=UTF-8
encoding/bnd.bnd=UTF-8
1 change: 0 additions & 1 deletion io.openems.backend.common/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Bundle-Version: 1.0.0.${tstamp}

-buildpath: \
${buildpath},\
io.openems.backend.metadata.api,\
io.openems.common

-testpath: \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.openems.backend.edgewebsocket.api;
package io.openems.backend.common.edgewebsocket;

import java.util.UUID;
import java.util.concurrent.CompletableFuture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@org.osgi.annotation.versioning.Version("1.0.0")
@org.osgi.annotation.bundle.Export
package io.openems.backend.uiwebsocket.api;
package io.openems.backend.common.edgewebsocket;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.concurrent.CompletableFuture;

import io.openems.backend.metadata.api.BackendUser;
import io.openems.backend.common.metadata.BackendUser;
import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.jsonrpc.base.JsonrpcRequest;
import io.openems.common.jsonrpc.base.JsonrpcResponseSuccess;
Expand Down
Loading

0 comments on commit 5c9a9c5

Please sign in to comment.