100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Code cleanup (naming of agent/protocol classes)
Rich Turner5e125a398e74
diff --git a/agent/build.gradle b/agent/build.gradleindex 10ee387b7..ce483f99e 100644--- a/agent/build.gradle+++ b/agent/build.gradle@@ -12,11 +12,6 @@ dependencies {compile "io.netty:netty-codec-http:$nettyVersion"compile "com.neuronrobotics:nrjavaserial:$nrjavaserialVersion"- compile "com.luckycatlabs:SunriseSunsetCalculator:$sunriseSunsetCalculatorVersion"- compile("org.quartz-scheduler:quartz:$quartzVersion") {- exclude group: "c3p0"- }-compile("com.github.calimero:calimero-core:$calimeroVersion") {// Libraries should not depend on a logging implementation and/or alpha versions!exclude group: "org.slf4j"diff --git a/agent/src/main/java/org/openremote/agent/protocol/artnet/ArtnetAgent.java b/agent/src/main/java/org/openremote/agent/protocol/artnet/ArtnetAgent.javaindex 98efeca55..6a271bc20 100644--- a/agent/src/main/java/org/openremote/agent/protocol/artnet/ArtnetAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/artnet/ArtnetAgent.java@@ -19,7 +19,7 @@*/package org.openremote.agent.protocol.artnet;-import org.openremote.agent.protocol.io.IoAgent;+import org.openremote.agent.protocol.io.IOAgent;import org.openremote.model.asset.agent.AgentDescriptor;import org.openremote.model.asset.agent.AgentLink;import org.openremote.model.util.ModelIgnore;@@ -29,7 +29,7 @@ import javax.persistence.Entity;@ModelIgnore@Entity-public class ArtnetAgent extends IoAgent<ArtnetAgent, ArtnetProtocol, AgentLink.Default> {+public class ArtnetAgent extends IOAgent<ArtnetAgent, ArtnetProtocol, AgentLink.Default> {public static final AgentDescriptor<ArtnetAgent, ArtnetProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(ArtnetAgent.class, ArtnetProtocol.class, AgentLink.Default.classdiff --git a/agent/src/main/java/org/openremote/agent/protocol/artnet/ArtnetProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/artnet/ArtnetProtocol.javaindex 60973e4e7..12f09bda9 100644--- a/agent/src/main/java/org/openremote/agent/protocol/artnet/ArtnetProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/artnet/ArtnetProtocol.java@@ -1,9 +1,9 @@package org.openremote.agent.protocol.artnet;import io.netty.channel.ChannelHandler;-import org.openremote.agent.protocol.io.AbstractIoClientProtocol;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;-import org.openremote.agent.protocol.udp.UdpIoClient;+import org.openremote.agent.protocol.io.AbstractIOClientProtocol;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.udp.UDPIOClient;import org.openremote.model.asset.AssetTreeNode;import org.openremote.model.asset.agent.AgentLink;import org.openremote.model.attribute.Attribute;@@ -18,7 +18,7 @@ import java.util.concurrent.Future;import java.util.function.Consumer;import java.util.function.Supplier;-public class ArtnetProtocol extends AbstractIoClientProtocol<ArtnetProtocol, ArtnetAgent, ArtnetPacket, UdpIoClient<ArtnetPacket>, AgentLink.Default> implements ProtocolAssetImport {+public class ArtnetProtocol extends AbstractIOClientProtocol<ArtnetProtocol, ArtnetAgent, ArtnetPacket, UDPIOClient<ArtnetPacket>, AgentLink.Default> implements ProtocolAssetImport {public static final String PROTOCOL_DISPLAY_NAME = "Artnet";protected final Map<AttributeRef, Consumer<ArtnetPacket>> protocolMessageConsumers = new HashMap<>();@@ -34,7 +34,7 @@ public class ArtnetProtocol extends AbstractIoClientProtocol<ArtnetProtocol, Art}@Override- protected UdpIoClient<ArtnetPacket> doCreateIoClient() throws Exception {+ protected UDPIOClient<ArtnetPacket> doCreateIoClient() throws Exception {String host = agent.getHost().orElseThrow(() ->new IllegalArgumentException("Required host attribute is null or missing"));@@ -43,14 +43,14 @@ public class ArtnetProtocol extends AbstractIoClientProtocol<ArtnetProtocol, ArtInteger bindPort = agent.getBindPort().orElse(null);- return new UdpIoClient<>(host, port, bindPort);+ return new UDPIOClient<>(host, port, bindPort);}@Overrideprotected Supplier<ChannelHandler[]> getEncoderDecoderProvider() {return () ->new ChannelHandler[] {- new AbstractNettyIoClient.MessageToByteEncoder<>(ArtnetPacket.class, client.ioClient, ArtnetPacket::toByteBuf)+ new AbstractNettyIOClient.MessageToByteEncoder<>(ArtnetPacket.class, client.ioClient, ArtnetPacket::toByteBuf)};}diff --git a/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerProtocol.javaindex 5290768f3..3f2ae0676 100644--- a/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerProtocol.java@@ -28,10 +28,9 @@ import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;import org.openremote.agent.protocol.AbstractProtocol;import org.openremote.agent.protocol.controller.command.ControllerCommandBasic;import org.openremote.agent.protocol.controller.command.ControllerCommandMapped;-import org.openremote.agent.protocol.http.HttpClientProtocol;+import org.openremote.agent.protocol.http.HTTPProtocol;import org.openremote.container.web.WebTargetBuilder;import org.openremote.model.Container;-import org.openremote.model.asset.AssetResource;import org.openremote.model.asset.agent.ConnectionStatus;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;@@ -233,7 +232,7 @@ public class ControllerProtocol extends AbstractProtocol<ControllerAgent, ControAttributeRef attributeRef = event.getAttributeRef();ControllerCommand controllerCommand = controller.getCommand(attributeRef);- HttpClientProtocol.HttpClientRequest request = RequestBuilder.buildCommandRequest(controllerCommand, event, controllerWebTarget);+ HTTPProtocol.HttpClientRequest request = RequestBuilder.buildCommandRequest(controllerCommand, event, controllerWebTarget);String body = null;@@ -269,7 +268,7 @@ public class ControllerProtocol extends AbstractProtocol<ControllerAgent, ControwithLock(getProtocolName() + "::executeInitialStatus::" + attributeRef, () -> {LOG.info("### Initial status check for " + attributeRef.getName() + " [" + deviceName + "," + sensorName + "] ...");- HttpClientProtocol.HttpClientRequest checkRequest = RequestBuilder.buildStatusRequest(deviceName, Arrays.asList(sensorName), controllerWebTarget);+ HTTPProtocol.HttpClientRequest checkRequest = RequestBuilder.buildStatusRequest(deviceName, Arrays.asList(sensorName), controllerWebTarget);Response response = null;@@ -340,7 +339,7 @@ public class ControllerProtocol extends AbstractProtocol<ControllerAgent, Controprivate void executePollingRequest(String deviceName, List<String> sensorList, Consumer<Response> responseConsumer) {LOG.info("### Polling Request for device [device=" + deviceName + ", sensors=" + this.formatSensors(sensorList) + "]");- HttpClientProtocol.HttpClientRequest httpClientRequest = RequestBuilder+ HTTPProtocol.HttpClientRequest httpClientRequest = RequestBuilder.buildStatusPollingRequest(deviceName, sensorList, controller.getDeviceId(), controllerWebTarget);Response response = null;@@ -419,7 +418,7 @@ public class ControllerProtocol extends AbstractProtocol<ControllerAgent, Controthis.updateLinkedAttribute(new AttributeState(attributeRef, valueObj));}- private void executeAttributeWriteRequest(HttpClientProtocol.HttpClientRequest request, String body, Consumer<Response> responseConsumer) {+ private void executeAttributeWriteRequest(HTTPProtocol.HttpClientRequest request, String body, Consumer<Response> responseConsumer) {Response response = null;try {@@ -479,7 +478,7 @@ public class ControllerProtocol extends AbstractProtocol<ControllerAgent, ControwithLock(getProtocolName() + "::executeHeartbeat", () -> {LOG.info("Doing heartbeat check for controller: " + controllerWebTarget.getUriBuilder().build());- HttpClientProtocol.HttpClientRequest checkRequest = RequestBuilder.buildCheckRequest(controllerWebTarget);+ HTTPProtocol.HttpClientRequest checkRequest = RequestBuilder.buildCheckRequest(controllerWebTarget);Response response = null;diff --git a/agent/src/main/java/org/openremote/agent/protocol/controller/RequestBuilder.java b/agent/src/main/java/org/openremote/agent/protocol/controller/RequestBuilder.javaindex 4dafc79b3..32018cf8b 100644--- a/agent/src/main/java/org/openremote/agent/protocol/controller/RequestBuilder.java+++ b/agent/src/main/java/org/openremote/agent/protocol/controller/RequestBuilder.java@@ -22,7 +22,7 @@ package org.openremote.agent.protocol.controller;import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;import org.openremote.agent.protocol.controller.command.ControllerCommandBasic;import org.openremote.agent.protocol.controller.command.ControllerCommandMapped;-import org.openremote.agent.protocol.http.HttpClientProtocol;+import org.openremote.agent.protocol.http.HTTPProtocol;import org.openremote.model.attribute.AttributeEvent;import javax.ws.rs.core.MediaType;@@ -48,7 +48,7 @@ public class RequestBuilder {return headers;}- public static HttpClientProtocol.HttpClientRequest buildCommandRequest(ControllerCommand controllerCommand, AttributeEvent event, ResteasyWebTarget webTarget) {+ public static HTTPProtocol.HttpClientRequest buildCommandRequest(ControllerCommand controllerCommand, AttributeEvent event, ResteasyWebTarget webTarget) {MultivaluedMap<String, String> queryParam = new MultivaluedHashMap<>();//This part could be put in a Wrapper@@ -64,7 +64,7 @@ public class RequestBuilder {queryParam.add("name", correspondingCommandName);}- return new HttpClientProtocol.HttpClientRequest(+ return new HTTPProtocol.HttpClientRequest(webTarget,"/rest/devices/" + controllerCommand.getDeviceName() + "/commands","POST",@@ -75,12 +75,12 @@ public class RequestBuilder {);}- public static HttpClientProtocol.HttpClientRequest buildStatusPollingRequest(String deviceName, List<String> sensorsName, String deviceId, ResteasyWebTarget webTarget) {+ public static HTTPProtocol.HttpClientRequest buildStatusPollingRequest(String deviceName, List<String> sensorsName, String deviceId, ResteasyWebTarget webTarget) {MultivaluedMap<String, String> queryParam = new MultivaluedHashMap<>();queryParam.addAll("name", sensorsName);- return new HttpClientProtocol.HttpClientRequest(+ return new HTTPProtocol.HttpClientRequest(webTarget,"/rest/devices/" + deviceName + "/polling/" + deviceId,"GET",@@ -91,12 +91,12 @@ public class RequestBuilder {);}- public static HttpClientProtocol.HttpClientRequest buildStatusRequest(String deviceName, List<String> sensorsName, ResteasyWebTarget webTarget) {+ public static HTTPProtocol.HttpClientRequest buildStatusRequest(String deviceName, List<String> sensorsName, ResteasyWebTarget webTarget) {MultivaluedMap<String, String> queryParam = new MultivaluedHashMap<>();queryParam.addAll("name", sensorsName);- return new HttpClientProtocol.HttpClientRequest(+ return new HTTPProtocol.HttpClientRequest(webTarget,"/rest/devices/" + deviceName + "/status","GET",@@ -107,8 +107,8 @@ public class RequestBuilder {);}- public static HttpClientProtocol.HttpClientRequest buildCheckRequest(ResteasyWebTarget webTarget) {- return new HttpClientProtocol.HttpClientRequest(+ public static HTTPProtocol.HttpClientRequest buildCheckRequest(ResteasyWebTarget webTarget) {+ return new HTTPProtocol.HttpClientRequest(webTarget,"","GET",diff --git a/agent/src/main/java/org/openremote/agent/protocol/controller/command/ControllerCommandBasic.java b/agent/src/main/java/org/openremote/agent/protocol/controller/command/ControllerCommandBasic.javaindex 43bc4f805..a919d0c5f 100644--- a/agent/src/main/java/org/openremote/agent/protocol/controller/command/ControllerCommandBasic.java+++ b/agent/src/main/java/org/openremote/agent/protocol/controller/command/ControllerCommandBasic.java@@ -1,7 +1,7 @@package org.openremote.agent.protocol.controller.command;import org.openremote.agent.protocol.controller.ControllerCommand;-import org.openremote.agent.protocol.http.HttpClientProtocol;+import org.openremote.agent.protocol.http.HTTPProtocol;import org.openremote.model.attribute.AttributeRef;import java.util.function.Consumer;@@ -9,7 +9,7 @@ import java.util.function.Consumer;/*** A ControllerCommandBasic represent a configuration to execute a Controller 2.5 command with just a command name* (command parameter is managed at launch depending on linked attribute value {@link- * org.openremote.agent.protocol.controller.ControllerProtocol#executeAttributeWriteRequest(HttpClientProtocol.HttpClientRequest,+ * org.openremote.agent.protocol.controller.ControllerProtocol#executeAttributeWriteRequest(HTTPProtocol.HttpClientRequest,* AttributeRef, Consumer)}).*/public class ControllerCommandBasic extends ControllerCommand {diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/AbstractHttpServerAgent.java b/agent/src/main/java/org/openremote/agent/protocol/http/AbstractHTTPServerAgent.javasimilarity index 85%rename from agent/src/main/java/org/openremote/agent/protocol/http/AbstractHttpServerAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/http/AbstractHTTPServerAgent.javaindex 32bdda214..08aef78c7 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/AbstractHttpServerAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/AbstractHTTPServerAgent.java@@ -26,19 +26,19 @@ import org.openremote.model.value.ValueType;import java.util.Optional;-import static org.openremote.agent.protocol.http.HttpClientAgent.VALUE_HTTP_METHOD;+import static org.openremote.agent.protocol.http.HTTPAgent.VALUE_HTTP_METHOD;-public abstract class AbstractHttpServerAgent<T extends AbstractHttpServerAgent<T, U, V>, U extends AbstractHttpServerProtocol<U, T, V>, V extends AgentLink<?>> extends Agent<T, U, V> {+public abstract class AbstractHTTPServerAgent<T extends AbstractHTTPServerAgent<T, U, V>, U extends AbstractHTTPServerProtocol<U, T, V>, V extends AgentLink<?>> extends Agent<T, U, V> {public static final AttributeDescriptor<String> DEPLOYMENT_PATH = new AttributeDescriptor<>("deploymentPath", ValueType.TEXT);- public static final AttributeDescriptor<HttpMethod[]> ALLOWED_HTTP_METHODS = new AttributeDescriptor<>("allowedHTTPMethods", VALUE_HTTP_METHOD.asArray());+ public static final AttributeDescriptor<HTTPMethod[]> ALLOWED_HTTP_METHODS = new AttributeDescriptor<>("allowedHTTPMethods", VALUE_HTTP_METHOD.asArray());public static final AttributeDescriptor<String[]> ALLOWED_ORIGINS = new AttributeDescriptor<>("allowedOrigins", ValueType.TEXT.asArray());public static final AttributeDescriptor<Boolean> ROLE_BASED_SECURITY = new AttributeDescriptor<>("roleBasedSecurity", ValueType.BOOLEAN);- protected AbstractHttpServerAgent() {}+ protected AbstractHTTPServerAgent() {}- protected AbstractHttpServerAgent(String name) {+ protected AbstractHTTPServerAgent(String name) {super(name);}@@ -52,12 +52,12 @@ public abstract class AbstractHttpServerAgent<T extends AbstractHttpServerAgent<return (T)this;}- public Optional<HttpMethod[]> getAllowedHTTPMethods() {+ public Optional<HTTPMethod[]> getAllowedHTTPMethods() {return getAttributes().getValue(ALLOWED_HTTP_METHODS);}@SuppressWarnings("unchecked")- public T setAllowedHTTPMethods(HttpMethod[] value) {+ public T setAllowedHTTPMethods(HTTPMethod[] value) {getAttributes().getOrCreate(ALLOWED_HTTP_METHODS).setValue(value);return (T)this;}diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/AbstractHttpServerProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/http/AbstractHTTPServerProtocol.javasimilarity index 94%rename from agent/src/main/java/org/openremote/agent/protocol/http/AbstractHttpServerProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/http/AbstractHTTPServerProtocol.javaindex fb2d3c753..d3cc4adee 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/AbstractHttpServerProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/AbstractHTTPServerProtocol.java@@ -57,19 +57,19 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;* required JAX-RS deployment. Multiple instances of the same deployment can be created by creating multiple protocol* instances for the desired concrete implementation.* <p>- * The deployment is deployed by creating an instance of a concrete {@link AbstractHttpServerAgent} implementation with+ * The deployment is deployed by creating an instance of a concrete {@link AbstractHTTPServerAgent} implementation with* the following {@link Attribute}s:* <ul>- * <li>{@link AbstractHttpServerAgent#DEPLOYMENT_PATH} <b>(required)</b></li>- * <li>{@link AbstractHttpServerAgent#ALLOWED_ORIGINS}</li>- * <li>{@link AbstractHttpServerAgent#ALLOWED_HTTP_METHODS}</li>+ * <li>{@link AbstractHTTPServerAgent#DEPLOYMENT_PATH} <b>(required)</b></li>+ * <li>{@link AbstractHTTPServerAgent#ALLOWED_ORIGINS}</li>+ * <li>{@link AbstractHTTPServerAgent#ALLOWED_HTTP_METHODS}</li>* </ul>* The path used for the deployment is determined by {@link #getDeploymentPath}. The realm that the {@link Agent}* belongs to will be used implicitly for all incoming requests to any deployments* that this protocol creates and therefore only users of that realm will be able to make calls to the deployment when- * {@link AbstractHttpServerAgent#ROLE_BASED_SECURITY} is true.+ * {@link AbstractHTTPServerAgent#ROLE_BASED_SECURITY} is true.*/-public abstract class AbstractHttpServerProtocol<T extends AbstractHttpServerProtocol<T, U, V>, U extends AbstractHttpServerAgent<U, T, V>, V extends AgentLink<?>> extends AbstractProtocol<U, V> {+public abstract class AbstractHTTPServerProtocol<T extends AbstractHTTPServerProtocol<T, U, V>, U extends AbstractHTTPServerAgent<U, T, V>, V extends AgentLink<?>> extends AbstractProtocol<U, V> {public static class DeploymentInstance {protected DeploymentInfo deploymentInfo;@@ -91,8 +91,8 @@ public abstract class AbstractHttpServerProtocol<T extends AbstractHttpServerPro* The regex used to validate the deployment path.*/public static final Pattern PATH_REGEX = Pattern.compile("^[\\w/_]+$", Pattern.CASE_INSENSITIVE);- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, AbstractHttpServerProtocol.class);- public static final HttpMethod[] DEFAULT_ALLOWED_METHODS = HttpMethod.values();+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, AbstractHTTPServerProtocol.class);+ public static final HTTPMethod[] DEFAULT_ALLOWED_METHODS = HTTPMethod.values();protected DeploymentInstance deployment;protected static WebServiceExceptions.DefaultResteasyExceptionMapper defaultResteasyExceptionMapper;protected static WebServiceExceptions.ForbiddenResteasyExceptionMapper forbiddenResteasyExceptionMapper;@@ -105,7 +105,7 @@ public abstract class AbstractHttpServerProtocol<T extends AbstractHttpServerProprotected IdentityService identityService;protected WebService webService;- public AbstractHttpServerProtocol(U agent) {+ public AbstractHTTPServerProtocol(U agent) {super(agent);}@@ -219,15 +219,15 @@ public abstract class AbstractHttpServerProtocol<T extends AbstractHttpServerPro/*** Deployment path will always be prefixed with {@link #getDeploymentPathPrefix()}; default implementation combines- * the prefix with the value of {@link AbstractHttpServerAgent# META_PROTOCOL_DEPLOYMENT_PATH}, for example:+ * the prefix with the value of {@link AbstractHTTPServerAgent# META_PROTOCOL_DEPLOYMENT_PATH}, for example:* <ul>* <li>getDeploymentPathPrefix() = {@value #DEFAULT_DEPLOYMENT_PATH_PREFIX}</li>- * <li>{@link AbstractHttpServerAgent#DEPLOYMENT_PATH} = "complaints"</li>+ * <li>{@link AbstractHTTPServerAgent#DEPLOYMENT_PATH} = "complaints"</li>* </ul>* <p>* Full path to deployment = "/rest/complaints"* <p>- * If the {@link AbstractHttpServerAgent#DEPLOYMENT_PATH} is missing or not a String or the generated path does+ * If the {@link AbstractHTTPServerAgent#DEPLOYMENT_PATH} is missing or not a String or the generated path does* not match the {@link #PATH_REGEX} regex then an {@link IllegalArgumentException} will is thrown.*/protected String getDeploymentPath() throws IllegalArgumentException {diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPAgent.javasimilarity index 83%rename from agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/http/HTTPAgent.javaindex e6724d358..d5ecca7c7 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPAgent.java@@ -32,7 +32,7 @@ import java.util.Map;import java.util.Optional;@Entity-public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol, HttpClientAgent.HttpClientAgentLink> {+public class HTTPAgent extends Agent<HTTPAgent, HTTPProtocol, HTTPAgent.HttpClientAgentLink> {public static class HttpClientAgentLink extends AgentLink<HttpClientAgentLink> {@@ -41,7 +41,7 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,protected Integer pollingMillis;protected Boolean pagingMode;protected String path;- protected HttpMethod method;+ protected HTTPMethod method;protected String contentType;protected String pollingAttribute;@@ -97,11 +97,11 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,return this;}- public Optional<HttpMethod> getMethod() {+ public Optional<HTTPMethod> getMethod() {return Optional.ofNullable(method);}- public HttpClientAgentLink setMethod(HttpMethod method) {+ public HttpClientAgentLink setMethod(HTTPMethod method) {this.method = method;return this;}@@ -125,7 +125,7 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,}}- public static final ValueDescriptor<HttpMethod> VALUE_HTTP_METHOD = new ValueDescriptor<>("HTTPMethod", HttpMethod.class);+ public static final ValueDescriptor<HTTPMethod> VALUE_HTTP_METHOD = new ValueDescriptor<>("HTTPMethod", HTTPMethod.class);public static final AttributeDescriptor<String> BASE_URI = new AttributeDescriptor<>("baseURI", ValueType.TEXT);public static final AttributeDescriptor<Boolean> FOLLOW_REDIRECTS = new AttributeDescriptor<>("followRedirects", ValueType.BOOLEAN);@@ -133,17 +133,17 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,public static final AttributeDescriptor<ValueType.MultivaluedStringMap> REQUEST_QUERY_PARAMETERS = new AttributeDescriptor<>("requestQueryParameters", ValueType.MULTIVALUED_TEXT_MAP);public static final AttributeDescriptor<Integer> REQUEST_TIMEOUT_MILLIS = new AttributeDescriptor<>("requestTimeoutMillis", ValueType.POSITIVE_INTEGER);- public static final AgentDescriptor<HttpClientAgent, HttpClientProtocol, HttpClientAgentLink> DESCRIPTOR = new AgentDescriptor<>(- HttpClientAgent.class, HttpClientProtocol.class, HttpClientAgentLink.class+ public static final AgentDescriptor<HTTPAgent, HTTPProtocol, HttpClientAgentLink> DESCRIPTOR = new AgentDescriptor<>(+ HTTPAgent.class, HTTPProtocol.class, HttpClientAgentLink.class);/*** For use by hydrators (i.e. JPA/Jackson)*/- protected HttpClientAgent() {+ protected HTTPAgent() {}- public HttpClientAgent(String name) {+ public HTTPAgent(String name) {super(name);}@@ -151,7 +151,7 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,return getAttributes().getValue(BASE_URI);}- public HttpClientAgent setBaseURI(String value) {+ public HTTPAgent setBaseURI(String value) {getAttributes().getOrCreate(BASE_URI).setValue(value);return this;}@@ -160,7 +160,7 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,return getAttributes().getValue(FOLLOW_REDIRECTS);}- public HttpClientAgent setFollowRedirects(Boolean value) {+ public HTTPAgent setFollowRedirects(Boolean value) {getAttributes().getOrCreate(FOLLOW_REDIRECTS).setValue(value);return this;}@@ -169,7 +169,7 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,return getAttributes().getValue(REQUEST_HEADERS);}- public HttpClientAgent setRequestHeaders(ValueType.MultivaluedStringMap value) {+ public HTTPAgent setRequestHeaders(ValueType.MultivaluedStringMap value) {getAttributes().getOrCreate(REQUEST_HEADERS).setValue(value);return this;}@@ -178,7 +178,7 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,return getAttributes().getValue(REQUEST_QUERY_PARAMETERS);}- public HttpClientAgent setRequestQueryParameters(ValueType.MultivaluedStringMap value) {+ public HTTPAgent setRequestQueryParameters(ValueType.MultivaluedStringMap value) {getAttributes().getOrCreate(REQUEST_QUERY_PARAMETERS).setValue(value);return this;}@@ -187,13 +187,13 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,return getAttributes().getValue(REQUEST_TIMEOUT_MILLIS);}- public HttpClientAgent setRequestTimeoutMillis(Integer value) {+ public HTTPAgent setRequestTimeoutMillis(Integer value) {getAttributes().getOrCreate(REQUEST_TIMEOUT_MILLIS).setValue(value);return this;}@Override- public HttpClientProtocol getProtocolInstance() {- return new HttpClientProtocol(this);+ public HTTPProtocol getProtocolInstance() {+ return new HTTPProtocol(this);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HttpMethod.java b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPMethod.javasimilarity index 97%rename from agent/src/main/java/org/openremote/agent/protocol/http/HttpMethod.javarename to agent/src/main/java/org/openremote/agent/protocol/http/HTTPMethod.javaindex dd4f747e7..414d9d6f4 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/HttpMethod.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPMethod.java@@ -19,7 +19,7 @@*/package org.openremote.agent.protocol.http;-public enum HttpMethod {+public enum HTTPMethod {GET,POST,PUT,diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.javasimilarity index 97%rename from agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.javaindex a1f362633..1300835ea 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.java@@ -59,7 +59,7 @@ import java.util.function.Consumer;import java.util.logging.Level;import java.util.logging.Logger;-import static org.openremote.agent.protocol.http.HttpClientAgent.*;+import static org.openremote.agent.protocol.http.HTTPAgent.*;import static org.openremote.container.concurrent.GlobalLock.withLock;import static org.openremote.container.web.QueryParameterInjectorFilter.QUERY_PARAMETERS_PROPERTY;import static org.openremote.container.web.WebTargetBuilder.createClient;@@ -72,20 +72,20 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;* <h1>Response filtering</h1>* <p>* Any {@link Attribute} whose value is to be set by the HTTP server response (i.e. it has an {@link- * HttpClientAgent#META_REQUEST_POLLING_MILLIS} {@link MetaItem}) can use the standard {@link Agent#META_VALUE_FILTERS} in+ * HTTPAgent#META_REQUEST_POLLING_MILLIS} {@link MetaItem}) can use the standard {@link Agent#META_VALUE_FILTERS} in* order to filter the received HTTP response.* <p>* <b>NOTE: if an exception is thrown during the request that means no response is returned then this is treated as if* a 500 response has been received</b>* <h1>Dynamic value injection</h1>- * This allows the {@link HttpClientAgent#META_REQUEST_PATH} and/or {@link Agent#META_WRITE_VALUE} to contain the linked+ * This allows the {@link HTTPAgent#META_REQUEST_PATH} and/or {@link Agent#META_WRITE_VALUE} to contain the linked* {@link Attribute} value when sending requests. To dynamically inject the attribute value use* {@value Protocol#DYNAMIC_VALUE_PLACEHOLDER} as a placeholder and this will be dynamically replaced at request time.* <h2>Path example</h2>- * {@link HttpClientAgent#META_REQUEST_PATH} = "volume/set/{$value}" and request received to set attribute value to 100. Actual path+ * {@link HTTPAgent#META_REQUEST_PATH} = "volume/set/{$value}" and request received to set attribute value to 100. Actual path* used for the request = "volume/set/100"* <h2>Query parameter example</h2>- * {@link HttpClientAgent#META_REQUEST_QUERY_PARAMETERS} =+ * {@link HTTPAgent#META_REQUEST_QUERY_PARAMETERS} =* <blockquote><pre>* {@code* {@@ -115,7 +115,7 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;* </pre></blockquote>* Actual body used for the request = "{myObject: {prop1: true, prop2: "test", prop3: {prop4: 1234.4223}}}"*/-public class HttpClientProtocol extends AbstractProtocol<HttpClientAgent, HttpClientAgentLink> {+public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HttpClientAgentLink> {public static class HttpClientRequest {@@ -273,7 +273,7 @@ public class HttpClientProtocol extends AbstractProtocol<HttpClientAgent, HttpClpublic static final String PROTOCOL_DISPLAY_NAME = "HTTP Client";public static final String DEFAULT_HTTP_METHOD = HttpMethod.GET;public static final String DEFAULT_CONTENT_TYPE = MediaType.TEXT_PLAIN;- protected static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, HttpClientProtocol.class);+ protected static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, HTTPProtocol.class);public static int MIN_POLLING_MILLIS = 5000;protected ResteasyWebTarget webTarget;@@ -286,7 +286,7 @@ public class HttpClientProtocol extends AbstractProtocol<HttpClientAgent, HttpClclient = createClient(org.openremote.container.Container.EXECUTOR_SERVICE);}- public HttpClientProtocol(HttpClientAgent agent) {+ public HTTPProtocol(HTTPAgent agent) {super(agent);}diff --git a/agent/src/main/java/org/openremote/agent/protocol/io/AbstractIoClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/io/AbstractIOClientProtocol.javasimilarity index 88%rename from agent/src/main/java/org/openremote/agent/protocol/io/AbstractIoClientProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/io/AbstractIOClientProtocol.javaindex cb6259e44..fcf8cb694 100644--- a/agent/src/main/java/org/openremote/agent/protocol/io/AbstractIoClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/io/AbstractIOClientProtocol.java@@ -49,14 +49,14 @@ import java.util.logging.Logger;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/**- * This is an abstract {@link Protocol} for protocols that require an {@link IoClient}.+ * This is an abstract {@link Protocol} for protocols that require an {@link IOClient}.*/-public abstract class AbstractIoClientProtocol<T extends AbstractIoClientProtocol<T, U, V, W, X>, U extends IoAgent<U, T, X>, V, W extends IoClient<V>, X extends AgentLink<?>> extends AbstractProtocol<U, X> {+public abstract class AbstractIOClientProtocol<T extends AbstractIOClientProtocol<T, U, V, W, X>, U extends IOAgent<U, T, X>, V, W extends IOClient<V>, X extends AgentLink<?>> extends AbstractProtocol<U, X> {/*** Supplies a set of encoders/decoders that convert from/to {@link String} to/from {@link ByteBuf} based on the generic protocol {@link Attribute}s*/- public static Supplier<ChannelHandler[]> getGenericStringEncodersAndDecoders(AbstractNettyIoClient<String, ?> client, IoAgent<?, ?, ?> agent) {+ public static Supplier<ChannelHandler[]> getGenericStringEncodersAndDecoders(AbstractNettyIOClient<String, ?> client, IOAgent<?, ?, ?> agent) {boolean hexMode = agent.getMessageConvertHex().orElse(false);boolean binaryMode = agent.getMessageConvertBinary().orElse(false);@@ -70,7 +70,7 @@ public abstract class AbstractIoClientProtocol<T extends AbstractIoClientProtocoif (hexMode || binaryMode) {encodersDecoders.add(- new AbstractNettyIoClient.MessageToByteEncoder<>(+ new AbstractNettyIOClient.MessageToByteEncoder<>(String.class,client,(msg, out) -> {@@ -90,7 +90,7 @@ public abstract class AbstractIoClientProtocol<T extends AbstractIoClientProtoco// Incoming messages will be bytesencodersDecoders.add(- new AbstractNettyIoClient.ByteToMessageDecoder<>(+ new AbstractNettyIOClient.ByteToMessageDecoder<>(client,(byteBuf, messages) -> {byte[] bytes = new byte[byteBuf.readableBytes()];@@ -111,17 +111,17 @@ public abstract class AbstractIoClientProtocol<T extends AbstractIoClientProtocoencodersDecoders.add(new FixedLengthFrameDecoder(maxLength));}encodersDecoders.add(new StringDecoder(charset));- encodersDecoders.add(new AbstractNettyIoClient.MessageToMessageDecoder<>(String.class, client));+ encodersDecoders.add(new AbstractNettyIOClient.MessageToMessageDecoder<>(String.class, client));}return encodersDecoders.toArray(new ChannelHandler[0]);};}- public static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, AbstractIoClientProtocol.class);- protected ProtocolIoClient<V, W> client;+ public static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, AbstractIOClientProtocol.class);+ protected ProtocolIOClient<V, W> client;- protected AbstractIoClientProtocol(U agent) {+ protected AbstractIOClientProtocol(U agent) {super(agent);}@@ -168,9 +168,9 @@ public abstract class AbstractIoClientProtocol<T extends AbstractIoClientProtococlient.send(message);}- protected ProtocolIoClient<V, W> createIoClient() throws Exception {+ protected ProtocolIOClient<V, W> createIoClient() throws Exception {W client = doCreateIoClient();- ProtocolIoClient<V, W> protocolIoClient = new ProtocolIoClient<>(client, this::onConnectionStatusChanged, this::onMessageReceived);+ ProtocolIOClient<V, W> protocolIoClient = new ProtocolIOClient<>(client, this::onConnectionStatusChanged, this::onMessageReceived);this.client = protocolIoClient;Supplier<ChannelHandler[]> encoderDecoderProvider = getEncoderDecoderProvider();client.setEncoderDecoderProvider(encoderDecoderProvider);@@ -178,14 +178,14 @@ public abstract class AbstractIoClientProtocol<T extends AbstractIoClientProtoco}/**- * Called when the {@link IoClient} {@link ConnectionStatus} changes+ * Called when the {@link IOClient} {@link ConnectionStatus} changes*/protected void onConnectionStatusChanged(ConnectionStatus connectionStatus) {setConnectionStatus(connectionStatus);}/**- * Should return an instance of {@link IoClient} for the linked {@link Agent}; the configuration of+ * Should return an instance of {@link IOClient} for the linked {@link Agent}; the configuration of* encoders/decoders is handled by the separate call to {@link #getEncoderDecoderProvider}*/protected abstract W doCreateIoClient() throws Exception;@@ -193,12 +193,12 @@ public abstract class AbstractIoClientProtocol<T extends AbstractIoClientProtocoprotected abstract Supplier<ChannelHandler[]> getEncoderDecoderProvider();/**- * Called when the {@link IoClient} receives a message from the server+ * Called when the {@link IOClient} receives a message from the server*/protected abstract void onMessageReceived(V message);/**- * Generate the actual message to send to the {@link IoClient} for this {@link AttributeEvent}+ * Generate the actual message to send to the {@link IOClient} for this {@link AttributeEvent}*/protected abstract V createWriteMessage(Attribute<?> attribute, X agentLink, AttributeEvent event, Object processedValue);}diff --git a/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIoClient.java b/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOClient.javasimilarity index 93%rename from agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIoClient.javarename to agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOClient.javaindex ebf02e3ab..2030aa99d 100644--- a/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIoClient.java+++ b/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOClient.java@@ -22,6 +22,8 @@ package org.openremote.agent.protocol.io;import io.netty.bootstrap.Bootstrap;import io.netty.buffer.ByteBuf;import io.netty.channel.*;+import org.openremote.agent.protocol.udp.UDPIOClient;+import org.openremote.agent.protocol.websocket.WebsocketIOClient;import org.openremote.container.Container;import org.openremote.model.util.Retry;import org.openremote.model.asset.agent.ConnectionStatus;@@ -42,26 +44,26 @@ import java.util.logging.Logger;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/**- * This is a {@link IoClient} implementation for netty.+ * This is a {@link IOClient} implementation for netty.* <p>* It uses the netty component for managing the connection.* <p>* Concrete implementations are responsible for providing the {@link ChannelOutboundHandler}s and* {@link ChannelInboundHandler}s required to encode/decode the specific type of messages sent/received to/from this- * client. For {@link IoClient}s that require some specific encoders/decoders irrespective of the message type (e.g.- * {@link org.openremote.agent.protocol.udp.UdpIoClient} and {@link org.openremote.agent.protocol.websocket.WebsocketIoClient})- * the {@link #addEncodersDecoders} method can be overridden so the {@link IoClient} can exactly control+ * client. For {@link IOClient}s that require some specific encoders/decoders irrespective of the message type (e.g.+ * {@link UDPIOClient} and {@link WebsocketIOClient})+ * the {@link #addEncodersDecoders} method can be overridden so the {@link IOClient} can exactly control* the order and types of encoders/decoders in the pipeline.* <p>- * Users of the {@link IoClient} can add encoders/decoders for their specific message type using the- * {@link #setEncoderDecoderProvider}, each {@link IoClient} should make it clear to users what the required output+ * Users of the {@link IOClient} can add encoders/decoders for their specific message type using the+ * {@link #setEncoderDecoderProvider}, each {@link IOClient} should make it clear to users what the required output* type(s) are for the last encoder and decoder that a user may wish to add, if adding encoders/decoders is not- * supported then {@link IoClient}s should override this setter and throw an {@link UnsupportedOperationException}.+ * supported then {@link IOClient}s should override this setter and throw an {@link UnsupportedOperationException}.* <p>* Typically for outgoing messages a single {@link ChannelOutboundHandler} is sufficient and the* {@link MessageToByteEncoder} can be used as a base.* <p>- * For inbound messages; the decoders required are very much dependent on the message type and {@link IoClient} type,+ * For inbound messages; the decoders required are very much dependent on the message type and {@link IOClient} type,* any number of standard netty {@link ChannelInboundHandler}s can be used but the last handler should build messages* of type <T> and pass them to the {@link #onMessageReceived} method of the client; the {@link ByteToMessageDecoder}* or {@link MessageToByteEncoder} can be used for this purpose, which one to use will depend on the previous@@ -70,19 +72,19 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;* <b>NOTE: Care must be taken when working with Netty {@link ByteBuf} as Netty uses reference counting to manage their* lifecycle. Refer to the Netty documentation for more information.</b>*/-public abstract class AbstractNettyIoClient<T, U extends SocketAddress> implements IoClient<T> {+public abstract class AbstractNettyIOClient<T, U extends SocketAddress> implements IOClient<T> {/*** This is intended to be used at the end of a decoder chain where the previous decoder outputs a {@link ByteBuf};* the provided {@link #decoder} should extract the messages of type <T> from the {@link ByteBuf} and add them- * to the {@link List} and they will then be passed to the {@link IoClient}.+ * to the {@link List} and they will then be passed to the {@link IOClient}.*/public static class ByteToMessageDecoder<T> extends io.netty.handler.codec.ByteToMessageDecoder {protected List<T> messages = new ArrayList<>(1);- protected AbstractNettyIoClient<T, ?> client;+ protected AbstractNettyIOClient<T, ?> client;protected BiConsumer<ByteBuf, List<T>> decoder;- public ByteToMessageDecoder(AbstractNettyIoClient<T, ?> client, @NotNull BiConsumer<ByteBuf, List<T>> decoder) {+ public ByteToMessageDecoder(AbstractNettyIOClient<T, ?> client, @NotNull BiConsumer<ByteBuf, List<T>> decoder) {this.client = client;this.decoder = decoder;}@@ -109,9 +111,9 @@ public abstract class AbstractNettyIoClient<T, U extends SocketAddress> implemen* This is intended to be used at the end of a decoder chain where the previous decoder outputs messages of type <T>.*/public static class MessageToMessageDecoder<T> extends SimpleChannelInboundHandler<T> {- protected AbstractNettyIoClient<T,?> client;+ protected AbstractNettyIOClient<T,?> client;- public MessageToMessageDecoder(Class<? extends T> typeClazz, AbstractNettyIoClient<T, ?> client) {+ public MessageToMessageDecoder(Class<? extends T> typeClazz, AbstractNettyIOClient<T, ?> client) {super(typeClazz);this.client = client;}@@ -132,10 +134,10 @@ public abstract class AbstractNettyIoClient<T, U extends SocketAddress> implemen* Concrete implementations must provide an encoder to fill the {@link ByteBuf} ready to be sent `over the wire`.*/public static class MessageToByteEncoder<T> extends io.netty.handler.codec.MessageToByteEncoder<T> {- protected AbstractNettyIoClient<T, ?> client;+ protected AbstractNettyIOClient<T, ?> client;protected BiConsumer<T, ByteBuf> encoder;- public MessageToByteEncoder(Class<? extends T> typeClazz, AbstractNettyIoClient<T, ?> client, BiConsumer<T, ByteBuf> encoder) {+ public MessageToByteEncoder(Class<? extends T> typeClazz, AbstractNettyIOClient<T, ?> client, BiConsumer<T, ByteBuf> encoder) {super(typeClazz);this.client = client;this.encoder = encoder;@@ -154,7 +156,7 @@ public abstract class AbstractNettyIoClient<T, U extends SocketAddress> implemen}}- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, AbstractNettyIoClient.class);+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, AbstractNettyIOClient.class);protected final static long RECONNECT_DELAY_INITIAL_MILLIS = 1000L;protected final static long RECONNECT_DELAY_MAX_MILLIS = 5*60000L;protected final static long RECONNECT_DELAY_JITTER_MILLIS = 10000L;@@ -170,7 +172,7 @@ public abstract class AbstractNettyIoClient<T, U extends SocketAddress> implemenprotected boolean permanentError;protected Supplier<ChannelHandler[]> encoderDecoderProvider;- protected AbstractNettyIoClient() {+ protected AbstractNettyIOClient() {this.executorService = Container.EXECUTOR_SERVICE;}@@ -251,7 +253,7 @@ public abstract class AbstractNettyIoClient<T, U extends SocketAddress> implemenbootstrap.handler(new ChannelInitializer<Channel>() {@Overridepublic void initChannel(Channel channel) {- AbstractNettyIoClient.this.initChannel(channel);+ AbstractNettyIOClient.this.initChannel(channel);}});diff --git a/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIoServer.java b/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOServer.javasimilarity index 97%rename from agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIoServer.javarename to agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOServer.javaindex d9b4e39c7..f895a8a1c 100644--- a/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIoServer.java+++ b/agent/src/main/java/org/openremote/agent/protocol/io/AbstractNettyIOServer.java@@ -44,15 +44,15 @@ import java.util.logging.Logger;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/**- * Abstract implementation of {@link IoServer} that uses the Netty library.+ * Abstract implementation of {@link IOServer} that uses the Netty library.*/@SuppressWarnings("unchecked")-public abstract class AbstractNettyIoServer<T, U extends Channel, V extends AbstractBootstrap<?,?>, W extends SocketAddress> implements IoServer<T, U, W> {+public abstract class AbstractNettyIOServer<T, U extends Channel, V extends AbstractBootstrap<?,?>, W extends SocketAddress> implements IOServer<T, U, W> {protected final static int INITIAL_RECONNECT_DELAY_MILLIS = 1000;protected final static int MAX_RECONNECT_DELAY_MILLIS = 60000;protected final static int RECONNECT_BACKOFF_MULTIPLIER = 2;- protected static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, AbstractNettyIoServer.class);+ protected static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, AbstractNettyIOServer.class);protected final ScheduledExecutorService executorService;protected int clientLimit = 0; // 0 means no limitprotected V bootstrap;@@ -67,7 +67,7 @@ public abstract class AbstractNettyIoServer<T, U extends Channel, V extends Abstprotected ScheduledFuture<?> reconnectTask;protected int reconnectDelayMilliseconds = INITIAL_RECONNECT_DELAY_MILLIS;- public AbstractNettyIoServer() {+ public AbstractNettyIOServer() {this.executorService = Container.EXECUTOR_SERVICE;}@@ -92,7 +92,7 @@ public abstract class AbstractNettyIoServer<T, U extends Channel, V extends Abstbootstrap.handler(new ChannelInitializer<U>() {@Overridepublic void initChannel(U channel) {- AbstractNettyIoServer.this.initChannel(channel);+ AbstractNettyIOServer.this.initChannel(channel);}});@@ -105,7 +105,7 @@ public abstract class AbstractNettyIoServer<T, U extends Channel, V extends AbstchannelFuture.addListener(new ChannelFutureListener() {@Overridepublic void operationComplete(ChannelFuture future) {- synchronized (AbstractNettyIoServer.this) {+ synchronized (AbstractNettyIOServer.this) {channelFuture.removeListener(this);if (connectionStatus == ConnectionStatus.DISCONNECTING) {@@ -258,7 +258,7 @@ public abstract class AbstractNettyIoServer<T, U extends Channel, V extends Abstchannel.pipeline().addLast(new ChannelInboundHandlerAdapter() {@Overridepublic void channelActive(ChannelHandlerContext ctx) throws Exception {- synchronized (AbstractNettyIoServer.this) {+ synchronized (AbstractNettyIOServer.this) {LOG.fine("Connected: " + getSocketAddressString());onConnectionStatusChanged(ConnectionStatus.CONNECTED);}@@ -267,7 +267,7 @@ public abstract class AbstractNettyIoServer<T, U extends Channel, V extends Abst@Overridepublic void channelInactive(ChannelHandlerContext ctx) throws Exception {- synchronized (AbstractNettyIoServer.this) {+ synchronized (AbstractNettyIOServer.this) {if (connectionStatus != ConnectionStatus.DISCONNECTING) {// This is a connection failure so ignore as reconnect logic will handle itreturn;@@ -432,7 +432,7 @@ public abstract class AbstractNettyIoServer<T, U extends Channel, V extends AbstLOG.finest("Scheduling reconnection in '" + reconnectDelayMilliseconds + "' milliseconds: " + getSocketAddressString());reconnectTask = executorService.schedule(() -> {- synchronized (AbstractNettyIoServer.this) {+ synchronized (AbstractNettyIOServer.this) {reconnectTask = null;// Attempt to reconnect if not disconnectingdiff --git a/agent/src/main/java/org/openremote/agent/protocol/io/IoAgent.java b/agent/src/main/java/org/openremote/agent/protocol/io/IOAgent.javasimilarity index 93%rename from agent/src/main/java/org/openremote/agent/protocol/io/IoAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/io/IOAgent.javaindex 3a8ba83fd..642b6aef9 100644--- a/agent/src/main/java/org/openremote/agent/protocol/io/IoAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/io/IOAgent.java@@ -25,11 +25,11 @@ import org.openremote.model.asset.agent.AgentLink;import java.util.Optional;@SuppressWarnings("unchecked")-public abstract class IoAgent<T extends IoAgent<T, U, V>, U extends AbstractIoClientProtocol<U, T, ?, ?, V>, V extends AgentLink<?>> extends Agent<T, U, V> {+public abstract class IOAgent<T extends IOAgent<T, U, V>, U extends AbstractIOClientProtocol<U, T, ?, ?, V>, V extends AgentLink<?>> extends Agent<T, U, V> {- protected IoAgent() {}+ protected IOAgent() {}- protected IoAgent(String name) {+ protected IOAgent(String name) {super(name);}diff --git a/agent/src/main/java/org/openremote/agent/protocol/io/IoClient.java b/agent/src/main/java/org/openremote/agent/protocol/io/IOClient.javasimilarity index 95%rename from agent/src/main/java/org/openremote/agent/protocol/io/IoClient.javarename to agent/src/main/java/org/openremote/agent/protocol/io/IOClient.javaindex 7311a3fc0..30c6d08c9 100644--- a/agent/src/main/java/org/openremote/agent/protocol/io/IoClient.java+++ b/agent/src/main/java/org/openremote/agent/protocol/io/IOClient.java@@ -31,7 +31,7 @@ import java.util.function.Supplier;** @param <T> Defines the message type that the instance will encode/decode*/-public interface IoClient<T> {+public interface IOClient<T> {/*** Send a message over the wire@@ -89,8 +89,8 @@ public interface IoClient<T> {String getClientUri();/**- * Allows appropriate encoders and decoders to be added to the message pipeline; if an {@link IoClient} doesn't- * support this then an {@link UnsupportedOperationException} will be thrown, consult the {@link IoClient}'s documentation.+ * Allows appropriate encoders and decoders to be added to the message pipeline; if an {@link IOClient} doesn't+ * support this then an {@link UnsupportedOperationException} will be thrown, consult the {@link IOClient}'s documentation.*/void setEncoderDecoderProvider(Supplier<ChannelHandler[]> encoderDecoderProvider) throws UnsupportedOperationException;}diff --git a/agent/src/main/java/org/openremote/agent/protocol/io/IoServer.java b/agent/src/main/java/org/openremote/agent/protocol/io/IOServer.javasimilarity index 98%rename from agent/src/main/java/org/openremote/agent/protocol/io/IoServer.javarename to agent/src/main/java/org/openremote/agent/protocol/io/IOServer.javaindex 9eb3146d7..6df4e62cd 100644--- a/agent/src/main/java/org/openremote/agent/protocol/io/IoServer.java+++ b/agent/src/main/java/org/openremote/agent/protocol/io/IOServer.java@@ -35,7 +35,7 @@ import java.util.function.Consumer;* @param <U> Defines the client identifier type that can be used to uniquely identify clients connected to this server* @param <V> Defines the client address that can be used to uniquely identify the client*/-public interface IoServer<T, U, V extends SocketAddress> {+public interface IOServer<T, U, V extends SocketAddress> {@FunctionalInterfaceinterface IoServerMessageConsumer<T, U, V> {diff --git a/agent/src/main/java/org/openremote/agent/protocol/io/ProtocolIoClient.java b/agent/src/main/java/org/openremote/agent/protocol/io/ProtocolIOClient.javasimilarity index 86%rename from agent/src/main/java/org/openremote/agent/protocol/io/ProtocolIoClient.javarename to agent/src/main/java/org/openremote/agent/protocol/io/ProtocolIOClient.javaindex f4bb24bde..c87bea467 100644--- a/agent/src/main/java/org/openremote/agent/protocol/io/ProtocolIoClient.java+++ b/agent/src/main/java/org/openremote/agent/protocol/io/ProtocolIOClient.java@@ -23,12 +23,12 @@ import org.openremote.model.asset.agent.ConnectionStatus;import java.util.function.Consumer;-public class ProtocolIoClient<W, X extends IoClient<W>> {+public class ProtocolIOClient<W, X extends IOClient<W>> {public X ioClient;public Consumer<ConnectionStatus> connectionStatusConsumer;public Consumer<W> messageConsumer;- public ProtocolIoClient(X ioClient, Consumer<ConnectionStatus> connectionStatusConsumer, Consumer<W> messageConsumer) {+ public ProtocolIOClient(X ioClient, Consumer<ConnectionStatus> connectionStatusConsumer, Consumer<W> messageConsumer) {this.ioClient = ioClient;this.connectionStatusConsumer = connectionStatusConsumer;this.messageConsumer = messageConsumer;@@ -47,19 +47,19 @@ public class ProtocolIoClient<W, X extends IoClient<W>> {}});- AbstractIoClientProtocol.LOG.info("Connecting IO client");+ AbstractIOClientProtocol.LOG.info("Connecting IO client");ioClient.connect();}protected void disconnect() {ioClient.removeAllMessageConsumers();ioClient.removeAllConnectionStatusConsumers();- AbstractIoClientProtocol.LOG.info("Disconnecting IO client");+ AbstractIOClientProtocol.LOG.info("Disconnecting IO client");ioClient.disconnect();}protected synchronized void send(W message) {- AbstractIoClientProtocol.LOG.fine("Sending message to IO client: " + ioClient.getClientUri());+ AbstractIOClientProtocol.LOG.fine("Sending message to IO client: " + ioClient.getClientUri());ioClient.sendMessage(message);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/EtsFileUriResolver.java b/agent/src/main/java/org/openremote/agent/protocol/knx/ETSFileURIResolver.javasimilarity index 95%rename from agent/src/main/java/org/openremote/agent/protocol/knx/EtsFileUriResolver.javarename to agent/src/main/java/org/openremote/agent/protocol/knx/ETSFileURIResolver.javaindex 745663ab8..c38abde78 100644--- a/agent/src/main/java/org/openremote/agent/protocol/knx/EtsFileUriResolver.java+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/ETSFileURIResolver.java@@ -22,13 +22,13 @@ import javax.xml.transform.stream.StreamSource;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;-public class EtsFileUriResolver implements URIResolver {+public class ETSFileURIResolver implements URIResolver {private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, KNXProtocol.class);private byte[] data;- public EtsFileUriResolver(byte[] fileData) {+ public ETSFileURIResolver(byte[] fileData) {this.data = fileData;}diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.javaindex 9807568fa..2dc1323ab 100644--- a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXProtocol.java@@ -233,7 +233,7 @@ public class KNXProtocol extends AbstractProtocol<KNXAgent, KNXAgent.KNXAgentLinTransformer transformer = tfactory.newTransformer(new StreamSource(new StringReader(xsd)));// Set the URIResolver- transformer.setURIResolver(new EtsFileUriResolver(fileData));+ transformer.setURIResolver(new ETSFileURIResolver(fileData));// Transform the source XMLString xml = IOUtils.toString(zin, StandardCharsets.UTF_8);diff --git a/agent/src/main/java/org/openremote/agent/protocol/serial/AbstractSerialClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/serial/AbstractSerialClientProtocol.javaindex 754eac7ae..bdaa0c198 100644--- a/agent/src/main/java/org/openremote/agent/protocol/serial/AbstractSerialClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/serial/AbstractSerialClientProtocol.java@@ -19,16 +19,16 @@*/package org.openremote.agent.protocol.serial;-import org.openremote.agent.protocol.io.AbstractIoClientProtocol;-import org.openremote.agent.protocol.io.IoAgent;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.AbstractIOClientProtocol;+import org.openremote.agent.protocol.io.IOAgent;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.model.asset.agent.AgentLink;/*** This is an abstract TCP client protocol for communicating with TCP servers; concrete implementations must provide- * an {@link IoClient<T> for handling over the wire communication}.+ * an {@link IOClient <T> for handling over the wire communication}.*/-public abstract class AbstractSerialClientProtocol<T extends AbstractIoClientProtocol<T, U, W, X, V>, U extends IoAgent<U, T, V>, V extends AgentLink<?>, W, X extends SerialIoClient<W>> extends AbstractIoClientProtocol<T, U, W, X, V> {+public abstract class AbstractSerialClientProtocol<T extends AbstractIOClientProtocol<T, U, W, X, V>, U extends IOAgent<U, T, V>, V extends AgentLink<?>, W, X extends SerialIOClient<W>> extends AbstractIOClientProtocol<T, U, W, X, V> {protected AbstractSerialClientProtocol(U agent) {super(agent);@@ -41,6 +41,6 @@ public abstract class AbstractSerialClientProtocol<T extends AbstractIoClientProString port = agent.getSerialPort().orElse(null);Integer baudrate = agent.getSerialBaudrate().orElse(null);- return (X) new SerialIoClient<W>(port, baudrate);+ return (X) new SerialIOClient<W>(port, baudrate);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialAgent.java b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialAgent.javaindex 6c093298b..438f2b644 100644--- a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialAgent.java@@ -19,14 +19,14 @@*/package org.openremote.agent.protocol.serial;-import org.openremote.agent.protocol.io.IoAgent;+import org.openremote.agent.protocol.io.IOAgent;import org.openremote.model.asset.agent.AgentDescriptor;import org.openremote.model.asset.agent.AgentLink;import javax.persistence.Entity;@Entity-public class SerialAgent extends IoAgent<SerialAgent, SerialClientProtocol, AgentLink.Default> {+public class SerialAgent extends IOAgent<SerialAgent, SerialClientProtocol, AgentLink.Default> {public static final AgentDescriptor<SerialAgent, SerialClientProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(SerialAgent.class, SerialClientProtocol.class, AgentLink.Default.classdiff --git a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialClientProtocol.javaindex 9433f070f..357124d07 100644--- a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialClientProtocol.java@@ -40,11 +40,11 @@ import java.util.logging.Logger;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/**- * This is a generic Serial client protocol for communicating with Serial ports; it uses the {@link SerialIoClient} to+ * This is a generic Serial client protocol for communicating with Serial ports; it uses the {@link SerialIOClient} to* handle the communication and all messages are processed as strings; if you require custom message type handling* then please sub class the {@link AbstractSerialClientProtocol}).*/-public class SerialClientProtocol extends AbstractSerialClientProtocol<SerialClientProtocol, SerialAgent, AgentLink.Default, String, SerialIoClient<String>> {+public class SerialClientProtocol extends AbstractSerialClientProtocol<SerialClientProtocol, SerialAgent, AgentLink.Default, String, SerialIOClient<String>> {private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, SerialClientProtocol.class);public static final String PROTOCOL_DISPLAY_NAME = "Serial Client";diff --git a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialIoClient.java b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialIOClient.javasimilarity index 84%rename from agent/src/main/java/org/openremote/agent/protocol/serial/SerialIoClient.javarename to agent/src/main/java/org/openremote/agent/protocol/serial/SerialIOClient.javaindex 4964cf91d..9a100ea48 100644--- a/agent/src/main/java/org/openremote/agent/protocol/serial/SerialIoClient.java+++ b/agent/src/main/java/org/openremote/agent/protocol/serial/SerialIOClient.java@@ -21,26 +21,26 @@ package org.openremote.agent.protocol.serial;import io.netty.channel.Channel;import io.netty.channel.ChannelFuture;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.model.util.TextUtil;/**- * This is a {@link IoClient} implementation for serial ports.+ * This is a {@link IOClient} implementation for serial ports.* <p>- * Users of this {@link IoClient} are responsible for adding encoders for converting messages of type <T> to+ * Users of this {@link IOClient} are responsible for adding encoders for converting messages of type <T> to* {@link io.netty.buffer.ByteBuf} (see {@link MessageToByteEncoder}) and adding decoders to convert from* {@link io.netty.buffer.ByteBuf} to messages of type <T> and ensuring these decoded messages are passed back- * to this client via {@link AbstractNettyIoClient#onMessageReceived} (see {@link ByteToMessageDecoder and+ * to this client via {@link AbstractNettyIOClient#onMessageReceived} (see {@link ByteToMessageDecoder and* {@link MessageToMessageDecoder}).*/-public class SerialIoClient<T> extends AbstractNettyIoClient<T, NrJavaSerialAddress> {+public class SerialIOClient<T> extends AbstractNettyIOClient<T, NrJavaSerialAddress> {protected String port;protected int baudRate;public static int DEFAULT_BAUD_RATE = 38400;- public SerialIoClient(String port, Integer baudRate) {+ public SerialIOClient(String port, Integer baudRate) {TextUtil.requireNonNullAndNonEmpty(port);this.port = port;this.baudRate = baudRate == null ? DEFAULT_BAUD_RATE : baudRate;diff --git a/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPAgent.javasimilarity index 72%rename from agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPClientAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPAgent.javaindex bbdbff9d2..09b399b74 100644--- a/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPClientAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPAgent.java@@ -1,7 +1,6 @@package org.openremote.agent.protocol.snmp;import com.fasterxml.jackson.annotation.JsonValue;-import org.openremote.agent.protocol.knx.KNXAgent;import org.openremote.model.asset.agent.Agent;import org.openremote.model.asset.agent.AgentDescriptor;import org.openremote.model.asset.agent.AgentLink;@@ -13,9 +12,9 @@ import javax.validation.constraints.NotNull;import java.util.Optional;@Entity-public class SNMPClientAgent extends Agent<SNMPClientAgent, SNMPClientProtocol, SNMPClientAgent.SNMPAgentLink> {+public class SNMPAgent extends Agent<SNMPAgent, SNMPProtocol, SNMPAgent.SNMPAgentLink> {- public static class SNMPAgentLink extends AgentLink<SNMPClientAgent.SNMPAgentLink> {+ public static class SNMPAgentLink extends AgentLink<SNMPAgent.SNMPAgentLink> {@NotNullprotected String oid;@@ -33,7 +32,7 @@ public class SNMPClientAgent extends Agent<SNMPClientAgent, SNMPClientProtocol,return Optional.ofNullable(oid);}- public SNMPClientAgent.SNMPAgentLink setOID(String oid) {+ public SNMPAgent.SNMPAgentLink setOID(String oid) {this.oid = oid;return this;}@@ -68,30 +67,30 @@ public class SNMPClientAgent extends Agent<SNMPClientAgent, SNMPClientProtocol,public static final AttributeDescriptor<Integer> SNMP_BIND_PORT = BIND_PORT.withOptional(false);- public static final AgentDescriptor<SNMPClientAgent, SNMPClientProtocol, SNMPAgentLink> DESCRIPTOR = new AgentDescriptor<>(- SNMPClientAgent.class, SNMPClientProtocol.class, SNMPAgentLink.class+ public static final AgentDescriptor<SNMPAgent, SNMPProtocol, SNMPAgentLink> DESCRIPTOR = new AgentDescriptor<>(+ SNMPAgent.class, SNMPProtocol.class, SNMPAgentLink.class);/*** For use by hydrators (i.e. JPA/Jackson)*/- protected SNMPClientAgent() {+ protected SNMPAgent() {}- public SNMPClientAgent(String name) {+ public SNMPAgent(String name) {super(name);}@Override- public SNMPClientProtocol getProtocolInstance() {- return new SNMPClientProtocol(this);+ public SNMPProtocol getProtocolInstance() {+ return new SNMPProtocol(this);}public Optional<SNMPVersion> getSNMPVersion() {return getAttributes().getValue(SNMP_VERSION);}- public SNMPClientAgent setSNMPVersion(SNMPVersion version) {+ public SNMPAgent setSNMPVersion(SNMPVersion version) {getAttributes().getOrCreate(SNMP_VERSION).setValue(version);return this;}diff --git a/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPProtocol.javasimilarity index 87%rename from agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPClientProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPProtocol.javaindex b1d381b35..57daa47e9 100644--- a/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/snmp/SNMPProtocol.java@@ -23,15 +23,15 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/*** This is a SNMP client protocol for receiving SNMP traps.* <p>- * To use this protocol create a {@link SNMPClientAgent}.+ * To use this protocol create a {@link SNMPAgent}.*/-public class SNMPClientProtocol extends AbstractProtocol<SNMPClientAgent, SNMPClientAgent.SNMPAgentLink> {+public class SNMPProtocol extends AbstractProtocol<SNMPAgent, SNMPAgent.SNMPAgentLink> {public static final String PROTOCOL_DISPLAY_NAME = "SNMP Client";- protected static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, SNMPClientProtocol.class);+ protected static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, SNMPProtocol.class);protected final Map<String, AttributeRef> oidMap = new HashMap<>();- public SNMPClientProtocol(SNMPClientAgent agent) {+ public SNMPProtocol(SNMPAgent agent) {super(agent);}@@ -45,7 +45,7 @@ public class SNMPClientProtocol extends AbstractProtocol<SNMPClientAgent, SNMPClreturn String.format("snmp:%s:%d?protocol=udp&type=TRAP&snmpVersion=%s",agent.getBindHost().orElse(""),agent.getBindPort().orElse(162),- agent.getSNMPVersion().orElse(SNMPClientAgent.SNMPVersion.V2c).getValue());+ agent.getSNMPVersion().orElse(SNMPAgent.SNMPVersion.V2c).getValue());}@Override@@ -58,7 +58,7 @@ public class SNMPClientProtocol extends AbstractProtocol<SNMPClientAgent, SNMPCl});Integer snmpBindPort = agent.getBindPort().orElse(162);- SNMPClientAgent.SNMPVersion snmpVersion = agent.getSNMPVersion().orElse(SNMPClientAgent.SNMPVersion.V2c);+ SNMPAgent.SNMPVersion snmpVersion = agent.getSNMPVersion().orElse(SNMPAgent.SNMPVersion.V2c);String snmpUri = String.format("snmp:%s:%d?protocol=udp&type=TRAP&snmpVersion=%d", snmpBindHost, snmpBindPort, snmpVersion.getVersion());messageBrokerContext.addRoutes(new RouteBuilder() {@@ -100,7 +100,7 @@ public class SNMPClientProtocol extends AbstractProtocol<SNMPClientAgent, SNMPCl}@Override- protected void doLinkAttribute(String assetId, Attribute<?> attribute, SNMPClientAgent.SNMPAgentLink agentLink) throws RuntimeException {+ protected void doLinkAttribute(String assetId, Attribute<?> attribute, SNMPAgent.SNMPAgentLink agentLink) throws RuntimeException {String oid = agentLink.getOID().orElseThrow(() -> {String msg = "No OID provided for protocol: " + this;LOG.info(msg);@@ -117,12 +117,12 @@ public class SNMPClientProtocol extends AbstractProtocol<SNMPClientAgent, SNMPCl}@Override- protected void doUnlinkAttribute(String assetId, Attribute<?> attribute, SNMPClientAgent.SNMPAgentLink agentLink) {+ protected void doUnlinkAttribute(String assetId, Attribute<?> attribute, SNMPAgent.SNMPAgentLink agentLink) {agentLink.getOID().ifPresent(oidMap::remove);}@Override- protected void doLinkedAttributeWrite(Attribute<?> attribute, SNMPClientAgent.SNMPAgentLink agentLink, AttributeEvent event, Object processedValue) {+ protected void doLinkedAttributeWrite(Attribute<?> attribute, SNMPAgent.SNMPAgentLink agentLink, AttributeEvent event, Object processedValue) {// Nothing to do here}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPClientProtocol.javasimilarity index 71%rename from agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpClientProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPClientProtocol.javaindex 0a1542556..b40b890d5 100644--- a/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPClientProtocol.java@@ -19,19 +19,19 @@*/package org.openremote.agent.protocol.tcp;-import org.openremote.agent.protocol.io.AbstractIoClientProtocol;-import org.openremote.agent.protocol.io.IoAgent;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.AbstractIOClientProtocol;+import org.openremote.agent.protocol.io.IOAgent;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.model.asset.agent.Agent;import org.openremote.model.asset.agent.AgentLink;/*** This is an abstract TCP client protocol for communicating with TCP servers; concrete implementations must provide- * an {@link IoClient<T> for handling over the wire communication}.+ * an {@link IOClient <T> for handling over the wire communication}.*/-public abstract class AbstractTcpClientProtocol<T extends AbstractIoClientProtocol<T, U, W, X, V>, U extends IoAgent<U, T, V>, V extends AgentLink<?>, W, X extends TcpIoClient<W>> extends AbstractIoClientProtocol<T, U, W, X, V> {+public abstract class AbstractTCPClientProtocol<T extends AbstractIOClientProtocol<T, U, W, X, V>, U extends IOAgent<U, T, V>, V extends AgentLink<?>, W, X extends TCPIOClient<W>> extends AbstractIOClientProtocol<T, U, W, X, V> {- protected AbstractTcpClientProtocol(U agent) {+ protected AbstractTCPClientProtocol(U agent) {super(agent);}@@ -42,6 +42,6 @@ public abstract class AbstractTcpClientProtocol<T extends AbstractIoClientProtocString host = agent.getAttributes().getValue(Agent.HOST).orElse(null);int port = agent.getAttributes().getValue(Agent.PORT).orElse(0);- return (X) new TcpIoClient<W>(host, port);+ return (X) new TCPIOClient<W>(host, port);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServer.java b/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServer.javasimilarity index 88%rename from agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServer.javarename to agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServer.javaindex fcad26642..f240a1fbe 100644--- a/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServer.java+++ b/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServer.java@@ -24,7 +24,7 @@ import io.netty.channel.ChannelInitializer;import io.netty.channel.ChannelOption;import io.netty.channel.socket.SocketChannel;import io.netty.channel.socket.nio.NioServerSocketChannel;-import org.openremote.agent.protocol.io.AbstractNettyIoServer;+import org.openremote.agent.protocol.io.AbstractNettyIOServer;import java.net.InetSocketAddress;import java.net.SocketAddress;@@ -34,11 +34,11 @@ import java.net.SocketAddress;* to configure the pipeline with the necessary encoders and decoders to ensure messages of type <T> are* generated/consumed at/from the end/start of the pipeline.*/-public abstract class AbstractTcpServer<T> extends AbstractNettyIoServer<T, SocketChannel, ServerBootstrap, InetSocketAddress> {+public abstract class AbstractTCPServer<T> extends AbstractNettyIOServer<T, SocketChannel, ServerBootstrap, InetSocketAddress> {protected SocketAddress localAddress;- public AbstractTcpServer(InetSocketAddress localAddress) {+ public AbstractTCPServer(InetSocketAddress localAddress) {this.localAddress = localAddress;}@@ -59,7 +59,7 @@ public abstract class AbstractTcpServer<T> extends AbstractNettyIoServer<T, Sockbootstrap.childHandler(new ChannelInitializer<SocketChannel>() {@Overrideprotected void initChannel(SocketChannel channel) {- AbstractTcpServer.this.initClientChannel(channel);+ AbstractTCPServer.this.initClientChannel(channel);}});diff --git a/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServerAgent.java b/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServerAgent.javasimilarity index 82%rename from agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServerAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServerAgent.javaindex 64b9440ca..dc7d4c2fd 100644--- a/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServerAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServerAgent.java@@ -22,11 +22,11 @@ package org.openremote.agent.protocol.tcp;import org.openremote.model.asset.agent.Agent;import org.openremote.model.asset.agent.AgentLink;-public abstract class AbstractTcpServerAgent<T extends AbstractTcpServerAgent<T, U, V>, U extends AbstractTcpServerProtocol<?, ?, U, T, V>, V extends AgentLink<?>> extends Agent<T, U, V> {+public abstract class AbstractTCPServerAgent<T extends AbstractTCPServerAgent<T, U, V>, U extends AbstractTCPServerProtocol<?, ?, U, T, V>, V extends AgentLink<?>> extends Agent<T, U, V> {- protected AbstractTcpServerAgent() {}+ protected AbstractTCPServerAgent() {}- protected AbstractTcpServerAgent(String name) {+ protected AbstractTCPServerAgent(String name) {super(name);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServerProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServerProtocol.javasimilarity index 90%rename from agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServerProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServerProtocol.javaindex 92b3b2736..d13d7a5f7 100644--- a/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTcpServerProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/tcp/AbstractTCPServerProtocol.java@@ -33,13 +33,13 @@ import java.util.logging.Logger;* It is up to the concrete implementations whether or not linked {@link Attribute}s can be used with this protocol and* to define the semantics of these linked attributes.*/-public abstract class AbstractTcpServerProtocol<R, S extends AbstractTcpServer<R>, T extends AbstractTcpServerProtocol<R, S, T, U, V>, U extends AbstractTcpServerAgent<U, T, V>, V extends AgentLink<?>> extends AbstractProtocol<U, V> {+public abstract class AbstractTCPServerProtocol<R, S extends AbstractTCPServer<R>, T extends AbstractTCPServerProtocol<R, S, T, U, V>, U extends AbstractTCPServerAgent<U, T, V>, V extends AgentLink<?>> extends AbstractProtocol<U, V> {- private static final Logger LOG = Logger.getLogger(AbstractTcpServerProtocol.class.getName());+ private static final Logger LOG = Logger.getLogger(AbstractTCPServerProtocol.class.getName());protected S tcpServer;- public AbstractTcpServerProtocol(U agent) {+ public AbstractTCPServerProtocol(U agent) {super(agent);}@@ -47,7 +47,7 @@ public abstract class AbstractTcpServerProtocol<R, S extends AbstractTcpServer<Rprotected void doStart(Container container) throws Exception {int port = getAgent().getBindPort().orElseThrow(() ->- new IllegalArgumentException("Missing or invalid attribute: " + AbstractTcpServerAgent.BIND_PORT));+ new IllegalArgumentException("Missing or invalid attribute: " + AbstractTCPServerAgent.BIND_PORT));String bindAddress = getAgent().getBindHost().orElse(null);diff --git a/agent/src/main/java/org/openremote/agent/protocol/tcp/TcpClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPAgent.javasimilarity index 68%rename from agent/src/main/java/org/openremote/agent/protocol/tcp/TcpClientAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/tcp/TCPAgent.javaindex 3a35cacbc..d6744fd90 100644--- a/agent/src/main/java/org/openremote/agent/protocol/tcp/TcpClientAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPAgent.java@@ -19,31 +19,31 @@*/package org.openremote.agent.protocol.tcp;-import org.openremote.agent.protocol.io.IoAgent;+import org.openremote.agent.protocol.io.IOAgent;import org.openremote.model.asset.agent.AgentDescriptor;import org.openremote.model.asset.agent.AgentLink;import javax.persistence.Entity;@Entity-public class TcpClientAgent extends IoAgent<TcpClientAgent, TcpClientProtocol, AgentLink.Default> {+public class TCPAgent extends IOAgent<TCPAgent, TCPProtocol, AgentLink.Default> {- public static final AgentDescriptor<TcpClientAgent, TcpClientProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(- TcpClientAgent.class, TcpClientProtocol.class, AgentLink.Default.class+ public static final AgentDescriptor<TCPAgent, TCPProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(+ TCPAgent.class, TCPProtocol.class, AgentLink.Default.class);/*** For use by hydrators (i.e. JPA/Jackson)*/- protected TcpClientAgent() {+ protected TCPAgent() {}- public TcpClientAgent(String name) {+ public TCPAgent(String name) {super(name);}@Override- public TcpClientProtocol getProtocolInstance() {- return new TcpClientProtocol(this);+ public TCPProtocol getProtocolInstance() {+ return new TCPProtocol(this);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/tcp/TcpIoClient.java b/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPIOClient.javasimilarity index 84%rename from agent/src/main/java/org/openremote/agent/protocol/tcp/TcpIoClient.javarename to agent/src/main/java/org/openremote/agent/protocol/tcp/TCPIOClient.javaindex 609ebd2bb..a756db20e 100644--- a/agent/src/main/java/org/openremote/agent/protocol/tcp/TcpIoClient.java+++ b/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPIOClient.java@@ -22,27 +22,27 @@ package org.openremote.agent.protocol.tcp;import io.netty.channel.*;import io.netty.channel.nio.NioEventLoopGroup;import io.netty.channel.socket.nio.NioSocketChannel;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.model.util.TextUtil;import java.net.InetSocketAddress;/**- * This is a {@link IoClient} implementation for TCP.+ * This is a {@link IOClient} implementation for TCP.* <p>- * Users of this {@link IoClient} are responsible for adding encoders for converting messages of type <T> to+ * Users of this {@link IOClient} are responsible for adding encoders for converting messages of type <T> to* {@link io.netty.buffer.ByteBuf} (see {@link MessageToByteEncoder}) and adding decoders to convert from* {@link io.netty.buffer.ByteBuf} to messages of type <T> and ensuring these decoded messages are passed back- * to this client via {@link AbstractNettyIoClient#onMessageReceived} (see {@link ByteToMessageDecoder and+ * to this client via {@link AbstractNettyIOClient#onMessageReceived} (see {@link ByteToMessageDecoder and* {@link MessageToMessageDecoder}).*/-public class TcpIoClient<T> extends AbstractNettyIoClient<T, InetSocketAddress> {+public class TCPIOClient<T> extends AbstractNettyIOClient<T, InetSocketAddress> {protected String host;protected int port;- public TcpIoClient(String host, int port) {+ public TCPIOClient(String host, int port) {TextUtil.requireNonNullAndNonEmpty(host);this.host = host;this.port = port;diff --git a/agent/src/main/java/org/openremote/agent/protocol/tcp/TcpClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPProtocol.javasimilarity index 89%rename from agent/src/main/java/org/openremote/agent/protocol/tcp/TcpClientProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/tcp/TCPProtocol.javaindex 6bf4e0847..33e8ff4e3 100644--- a/agent/src/main/java/org/openremote/agent/protocol/tcp/TcpClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPProtocol.java@@ -38,20 +38,20 @@ import java.util.logging.Logger;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/**- * This is a generic TCP client protocol for communicating with TCP servers; it uses the {@link TcpIoClient} to+ * This is a generic TCP client protocol for communicating with TCP servers; it uses the {@link TCPIOClient} to* handle the communication and all messages are processed as strings; if you require custom message type handling or- * more specific handling then sub class the {@link AbstractTcpClientProtocol}).+ * more specific handling then sub class the {@link AbstractTCPClientProtocol}).* <p>- * To use this protocol create a {@link TcpClientAgent}.+ * To use this protocol create a {@link TCPAgent}.*/-public class TcpClientProtocol extends AbstractTcpClientProtocol<TcpClientProtocol, TcpClientAgent, AgentLink.Default, String, TcpIoClient<String>> {+public class TCPProtocol extends AbstractTCPClientProtocol<TCPProtocol, TCPAgent, AgentLink.Default, String, TCPIOClient<String>> {- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, TcpClientProtocol.class);+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, TCPProtocol.class);public static final String PROTOCOL_DISPLAY_NAME = "TCP Client";protected final List<Pair<AttributeRef, Consumer<String>>> protocolMessageConsumers = new ArrayList<>();- public TcpClientProtocol(TcpClientAgent agent) {+ public TCPProtocol(TCPAgent agent) {super(agent);}diff --git a/agent/src/main/java/org/openremote/agent/protocol/tcp/TcpStringServer.java b/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPStringServer.javasimilarity index 91%rename from agent/src/main/java/org/openremote/agent/protocol/tcp/TcpStringServer.javarename to agent/src/main/java/org/openremote/agent/protocol/tcp/TCPStringServer.javaindex 23e7ce30e..2beccb878 100644--- a/agent/src/main/java/org/openremote/agent/protocol/tcp/TcpStringServer.java+++ b/agent/src/main/java/org/openremote/agent/protocol/tcp/TCPStringServer.java@@ -28,17 +28,17 @@ import io.netty.handler.codec.string.StringEncoder;import java.net.InetSocketAddress;/**- * This is an {@link AbstractTcpServer} implementation that handles {@link String} messages.+ * This is an {@link AbstractTCPServer} implementation that handles {@link String} messages.* <p>* Uses {@link DelimiterBasedFrameDecoder} and {@link StringDecoder}.*/-public class TcpStringServer extends AbstractTcpServer<String> {+public class TCPStringServer extends AbstractTCPServer<String> {protected String delimiter;protected int maxFrameLength;protected boolean stripDelimiter;- public TcpStringServer(InetSocketAddress localAddress, String delimiter, int maxFrameLength, boolean stripDelimiter) {+ public TCPStringServer(InetSocketAddress localAddress, String delimiter, int maxFrameLength, boolean stripDelimiter) {super(localAddress);this.delimiter = delimiter;this.maxFrameLength = maxFrameLength;diff --git a/agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUdpClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUDPProtocol.javasimilarity index 76%rename from agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUdpClientProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUDPProtocol.javaindex 07d9de0cc..964471257 100644--- a/agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUdpClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUDPProtocol.java@@ -19,17 +19,17 @@*/package org.openremote.agent.protocol.udp;-import org.openremote.agent.protocol.io.AbstractIoClientProtocol;-import org.openremote.agent.protocol.io.IoAgent;+import org.openremote.agent.protocol.io.AbstractIOClientProtocol;+import org.openremote.agent.protocol.io.IOAgent;import org.openremote.model.asset.agent.AgentLink;/*** This is an abstract UDP client protocol for communicating with UDP servers; concrete implementations must implement* {@link #getEncoderDecoderProvider} to provide encoders/decoders for messages of type <T>.*/-public abstract class AbstractUdpClientProtocol<T extends AbstractIoClientProtocol<T, U, W, X, V>, U extends IoAgent<U, T, V>, V extends AgentLink<?>, W, X extends UdpIoClient<W>> extends AbstractIoClientProtocol<T, U, W, X, V> {+public abstract class AbstractUDPProtocol<T extends AbstractIOClientProtocol<T, U, W, X, V>, U extends IOAgent<U, T, V>, V extends AgentLink<?>, W, X extends UDPIOClient<W>> extends AbstractIOClientProtocol<T, U, W, X, V> {- protected AbstractUdpClientProtocol(U agent) {+ protected AbstractUDPProtocol(U agent) {super(agent);}@@ -41,6 +41,6 @@ public abstract class AbstractUdpClientProtocol<T extends AbstractIoClientProtocInteger port = agent.getPort().orElse(null);Integer bindPort = agent.getBindPort().orElse(null);- return (X) new UdpIoClient<W>(host, port, bindPort);+ return (X) new UDPIOClient<W>(host, port, bindPort);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUdpServer.java b/agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUDPServer.javasimilarity index 95%rename from agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUdpServer.javarename to agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUDPServer.javaindex 74c18aca7..555a47926 100644--- a/agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUdpServer.java+++ b/agent/src/main/java/org/openremote/agent/protocol/udp/AbstractUDPServer.java@@ -29,7 +29,7 @@ import io.netty.channel.socket.nio.NioDatagramChannel;import io.netty.handler.codec.DatagramPacketEncoder;import io.netty.handler.codec.MessageToMessageDecoder;import io.netty.handler.codec.MessageToMessageEncoder;-import org.openremote.agent.protocol.io.AbstractNettyIoServer;+import org.openremote.agent.protocol.io.AbstractNettyIOServer;import java.net.InetSocketAddress;import java.util.List;@@ -42,12 +42,12 @@ import java.util.logging.Level;* For outbound messages we wrap each decoder in a {@link DatagramPacketEncoder} which unfortunately only supports* {@link MessageToMessageEncoder}s.*/-public abstract class AbstractUdpServer<T> extends AbstractNettyIoServer<T, DatagramChannel, Bootstrap, InetSocketAddress> {+public abstract class AbstractUDPServer<T> extends AbstractNettyIOServer<T, DatagramChannel, Bootstrap, InetSocketAddress> {protected InetSocketAddress localAddress;protected InetSocketAddress lastMessageSender;- public AbstractUdpServer(InetSocketAddress localAddress) {+ public AbstractUDPServer(InetSocketAddress localAddress) {this.localAddress = localAddress;}diff --git a/agent/src/main/java/org/openremote/agent/protocol/udp/UdpClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/udp/UDPAgent.javasimilarity index 68%rename from agent/src/main/java/org/openremote/agent/protocol/udp/UdpClientAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/udp/UDPAgent.javaindex 0e10fca24..2f6fbf208 100644--- a/agent/src/main/java/org/openremote/agent/protocol/udp/UdpClientAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/udp/UDPAgent.java@@ -19,31 +19,31 @@*/package org.openremote.agent.protocol.udp;-import org.openremote.agent.protocol.io.IoAgent;+import org.openremote.agent.protocol.io.IOAgent;import org.openremote.model.asset.agent.AgentDescriptor;import org.openremote.model.asset.agent.AgentLink;import javax.persistence.Entity;@Entity-public class UdpClientAgent extends IoAgent<UdpClientAgent, UdpClientProtocol, AgentLink.Default> {+public class UDPAgent extends IOAgent<UDPAgent, UDPProtocol, AgentLink.Default> {- public static final AgentDescriptor<UdpClientAgent, UdpClientProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(- UdpClientAgent.class, UdpClientProtocol.class, AgentLink.Default.class+ public static final AgentDescriptor<UDPAgent, UDPProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(+ UDPAgent.class, UDPProtocol.class, AgentLink.Default.class);/*** For use by hydrators (i.e. JPA/Jackson)*/- protected UdpClientAgent() {+ protected UDPAgent() {}- public UdpClientAgent(String name) {+ public UDPAgent(String name) {super(name);}@Override- public UdpClientProtocol getProtocolInstance() {- return new UdpClientProtocol(this);+ public UDPProtocol getProtocolInstance() {+ return new UDPProtocol(this);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/udp/UdpIoClient.java b/agent/src/main/java/org/openremote/agent/protocol/udp/UDPIOClient.javasimilarity index 89%rename from agent/src/main/java/org/openremote/agent/protocol/udp/UdpIoClient.javarename to agent/src/main/java/org/openremote/agent/protocol/udp/UDPIOClient.javaindex 4f144f18a..5ccc0bd45 100644--- a/agent/src/main/java/org/openremote/agent/protocol/udp/UdpIoClient.java+++ b/agent/src/main/java/org/openremote/agent/protocol/udp/UDPIOClient.java@@ -25,8 +25,8 @@ import io.netty.channel.nio.NioEventLoopGroup;import io.netty.channel.socket.DatagramPacket;import io.netty.channel.socket.nio.NioDatagramChannel;import io.netty.handler.codec.MessageToMessageEncoder;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.model.syslog.SyslogCategory;import java.net.InetSocketAddress;@@ -36,22 +36,22 @@ import java.util.logging.Logger;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/**- * This is a {@link IoClient} implementation for UDP.+ * This is a {@link IOClient} implementation for UDP.* <p>- * Users of this {@link IoClient} are responsible for adding encoders for converting messages of type <T> to+ * Users of this {@link IOClient} are responsible for adding encoders for converting messages of type <T> to* {@link io.netty.buffer.ByteBuf} (see {@link MessageToByteEncoder}) and adding decoders to convert from* {@link io.netty.buffer.ByteBuf} to messages of type <T> and ensuring these decoded messages are passed back- * to this client via {@link AbstractNettyIoClient#onMessageReceived} (see {@link ByteToMessageDecoder and+ * to this client via {@link AbstractNettyIOClient#onMessageReceived} (see {@link ByteToMessageDecoder and* {@link MessageToMessageDecoder}).*/-public class UdpIoClient<T> extends AbstractNettyIoClient<T, InetSocketAddress> {+public class UDPIOClient<T> extends AbstractNettyIOClient<T, InetSocketAddress> {- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, UdpIoClient.class);+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, UDPIOClient.class);protected String host;protected int port;protected int bindPort;- public UdpIoClient(String host, Integer port, Integer bindPort) {+ public UDPIOClient(String host, Integer port, Integer bindPort) {if (port == null) {port = 0;} else if (port < 1 || port > 65536) {diff --git a/agent/src/main/java/org/openremote/agent/protocol/udp/UdpClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/udp/UDPProtocol.javasimilarity index 89%rename from agent/src/main/java/org/openremote/agent/protocol/udp/UdpClientProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/udp/UDPProtocol.javaindex 7fdb955a6..aea596b04 100644--- a/agent/src/main/java/org/openremote/agent/protocol/udp/UdpClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/udp/UDPProtocol.java@@ -38,19 +38,19 @@ import java.util.logging.Logger;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/**- * This is a UDP client protocol for communicating with UDP servers; it uses the {@link UdpIoClient} to handle the+ * This is a UDP client protocol for communicating with UDP servers; it uses the {@link UDPIOClient} to handle the* communication and all messages are processed as strings; if you require custom message type handling then- * sub class the {@link AbstractUdpClientProtocol}).+ * sub class the {@link AbstractUDPProtocol}).* <p>- * To use this protocol create a {@link UdpClientAgent}.+ * To use this protocol create a {@link UDPAgent}.*/-public class UdpClientProtocol extends AbstractUdpClientProtocol<UdpClientProtocol, UdpClientAgent, AgentLink.Default, String, UdpIoClient<String>> {+public class UDPProtocol extends AbstractUDPProtocol<UDPProtocol, UDPAgent, AgentLink.Default, String, UDPIOClient<String>> {- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, UdpClientProtocol.class);+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, UDPProtocol.class);public static final String PROTOCOL_DISPLAY_NAME = "UDP Client";protected final List<Pair<AttributeRef, Consumer<String>>> protocolMessageConsumers = new ArrayList<>();- public UdpClientProtocol(UdpClientAgent agent) {+ public UDPProtocol(UDPAgent agent) {super(agent);}diff --git a/agent/src/main/java/org/openremote/agent/protocol/udp/UdpStringServer.java b/agent/src/main/java/org/openremote/agent/protocol/udp/UDPStringServer.javasimilarity index 91%rename from agent/src/main/java/org/openremote/agent/protocol/udp/UdpStringServer.javarename to agent/src/main/java/org/openremote/agent/protocol/udp/UDPStringServer.javaindex 8f8f51d2d..5a3efb247 100644--- a/agent/src/main/java/org/openremote/agent/protocol/udp/UdpStringServer.java+++ b/agent/src/main/java/org/openremote/agent/protocol/udp/UDPStringServer.java@@ -28,17 +28,17 @@ import io.netty.handler.codec.string.StringEncoder;import java.net.InetSocketAddress;/**- * This is an {@link AbstractUdpServer} implementation that handles {@link String} messages.+ * This is an {@link AbstractUDPServer} implementation that handles {@link String} messages.* <p>* Uses {@link DelimiterBasedFrameDecoder} and {@link StringDecoder}.*/-public class UdpStringServer extends AbstractUdpServer<String> {+public class UDPStringServer extends AbstractUDPServer<String> {protected String delimiter;protected int maxFrameLength;protected boolean stripDelimiter;- public UdpStringServer(InetSocketAddress localAddress, String delimiter, int maxFrameLength, boolean stripDelimiter) {+ public UDPStringServer(InetSocketAddress localAddress, String delimiter, int maxFrameLength, boolean stripDelimiter) {super(localAddress);this.delimiter = delimiter;this.maxFrameLength = maxFrameLength;diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.javaindex a3c95a5ef..636466d27 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java@@ -20,7 +20,7 @@package org.openremote.agent.protocol.velbus;import org.openremote.agent.protocol.AbstractProtocol;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.agent.protocol.velbus.device.VelbusDeviceType;import org.openremote.model.Container;import org.openremote.model.asset.Asset;@@ -74,7 +74,7 @@ public abstract class AbstractVelbusProtocol<S extends AbstractVelbusProtocol<S,try {- IoClient<VelbusPacket> messageProcessor = createIoClient(agent);+ IOClient<VelbusPacket> messageProcessor = createIoClient(agent);int timeInjectionSeconds = agent.getTimeInjectionInterval().orElse(DEFAULT_TIME_INJECTION_INTERVAL_SECONDS);LOG.fine("Creating new VELBUS network instance for protocol instance: " + agent);@@ -144,9 +144,9 @@ public abstract class AbstractVelbusProtocol<S extends AbstractVelbusProtocol<S,}/**- * Should return an instance of {@link IoClient} for the supplied agent+ * Should return an instance of {@link IOClient} for the supplied agent*/- protected abstract IoClient<VelbusPacket> createIoClient(T agent) throws RuntimeException;+ protected abstract IOClient<VelbusPacket> createIoClient(T agent) throws RuntimeException;/* ProtocolAssetImport */diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusNetwork.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusNetwork.javaindex 50a5f9e49..e8345938f 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusNetwork.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusNetwork.java@@ -19,7 +19,7 @@*/package org.openremote.agent.protocol.velbus;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.agent.protocol.velbus.device.VelbusDevice;import org.openremote.model.asset.agent.ConnectionStatus;@@ -33,7 +33,7 @@ public class VelbusNetwork {protected static int DELAY_BETWEEN_PACKET_WRITES_MILLISECONDS = 100; // Need to throttle bus writesprotected final Integer timeInjectionIntervalSeconds;- protected IoClient<VelbusPacket> client;+ protected IOClient<VelbusPacket> client;protected final Queue<VelbusPacket> messageQueue = new ArrayDeque<>();protected List<ScheduledFuture<?>> scheduledTasks = new ArrayList<>();protected ScheduledFuture<?> timeInjector;@@ -43,7 +43,7 @@ public class VelbusNetwork {protected ScheduledExecutorService executorService;protected final List<Consumer<ConnectionStatus>> connectionStatusConsumers = new ArrayList<>();- public VelbusNetwork(IoClient<VelbusPacket> client, ScheduledExecutorService executorService, Integer timeInjectionIntervalSeconds) {+ public VelbusNetwork(IOClient<VelbusPacket> client, ScheduledExecutorService executorService, Integer timeInjectionIntervalSeconds) {this.client = client;this.executorService = executorService;this.timeInjectionIntervalSeconds = timeInjectionIntervalSeconds;diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusSerialProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusSerialProtocol.javaindex edcac508d..126711ac7 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusSerialProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusSerialProtocol.java@@ -20,9 +20,9 @@package org.openremote.agent.protocol.velbus;import io.netty.channel.ChannelHandler;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;-import org.openremote.agent.protocol.io.IoClient;-import org.openremote.agent.protocol.serial.SerialIoClient;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.io.IOClient;+import org.openremote.agent.protocol.serial.SerialIOClient;import org.openremote.model.util.TextUtil;public class VelbusSerialProtocol extends AbstractVelbusProtocol<VelbusSerialProtocol, VelbusSerialAgent> {@@ -40,20 +40,20 @@ public class VelbusSerialProtocol extends AbstractVelbusProtocol<VelbusSerialPro}@Override- protected IoClient<VelbusPacket> createIoClient(VelbusSerialAgent agent) throws RuntimeException {+ protected IOClient<VelbusPacket> createIoClient(VelbusSerialAgent agent) throws RuntimeException {// Extract port and baud rateString port = agent.getSerialPort().orElse(null);int baudRate = agent.getSerialBaudrate().orElse(DEFAULT_BAUDRATE);TextUtil.requireNonNullAndNonEmpty(port, "Port cannot be null or empty");- SerialIoClient<VelbusPacket> client = new SerialIoClient<>(port, baudRate);+ SerialIOClient<VelbusPacket> client = new SerialIOClient<>(port, baudRate);client.setEncoderDecoderProvider(() -> new ChannelHandler[]{new VelbusPacketEncoder(),new VelbusPacketDecoder(),- new AbstractNettyIoClient.MessageToMessageDecoder<>(VelbusPacket.class, client)+ new AbstractNettyIOClient.MessageToMessageDecoder<>(VelbusPacket.class, client)});return client;diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTcpAgent.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTCPAgent.javasimilarity index 75%rename from agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTcpAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTCPAgent.javaindex 78f362de1..aa4ebab7a 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTcpAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTCPAgent.java@@ -25,27 +25,27 @@ import org.openremote.model.value.AttributeDescriptor;import javax.persistence.Entity;@Entity-public class VelbusTcpAgent extends VelbusAgent<VelbusTcpAgent, VelbusTcpProtocol> {+public class VelbusTCPAgent extends VelbusAgent<VelbusTCPAgent, VelbusTCPProtocol> {public static final AttributeDescriptor<String> VELBUS_HOST = HOST.withOptional(false);public static final AttributeDescriptor<Integer> VELBUS_PORT = PORT.withOptional(false);- public static final AgentDescriptor<VelbusTcpAgent, VelbusTcpProtocol, VelbusAgentLink> DESCRIPTOR = new AgentDescriptor<>(- VelbusTcpAgent.class, VelbusTcpProtocol.class, VelbusAgentLink.class+ public static final AgentDescriptor<VelbusTCPAgent, VelbusTCPProtocol, VelbusAgentLink> DESCRIPTOR = new AgentDescriptor<>(+ VelbusTCPAgent.class, VelbusTCPProtocol.class, VelbusAgentLink.class);/*** For use by hydrators (i.e. JPA/Jackson)*/- protected VelbusTcpAgent() {+ protected VelbusTCPAgent() {}- public VelbusTcpAgent(String name) {+ public VelbusTCPAgent(String name) {super(name);}@Override- public VelbusTcpProtocol getProtocolInstance() {- return new VelbusTcpProtocol(this);+ public VelbusTCPProtocol getProtocolInstance() {+ return new VelbusTCPProtocol(this);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTcpProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTCPProtocol.javasimilarity index 77%rename from agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTcpProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTCPProtocol.javaindex b311cebe1..9d317d096 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTcpProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/VelbusTCPProtocol.java@@ -20,18 +20,18 @@package org.openremote.agent.protocol.velbus;import io.netty.channel.ChannelHandler;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;-import org.openremote.agent.protocol.io.IoClient;-import org.openremote.agent.protocol.tcp.TcpIoClient;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.io.IOClient;+import org.openremote.agent.protocol.tcp.TCPIOClient;import org.openremote.model.util.TextUtil;import java.util.Objects;-public class VelbusTcpProtocol extends AbstractVelbusProtocol<VelbusTcpProtocol, VelbusTcpAgent> {+public class VelbusTCPProtocol extends AbstractVelbusProtocol<VelbusTCPProtocol, VelbusTCPAgent> {public static final String PROTOCOL_DISPLAY_NAME = "VELBUS TCP";- public VelbusTcpProtocol(VelbusTcpAgent agent) {+ public VelbusTCPProtocol(VelbusTCPAgent agent) {super(agent);}@@ -41,7 +41,7 @@ public class VelbusTcpProtocol extends AbstractVelbusProtocol<VelbusTcpProtocol,}@Override- protected IoClient<VelbusPacket> createIoClient(VelbusTcpAgent agent) throws RuntimeException {+ protected IOClient<VelbusPacket> createIoClient(VelbusTCPAgent agent) throws RuntimeException {// Extract IP and HostString host = agent.getHost().orElse(null);@@ -49,12 +49,12 @@ public class VelbusTcpProtocol extends AbstractVelbusProtocol<VelbusTcpProtocol,TextUtil.requireNonNullAndNonEmpty(host, "Host cannot be null or empty");Objects.requireNonNull(port, "Port cannot be null");- TcpIoClient<VelbusPacket> client = new TcpIoClient<>(host, port);+ TCPIOClient<VelbusPacket> client = new TCPIOClient<>(host, port);client.setEncoderDecoderProvider(() -> new ChannelHandler[] {new VelbusPacketEncoder(),new VelbusPacketDecoder(),- new AbstractNettyIoClient.MessageToMessageDecoder<>(VelbusPacket.class, client)+ new AbstractNettyIOClient.MessageToMessageDecoder<>(VelbusPacket.class, client)});return client;diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/OledProcessor.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/OLEDProcessor.javasimilarity index 99%rename from agent/src/main/java/org/openremote/agent/protocol/velbus/device/OledProcessor.javarename to agent/src/main/java/org/openremote/agent/protocol/velbus/device/OLEDProcessor.javaindex 9236ecb72..5358f6138 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/OledProcessor.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/OLEDProcessor.java@@ -38,7 +38,7 @@ import static org.openremote.agent.protocol.velbus.AbstractVelbusProtocol.LOG;* <li> Memo Text* </ul>*/-public class OledProcessor extends FeatureProcessor {+public class OLEDProcessor extends FeatureProcessor {@Overridepublic List<PropertyDescriptor> getPropertyDescriptors(VelbusDeviceType deviceType) {diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/VelbusDeviceType.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/VelbusDeviceType.javaindex 5a7a0ea65..2fdac3d34 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/VelbusDeviceType.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/VelbusDeviceType.java@@ -19,8 +19,8 @@ public enum VelbusDeviceType {VMBGP1(0x1E, true, InputProcessor.class, TemperatureProcessor.class, ThermostatProcessor.class, ProgramsProcessor.class),VMBGP2(0x1F, true, InputProcessor.class, TemperatureProcessor.class, ThermostatProcessor.class, ProgramsProcessor.class),VMBGP4(0x20, true, InputProcessor.class, TemperatureProcessor.class, ThermostatProcessor.class, ProgramsProcessor.class),- VMBGPO(0x21, true, InputProcessor.class, TemperatureProcessor.class, ThermostatProcessor.class, ProgramsProcessor.class, OledProcessor.class),- VMBGPOD(0x28, true, InputProcessor.class, TemperatureProcessor.class, ThermostatProcessor.class, ProgramsProcessor.class, OledProcessor.class),+ VMBGPO(0x21, true, InputProcessor.class, TemperatureProcessor.class, ThermostatProcessor.class, ProgramsProcessor.class, OLEDProcessor.class),+ VMBGPOD(0x28, true, InputProcessor.class, TemperatureProcessor.class, ThermostatProcessor.class, ProgramsProcessor.class, OLEDProcessor.class),VMB7IN(0x22, false, InputProcessor.class, ProgramsProcessor.class, CounterProcessor.class),VMB8PBU(0x16, false, InputProcessor.class, ProgramsProcessor.class),VMB6PBN(0x17, false, InputProcessor.class, ProgramsProcessor.class),diff --git a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgent.javasimilarity index 75%rename from agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.javarename to agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgent.javaindex 52e2c3f25..6fb7e3375 100644--- a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgent.java@@ -20,7 +20,7 @@package org.openremote.agent.protocol.websocket;import com.fasterxml.jackson.annotation.JsonPropertyDescription;-import org.openremote.agent.protocol.io.IoAgent;+import org.openremote.agent.protocol.io.IOAgent;import org.openremote.model.asset.agent.AgentDescriptor;import org.openremote.model.asset.agent.AgentLink;import org.openremote.model.value.AttributeDescriptor;@@ -31,16 +31,16 @@ import javax.persistence.Entity;import java.util.Optional;@Entity-public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, WebsocketClientProtocol, WebsocketClientAgent.WebsocketClientAgentLink> {+public class WebsocketAgent extends IOAgent<WebsocketAgent, WebsocketAgentProtocol, WebsocketAgent.WebsocketAgentLink> {- public static class WebsocketClientAgentLink extends AgentLink<WebsocketClientAgentLink> {+ public static class WebsocketAgentLink extends AgentLink<WebsocketAgentLink> {protected WebsocketSubscription[] websocketSubscriptions;// For Hydrators- protected WebsocketClientAgentLink() {}+ protected WebsocketAgentLink() {}- public WebsocketClientAgentLink(String id) {+ public WebsocketAgentLink(String id) {super(id);}@@ -49,7 +49,7 @@ public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, Websockereturn Optional.ofNullable(websocketSubscriptions);}- public WebsocketClientAgentLink setWebsocketSubscriptions(WebsocketSubscription[] websocketSubscriptions) {+ public WebsocketAgentLink setWebsocketSubscriptions(WebsocketSubscription[] websocketSubscriptions) {this.websocketSubscriptions = websocketSubscriptions;return this;}@@ -73,17 +73,17 @@ public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, Websocke*/public static final AttributeDescriptor<WebsocketSubscription[]> CONNECT_SUBSCRIPTIONS = new AttributeDescriptor<>("connectSubscriptions", WEBSOCKET_SUBSCRIPTION_VALUE_DESCRIPTOR.asArray());- public static final AgentDescriptor<WebsocketClientAgent, WebsocketClientProtocol, WebsocketClientAgentLink> DESCRIPTOR = new AgentDescriptor<>(- WebsocketClientAgent.class, WebsocketClientProtocol.class, WebsocketClientAgentLink.class, null+ public static final AgentDescriptor<WebsocketAgent, WebsocketAgentProtocol, WebsocketAgentLink> DESCRIPTOR = new AgentDescriptor<>(+ WebsocketAgent.class, WebsocketAgentProtocol.class, WebsocketAgentLink.class, null);/*** For use by hydrators (i.e. JPA/Jackson)*/- protected WebsocketClientAgent() {+ protected WebsocketAgent() {}- public WebsocketClientAgent(String name) {+ public WebsocketAgent(String name) {super(name);}@@ -91,7 +91,7 @@ public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, Websockereturn getAttributes().getValue(CONNECT_URI);}- public WebsocketClientAgent setConnectUri(String value) {+ public WebsocketAgent setConnectUri(String value) {getAttributes().getOrCreate(CONNECT_URI).setValue(value);return this;}@@ -100,7 +100,7 @@ public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, Websockereturn getAttributes().getValue(CONNECT_HEADERS);}- public WebsocketClientAgent setConnectHeaders(ValueType.MultivaluedStringMap value) {+ public WebsocketAgent setConnectHeaders(ValueType.MultivaluedStringMap value) {getAttributes().getOrCreate(CONNECT_HEADERS).setValue(value);return this;}@@ -109,13 +109,13 @@ public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, Websockereturn getAttributes().getValue(CONNECT_SUBSCRIPTIONS);}- public WebsocketClientAgent setConnectSubscriptions(WebsocketSubscription[] value) {+ public WebsocketAgent setConnectSubscriptions(WebsocketSubscription[] value) {getAttributes().getOrCreate(CONNECT_SUBSCRIPTIONS).setValue(value);return this;}@Override- public WebsocketClientProtocol getProtocolInstance() {- return new WebsocketClientProtocol(this);+ public WebsocketAgentProtocol getProtocolInstance() {+ return new WebsocketAgentProtocol(this);}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgentProtocol.javasimilarity index 89%rename from agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientProtocol.javarename to agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgentProtocol.javaindex cbcba19bf..24010b0ec 100644--- a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgentProtocol.java@@ -24,7 +24,7 @@ import org.apache.http.HttpHeaders;import org.jboss.resteasy.client.jaxrs.ResteasyClient;import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;import org.jboss.resteasy.util.BasicAuthHelper;-import org.openremote.agent.protocol.io.AbstractIoClientProtocol;+import org.openremote.agent.protocol.io.AbstractIOClientProtocol;import org.openremote.container.web.WebTargetBuilder;import org.openremote.model.Container;import org.openremote.model.asset.agent.ConnectionStatus;@@ -53,8 +53,8 @@ import java.util.function.Consumer;import java.util.function.Supplier;import java.util.logging.Logger;-import static org.openremote.agent.protocol.http.HttpClientProtocol.DEFAULT_CONTENT_TYPE;-import static org.openremote.agent.protocol.http.HttpClientProtocol.DEFAULT_HTTP_METHOD;+import static org.openremote.agent.protocol.http.HTTPProtocol.DEFAULT_CONTENT_TYPE;+import static org.openremote.agent.protocol.http.HTTPProtocol.DEFAULT_HTTP_METHOD;import static org.openremote.container.web.WebTargetBuilder.createClient;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;@@ -64,14 +64,14 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;* <p>* <h2>Protocol Specifics</h2>* When the websocket connection is established it is possible to subscribe to events by specifying the- * {@link WebsocketClientAgent#CONNECT_SUBSCRIPTIONS} on the {@link WebsocketClientAgent} or- * {@link WebsocketClientAgent.WebsocketClientAgentLink#getConnectSubscriptions()} on linked {@link Attribute}s; a+ * {@link WebsocketAgent#CONNECT_SUBSCRIPTIONS} on the {@link WebsocketAgent} or+ * {@link WebsocketAgent.WebsocketAgentLink#getConnectSubscriptions()} on linked {@link Attribute}s; a* subscription can be a message sent over the websocket or a HTTP REST API call.*/-public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketClientProtocol, WebsocketClientAgent, String, WebsocketIoClient<String>, WebsocketClientAgent.WebsocketClientAgentLink> {+public class WebsocketAgentProtocol extends AbstractIOClientProtocol<WebsocketAgentProtocol, WebsocketAgent, String, WebsocketIOClient<String>, WebsocketAgent.WebsocketAgentLink> {public static final String PROTOCOL_DISPLAY_NAME = "Websocket Client";- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, WebsocketClientProtocol.class);+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, WebsocketAgentProtocol.class);public static final int CONNECTED_SEND_DELAY_MILLIS = 2000;protected static final ResteasyClient resteasyClient;protected List<Runnable> protocolConnectedTasks;@@ -83,7 +83,7 @@ public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketCresteasyClient = createClient(org.openremote.container.Container.EXECUTOR_SERVICE);}- public WebsocketClientProtocol(WebsocketClientAgent agent) {+ public WebsocketAgentProtocol(WebsocketAgent agent) {super(agent);}@@ -117,7 +117,7 @@ public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketC}@Override- protected String createWriteMessage(Attribute<?> attribute, WebsocketClientAgent.WebsocketClientAgentLink agentLink, AttributeEvent event, Object processedValue) {+ protected String createWriteMessage(Attribute<?> attribute, WebsocketAgent.WebsocketAgentLink agentLink, AttributeEvent event, Object processedValue) {if (attribute.getType().equals(ValueType.EXECUTION_STATUS)) {boolean isRequestStart = event.getValue()@@ -134,7 +134,7 @@ public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketC}@Override- protected WebsocketIoClient<String> doCreateIoClient() throws Exception {+ protected WebsocketIOClient<String> doCreateIoClient() throws Exception {String uriStr = agent.getConnectUri().orElseThrow(() ->new IllegalArgumentException("Missing or invalid connectUri: " + agent));@@ -162,7 +162,7 @@ public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketC}clientHeaders = headers.orElse(null);- WebsocketIoClient<String> websocketClient = new WebsocketIoClient<>(uri, headers.orElse(null), oAuthGrant.orElse(null));+ WebsocketIOClient<String> websocketClient = new WebsocketIOClient<>(uri, headers.orElse(null), oAuthGrant.orElse(null));Map<String, List<String>> finalHeaders = headers.orElse(null);subscriptions.ifPresent(websocketSubscriptions ->@@ -181,7 +181,7 @@ public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketC}@Override- protected void doLinkAttribute(String assetId, Attribute<?> attribute, WebsocketClientAgent.WebsocketClientAgentLink agentLink) {+ protected void doLinkAttribute(String assetId, Attribute<?> attribute, WebsocketAgent.WebsocketAgentLink agentLink) {Optional<WebsocketSubscription[]> subscriptions = agentLink.getWebsocketSubscriptions();AttributeRef attributeRef = new AttributeRef(assetId, attribute.getName());@@ -201,7 +201,7 @@ public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketC}@Override- protected void doUnlinkAttribute(String assetId, Attribute<?> attribute, WebsocketClientAgent.WebsocketClientAgentLink agentLink) {+ protected void doUnlinkAttribute(String assetId, Attribute<?> attribute, WebsocketAgent.WebsocketAgentLink agentLink) {AttributeRef attributeRef = new AttributeRef(assetId, attribute.getName());protocolMessageConsumers.removeIf((attrRefConsumer) -> attrRefConsumer.key.equals(attributeRef));attributeConnectedTasks.remove(attributeRef);@@ -254,8 +254,8 @@ public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketC}protected void doSubscription(Map<String, List<String>> headers, WebsocketSubscription subscription) {- if (subscription instanceof WebsocketHttpSubscription) {- WebsocketHttpSubscription httpSubscription = (WebsocketHttpSubscription)subscription;+ if (subscription instanceof WebsocketHTTPSubscription) {+ WebsocketHTTPSubscription httpSubscription = (WebsocketHTTPSubscription)subscription;if (TextUtil.isNullOrEmpty(httpSubscription.uri)) {LOG.warning("Websocket subscription missing or empty URI so skipping: " + subscription);@@ -272,7 +272,7 @@ public class WebsocketClientProtocol extends AbstractIoClientProtocol<WebsocketC}if (httpSubscription.method == null) {- httpSubscription.method = WebsocketHttpSubscription.Method.valueOf(DEFAULT_HTTP_METHOD);+ httpSubscription.method = WebsocketHTTPSubscription.Method.valueOf(DEFAULT_HTTP_METHOD);}if (TextUtil.isNullOrEmpty(httpSubscription.contentType)) {diff --git a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketHttpSubscription.java b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketHTTPSubscription.javasimilarity index 80%rename from agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketHttpSubscription.javarename to agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketHTTPSubscription.javaindex 0b33b9bac..4dbd738b5 100644--- a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketHttpSubscription.java+++ b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketHTTPSubscription.java@@ -22,7 +22,7 @@ package org.openremote.agent.protocol.websocket;import java.util.List;import java.util.Map;-public class WebsocketHttpSubscription extends WebsocketSubscription {+public class WebsocketHTTPSubscription extends WebsocketSubscription {public enum Method {GET,@@ -37,33 +37,33 @@ public class WebsocketHttpSubscription extends WebsocketSubscription {public Map<String, List<String>> headers;public String uri;- public WebsocketHttpSubscription() {+ public WebsocketHTTPSubscription() {super(TYPE);}- public WebsocketHttpSubscription method(Method method) {+ public WebsocketHTTPSubscription method(Method method) {this.method = method;return this;}- public WebsocketHttpSubscription contentType(String contentType) {+ public WebsocketHTTPSubscription contentType(String contentType) {this.contentType = contentType;return this;}- public WebsocketHttpSubscription headers(Map<String, List<String>> headers) {+ public WebsocketHTTPSubscription headers(Map<String, List<String>> headers) {this.headers = headers;return this;}- public WebsocketHttpSubscription uri(String uri) {+ public WebsocketHTTPSubscription uri(String uri) {this.uri = uri;return this;}@Overridepublic String toString() {- return WebsocketHttpSubscription.class.getSimpleName() + "{" ++ return WebsocketHTTPSubscription.class.getSimpleName() + "{" +"method=" + method +", uri='" + uri + '\'' +", contentType='" + contentType + '\'' +diff --git a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketIoClient.java b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketIOClient.javasimilarity index 95%rename from agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketIoClient.javarename to agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketIOClient.javaindex d6c73cd53..f17e408a5 100644--- a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketIoClient.java+++ b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketIOClient.java@@ -32,14 +32,14 @@ import io.netty.handler.ssl.SslContextBuilder;import io.netty.handler.ssl.util.InsecureTrustManagerFactory;import io.netty.util.CharsetUtil;import org.jboss.resteasy.client.jaxrs.ResteasyClient;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.container.web.OAuthFilter;import org.openremote.model.auth.OAuthGrant;import org.openremote.model.syslog.SyslogCategory;import org.openremote.model.util.TextUtil;import javax.ws.rs.ProcessingException;-import javax.ws.rs.client.WebTarget;import java.net.InetSocketAddress;import java.net.SocketException;import java.net.URI;@@ -55,11 +55,11 @@ import static org.openremote.container.web.WebTargetBuilder.createClient;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;/**- * This is an {@link org.openremote.agent.protocol.io.IoClient} implementation based on {@link AbstractNettyIoClient}.+ * This is an {@link IOClient} implementation based on {@link AbstractNettyIOClient}.* For custom decoders, the initial message type is of type {@link String}.* For custom encoders, the final message type must be of type {@link String}.*/-public class WebsocketIoClient<T> extends AbstractNettyIoClient<T, InetSocketAddress> {+public class WebsocketIOClient<T> extends AbstractNettyIOClient<T, InetSocketAddress> {/*** Extracts the text from the {@link WebSocketFrame} and sends it to the next handler in the pipeline@@ -94,7 +94,7 @@ public class WebsocketIoClient<T> extends AbstractNettyIoClient<T, InetSocketAdd} catch (WebSocketHandshakeException e) {handshakeFuture.setFailure(e);}- WebsocketIoClient.this.onHandshakeComplete(handshakeFuture);+ WebsocketIOClient.this.onHandshakeComplete(handshakeFuture);return;}@@ -123,11 +123,11 @@ public class WebsocketIoClient<T> extends AbstractNettyIoClient<T, InetSocketAddhandshakeFuture.setFailure(cause);}ctx.close();- WebsocketIoClient.this.onDecodeException(ctx, cause);+ WebsocketIOClient.this.onDecodeException(ctx, cause);}}- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, WebsocketIoClient.class);+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, WebsocketIOClient.class);protected boolean useSsl;protected URI uri;protected SslContext sslCtx;@@ -139,7 +139,7 @@ public class WebsocketIoClient<T> extends AbstractNettyIoClient<T, InetSocketAddprotected int port;protected CompletableFuture<Boolean> connectedFuture;- public WebsocketIoClient(URI uri, Map<String, List<String>> headers, OAuthGrant oAuthGrant) {+ public WebsocketIOClient(URI uri, Map<String, List<String>> headers, OAuthGrant oAuthGrant) {this.uri = uri;this.headers = headers;this.oAuthGrant = oAuthGrant;diff --git a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketSubscription.java b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketSubscription.javaindex 3f0273947..8b4a8fd65 100644--- a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketSubscription.java+++ b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketSubscription.java@@ -26,7 +26,7 @@ import java.io.Serializable;@JsonSubTypes({@JsonSubTypes.Type(value = WebsocketSubscription.class, name = WebsocketSubscription.TYPE),- @JsonSubTypes.Type(value = WebsocketHttpSubscription.class, name = WebsocketHttpSubscription.TYPE)+ @JsonSubTypes.Type(value = WebsocketHTTPSubscription.class, name = WebsocketHTTPSubscription.TYPE)})@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,diff --git a/agent/src/main/java/org/openremote/agent/protocol/zwave/NettyConnectionManager.java b/agent/src/main/java/org/openremote/agent/protocol/zwave/NettyConnectionManager.javaindex 02da66233..800dda17c 100644--- a/agent/src/main/java/org/openremote/agent/protocol/zwave/NettyConnectionManager.java+++ b/agent/src/main/java/org/openremote/agent/protocol/zwave/NettyConnectionManager.java@@ -25,16 +25,16 @@ import org.openremote.protocol.zwave.port.ZWavePortConfiguration;public class NettyConnectionManager extends DefaultZWConnectionManager {- public static NettyConnectionManager create(ZWavePortConfiguration configuration, ZWaveSerialIoClient messageProcessor) {+ public static NettyConnectionManager create(ZWavePortConfiguration configuration, ZWaveSerialIOClient messageProcessor) {NettyConnectionManager mgr = new NettyConnectionManager(configuration, messageProcessor);mgr.createControllerAPI();mgr.addShutdownHook();return mgr;}- private final ZWaveSerialIoClient ioClient;+ private final ZWaveSerialIOClient ioClient;- protected NettyConnectionManager(ZWavePortConfiguration configuration, ZWaveSerialIoClient ioClient) {+ protected NettyConnectionManager(ZWavePortConfiguration configuration, ZWaveSerialIOClient ioClient) {super(configuration);this.ioClient = ioClient;}diff --git a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveNetwork.java b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveNetwork.javaindex 7e99f1359..cc0245f49 100644--- a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveNetwork.java+++ b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveNetwork.java@@ -59,7 +59,7 @@ public class ZWaveNetwork {private final List<Consumer<ConnectionStatus>> connectionStatusConsumers = new CopyOnWriteArrayList<>();private final Map<Consumer<Value>, ChannelConsumerLink> consumerLinkMap = new HashMap<>();protected String serialPort;- protected ZWaveSerialIoClient ioClient;+ protected ZWaveSerialIOClient ioClient;protected ScheduledExecutorService executorService;public ZWaveNetwork(String serialPort, ScheduledExecutorService executorService) {@@ -77,7 +77,7 @@ public class ZWaveNetwork {configuration.setCommLayer(ZWavePortConfiguration.CommLayer.NETTY);configuration.setComPort(serialPort);- ioClient = new ZWaveSerialIoClient(serialPort);+ ioClient = new ZWaveSerialIOClient(serialPort);ioClient.addConnectionStatusConsumer(this::onConnectionStatusChanged);controller = new Controller(NettyConnectionManager.create(configuration, ioClient));diff --git a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveSerialIoClient.java b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveSerialIOClient.javasimilarity index 93%rename from agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveSerialIoClient.javarename to agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveSerialIOClient.javaindex 50f35f2ff..1dd8fdb81 100644--- a/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveSerialIoClient.java+++ b/agent/src/main/java/org/openremote/agent/protocol/zwave/ZWaveSerialIOClient.java@@ -20,8 +20,8 @@package org.openremote.agent.protocol.zwave;import io.netty.channel.ChannelHandler;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;-import org.openremote.agent.protocol.serial.SerialIoClient;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.serial.SerialIOClient;import org.openremote.controller.protocol.zwave.ZWaveCommandBuilder;import org.openremote.model.asset.agent.ConnectionStatus;import org.openremote.model.syslog.SyslogCategory;@@ -33,9 +33,9 @@ import java.util.logging.Level;import java.util.logging.Logger;/**- * Wrapper around {@link SerialIoClient} to allow compatibility with Z Wave library+ * Wrapper around {@link SerialIOClient} to allow compatibility with Z Wave library*/-public class ZWaveSerialIoClient extends SerialIoClient<byte[]> implements TransportLayer {+public class ZWaveSerialIOClient extends SerialIOClient<byte[]> implements TransportLayer {// Constants ----------------------------------------------------------------------------------@@ -56,14 +56,14 @@ public class ZWaveSerialIoClient extends SerialIoClient<byte[]> implements Trans// Constructors -------------------------------------------------------------------------------- public ZWaveSerialIoClient(String port) {+ public ZWaveSerialIOClient(String port) {super(port, 115200);setEncoderDecoderProvider(() -> new ChannelHandler[] {new ZWavePacketEncoder(),new ZWavePacketDecoder(),- new AbstractNettyIoClient.MessageToMessageDecoder<>(byte[].class, this)+ new AbstractNettyIOClient.MessageToMessageDecoder<>(byte[].class, this)});diff --git a/manager/build.gradle b/manager/build.gradleindex f2a81be92..4c6cb9eaa 100644--- a/manager/build.gradle+++ b/manager/build.gradle@@ -27,6 +27,10 @@ dependencies {compile ("io.moquette:moquette-broker:$moquetteVersion") {exclude module: "slf4j-log4j12" // Don't want log4J}++ compile("org.quartz-scheduler:quartz:$quartzVersion") {+ exclude group: "c3p0"+ }}// Load version properties file and use same version as source codediff --git a/manager/src/main/java/org/openremote/manager/gateway/GatewayClientService.java b/manager/src/main/java/org/openremote/manager/gateway/GatewayClientService.javaindex 3208c98c5..e8b0baeb3 100644--- a/manager/src/main/java/org/openremote/manager/gateway/GatewayClientService.java+++ b/manager/src/main/java/org/openremote/manager/gateway/GatewayClientService.java@@ -24,8 +24,8 @@ import org.apache.camel.builder.RouteBuilder;import org.apache.http.client.utils.URIBuilder;import org.openremote.model.Container;import org.openremote.model.auth.OAuthClientCredentialsGrant;-import org.openremote.agent.protocol.io.AbstractNettyIoClient;-import org.openremote.agent.protocol.websocket.WebsocketIoClient;+import org.openremote.agent.protocol.io.AbstractNettyIOClient;+import org.openremote.agent.protocol.websocket.WebsocketIOClient;import org.openremote.model.ContainerService;import org.openremote.container.message.MessageBrokerService;import org.openremote.container.persistence.PersistenceEvent;@@ -77,7 +77,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServiprotected ScheduledExecutorService executorService;protected ManagerIdentityService identityService;protected final Map<String, GatewayConnection> connectionRealmMap = new HashMap<>();- protected final Map<String, WebsocketIoClient<String>> clientRealmMap = new HashMap<>();+ protected final Map<String, WebsocketIOClient<String>> clientRealmMap = new HashMap<>();@Overridepublic int getPriority() {@@ -166,7 +166,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServiswitch (cause) {case UPDATE:- WebsocketIoClient<String> client = clientRealmMap.remove(connection.getLocalRealm());+ WebsocketIOClient<String> client = clientRealmMap.remove(connection.getLocalRealm());if (client != null) {destroyGatewayClient(connection, client);}@@ -187,7 +187,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServi}}- protected WebsocketIoClient<String> createGatewayClient(GatewayConnection connection) {+ protected WebsocketIOClient<String> createGatewayClient(GatewayConnection connection) {if (connection.isDisabled()) {LOG.info("Disabled gateway client connection so ignoring: " + connection);@@ -197,7 +197,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServiLOG.info("Creating gateway IO client: " + connection);try {- WebsocketIoClient<String> client = new WebsocketIoClient<>(+ WebsocketIOClient<String> client = new WebsocketIOClient<>(new URIBuilder().setScheme(connection.isSecured() ? "wss" : "ws").setHost(connection.getHost())@@ -218,7 +218,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServi);client.setEncoderDecoderProvider(() ->- new ChannelHandler[] {new AbstractNettyIoClient.MessageToMessageDecoder<>(String.class, client)}+ new ChannelHandler[] {new AbstractNettyIOClient.MessageToMessageDecoder<>(String.class, client)});client.addConnectionStatusConsumer(@@ -254,7 +254,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServireturn null;}- protected void destroyGatewayClient(GatewayConnection connection, WebsocketIoClient<String> client) {+ protected void destroyGatewayClient(GatewayConnection connection, WebsocketIOClient<String> client) {if (client == null) {return;}@@ -355,7 +355,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServi}protected void sendCentralManagerMessage(String realm, String message) {- WebsocketIoClient<String> client;+ WebsocketIOClient<String> client;synchronized (clientRealmMap) {client = clientRealmMap.get(realm);@@ -425,7 +425,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServireturn ConnectionStatus.DISABLED;}- WebsocketIoClient<String> client = clientRealmMap.get(realm);+ WebsocketIOClient<String> client = clientRealmMap.get(realm);return client != null ? client.getConnectionStatus() : null;}}diff --git a/model/src/main/java/org/openremote/model/util/CronExpressionParser.java b/model/src/main/java/org/openremote/model/util/CronExpressionParser.javanew file mode 100644index 000000000..308624634--- /dev/null+++ b/model/src/main/java/org/openremote/model/util/CronExpressionParser.java@@ -0,0 +1,193 @@+/*+ * Copyright 2017, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+package org.openremote.model.util;++import com.fasterxml.jackson.annotation.JsonCreator;+import com.fasterxml.jackson.annotation.JsonValue;+import org.openremote.model.syslog.SyslogCategory;++import java.io.Serializable;+import java.util.EnumSet;+import java.util.Locale;+import java.util.logging.Level;+import java.util.logging.Logger;+import java.util.regex.Pattern;++import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;++/**+ * Basic cron expression parser (unfortunately the quartz cron expression class+ * uses all protected methods and class is final).+ *+ */+public class CronExpressionParser implements Serializable {++ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, CronExpressionParser.class);++ enum DaysOfWeek {+ SUN,+ MON,+ TUE,+ WED,+ THU,+ FRI,+ SAT;++ private static DaysOfWeek[] values = DaysOfWeek.values();+ static final EnumSet<DaysOfWeek> ALL_OPTS = EnumSet.allOf(DaysOfWeek.class);++ public static EnumSet<DaysOfWeek> fromString(String str) {+ String[] arr = str.split(",");+ EnumSet<DaysOfWeek> set = EnumSet.noneOf(DaysOfWeek.class);++ for (String e : arr) {+ DaysOfWeek daysOfWeek = null;++ try {+ int i = Integer.parseInt(e);+ daysOfWeek = values[i-1];+ } catch (NumberFormatException ex) {+ try {+ daysOfWeek = DaysOfWeek.valueOf(e.trim().toUpperCase(Locale.ROOT));+ } catch(Exception ex2) {+ LOG.log(Level.INFO, "Cannot convert cron value for days of week to a day", ex2);+ }+ }+ if (daysOfWeek != null && !set.contains(daysOfWeek)) {+ set.add(daysOfWeek);+ }+ }+ return set;+ }+ }++ enum Months {+ JAN,+ FEB,+ MAR,+ APR,+ MAY,+ JUN,+ JUL,+ AUG,+ SEP,+ OCT,+ NOV,+ DEC;++ private static Months[] values = Months.values();+ static final EnumSet<Months> ALL_OPTS = EnumSet.allOf(Months.class);++ public static EnumSet<Months> fromString(String str) {+ String[] arr = str.split(",");+ EnumSet<Months> set = EnumSet.noneOf(Months.class);++ for (String e : arr) {+ Months months = null;++ try {+ int i = Integer.parseInt(e);+ months = values[i-1];+ } catch (NumberFormatException ex) {+ try {+ months = Months.valueOf(e.trim().toUpperCase(Locale.ROOT));+ } catch(Exception ex2) {+ LOG.log(Level.INFO, "Cannot convert cron value for days of week to a day", ex2);+ }+ }+ if (months != null && !set.contains(months)) {+ set.add(months);+ }+ }+ return set;+ }+ }++ protected final String originalCronExpression;+ protected static final int SECONDS = 0;+ protected static final int MINUTES = 1;+ protected static final int HOURS = 2;+ protected static final int DAY_OF_MONTH = 0;+ protected static final int MONTH = 1;+ protected static final int DAY_OF_WEEK = 2;+ protected static final int YEAR = 3;+ protected int[] timeValues = new int[3];+ protected String[] otherValues = new String[4];+ protected boolean compatible = true;+ protected boolean valid;++ @JsonCreator(mode = JsonCreator.Mode.DELEGATING)+ public CronExpressionParser(String cronExpression) {+ valid = Pattern.matches(TextUtil.REGEXP_PATTERN_CRON_EXPRESSION, cronExpression);+ originalCronExpression = cronExpression;+ String[] fields = cronExpression.split("\\s+");++ if (fields.length < 6 || fields.length > 7) {+ LOG.info("Cron expression doesn't contain the required 6 or 7 space separated values");+ compatible = false;+ } else {+ for (int i=0; i<3; i++) {+ Integer value = TextUtil.asInteger(fields[i]).orElse(null);+ if (value == null) {+ compatible = false;+ } else {+ timeValues[i] = value;+ }+ }++ // Initialise empty year value+ otherValues[3] = "";++ System.arraycopy(fields, 3, otherValues, 0, fields.length - 3);+ }+ }++ public boolean isCompatible() {+ return compatible;+ }++ public boolean isValid() {+ return valid;+ }++ @JsonValue+ public String buildCronExpression() {+ if (!isCompatible()) {+ return originalCronExpression;+ } else {+ return timeValues[0] + " " + timeValues[1] + " " + timeValues[2] + " " + String.join(" ", otherValues).trim();+ }+ }++ public void setTime(int hours, int minutes, int seconds) {+ hours = Math.max(0, hours % 24);+ minutes = Math.max(0, minutes % 60);+ seconds = Math.max(0, seconds % 60);+ compatible = true;++ timeValues[HOURS] = hours;+ timeValues[MINUTES] = minutes;+ timeValues[SECONDS] = seconds;+ }++ public String getFormattedTime() {+ return String.format("%02d:%02d:%02d", timeValues[HOURS], timeValues[MINUTES], timeValues[SECONDS]);+ }+}diff --git a/model/src/main/java/org/openremote/model/value/ValueType.java b/model/src/main/java/org/openremote/model/value/ValueType.javaindex 3e023e7c3..a926272ef 100644--- a/model/src/main/java/org/openremote/model/value/ValueType.java+++ b/model/src/main/java/org/openremote/model/value/ValueType.java@@ -32,6 +32,7 @@ import org.openremote.model.auth.UsernamePassword;import org.openremote.model.calendar.CalendarEvent;import org.openremote.model.console.ConsoleProviders;import org.openremote.model.geo.GeoJSONPoint;+import org.openremote.model.util.CronExpressionParser;import org.openremote.model.util.TsIgnore;import org.openremote.model.value.impl.*;@@ -186,6 +187,8 @@ public final class ValueType {public static final ValueDescriptor<AgentLink> VALUE_AGENT_LINK = new ValueDescriptor<>("agentLink", AgentLink.class);+ public static final ValueDescriptor<CronExpressionParser> CRON_EXPRESSION = new ValueDescriptor<>("cRONExpression", CronExpressionParser.class);+protected ValueType() {}}diff --git a/test/src/main/java/org/openremote/test/protocol/http/HttpServerTestAgent.java b/test/src/main/java/org/openremote/test/protocol/http/HTTPServerTestAgent.javasimilarity index 65%rename from test/src/main/java/org/openremote/test/protocol/http/HttpServerTestAgent.javarename to test/src/main/java/org/openremote/test/protocol/http/HTTPServerTestAgent.javaindex b5338f58a..28b637939 100644--- a/test/src/main/java/org/openremote/test/protocol/http/HttpServerTestAgent.java+++ b/test/src/main/java/org/openremote/test/protocol/http/HTTPServerTestAgent.java@@ -19,27 +19,27 @@*/package org.openremote.test.protocol.http;-import org.openremote.agent.protocol.http.AbstractHttpServerAgent;+import org.openremote.agent.protocol.http.AbstractHTTPServerAgent;import org.openremote.model.asset.agent.AgentDescriptor;import org.openremote.model.asset.agent.AgentLink;import javax.persistence.Entity;@Entity-public class HttpServerTestAgent extends AbstractHttpServerAgent<HttpServerTestAgent, TestHttpServerProtocol, AgentLink.Default> {+public class HTTPServerTestAgent extends AbstractHTTPServerAgent<HTTPServerTestAgent, TestHTTPServerProtocol, AgentLink.Default> {- public static final AgentDescriptor<HttpServerTestAgent, TestHttpServerProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(- HttpServerTestAgent.class, TestHttpServerProtocol.class, AgentLink.Default.class+ public static final AgentDescriptor<HTTPServerTestAgent, TestHTTPServerProtocol, AgentLink.Default> DESCRIPTOR = new AgentDescriptor<>(+ HTTPServerTestAgent.class, TestHTTPServerProtocol.class, AgentLink.Default.class);- protected HttpServerTestAgent() {}+ protected HTTPServerTestAgent() {}- public HttpServerTestAgent(String name) {+ public HTTPServerTestAgent(String name) {super(name);}@Override- public TestHttpServerProtocol getProtocolInstance() {- return new TestHttpServerProtocol(this);+ public TestHTTPServerProtocol getProtocolInstance() {+ return new TestHTTPServerProtocol(this);}}diff --git a/test/src/main/java/org/openremote/test/protocol/http/TestHttpServerProtocol.java b/test/src/main/java/org/openremote/test/protocol/http/TestHTTPServerProtocol.javasimilarity index 89%rename from test/src/main/java/org/openremote/test/protocol/http/TestHttpServerProtocol.javarename to test/src/main/java/org/openremote/test/protocol/http/TestHTTPServerProtocol.javaindex e3d7a905e..104da5a67 100644--- a/test/src/main/java/org/openremote/test/protocol/http/TestHttpServerProtocol.java+++ b/test/src/main/java/org/openremote/test/protocol/http/TestHTTPServerProtocol.java@@ -19,7 +19,7 @@*/package org.openremote.test.protocol.http;-import org.openremote.agent.protocol.http.AbstractHttpServerProtocol;+import org.openremote.agent.protocol.http.AbstractHTTPServerProtocol;import org.openremote.model.asset.agent.AgentLink;import org.openremote.model.attribute.Attribute;import org.openremote.model.attribute.AttributeEvent;@@ -28,12 +28,12 @@ import java.util.Collections;import java.util.HashSet;import java.util.Set;-public class TestHttpServerProtocol extends AbstractHttpServerProtocol<TestHttpServerProtocol, HttpServerTestAgent, AgentLink.Default> {+public class TestHTTPServerProtocol extends AbstractHTTPServerProtocol<TestHTTPServerProtocol, HTTPServerTestAgent, AgentLink.Default> {public static final String PROTOCOL_DISPLAY_NAME = "HTTP Server Test Protocol";public TestResourceImpl resource1 = new TestResourceImpl();- public TestHttpServerProtocol(HttpServerTestAgent agent) {+ public TestHTTPServerProtocol(HTTPServerTestAgent agent) {super(agent);}diff --git a/test/src/main/java/org/openremote/test/protocol/velbus/MockVelbusClient.java b/test/src/main/java/org/openremote/test/protocol/velbus/MockVelbusClient.javaindex 4a3f2abf2..f0705e742 100644--- a/test/src/main/java/org/openremote/test/protocol/velbus/MockVelbusClient.java+++ b/test/src/main/java/org/openremote/test/protocol/velbus/MockVelbusClient.java@@ -20,7 +20,7 @@package org.openremote.test.protocol.velbus;import io.netty.channel.ChannelHandler;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.agent.protocol.velbus.VelbusPacket;import org.openremote.model.asset.agent.ConnectionStatus;@@ -30,7 +30,7 @@ import java.util.Map;import java.util.function.Consumer;import java.util.function.Supplier;-public class MockVelbusClient implements IoClient<VelbusPacket> {+public class MockVelbusClient implements IOClient<VelbusPacket> {protected final List<Consumer<VelbusPacket>> messageConsumers = new ArrayList<>();protected final List<Consumer<ConnectionStatus>> statusConsumers = new ArrayList<>();protected List<String> sentMessages = new ArrayList<>();diff --git a/test/src/main/java/org/openremote/test/protocol/velbus/MockVelbusProtocol.java b/test/src/main/java/org/openremote/test/protocol/velbus/MockVelbusProtocol.javaindex a79c92677..01f8029fb 100644--- a/test/src/main/java/org/openremote/test/protocol/velbus/MockVelbusProtocol.java+++ b/test/src/main/java/org/openremote/test/protocol/velbus/MockVelbusProtocol.java@@ -19,7 +19,7 @@*/package org.openremote.test.protocol.velbus;-import org.openremote.agent.protocol.io.IoClient;+import org.openremote.agent.protocol.io.IOClient;import org.openremote.agent.protocol.velbus.AbstractVelbusProtocol;import org.openremote.agent.protocol.velbus.VelbusPacket;@@ -37,7 +37,7 @@ public class MockVelbusProtocol extends AbstractVelbusProtocol<MockVelbusProtoco}@Override- protected IoClient<VelbusPacket> createIoClient(MockVelbusAgent agent) throws RuntimeException {+ protected IOClient<VelbusPacket> createIoClient(MockVelbusAgent agent) throws RuntimeException {messageProcessor = new MockVelbusClient();return messageProcessor;}diff --git a/test/src/main/java/org/openremote/test/setup/ManagerTestAgentSetup.java b/test/src/main/java/org/openremote/test/setup/ManagerTestAgentSetup.javaindex cb410878a..90b249fc4 100644--- a/test/src/main/java/org/openremote/test/setup/ManagerTestAgentSetup.java+++ b/test/src/main/java/org/openremote/test/setup/ManagerTestAgentSetup.java@@ -20,7 +20,7 @@package org.openremote.test.setup;import org.openremote.agent.protocol.knx.KNXAgent;-import org.openremote.agent.protocol.velbus.VelbusTcpAgent;+import org.openremote.agent.protocol.velbus.VelbusTCPAgent;import org.openremote.manager.setup.ManagerSetup;import org.openremote.model.Container;import org.openremote.model.security.Tenant;@@ -84,7 +84,7 @@ public class ManagerTestAgentSetup extends ManagerSetup {if (velbus) {LOG.info("Enable Velbus demo agent, COM port: " + velbusPort);- VelbusTcpAgent agent = new VelbusTcpAgent("Demo VELBUS agent")+ VelbusTCPAgent agent = new VelbusTCPAgent("Demo VELBUS agent").setRealm(masterRealm).setHost(velbusHost).setPort(velbusPort);diff --git a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovyindex a961300fb..ed17a320b 100644--- a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy+++ b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy@@ -3,10 +3,10 @@ package org.openremote.test.gatewayimport com.google.common.collect.Listsimport io.netty.channel.ChannelHandlerimport org.apache.http.client.utils.URIBuilder-import org.openremote.agent.protocol.http.HttpClientAgent-import org.openremote.agent.protocol.io.AbstractNettyIoClient+import org.openremote.agent.protocol.http.HTTPAgent+import org.openremote.agent.protocol.io.AbstractNettyIOClientimport org.openremote.agent.protocol.simulator.SimulatorProtocol-import org.openremote.agent.protocol.websocket.WebsocketIoClient+import org.openremote.agent.protocol.websocket.WebsocketIOClientimport org.openremote.container.timer.TimerServiceimport org.openremote.container.util.UniqueIdentifierGeneratorimport org.openremote.manager.agent.AgentService@@ -106,7 +106,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {}when: "the Gateway client is created"- def gatewayClient = new WebsocketIoClient<String>(+ def gatewayClient = new WebsocketIOClient<String>(new URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Auth-Realm=$managerTestSetup.realmBuildingTenant").build(),null,new OAuthClientCredentialsGrant("http://127.0.0.1:$serverPort/auth/realms/$managerTestSetup.realmBuildingTenant/protocol/openid-connect/token",@@ -114,7 +114,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {gateway.getClientSecret().orElse(""),null).setBasicAuthHeader(true))gatewayClient.setEncoderDecoderProvider({- [new AbstractNettyIoClient.MessageToMessageDecoder<String>(String.class, gatewayClient)].toArray(new ChannelHandler[0])+ [new AbstractNettyIOClient.MessageToMessageDecoder<String>(String.class, gatewayClient)].toArray(new ChannelHandler[0])})and: "we add callback consumers to the client"@@ -161,14 +161,14 @@ class GatewayTest extends Specification implements ManagerContainerTrait {and: "the gateway client assets are defined"List<String> agentAssetIds = []- List<HttpClientAgent> agentAssets = []+ List<HTTPAgent> agentAssets = []List<String> assetIds = []List<Asset> assets = []IntStream.rangeClosed(1, 5).forEach {i ->agentAssetIds.add(UniqueIdentifierGenerator.generateId("Test Agent $i"))agentAssets.add(- new HttpClientAgent("Test Agent $i")+ new HTTPAgent("Test Agent $i").setId(agentAssetIds[i-1]).setBaseURI("https://google.co.uk").setRealm(MASTER_REALM)@@ -195,12 +195,12 @@ class GatewayTest extends Specification implements ManagerContainerTrait {new MetaItem<>(ACCESS_PUBLIC_READ)),new Attribute<>("temp", NUMBER).addOrReplaceMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agentAssetIds[i-1])+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[i-1]).setPath("")),new MetaItem<>(UNITS, units(UNITS_CELSIUS))),new Attribute<>("tempSetpoint", NUMBER).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agentAssetIds[i-1])+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[i-1]).setPath("")),new MetaItem<>(UNITS, units(UNITS_CELSIUS)))@@ -269,11 +269,11 @@ class GatewayTest extends Specification implements ManagerContainerTrait {assert syncedAssets.size() == sendAssets.size()assert syncedAssets.stream().filter{syncedAsset -> sendAssets.stream().anyMatch{mapAssetId(gateway.getId(), it.id, false) == syncedAsset.id}}.count() == sendAssets.size()assert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[0]}.getName() == "Test Agent 1"- assert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[0]}.getType() == HttpClientAgent.DESCRIPTOR.name+ assert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[0]}.getType() == HTTPAgent.DESCRIPTOR.nameassert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[0]}.getRealm() == managerTestSetup.realmBuildingTenantassert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[0]}.getParentId() == gateway.getId()assert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[4]}.getName() == "Test Agent 5"- assert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[4]}.getType() == HttpClientAgent.DESCRIPTOR.name+ assert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[4]}.getType() == HTTPAgent.DESCRIPTOR.nameassert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[4]}.getRealm() == managerTestSetup.realmBuildingTenantassert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == agentAssetIds[4]}.getParentId() == gateway.getId()assert syncedAssets.find {mapAssetId(gateway.getId(), it.id, true) == assetIds[0]}.getName() == "Test Building 1"@@ -386,12 +386,12 @@ class GatewayTest extends Specification implements ManagerContainerTrait {new MetaItem<>(ACCESS_PUBLIC_READ)),new Attribute<>("temp", NUMBER).addOrReplaceMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agentAssetIds[0])+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[0]).setPath("")),new MetaItem<>(UNITS, units(UNITS_CELSIUS))),new Attribute<>("tempSetpoint", NUMBER).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agentAssetIds[0])+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[0]).setPath("")),new MetaItem<>(UNITS, units(UNITS_CELSIUS)))@@ -418,7 +418,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {new Attribute<>("co2Level", POSITIVE_INTEGER, 500).addMeta(new MetaItem<>(UNITS, units(UNITS_PART_PER_MILLION)),- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agentAssetIds[0]).setPath(""))+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[0]).setPath(""))))gatewayClient.sendMessage(SharedEvent.MESSAGE_PREFIX + Values.asJSON(new AssetEvent(AssetEvent.Cause.UPDATE, building1Room5Asset, (String[]) ["name", "attributes"].toArray(new String[0]))).get())@@ -648,12 +648,12 @@ class GatewayTest extends Specification implements ManagerContainerTrait {new MetaItem<>(ACCESS_PUBLIC_READ)),new Attribute<>("temp", NUMBER).addOrReplaceMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agentAssetIds[1])+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[1]).setPath("")),new MetaItem<>(UNITS, units(UNITS_CELSIUS))),new Attribute<>("tempSetpoint", NUMBER).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agentAssetIds[1])+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agentAssetIds[1]).setPath("")),new MetaItem<>(UNITS, units(UNITS_CELSIUS)))diff --git a/test/src/test/groovy/org/openremote/test/model/AssetModelTest.groovy b/test/src/test/groovy/org/openremote/test/model/AssetModelTest.groovyindex 1805bff2d..57a384876 100644--- a/test/src/test/groovy/org/openremote/test/model/AssetModelTest.groovy+++ b/test/src/test/groovy/org/openremote/test/model/AssetModelTest.groovy@@ -1,9 +1,9 @@package org.openremote.test.modelimport com.fasterxml.jackson.databind.node.ObjectNode-import org.openremote.agent.protocol.http.HttpClientAgent+import org.openremote.agent.protocol.http.HTTPAgentimport org.openremote.agent.protocol.simulator.SimulatorAgent-import org.openremote.agent.protocol.velbus.VelbusTcpAgent+import org.openremote.agent.protocol.velbus.VelbusTCPAgentimport org.openremote.manager.asset.AssetModelServiceimport org.openremote.model.asset.Assetimport org.openremote.model.asset.AssetModelResource@@ -24,7 +24,7 @@ import org.openremote.model.value.ValueTypeimport org.openremote.model.value.Valuesimport org.openremote.model.value.impl.ColourRGBimport org.openremote.test.ManagerContainerTrait-import org.openremote.test.protocol.http.HttpServerTestAgent+import org.openremote.test.protocol.http.HTTPServerTestAgentimport spock.lang.Sharedimport spock.lang.Specification@@ -78,10 +78,10 @@ class AssetModelTest extends Specification implements ManagerContainerTrait {then: "the asset model infos should be available"assetInfos.size() > 0assetInfos.size() == AssetModelUtil.assetTypeMap.size()- def velbusTcpAgent = assetInfos.find {it.assetDescriptor.type == VelbusTcpAgent.class}+ def velbusTcpAgent = assetInfos.find {it.assetDescriptor.type == VelbusTCPAgent.class}velbusTcpAgent != null- velbusTcpAgent.attributeDescriptors.any {it == VelbusTcpAgent.VELBUS_HOST && !it.optional}- velbusTcpAgent.attributeDescriptors.any {it == VelbusTcpAgent.VELBUS_PORT && !it.optional}+ velbusTcpAgent.attributeDescriptors.any {it == VelbusTCPAgent.VELBUS_HOST && !it.optional}+ velbusTcpAgent.attributeDescriptors.any {it == VelbusTCPAgent.VELBUS_PORT && !it.optional}}def "Retrieving a specific asset model info"() {@@ -100,7 +100,7 @@ class AssetModelTest extends Specification implements ManagerContainerTrait {AssetModelUtil.getAgentDescriptor(SimulatorAgent.class) != nulland: "the test asset model provider should have registered test agents and assets"- AssetModelUtil.getAgentDescriptor(HttpServerTestAgent.DESCRIPTOR.name).isPresent()+ AssetModelUtil.getAgentDescriptor(HTTPServerTestAgent.DESCRIPTOR.name).isPresent()}def "Serialize/Deserialize asset model"() {@@ -112,7 +112,7 @@ class AssetModelTest extends Specification implements ManagerContainerTrait {.addAttributes(new Attribute<>("testAttribute", BIG_NUMBER, 100.5, System.currentTimeMillis()).addOrReplaceMeta(- new MetaItem<>(MetaItemType.AGENT_LINK, new HttpClientAgent.HttpClientAgentLink("http_agent_id")+ new MetaItem<>(MetaItemType.AGENT_LINK, new HTTPAgent.HttpClientAgentLink("http_agent_id").setPath("test_path").setPagingMode(true)))@@ -147,7 +147,7 @@ class AssetModelTest extends Specification implements ManagerContainerTrait {assetObjectNode.get("attributes").get("testAttribute").get("meta").get(MetaItemType.AGENT_LINK.name).isObject()assetObjectNode.get("attributes").get("testAttribute").get("value").decimalValue() == 100.5assetObjectNode.get("attributes").get("testAttribute").get("meta").get(MetaItemType.AGENT_LINK.name).get("id").asText() == "http_agent_id"- assetObjectNode.get("attributes").get("testAttribute").get("meta").get(MetaItemType.AGENT_LINK.name).get("type").asText() == HttpClientAgent.HttpClientAgentLink.class.getSimpleName()+ assetObjectNode.get("attributes").get("testAttribute").get("meta").get(MetaItemType.AGENT_LINK.name).get("type").asText() == HTTPAgent.HttpClientAgentLink.class.getSimpleName()when: "the asset is deserialized"def asset2 = Values.parse(assetStr, LightAsset.class).orElse(null)@@ -159,9 +159,9 @@ class AssetModelTest extends Specification implements ManagerContainerTrait {asset2.getColourRGB().map{it.getR()}.orElse(null) == asset.getColourRGB().map{it.getR()}.orElse(null)asset2.getColourRGB().map{it.getG()}.orElse(null) == asset.getColourRGB().map{it.getG()}.orElse(null)asset2.getColourRGB().map{it.getB()}.orElse(null) == asset.getColourRGB().map{it.getB()}.orElse(null)- asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.orElse(null) instanceof HttpClientAgent.HttpClientAgentLink- asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.map{(HttpClientAgent.HttpClientAgentLink)it}.flatMap{it.path}.orElse("") == "test_path"- asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.map{(HttpClientAgent.HttpClientAgentLink)it}.flatMap{it.pagingMode}.orElse(false)+ asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.orElse(null) instanceof HTTPAgent.HttpClientAgentLink+ asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.map{(HTTPAgent.HttpClientAgentLink)it}.flatMap{it.path}.orElse("") == "test_path"+ asset2.getAttribute("testAttribute", BIG_NUMBER.type).flatMap{it.getMetaValue(MetaItemType.AGENT_LINK)}.map{(HTTPAgent.HttpClientAgentLink)it}.flatMap{it.pagingMode}.orElse(false)when: "an attribute is cloned"def attribute = asset2.getAttribute(LightAsset.COLOUR_RGB).get()diff --git a/test/src/test/groovy/org/openremote/test/protocol/TcpClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/TcpClientTest.groovyindex c579a6d2d..af6c00f95 100644--- a/test/src/test/groovy/org/openremote/test/protocol/TcpClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/TcpClientTest.groovy@@ -23,16 +23,16 @@ import io.netty.channel.ChannelHandlerimport io.netty.handler.codec.string.StringDecoderimport io.netty.handler.codec.string.StringEncoderimport io.netty.util.CharsetUtil-import org.openremote.agent.protocol.io.AbstractNettyIoClient-import org.openremote.agent.protocol.tcp.TcpIoClient-import org.openremote.agent.protocol.tcp.TcpStringServer+import org.openremote.agent.protocol.io.AbstractNettyIOClient+import org.openremote.agent.protocol.tcp.TCPIOClient+import org.openremote.agent.protocol.tcp.TCPStringServerimport org.openremote.model.asset.agent.ConnectionStatusimport org.openremote.test.ManagerContainerTraitimport spock.lang.Specificationimport spock.util.concurrent.PollingConditions/**- * This tests the {@link TcpIoClient} by creating a simple echo server that the client communicates with+ * This tests the {@link TCPIOClient} by creating a simple echo server that the client communicates with*/class TcpClientTest extends Specification implements ManagerContainerTrait {@@ -46,19 +46,19 @@ class TcpClientTest extends Specification implements ManagerContainerTrait {and: "a simple TCP echo server"def echoServerPort = findEphemeralPort()- def echoServer = new TcpStringServer(new InetSocketAddress("127.0.0.1", echoServerPort), ";", Integer.MAX_VALUE, true)+ def echoServer = new TCPStringServer(new InetSocketAddress("127.0.0.1", echoServerPort), ";", Integer.MAX_VALUE, true)echoServer.addMessageConsumer({message, channel, sender -> echoServer.sendMessage(message)})and: "a simple TCP client"- TcpIoClient<String> client = new TcpIoClient<String>(+ TCPIOClient<String> client = new TCPIOClient<String>("127.0.0.1",echoServerPort)client.setEncoderDecoderProvider({[new StringEncoder(CharsetUtil.UTF_8),new StringDecoder(CharsetUtil.UTF_8),- new AbstractNettyIoClient.MessageToMessageDecoder<String>(String.class, client)].toArray(new ChannelHandler[0])+ new AbstractNettyIOClient.MessageToMessageDecoder<String>(String.class, client)].toArray(new ChannelHandler[0])})and: "we add callback consumers to the client"diff --git a/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovyindex 7454b60ab..0e00c28ce 100644--- a/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy@@ -22,8 +22,9 @@ package org.openremote.test.protocol.httpimport com.fasterxml.jackson.databind.node.ObjectNodeimport org.jboss.resteasy.spi.ResteasyUriInfoimport org.jboss.resteasy.util.BasicAuthHelper-import org.openremote.agent.protocol.http.HttpClientAgent-import org.openremote.agent.protocol.http.HttpClientProtocol+import org.openremote.agent.protocol.http.HTTPAgent+import org.openremote.agent.protocol.http.HTTPMethod+import org.openremote.agent.protocol.http.HTTPProtocolimport org.openremote.container.web.OAuthServerResponseimport org.openremote.manager.agent.AgentServiceimport org.openremote.manager.asset.AssetProcessingService@@ -236,7 +237,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrdef conditions = new PollingConditions(timeout: 10, initialDelay: 1)and: "the HTTP client protocol min times are adjusted for testing"- HttpClientProtocol.MIN_POLLING_MILLIS = 10+ HTTPProtocol.MIN_POLLING_MILLIS = 10and: "the container starts"def container = startContainer(defaultConfig(), defaultServices())@@ -245,12 +246,12 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrdef agentService = container.getService(AgentService.class)when: "the web target builder is configured to use the mock server"- if (!HttpClientProtocol.client.configuration.isRegistered(mockServer)) {- HttpClientProtocol.client.register(mockServer, Integer.MAX_VALUE)+ if (!HTTPProtocol.client.configuration.isRegistered(mockServer)) {+ HTTPProtocol.client.register(mockServer, Integer.MAX_VALUE)}and: "a HTTP client agent is created"- HttpClientAgent agent = new HttpClientAgent("Test agent")+ HTTPAgent agent = new HTTPAgent("Test agent").setRealm(Constants.MASTER_REALM).setBaseURI("https://mockapi").setOAuthGrant(@@ -274,7 +275,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrthen: "the protocol should authenticate and the connection status should become CONNECTED"conditions.eventually {- agent = assetStorageService.find(agent.id, HttpClientAgent.class)+ agent = assetStorageService.find(agent.id, HTTPAgent.class)assert agent.getAgentStatus().orElse(ConnectionStatus.DISCONNECTED) == ConnectionStatus.CONNECTED}@@ -285,9 +286,9 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr// attribute that sends requests to the server using PUT with dynamic body and custom header to override parentnew Attribute<>("putRequestWithHeaders", JSON_OBJECT).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent.id).setPath("put_request_with_headers")- .setMethod(org.openremote.agent.protocol.http.HttpMethod.PUT)+ .setMethod(HTTPMethod.PUT).setWriteValue('{"prop1": {$value}, "prop2": "prop2Value"}').setContentType(MediaType.APPLICATION_JSON).setHeaders(new MultivaluedStringMap(@@ -306,7 +307,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr// attribute that sends requests to the server using GET with dynamic pathnew Attribute<>("getRequestWithDynamicPath", BOOLEAN).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent.id).setPath('value/{$value}/set').setWriteValueConverter((ObjectNode)Values.parse("{\n" +" \"TRUE\": \"on\",\n" +@@ -317,7 +318,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr// attribute that polls the server using GET and uses regex filter on responsenew Attribute<>("getPollSlow", INTEGER).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent.id).setPath("get_poll_slow").setPollingMillis(50).setValueFilters(@@ -330,7 +331,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr// attribute that polls the server using GET and uses regex filter on responsenew Attribute<>("getPollFast", INTEGER).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent.id).setPath("get_poll_fast").setPollingMillis(40).setValueFilters(@@ -347,7 +348,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrthen: "new request maps should be created in the HTTP client protocol for the linked attributes"conditions.eventually {- assert ((HttpClientProtocol)agentService.getProtocolInstance(agent.id)).requestMap.size() == 4+ assert ((HTTPProtocol)agentService.getProtocolInstance(agent.id)).requestMap.size() == 4}and: "the polling attributes should be polling the server"@@ -429,38 +430,38 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr.addOrReplaceAttributes(new Attribute<>("getSuccess", TEXT).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent2.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent2.id).setPath("get_success_200"))),new Attribute<>("getFailure", TEXT).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent2.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent2.id).setPath("get_failure_401"))),new Attribute<>("pollFailure", TEXT).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent3.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent3.id).setPath("get_failure_401").setPollingMillis(50))),new Attribute<>("getSuccess2", TEXT).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent4.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent4.id).setPath("get_success_200"))),new Attribute<>("getFailure2", TEXT).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent4.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent4.id).setPath("get_failure_401"))),new Attribute<>("getRedirect", TEXT).addMeta(- new MetaItem<>(AGENT_LINK, new HttpClientAgent.HttpClientAgentLink(agent4.id)+ new MetaItem<>(AGENT_LINK, new HTTPAgent.HttpClientAgentLink(agent4.id).setPath("redirect")))@@ -471,12 +472,12 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrthen: "new request maps should be created in the HTTP client protocol for the linked attributes"conditions.eventually {- assert ((HttpClientProtocol)agentService.getProtocolInstance(agent2.id)) != null- assert ((HttpClientProtocol)agentService.getProtocolInstance(agent2.id)).requestMap.size() == 2- assert ((HttpClientProtocol)agentService.getProtocolInstance(agent3.id)) != null- assert ((HttpClientProtocol)agentService.getProtocolInstance(agent3.id)).requestMap.size() == 1- assert ((HttpClientProtocol)agentService.getProtocolInstance(agent4.id)) != null- assert ((HttpClientProtocol)agentService.getProtocolInstance(agent4.id)).requestMap.size() == 3+ assert ((HTTPProtocol)agentService.getProtocolInstance(agent2.id)) != null+ assert ((HTTPProtocol)agentService.getProtocolInstance(agent2.id)).requestMap.size() == 2+ assert ((HTTPProtocol)agentService.getProtocolInstance(agent3.id)) != null+ assert ((HTTPProtocol)agentService.getProtocolInstance(agent3.id)).requestMap.size() == 1+ assert ((HTTPProtocol)agentService.getProtocolInstance(agent4.id)) != null+ assert ((HTTPProtocol)agentService.getProtocolInstance(agent4.id)).requestMap.size() == 3}and: "the polling attribute should be polling the server"diff --git a/test/src/test/groovy/org/openremote/test/protocol/http/HttpServerProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/HttpServerProtocolTest.groovyindex 811432fa2..5243064f2 100644--- a/test/src/test/groovy/org/openremote/test/protocol/http/HttpServerProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/http/HttpServerProtocolTest.groovy@@ -24,7 +24,7 @@ import io.undertow.servlet.Servletsimport io.undertow.servlet.api.DeploymentManagerimport org.jboss.resteasy.spi.ResteasyUriInfoimport org.jboss.resteasy.util.BasicAuthHelper-import org.openremote.agent.protocol.http.AbstractHttpServerProtocol+import org.openremote.agent.protocol.http.AbstractHTTPServerProtocolimport org.openremote.container.util.UniqueIdentifierGeneratorimport org.openremote.container.web.OAuthServerResponseimport org.openremote.manager.agent.AgentService@@ -296,17 +296,17 @@ class HttpServerProtocolTest extends Specification implements ManagerContainerTrand: "the test resource (to be deployed by the protocol)"def authenticatedTestResource = getClientTarget(serverUri(serverPort)- .path(AbstractHttpServerProtocol.DEFAULT_DEPLOYMENT_PATH_PREFIX)+ .path(AbstractHTTPServerProtocol.DEFAULT_DEPLOYMENT_PATH_PREFIX).path("test"),accessToken).proxy(TestResource.class)def testResource = getClientTarget(serverUri(serverPort)- .path(AbstractHttpServerProtocol.DEFAULT_DEPLOYMENT_PATH_PREFIX)+ .path(AbstractHTTPServerProtocol.DEFAULT_DEPLOYMENT_PATH_PREFIX).path("test"),null).proxy(TestResource.class)when: "a test HTTP server agent with a test deployment is created"- def agent = new HttpServerTestAgent("Test agent")+ def agent = new HTTPServerTestAgent("Test agent").setRealm(MASTER_REALM).setDeploymentPath("test").setRoleBasedSecurity(true)@@ -317,7 +317,7 @@ class HttpServerProtocolTest extends Specification implements ManagerContainerTrthen: "the protocol should be deployed"conditions.eventually {assert agentService.getProtocolInstance(agent.id) != null- assert ((TestHttpServerProtocol)agentService.getProtocolInstance(agent.id)).deployment != null+ assert ((TestHTTPServerProtocol)agentService.getProtocolInstance(agent.id)).deployment != null}when: "the authenticated test resource is used to post an asset"@@ -331,7 +331,7 @@ class HttpServerProtocolTest extends Specification implements ManagerContainerTrthen: "the asset should be stored in the test protocol"conditions.eventually {- def testServerProtocol = (TestHttpServerProtocol)agentService.getProtocolInstance(agent.id)+ def testServerProtocol = (TestHTTPServerProtocol)agentService.getProtocolInstance(agent.id)assert testServerProtocol != nullassert testServerProtocol.resource1.postedAssets.size() == 1assert testServerProtocol.resource1.postedAssets.get(0).name == "Test Asset"@@ -356,7 +356,7 @@ class HttpServerProtocolTest extends Specification implements ManagerContainerTrthrown ForbiddenExceptionwhen: "an additional instance of the Test HTTP Server protocol is deployed without security enabled"- def agent2 = new HttpServerTestAgent("Test agent 2")+ def agent2 = new HTTPServerTestAgent("Test agent 2").setRealm(MASTER_REALM).setDeploymentPath("test2").setRoleBasedSecurity(false)@@ -366,7 +366,7 @@ class HttpServerProtocolTest extends Specification implements ManagerContainerTrand: "an un-authenticated test resource proxy is created for the new deployment"def testResource2 = getClientTarget(serverUri(serverPort)- .path(AbstractHttpServerProtocol.DEFAULT_DEPLOYMENT_PATH_PREFIX)+ .path(AbstractHTTPServerProtocol.DEFAULT_DEPLOYMENT_PATH_PREFIX).path("test2"),null).proxy(TestResource.class)@@ -386,7 +386,7 @@ class HttpServerProtocolTest extends Specification implements ManagerContainerTrthen: "the asset should be stored in the test protocol"conditions.eventually {- def testServerProtocol = (TestHttpServerProtocol)agentService.getProtocolInstance(agent2.id)+ def testServerProtocol = (TestHTTPServerProtocol)agentService.getProtocolInstance(agent2.id)assert testServerProtocol != nullassert testServerProtocol.resource1.postedAssets.size() == 1assert testServerProtocol.resource1.postedAssets.get(0).name == "Test Asset 2"@@ -406,7 +406,7 @@ class HttpServerProtocolTest extends Specification implements ManagerContainerTrassert asset.getLocation().map{it.coordinates.y}.orElse(-1d) == testAsset.getLocation().map{it.coordinates.y}.orElse(0d)when: "an agent is deleted"- def protocolInstance = agentService.getProtocolInstance(agent.id) as TestHttpServerProtocol+ def protocolInstance = agentService.getProtocolInstance(agent.id) as TestHTTPServerProtocoldef deploymentManager = Servlets.defaultContainer().getDeployment(protocolInstance.deployment.deploymentInfo.getDeploymentName());assetStorageService.delete([agent.id])diff --git a/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientProtocolTest.groovyindex f2e75e7ba..93068351d 100644--- a/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientProtocolTest.groovy@@ -25,12 +25,12 @@ import io.netty.channel.socket.DatagramChannelimport io.netty.handler.codec.FixedLengthFrameDecoderimport io.netty.handler.codec.MessageToMessageEncoderimport io.netty.handler.codec.bytes.ByteArrayDecoder-import org.openremote.agent.protocol.udp.UdpClientAgent+import org.openremote.agent.protocol.udp.UDPAgentimport org.openremote.model.asset.agent.Agentimport org.openremote.model.asset.agent.AgentLink-import org.openremote.agent.protocol.udp.AbstractUdpServer-import org.openremote.agent.protocol.udp.UdpClientProtocol-import org.openremote.agent.protocol.udp.UdpStringServer+import org.openremote.agent.protocol.udp.AbstractUDPServer+import org.openremote.agent.protocol.udp.UDPProtocol+import org.openremote.agent.protocol.udp.UDPStringServerimport org.openremote.manager.agent.AgentServiceimport org.openremote.manager.asset.AssetProcessingServiceimport org.openremote.manager.asset.AssetStorageService@@ -68,7 +68,7 @@ class UdpClientProtocolTest extends Specification implements ManagerContainerTrawhen: "a simple UDP echo server is started"def echoServerPort = findEphemeralPort()def clientPort = findEphemeralPort()- AbstractUdpServer echoServer = new UdpStringServer(new InetSocketAddress("127.0.0.1", echoServerPort), ";", Integer.MAX_VALUE, true)+ AbstractUDPServer echoServer = new UDPStringServer(new InetSocketAddress("127.0.0.1", echoServerPort), ";", Integer.MAX_VALUE, true)def echoSkipCount = 0def clientActualPort = nulldef lastCommand = null@@ -95,7 +95,7 @@ class UdpClientProtocolTest extends Specification implements ManagerContainerTra}when: "a UDP client agent is created"- def agent = new UdpClientAgent("Test agent")+ def agent = new UDPAgent("Test agent")agent.setRealm(Constants.MASTER_REALM).setHost("127.0.0.1").setPort(echoServerPort)@@ -153,7 +153,7 @@ class UdpClientProtocolTest extends Specification implements ManagerContainerTrathen: "the attributes should be linked"conditions.eventually {assert agentService.getProtocolInstance(agent.id).linkedAttributes.size() == 5- assert ((UdpClientProtocol)agentService.getProtocolInstance(agent.id)).protocolMessageConsumers.size() == 2+ assert ((UDPProtocol)agentService.getProtocolInstance(agent.id)).protocolMessageConsumers.size() == 2}when: "a linked attribute value is updated"@@ -192,13 +192,13 @@ class UdpClientProtocolTest extends Specification implements ManagerContainerTraconditions.eventually {assert agentService.getProtocolInstance(agent.id) != nullassert agentService.getProtocolInstance(agent.id).linkedAttributes.size() == 5- assert ((UdpClientProtocol)agentService.getProtocolInstance(agent.id)).protocolMessageConsumers.size() == 2+ assert ((UDPProtocol)agentService.getProtocolInstance(agent.id)).protocolMessageConsumers.size() == 2}when: "the echo server is changed to a byte based server"echoServer.stop()echoServer.removeAllMessageConsumers()- echoServer = new AbstractUdpServer<byte[]>(new InetSocketAddress(echoServerPort)) {+ echoServer = new AbstractUDPServer<byte[]>(new InetSocketAddress(echoServerPort)) {@Overrideprotected void addDecoders(DatagramChannel channel) {@@ -237,10 +237,10 @@ class UdpClientProtocolTest extends Specification implements ManagerContainerTrathen: "the protocol should be relinked"conditions.eventually {assert agentService.agentMap.get(agent.id) != null- assert ((UdpClientAgent)agentService.agentMap.get(agent.id)).getMessageConvertHex().orElse(false)+ assert ((UDPAgent)agentService.agentMap.get(agent.id)).getMessageConvertHex().orElse(false)assert agentService.getProtocolInstance(agent.id) != nullassert agentService.getProtocolInstance(agent.id).linkedAttributes.size() == 5- assert ((UdpClientProtocol)agentService.getProtocolInstance(agent.id)).protocolMessageConsumers.size() == 2+ assert ((UDPProtocol)agentService.getProtocolInstance(agent.id)).protocolMessageConsumers.size() == 2}and: "the protocol should become CONNECTED"@@ -260,7 +260,7 @@ class UdpClientProtocolTest extends Specification implements ManagerContainerTraconditions.eventually {assert agentService.getProtocolInstance(agent.id) != nullassert agentService.getProtocolInstance(agent.id).linkedAttributes.size() == 5- assert ((UdpClientProtocol)agentService.getProtocolInstance(agent.id)).protocolMessageConsumers.size() == 2+ assert ((UDPProtocol)agentService.getProtocolInstance(agent.id)).protocolMessageConsumers.size() == 2assert agentService.getProtocolInstance(agent.id).linkedAttributes.get(new AttributeRef(asset.getId(), "echoWorld")).getMetaItem(AGENT_LINK).flatMap{it.value}.flatMap{it.writeValue}.orElse(null) == "123456"}diff --git a/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientTest.groovyindex 183e15f4a..0050f0316 100644--- a/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientTest.groovy@@ -24,9 +24,9 @@ import io.netty.handler.codec.string.StringDecoderimport io.netty.handler.codec.string.StringEncoderimport io.netty.util.CharsetUtilimport io.netty.util.internal.SocketUtils-import org.openremote.agent.protocol.io.AbstractNettyIoClient-import org.openremote.agent.protocol.udp.UdpIoClient-import org.openremote.agent.protocol.udp.UdpStringServer+import org.openremote.agent.protocol.io.AbstractNettyIOClient+import org.openremote.agent.protocol.udp.UDPIOClient+import org.openremote.agent.protocol.udp.UDPStringServerimport org.openremote.model.asset.agent.ConnectionStatusimport org.openremote.test.ManagerContainerTraitimport spock.lang.Specification@@ -35,7 +35,7 @@ import spock.util.concurrent.PollingConditionsimport java.util.function.Consumer/**- * This tests the {@link UdpIoClient} by creating a simple echo server that the client communicates with+ * This tests the {@link UDPIOClient} by creating a simple echo server that the client communicates with*/class UdpClientTest extends Specification implements ManagerContainerTrait {@@ -50,7 +50,7 @@ class UdpClientTest extends Specification implements ManagerContainerTrait {and: "a simple UDP echo server"def echoServerPort = findEphemeralPort()- def echoServer = new UdpStringServer(new InetSocketAddress("127.0.0.1", echoServerPort), ";", Integer.MAX_VALUE, true)+ def echoServer = new UDPStringServer(new InetSocketAddress("127.0.0.1", echoServerPort), ";", Integer.MAX_VALUE, true)echoServer.addMessageConsumer({message, channel, sender ->echoServer.sendMessage(message, sender)@@ -63,7 +63,7 @@ class UdpClientTest extends Specification implements ManagerContainerTrait {})and: "a simple UDP broadcast client"- UdpIoClient<String> client = new UdpIoClient<String>(+ UDPIOClient<String> client = new UDPIOClient<String>("127.0.0.1",echoServerPort,clientPort)@@ -71,7 +71,7 @@ class UdpClientTest extends Specification implements ManagerContainerTrait {[new StringEncoder(CharsetUtil.UTF_8),new StringDecoder(CharsetUtil.UTF_8),- new AbstractNettyIoClient.MessageToMessageDecoder<String>(String.class, client)+ new AbstractNettyIOClient.MessageToMessageDecoder<String>(String.class, client)].toArray(new ChannelHandler[0])})diff --git a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovyindex 207dfb046..ca3b9bf8d 100644--- a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy@@ -20,9 +20,9 @@package org.openremote.test.protocol.websocketimport org.openremote.agent.protocol.simulator.SimulatorProtocol-import org.openremote.agent.protocol.websocket.WebsocketClientAgent-import org.openremote.agent.protocol.websocket.WebsocketClientProtocol-import org.openremote.agent.protocol.websocket.WebsocketHttpSubscription+import org.openremote.agent.protocol.websocket.WebsocketAgent+import org.openremote.agent.protocol.websocket.WebsocketAgentProtocol+import org.openremote.agent.protocol.websocket.WebsocketHTTPSubscriptionimport org.openremote.agent.protocol.websocket.WebsocketSubscriptionimport org.openremote.manager.agent.AgentServiceimport org.openremote.manager.asset.AssetProcessingService@@ -136,12 +136,12 @@ class WebsocketClientProtocolTest extends Specification implements ManagerContaidef clientEventService = container.getService(ClientEventService.class)when: "the web target builder is configured to use the mock HTTP server (to test subscriptions)"- if (!WebsocketClientProtocol.resteasyClient.configuration.isRegistered(mockServer)) {- WebsocketClientProtocol.resteasyClient.register(mockServer, Integer.MAX_VALUE)+ if (!WebsocketAgentProtocol.resteasyClient.configuration.isRegistered(mockServer)) {+ WebsocketAgentProtocol.resteasyClient.register(mockServer, Integer.MAX_VALUE)}and: "a Websocket client agent is created to connect to this tests manager"- def agent = new WebsocketClientAgent("Test agent")+ def agent = new WebsocketAgent("Test agent").setRealm(Constants.MASTER_REALM).setConnectUri("ws://127.0.0.1:$serverPort/websocket/events?Auth-Realm=master").setOAuthGrant(new OAuthPasswordGrant("http://127.0.0.1:$serverPort/auth/realms/master/protocol/openid-connect/token",@@ -157,9 +157,9 @@ class WebsocketClientProtocolTest extends Specification implements ManagerContainew AssetFilter<AttributeEvent>().setAssetIds(managerTestSetup.apartment1LivingroomId),"1",null)).orElse(null)),- new WebsocketHttpSubscription()+ new WebsocketHTTPSubscription().contentType(MediaType.APPLICATION_JSON)- .method(WebsocketHttpSubscription.Method.POST)+ .method(WebsocketHTTPSubscription.Method.POST).headers(new HashMap<String, List<String>>(["header1" : ["header1Value1"],"header2" : ["header2Value1", "header2Value2"]@@ -192,7 +192,7 @@ class WebsocketClientProtocolTest extends Specification implements ManagerContai// write attribute valuenew Attribute<>("readWriteTargetTemp", NUMBER).addMeta(- new MetaItem<>(AGENT_LINK, new WebsocketClientAgent.WebsocketClientAgentLink(agent.id)+ new MetaItem<>(AGENT_LINK, new WebsocketAgent.WebsocketAgentLink(agent.id).setWriteValue(SharedEvent.MESSAGE_PREFIX +Values.asJSON(new AttributeEvent(managerTestSetup.apartment1LivingroomId,@@ -221,16 +221,16 @@ class WebsocketClientProtocolTest extends Specification implements ManagerContainew WebsocketSubscription().body(SharedEvent.MESSAGE_PREFIX + Values.asJSON(new ReadAttributeEvent(managerTestSetup.apartment1LivingroomId, "targetTemperature")).orElse(null)),- new WebsocketHttpSubscription()+ new WebsocketHTTPSubscription().contentType(MediaType.APPLICATION_JSON)- .method(WebsocketHttpSubscription.Method.GET)+ .method(WebsocketHTTPSubscription.Method.GET).uri("https://mockapi/targetTemperature")] as WebsocketSubscription[]))),new Attribute<>("readCo2Level", NUMBER).addMeta(- new MetaItem<>(AGENT_LINK, new WebsocketClientAgent.WebsocketClientAgentLink(agent.id)+ new MetaItem<>(AGENT_LINK, new WebsocketAgent.WebsocketAgentLink(agent.id).setMessageMatchFilters([new SubStringValueFilter(TriggeredEventSubscription.MESSAGE_PREFIX.length()),@@ -251,9 +251,9 @@ class WebsocketClientProtocolTest extends Specification implements ManagerContainew WebsocketSubscription().body(SharedEvent.MESSAGE_PREFIX + Values.asJSON(new ReadAttributeEvent(managerTestSetup.apartment1LivingroomId, "co2Level")).orElse(null)),- new WebsocketHttpSubscription()+ new WebsocketHTTPSubscription().contentType(MediaType.APPLICATION_JSON)- .method(WebsocketHttpSubscription.Method.GET)+ .method(WebsocketHTTPSubscription.Method.GET).uri("https://mockapi/co2Level")] as WebsocketSubscription[]))diff --git a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovyindex 3d272e0f6..cff29a447 100644--- a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy@@ -21,8 +21,8 @@ package org.openremote.test.protocol.websocketimport io.netty.channel.ChannelHandlerimport org.apache.http.client.utils.URIBuilder-import org.openremote.agent.protocol.io.AbstractNettyIoClient-import org.openremote.agent.protocol.websocket.WebsocketIoClient+import org.openremote.agent.protocol.io.AbstractNettyIOClient+import org.openremote.agent.protocol.websocket.WebsocketIOClientimport org.openremote.manager.agent.AgentServiceimport org.openremote.manager.asset.AssetProcessingServiceimport org.openremote.manager.asset.AssetStorageService@@ -48,7 +48,7 @@ import static org.openremote.model.Constants.KEYCLOAK_CLIENT_IDimport static org.openremote.model.Constants.MASTER_REALM_ADMIN_USER/**- * This tests the {@link WebsocketIoClient} by connecting to the manager web socket API which means it also tests+ * This tests the {@link WebsocketIOClient} by connecting to the manager web socket API which means it also tests* the API itself*/class WebsocketClientTest extends Specification implements ManagerContainerTrait {@@ -84,7 +84,7 @@ class WebsocketClientTest extends Specification implements ManagerContainerTraitdef managerTestSetup = container.getService(SetupService.class).getTaskOfType(ManagerTestSetup.class)and: "a simple Websocket client"- def client = new WebsocketIoClient<String>(+ def client = new WebsocketIOClient<String>(new URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Auth-Realm=master").build(),null,new OAuthPasswordGrant("http://127.0.0.1:$serverPort/auth/realms/master/protocol/openid-connect/token",@@ -94,7 +94,7 @@ class WebsocketClientTest extends Specification implements ManagerContainerTraitMASTER_REALM_ADMIN_USER,getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)))client.setEncoderDecoderProvider({- [new AbstractNettyIoClient.MessageToMessageDecoder<String>(String.class, client)].toArray(new ChannelHandler[0])+ [new AbstractNettyIOClient.MessageToMessageDecoder<String>(String.class, client)].toArray(new ChannelHandler[0])})and: "we add callback consumers to the client"