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
Renamed controller to agent, removed unused bits
Christian Bauer9cf842d5a409
diff --git a/LICENSE.txt b/LICENSE.txtindex b30e7a064..5db0fb808 100644--- a/LICENSE.txt+++ b/LICENSE.txt@@ -27,14 +27,12 @@ com.fasterxml.jackson.core:*: APACHE LICENSE, VERSION 2.0com.fasterxml.jackson.module:*: APACHE LICENSE, VERSION 2.0com.fasterxml.jackson.jaxrs:*: APACHE LICENSE, VERSION 2.0com.fasterxml:classmate: APACHE LICENSE, VERSION 2.0-com.github.gwtmaterialdesign:*: APACHE LICENSE, VERSION 2.0com.google.code.findbugs: GNU LESSER GENERAL PUBLIC LICENSE, VERSION 3com.google.errorprone:error_prone_annotations: APACHE LICENSE, VERSION 2.0com.google.guava:*: APACHE LICENSE, VERSION 2.0com.google.gwt:*: APACHE LICENSE, VERSION 2.0com.google.gwt.inject:*: APACHE LICENSE, VERSION 2.0com.google.j2objc:j2objc-annotations: APACHE LICENSE, VERSION 2.0-org.mariadb.jdbc:mariadb-java-client: GNU LESSER GENERAL PUBLIC LICENSE, VERSION 3com.ning:async-http-client: APACHE LICENSE, VERSION 2.0com.sun.xml.bind:*: GNU GENERAL PUBLIC LICENSE, VERSION 2.0 WITH CLASSPATH EXCEPTIONcom.zaxxer:HikariCP: APACHE LICENSE, VERSION 2.0@@ -51,8 +49,6 @@ javax.validation:validation-api: APACHE LICENSE, VERSION 2.0javax.activation:activation: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0javax.mail:mail: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0jdom:jdom: APACHE LICENSE, VERSION 2.0-mikaelhg:urlbuilder: APACHE LICENSE, VERSION 2.0-net.sf.flexjson:flexjson: APACHE LICENSE, VERSION 2.0net.jcip:jcip-annotations: Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.5), see http://www.jcip.netorg.apache.camel:*: APACHE LICENSE, VERSION 2.0org.apache.httpcomponents:*: APACHE LICENSE, VERSION 2.0@@ -91,9 +87,6 @@ org.openremote:or-commons: GNU AFFERO GENERAL PUBLIC LICENSE, VERSION 3org.openremote:or-controller: GNU AFFERO GENERAL PUBLIC LICENSE, VERSION 3org.openremote:or-shared: GNU AFFERO GENERAL PUBLIC LICENSE, VERSION 3org.openremote:or-zwave: TODO Proprietary?-org.seamless:seamless-http: GNU LESSER GENERAL PUBLIC LICENSE, VERSION 2.1-org.seamless:seamless-util: GNU LESSER GENERAL PUBLIC LICENSE, VERSION 2.1-org.seamless:seamless-xml: GNU LESSER GENERAL PUBLIC LICENSE, VERSION 2.1org.slf4j:*: SLF4J LICENSExml-apis:xml-apis: APACHE LICENSE, VERSION 2.0org.xerial:sqlite-jdbc: APACHE LICENSE, VERSION 2.0diff --git a/README.md b/README.mdindex 539931c1c..62a74f05b 100644--- a/README.md+++ b/README.md@@ -1,4 +1,4 @@-# OpenRemote+# OpenRemote v3* **Docker Images**: https://hub.docker.com/u/openremote/* **Documentation/Wiki:** https://github.com/openremote/Documentation/wiki@@ -7,13 +7,13 @@## Getting started with OpenRemote-Please see our [installation documentation](https://github.com/openremote/openremote/wiki/Installing-OpenRemote) for more information.+We are currently working on v3 of the OpenRemote platform. *No installable released version are available at this time.*-## Contributing to OpenRemote+If you want to try OpenRemote v2, please see our [documentation](https://github.com/openremote/Documentation/wiki) for more information.-We work with Java, Groovy, Gradle, Docker, and wide range of APIs and protocol implementations. Clone or checkout this project and send us pull requests.+## Contributing to OpenRemote-Please see our [developer documentation](https://github.com/openremote/openremote/wiki/Contributing-to-OpenRemote) for more information.+We work with Java, Groovy, Gradle, Docker, and wide range of APIs and protocol implementations. Clone or checkout this project and send us pull requests.## Discuss OpenRemote@@ -21,29 +21,10 @@ Join us on the [community group](https://groups.google.com/forum/#!forum/openrem## OpenRemote Projects-This is the platform project of OpenRemote, where we integrate services and code from many projects. Some projects developed by OpenRemote are co-located in this repository, others are dependencies that are developed and released independently.--* [Controller](https://github.com/openremote/Controller) - An IoT gateway with an HTTP API, it manages connections and protocols to devices and 3rd party services. Local state and rule execution provides intelligence at the edge of the network. Controllers can be provisioned directly through the file system or synchronize automatically with the Beehive service.--* [Designer](https://github.com/openremote/Designer) - Web application for configuring controllers and devices, writing rules, and editing user interfaces.--* [Web Console](https://github.com/openremote/WebConsole) - Connecting to a controller or its proxy, this web application renders panel configurations hosted on the controller and allows the user to monitor and interact with a controller.--* [Controller Command Service (CCS)](https://github.com/openremote/CCS) - A queue where you can put a command for any controller through HTTP. The controller receives commands through push or pull and executes them. Commands for establishing a secure tunnel on a socket of choice are included, thus implementing a remote proxy of a Controller.--TODO: Document other projects--WORK IN PROGRESS:--```-docker-compose -p myproject -f profile/dependencies/postgresql.yml -f profile/dependencies/keycloak.yml up+* [Agent](https://github.com/openremote/openremote/agent) - Connects sensors and actuators to an IoT network and provides intelligence at the edge of the network. Co-locate agents with backend services or install on gateways, close to devices.-org.openremote.ccs.Server#main()+* [Manager](https://github.com/openremote/openremote/manager) - Provides IoT backend services and a web-based operations frontend and management application for agents and domain assets. Design custom data flow, rules, notifications, and build end-user interfaces.-GET localhost:8080/master/command/controller/123-(Should result in 403 NOT ALLOWED)-```+* [Console](https://github.com/openremote/openremote/console) - Render and deploy custom end-user interfaces as applications for Web, iOS and Android.-```-./gradlew -p controller clean test-```\ No newline at end of file+TBC...\ No newline at end of filediff --git a/controller/build.gradle b/agent/build.gradlesimilarity index 87%rename from controller/build.gradlerename to agent/build.gradleindex e9c725d18..05bfcd979 100644--- a/controller/build.gradle+++ b/agent/build.gradle@@ -2,7 +2,7 @@ apply plugin: "java"apply plugin: "application"apply plugin: "groovy"-mainClassName = "org.openremote.controller.Main"+mainClassName = "org.openremote.agent.Main"dependencies {@@ -17,6 +17,7 @@ dependencies {testCompile "org.spockframework:spock-core:$spockVersion"}+/* TODO Enable when we build gateway packaging of agentimport com.bmuschko.gradle.docker.tasks.image.*task buildImage(type: DockerBuildImage) {@@ -28,4 +29,5 @@ task buildImage(type: DockerBuildImage) {task pushImage(type: DockerPushImage) {dependsOn buildImageimageName = dockerImageName-}\ No newline at end of file+}+*/\ No newline at end of filediff --git a/agent/src/main/java/org/openremote/agent/AgentService.java b/agent/src/main/java/org/openremote/agent/AgentService.javanew file mode 100644index 000000000..35b251c16--- /dev/null+++ b/agent/src/main/java/org/openremote/agent/AgentService.java@@ -0,0 +1,62 @@+package org.openremote.agent;++import org.openremote.container.Container;+import org.openremote.container.ContainerService;+import org.openremote.agent.command.CommandBuilder;+import org.openremote.agent.context.AgentContext;+import org.openremote.agent.context.InMemorySensorStateHandler;+import org.openremote.agent.deploy.xml.AgentDOMParser;+import org.openremote.agent.deploy.Deployment;+import org.openremote.agent.rules.RulesProvider;++import java.io.InputStream;++public class AgentService implements ContainerService {++ final protected AgentDOMParser agentDOMParser = new AgentDOMParser();+ final protected InputStream deploymentXml;+ final protected CommandBuilder commandBuilder;+ final protected RulesProvider rulesProvider;++ protected AgentContext agentContext;++ public AgentService(InputStream deploymentXml, CommandBuilder commandBuilder, RulesProvider rulesProvider) {+ this.deploymentXml = deploymentXml;+ this.commandBuilder = commandBuilder;+ this.rulesProvider = rulesProvider;+ }++ @Override+ public void init(Container container) throws Exception {+ }++ @Override+ public void configure(Container container) throws Exception {+ // TODO Support booting of multiple instances+ Deployment deployment = new Deployment(+ agentDOMParser.parse(deploymentXml, true).getDeploymentDefinition(),+ commandBuilder,+ new InMemorySensorStateHandler(),+ rulesProvider+ );+ agentContext = new AgentContext("OpenRemoteAgent123", deployment);+ }++ @Override+ public void start(Container container) throws Exception {+ if (agentContext != null) {+ agentContext.start();+ }+ }++ @Override+ public void stop(Container container) throws Exception {+ if (agentContext != null) {+ agentContext.stop();+ }+ }++ public AgentContext getContext() {+ return agentContext;+ }+}diff --git a/controller/src/main/java/org/openremote/controller/Main.java b/agent/src/main/java/org/openremote/agent/Main.javasimilarity index 72%rename from controller/src/main/java/org/openremote/controller/Main.javarename to agent/src/main/java/org/openremote/agent/Main.javaindex 7d19b6132..ceb78b431 100644--- a/controller/src/main/java/org/openremote/controller/Main.java+++ b/agent/src/main/java/org/openremote/agent/Main.java@@ -1,4 +1,4 @@-package org.openremote.controller;+package org.openremote.agent;public class Main {diff --git a/agent/src/main/java/org/openremote/agent/command/Command.java b/agent/src/main/java/org/openremote/agent/command/Command.javanew file mode 100644index 000000000..e492d2bb4--- /dev/null+++ b/agent/src/main/java/org/openremote/agent/command/Command.java@@ -0,0 +1,4 @@+package org.openremote.agent.command;++public interface Command {+}diff --git a/controller/src/main/java/org/openremote/controller/command/CommandBuilder.java b/agent/src/main/java/org/openremote/agent/command/CommandBuilder.javasimilarity index 67%rename from controller/src/main/java/org/openremote/controller/command/CommandBuilder.javarename to agent/src/main/java/org/openremote/agent/command/CommandBuilder.javaindex d82a8c654..779065143 100644--- a/controller/src/main/java/org/openremote/controller/command/CommandBuilder.java+++ b/agent/src/main/java/org/openremote/agent/command/CommandBuilder.java@@ -1,8 +1,8 @@-package org.openremote.controller.command;+package org.openremote.agent.command;-import org.openremote.controller.command.builtin.DateTimeCommand;-import org.openremote.controller.command.builtin.VirtualCommand;-import org.openremote.controller.deploy.CommandDefinition;+import org.openremote.agent.command.builtin.DateTimeCommand;+import org.openremote.agent.command.builtin.VirtualCommand;+import org.openremote.agent.deploy.CommandDefinition;/*** Build protocol- and device-specific command implementation.diff --git a/controller/src/main/java/org/openremote/controller/command/Commands.java b/agent/src/main/java/org/openremote/agent/command/Commands.javasimilarity index 94%rename from controller/src/main/java/org/openremote/controller/command/Commands.javarename to agent/src/main/java/org/openremote/agent/command/Commands.javaindex 1ebfd8747..22330d6cc 100644--- a/controller/src/main/java/org/openremote/controller/command/Commands.java+++ b/agent/src/main/java/org/openremote/agent/command/Commands.java@@ -1,7 +1,7 @@-package org.openremote.controller.command;+package org.openremote.agent.command;-import org.openremote.controller.deploy.CommandDefinition;-import org.openremote.controller.deploy.Deployment;+import org.openremote.agent.deploy.CommandDefinition;+import org.openremote.agent.deploy.Deployment;import java.util.logging.Level;import java.util.logging.Logger;diff --git a/controller/src/main/java/org/openremote/controller/command/ExecutableCommand.java b/agent/src/main/java/org/openremote/agent/command/ExecutableCommand.javasimilarity index 77%rename from controller/src/main/java/org/openremote/controller/command/ExecutableCommand.javarename to agent/src/main/java/org/openremote/agent/command/ExecutableCommand.javaindex 11a379c8f..b07084bbe 100644--- a/controller/src/main/java/org/openremote/controller/command/ExecutableCommand.java+++ b/agent/src/main/java/org/openremote/agent/command/ExecutableCommand.java@@ -1,4 +1,4 @@-package org.openremote.controller.command;+package org.openremote.agent.command;public interface ExecutableCommand extends Command {diff --git a/controller/src/main/java/org/openremote/controller/command/PullCommand.java b/agent/src/main/java/org/openremote/agent/command/PullCommand.javasimilarity index 91%rename from controller/src/main/java/org/openremote/controller/command/PullCommand.javarename to agent/src/main/java/org/openremote/agent/command/PullCommand.javaindex 35387b65f..e6c6e0b5b 100644--- a/controller/src/main/java/org/openremote/controller/command/PullCommand.java+++ b/agent/src/main/java/org/openremote/agent/command/PullCommand.java@@ -1,6 +1,6 @@-package org.openremote.controller.command;+package org.openremote.agent.command;-import org.openremote.controller.sensor.Sensor;+import org.openremote.agent.sensor.Sensor;/*** Pull commands are intended for collecting updates from "passive" devices which mustdiff --git a/controller/src/main/java/org/openremote/controller/command/PushCommand.java b/agent/src/main/java/org/openremote/agent/command/PushCommand.javasimilarity index 89%rename from controller/src/main/java/org/openremote/controller/command/PushCommand.javarename to agent/src/main/java/org/openremote/agent/command/PushCommand.javaindex ce0b9625b..b1752a60e 100644--- a/controller/src/main/java/org/openremote/controller/command/PushCommand.java+++ b/agent/src/main/java/org/openremote/agent/command/PushCommand.java@@ -1,6 +1,6 @@-package org.openremote.controller.command;+package org.openremote.agent.command;-import org.openremote.controller.sensor.Sensor;+import org.openremote.agent.sensor.Sensor;/*** Push commands are intended for collecting updates from "active" devices which broadcast@@ -8,11 +8,11 @@ import org.openremote.controller.sensor.Sensor;* KNX bus or IP-network broadcasts.** Push commands are expected to create their own threads (if needed) which implement the- * push functionality and also push updates to the context of the controller using the+ * push functionality and also push updates to the context of the agent using the* sensor callback API provided.** Push command implementations use the sensor {@link Sensor#update} method to push state- * changes into the controller's context, as shown in the example below:+ * changes into the agents's context, as shown in the example below:** <pre><code>*@@ -49,7 +49,7 @@ import org.openremote.controller.sensor.Sensor;***- * <b>NOTE:</b> The controller at this point does not implement any flow control on its side --+ * <b>NOTE:</b> The agent at this point does not implement any flow control on its side --* therefore a very busy listener can overflow it with too many updates. Control* flow must be implemented by the listener implementation ensuring that not too* many updates are created.diff --git a/controller/src/main/java/org/openremote/controller/command/SensorUpdateCommand.java b/agent/src/main/java/org/openremote/agent/command/SensorUpdateCommand.javasimilarity index 75%rename from controller/src/main/java/org/openremote/controller/command/SensorUpdateCommand.javarename to agent/src/main/java/org/openremote/agent/command/SensorUpdateCommand.javaindex 4c9f1add4..4f6f4ff10 100644--- a/controller/src/main/java/org/openremote/controller/command/SensorUpdateCommand.java+++ b/agent/src/main/java/org/openremote/agent/command/SensorUpdateCommand.java@@ -1,4 +1,4 @@-package org.openremote.controller.command;+package org.openremote.agent.command;/*** A command that can be used to update the state of a sensor.diff --git a/controller/src/main/java/org/openremote/controller/command/builtin/DateTimeCommand.java b/agent/src/main/java/org/openremote/agent/command/builtin/DateTimeCommand.javasimilarity index 97%rename from controller/src/main/java/org/openremote/controller/command/builtin/DateTimeCommand.javarename to agent/src/main/java/org/openremote/agent/command/builtin/DateTimeCommand.javaindex c14ac7739..8e33b2a3f 100644--- a/controller/src/main/java/org/openremote/controller/command/builtin/DateTimeCommand.java+++ b/agent/src/main/java/org/openremote/agent/command/builtin/DateTimeCommand.java@@ -1,11 +1,12 @@-package org.openremote.controller.command.builtin;+package org.openremote.agent.command.builtin;+// TODO Can this dependency be replaced with Java 8 datetime API?import com.luckycatlabs.sunrisesunset.SunriseSunsetCalculator;import com.luckycatlabs.sunrisesunset.dto.Location;import org.openremote.container.util.TextUtil;-import org.openremote.controller.command.PushCommand;-import org.openremote.controller.deploy.CommandDefinition;-import org.openremote.controller.sensor.Sensor;+import org.openremote.agent.command.PushCommand;+import org.openremote.agent.deploy.CommandDefinition;+import org.openremote.agent.sensor.Sensor;import java.text.SimpleDateFormat;import java.util.Calendar;diff --git a/controller/src/main/java/org/openremote/controller/command/builtin/VirtualCommand.java b/agent/src/main/java/org/openremote/agent/command/builtin/VirtualCommand.javasimilarity index 96%rename from controller/src/main/java/org/openremote/controller/command/builtin/VirtualCommand.javarename to agent/src/main/java/org/openremote/agent/command/builtin/VirtualCommand.javaindex e599550f1..65046039c 100644--- a/controller/src/main/java/org/openremote/controller/command/builtin/VirtualCommand.java+++ b/agent/src/main/java/org/openremote/agent/command/builtin/VirtualCommand.java@@ -1,9 +1,9 @@-package org.openremote.controller.command.builtin;+package org.openremote.agent.command.builtin;-import org.openremote.controller.command.ExecutableCommand;-import org.openremote.controller.command.PullCommand;-import org.openremote.controller.deploy.CommandDefinition;-import org.openremote.controller.sensor.*;+import org.openremote.agent.command.ExecutableCommand;+import org.openremote.agent.command.PullCommand;+import org.openremote.agent.deploy.CommandDefinition;+import org.openremote.agent.sensor.*;import java.util.Map;import java.util.concurrent.ConcurrentHashMap;diff --git a/agent/src/main/java/org/openremote/agent/context/AgentContext.java b/agent/src/main/java/org/openremote/agent/context/AgentContext.javanew file mode 100644index 000000000..c37f9b376--- /dev/null+++ b/agent/src/main/java/org/openremote/agent/context/AgentContext.java@@ -0,0 +1,125 @@+package org.openremote.agent.context;++import org.openremote.agent.command.Commands;+import org.openremote.agent.deploy.Deployment;+import org.openremote.agent.sensor.Sensor;+import org.openremote.agent.sensor.SensorState;+import org.openremote.agent.sensor.SensorStateUpdate;++import java.util.logging.Level;+import java.util.logging.Logger;++/**+ * An instance of an agent, bootstrapped from {@link Deployment}, this is the main API.+ */+public class AgentContext {++ private static final Logger LOG = Logger.getLogger(AgentContext.class.getName());++ final protected String agentID;+ final protected Deployment deployment;++ private volatile Boolean shutdownInProgress = false;++ public AgentContext(String agentID, Deployment deployment) {+ this.agentID = agentID;+ this.deployment = deployment;+ }++ public String getAgentID() {+ return agentID;+ }++ public Deployment getDeployment() {+ return deployment;+ }++ public Commands getCommands() {+ return getDeployment().getCommands();+ }++ public synchronized void start() {+ if (shutdownInProgress)+ return;+ LOG.info("Starting context: " + getAgentID());+ getDeployment().getSensorStateHandler().start(this);+ getDeployment().getRuleEngine().start(this);+ for (Sensor sensor : deployment.getSensors()) {++ // Put initial state "unknown" for each sensor+ getDeployment().getSensorStateHandler().put(+ new Sensor.UnknownState(sensor)+ );++ sensor.start(this);+ }+ }++ public synchronized void stop() {+ try {+ LOG.info("Stopping context: " + getAgentID());+ shutdownInProgress = true;+ try {+ getDeployment().getRuleEngine().stop();+ } catch (Throwable t) {+ LOG.log(Level.SEVERE, "Error stopping rule engine", t);+ }+ for (Sensor sensor : deployment.getSensors()) {+ try {+ sensor.stop();+ } catch (Throwable t) {+ LOG.log(Level.SEVERE, "Error stopping sensor: " + sensor, t);+ }+ }+ try {+ getDeployment().getSensorStateHandler().stop();+ } catch (Throwable t) {+ LOG.log(Level.SEVERE, "Error stopping state handler", t);+ }+ } finally {+ shutdownInProgress = false;+ }+ }++ public synchronized void update(SensorState sensorState) {+ LOG.fine("==> Update: " + sensorState);+ if (shutdownInProgress) {+ LOG.fine("<== Shutting down. Ignoring update for: " + sensorState);+ return;+ }++ SensorStateUpdate sensorStateUpdate = new SensorStateUpdate(this, sensorState);++ getDeployment().getRuleEngine().process(sensorStateUpdate);++ if (sensorStateUpdate.hasTerminated()) {+ LOG.fine("<== Update complete, processing terminated, no update was made for: " + sensorStateUpdate.getSensorState());+ return;+ }++ getDeployment().getSensorStateHandler().put(sensorState);+ LOG.fine("<== Update complete for: " + sensorState);+ }++ public synchronized String queryValue(int sensorID) {+ SensorState state;+ if ((state = queryState(sensorID)) == null) {+ LOG.info("Requested sensor id '" + sensorID + "' was not found. Defaulting to: " + SensorState.UNKNOWN_VALUE);+ return SensorState.UNKNOWN_VALUE;+ }+ return state.serialize();+ }++ public synchronized String queryValue(String sensorName) {+ return queryValue(deployment.getSensorID(sensorName));+ }++ public synchronized SensorState queryState(int sensorID) {+ return getDeployment().getSensorStateHandler().get(sensorID);+ }++ public synchronized SensorState queryState(String sensorName) {+ Integer sensorID = deployment.getSensorID(sensorName);+ return sensorID != null ? queryState(sensorID) : null;+ }+}diff --git a/controller/src/main/java/org/openremote/controller/context/InMemorySensorStateStorage.java b/agent/src/main/java/org/openremote/agent/context/InMemorySensorStateHandler.javasimilarity index 70%rename from controller/src/main/java/org/openremote/controller/context/InMemorySensorStateStorage.javarename to agent/src/main/java/org/openremote/agent/context/InMemorySensorStateHandler.javaindex e558f84a3..62c4ee964 100644--- a/controller/src/main/java/org/openremote/controller/context/InMemorySensorStateStorage.java+++ b/agent/src/main/java/org/openremote/agent/context/InMemorySensorStateHandler.java@@ -1,24 +1,29 @@-package org.openremote.controller.context;+package org.openremote.agent.context;-import org.openremote.controller.sensor.SensorState;+import org.openremote.agent.sensor.SensorState;import java.util.HashMap;import java.util.Map;import java.util.logging.Logger;-public class InMemorySensorStateStorage implements SensorStateStorage {+public class InMemorySensorStateHandler implements SensorStateHandler {- private static final Logger LOG = Logger.getLogger(InMemorySensorStateStorage.class.getName());+ private static final Logger LOG = Logger.getLogger(InMemorySensorStateHandler.class.getName());final protected Map<Integer, SensorState> sensorStates = new HashMap<>();@Override- synchronized public void clear() {+ public void start(AgentContext agentContext) {++ }++ @Override+ public void stop() {sensorStates.clear();}@Override- synchronized public void put(SensorState sensorState) {+ public void put(SensorState sensorState) {int sourceID = sensorState.getSensorID();if (sensorStates.get(sourceID) == null) {LOG.fine("Inserted: " + sensorState);@@ -34,11 +39,6 @@ public class InMemorySensorStateStorage implements SensorStateStorage {}}- @Override- synchronized public boolean contains(int sensorID) {- return sensorStates.containsKey(sensorID);- }-@Overridepublic SensorState get(int sensorID) {return sensorStates.get(sensorID);diff --git a/agent/src/main/java/org/openremote/agent/context/SensorStateHandler.java b/agent/src/main/java/org/openremote/agent/context/SensorStateHandler.javanew file mode 100644index 000000000..a5f456169--- /dev/null+++ b/agent/src/main/java/org/openremote/agent/context/SensorStateHandler.java@@ -0,0 +1,25 @@+package org.openremote.agent.context;++import org.openremote.agent.sensor.SensorState;++/**+ * Store and/or publish sensor state.+ *+ * TODO This is not accessed concurrently at this time, what happens after we improve agent's thread handling?+ */+public interface SensorStateHandler {++ void start(AgentContext agentContext);++ void stop();++ void put(SensorState sensorState);++ SensorState get(int sensorID);++ /* TODO For polling/pushing to external system we need to be able to continue processing state from a known offset+ Iterator<SensorState> getSince(int timestamp);++ Iterator<SensorState> getSince(int timestamp, int sensorID);+ */+}diff --git a/controller/src/main/java/org/openremote/controller/deploy/CommandDefinition.java b/agent/src/main/java/org/openremote/agent/deploy/CommandDefinition.javasimilarity index 93%rename from controller/src/main/java/org/openremote/controller/deploy/CommandDefinition.javarename to agent/src/main/java/org/openremote/agent/deploy/CommandDefinition.javaindex a55291773..f6324c850 100644--- a/controller/src/main/java/org/openremote/controller/deploy/CommandDefinition.java+++ b/agent/src/main/java/org/openremote/agent/deploy/CommandDefinition.java@@ -1,4 +1,4 @@-package org.openremote.controller.deploy;+package org.openremote.agent.deploy;import java.util.Locale;import java.util.Map;@@ -18,8 +18,7 @@ public class CommandDefinition {final protected Map<String, String> properties; // Note: properties are not case-sensitive, we convert to lowercase!/**- * @param commandID This represents the unique identifier of the command element in controller's- * XML definition (corresponding to 'id' attribute of {@code <command>} element)+ * @param commandID Unique identifier* @param protocolType Protocol type identifier for this command. The protocol type identifier is used* with the command factory to identify which plugin (Java bean implementation) is* used to construct command's protocol specific execution model.diff --git a/controller/src/main/java/org/openremote/controller/deploy/Deployment.java b/agent/src/main/java/org/openremote/agent/deploy/Deployment.javasimilarity index 88%rename from controller/src/main/java/org/openremote/controller/deploy/Deployment.javarename to agent/src/main/java/org/openremote/agent/deploy/Deployment.javaindex 2114806aa..151f2ebe3 100644--- a/controller/src/main/java/org/openremote/controller/deploy/Deployment.java+++ b/agent/src/main/java/org/openremote/agent/deploy/Deployment.java@@ -1,13 +1,13 @@-package org.openremote.controller.deploy;+package org.openremote.agent.deploy;-import org.openremote.container.util.MapAccess;-import org.openremote.controller.command.Command;-import org.openremote.controller.command.CommandBuilder;-import org.openremote.controller.command.Commands;-import org.openremote.controller.command.SensorUpdateCommand;-import org.openremote.controller.context.SensorStateStorage;-import org.openremote.controller.rules.RulesProvider;-import org.openremote.controller.sensor.*;+import org.openremote.agent.command.Command;+import org.openremote.agent.command.CommandBuilder;+import org.openremote.agent.command.Commands;+import org.openremote.agent.command.SensorUpdateCommand;+import org.openremote.agent.context.SensorStateHandler;+import org.openremote.agent.rules.RuleEngine;+import org.openremote.agent.rules.RulesProvider;+import org.openremote.agent.sensor.*;import java.util.Map;import java.util.concurrent.ConcurrentHashMap;@@ -17,7 +17,7 @@ import java.util.concurrent.ConcurrentHashMap;* <pre>* - General configuration properties* - How protocol-specific commands are build- * - How controller sensor state is stored+ * - How sensor state is handled* - Which rules process sensor state updates* - All known sensors, commands and their devices* </pre>@@ -27,21 +27,23 @@ public class Deployment {final protected Map<String, String> config;final protected CommandBuilder commandBuilder;final protected Commands commands;- final protected SensorStateStorage sensorStateStorage;+ final protected SensorStateHandler sensorStateHandler;final protected RulesProvider rulesProvider;+ final protected RuleEngine ruleEngine;final protected Map<String, Device> devices = new ConcurrentHashMap<>();final protected Map<Integer, Sensor> sensors = new ConcurrentHashMap<>();public Deployment(DeploymentDefinition deploymentDefinition,CommandBuilder commandBuilder,- SensorStateStorage sensorStateStorage,+ SensorStateHandler sensorStateHandler,RulesProvider rulesProvider) {this.config = deploymentDefinition.getConfig();this.commandBuilder = commandBuilder;this.commands = new Commands(this);- this.sensorStateStorage = sensorStateStorage;+ this.sensorStateHandler = sensorStateHandler;this.rulesProvider = rulesProvider;+ this.ruleEngine = new RuleEngine();for (SensorDefinition sensorDefinition : deploymentDefinition.getSensorDefinitions()) {Sensor sensor = buildSensor(sensorDefinition);@@ -74,14 +76,18 @@ public class Deployment {return commands;}- public SensorStateStorage getSensorStateStorage() {- return sensorStateStorage;+ public SensorStateHandler getSensorStateHandler() {+ return sensorStateHandler;}public RulesProvider getRulesProvider() {return rulesProvider;}+ public RuleEngine getRuleEngine() {+ return ruleEngine;+ }+public CommandDefinition getCommandDefinition(int commandID) {for (Device device : devices.values()) {CommandDefinition commandDefinition = device.getCommandDefinition(commandID);diff --git a/controller/src/main/java/org/openremote/controller/deploy/DeploymentDefinition.java b/agent/src/main/java/org/openremote/agent/deploy/DeploymentDefinition.javasimilarity index 96%rename from controller/src/main/java/org/openremote/controller/deploy/DeploymentDefinition.javarename to agent/src/main/java/org/openremote/agent/deploy/DeploymentDefinition.javaindex 76eb4dc4f..41fd558c7 100644--- a/controller/src/main/java/org/openremote/controller/deploy/DeploymentDefinition.java+++ b/agent/src/main/java/org/openremote/agent/deploy/DeploymentDefinition.java@@ -1,4 +1,4 @@-package org.openremote.controller.deploy;+package org.openremote.agent.deploy;import java.util.HashMap;import java.util.Map;diff --git a/controller/src/main/java/org/openremote/controller/deploy/Device.java b/agent/src/main/java/org/openremote/agent/deploy/Device.javasimilarity index 96%rename from controller/src/main/java/org/openremote/controller/deploy/Device.javarename to agent/src/main/java/org/openremote/agent/deploy/Device.javaindex 3417b6586..456c479a7 100644--- a/controller/src/main/java/org/openremote/controller/deploy/Device.java+++ b/agent/src/main/java/org/openremote/agent/deploy/Device.java@@ -1,4 +1,4 @@-package org.openremote.controller.deploy;+package org.openremote.agent.deploy;import java.util.Map;import java.util.concurrent.ConcurrentHashMap;diff --git a/controller/src/main/java/org/openremote/controller/deploy/SensorDefinition.java b/agent/src/main/java/org/openremote/agent/deploy/SensorDefinition.javasimilarity index 94%rename from controller/src/main/java/org/openremote/controller/deploy/SensorDefinition.javarename to agent/src/main/java/org/openremote/agent/deploy/SensorDefinition.javaindex d53cebf90..bf868f695 100644--- a/controller/src/main/java/org/openremote/controller/deploy/SensorDefinition.java+++ b/agent/src/main/java/org/openremote/agent/deploy/SensorDefinition.java@@ -1,4 +1,4 @@-package org.openremote.controller.deploy;+package org.openremote.agent.deploy;import java.util.HashMap;import java.util.Map;@@ -16,7 +16,7 @@ public class SensorDefinition {/*** @param name Human readable name of the sensor.- * @param sensorID A unique sensor ID. Must be unique per controller deployment.+ * @param sensorID A unique identifier.* @param type A sensor type.* @param updateCommandDefinition A command definition used to update sensor values.* @param properties Additional sensor properties. These properties can be used by the protocoldiff --git a/controller/src/main/java/org/openremote/controller/deploy/xml/ControllerDOM.java b/agent/src/main/java/org/openremote/agent/deploy/xml/AgentDOM.javasimilarity index 71%rename from controller/src/main/java/org/openremote/controller/deploy/xml/ControllerDOM.javarename to agent/src/main/java/org/openremote/agent/deploy/xml/AgentDOM.javaindex f6a6d92b3..fac62fb31 100644--- a/controller/src/main/java/org/openremote/controller/deploy/xml/ControllerDOM.java+++ b/agent/src/main/java/org/openremote/agent/deploy/xml/AgentDOM.java@@ -1,9 +1,9 @@-package org.openremote.controller.deploy.xml;+package org.openremote.agent.deploy.xml;import org.openremote.container.xml.DOM;-import org.openremote.controller.deploy.CommandDefinition;-import org.openremote.controller.deploy.DeploymentDefinition;-import org.openremote.controller.deploy.SensorDefinition;+import org.openremote.agent.deploy.CommandDefinition;+import org.openremote.agent.deploy.DeploymentDefinition;+import org.openremote.agent.deploy.SensorDefinition;import org.w3c.dom.Document;import javax.xml.xpath.XPath;@@ -14,20 +14,20 @@ import java.util.logging.Logger;* Usage:* <p>* <pre><code>- * ControllerDOM dom = new ControllerDOMParser().parse(deploymentXml);+ * AgentDOM dom = new AgentDOMParser().parse(deploymentXml);* Deployment deployment = new Deployment(dom.getDeploymentDefinition(), ...);* </code></pre>*/-public class ControllerDOM extends DOM {+public class AgentDOM extends DOM {- private static final Logger LOG = Logger.getLogger(ControllerDOM.class.getName());+ private static final Logger LOG = Logger.getLogger(AgentDOM.class.getName());- public static final String NAMESPACE_URI = "http://www.openremote.org";+ public static final String NAMESPACE_URI = "http://www.openremote.org/schemas/agent/3";final protected XPath xpath;final protected DeploymentDefinition deploymentDefinition;- public ControllerDOM(Document dom, XPath xpath) {+ public AgentDOM(Document dom, XPath xpath) {super(dom);this.xpath = xpath;@@ -35,12 +35,12 @@ public class ControllerDOM extends DOM {try {List<CommandDefinition> commandDefinitionList = new ArrayList<>();- ControllerElement[] commandElements = getRoot(xpath).getFirstChild("commands").getChildren();- for (ControllerElement commandElement : commandElements) {+ AgentElement[] commandElements = getRoot(xpath).getFirstChild("commands").getChildren();+ for (AgentElement commandElement : commandElements) {Integer commandID = Integer.valueOf(commandElement.getAttribute("id"));String protocolType = commandElement.getAttribute("protocol");Map<String, String> properties = new LinkedHashMap<>();- for (ControllerElement propertyElement : commandElement.getChildren("property")) {+ for (AgentElement propertyElement : commandElement.getChildren("property")) {properties.put(propertyElement.getAttribute("name"), propertyElement.getAttribute("value"));}commandDefinitionList.add(@@ -53,14 +53,14 @@ public class ControllerDOM extends DOM {);List<SensorDefinition> sensorDefinitionList = new ArrayList<>();- ControllerElement[] sensorElements = getRoot(xpath).getFirstChild("sensors").getChildren();- for (ControllerElement sensorElement : sensorElements) {+ AgentElement[] sensorElements = getRoot(xpath).getFirstChild("sensors").getChildren();+ for (AgentElement sensorElement : sensorElements) {Integer sensorID = Integer.valueOf(sensorElement.getAttribute("id"));String sensorName = sensorElement.getAttribute("name");String sensorType = sensorElement.getAttribute("type").toLowerCase(Locale.ROOT);Integer commandRefID = null;- ControllerElement includeElement = sensorElement.getFirstChild("include");+ AgentElement includeElement = sensorElement.getFirstChild("include");if (includeElement != null && "command".equals(includeElement.getAttribute("type"))) {commandRefID = Integer.valueOf(includeElement.getAttribute("ref"));}@@ -85,13 +85,13 @@ public class ControllerDOM extends DOM {// TODO This is horrible, not uniformMap<String, String> properties = new LinkedHashMap<>();- for (ControllerElement stateElement : sensorElement.getChildren("state")) {+ for (AgentElement stateElement : sensorElement.getChildren("state")) {properties.put("state-" + stateElement.getAttribute("name"), stateElement.getAttribute("value"));}- ControllerElement minElement = sensorElement.getFirstChild("min");+ AgentElement minElement = sensorElement.getFirstChild("min");if (minElement != null)properties.put("range-min", minElement.getAttribute("value"));- ControllerElement maxElement = sensorElement.getFirstChild("max");+ AgentElement maxElement = sensorElement.getFirstChild("max");if (maxElement != null)properties.put("range-max", maxElement.getAttribute("value"));@@ -104,8 +104,8 @@ public class ControllerDOM extends DOM {);Map<String, String> config = new HashMap<>();- ControllerElement[] configPropertyElements = getRoot(xpath).getFirstChild("config").getChildren();- for (ControllerElement configPropertyElement : configPropertyElements) {+ AgentElement[] configPropertyElements = getRoot(xpath).getFirstChild("config").getChildren();+ for (AgentElement configPropertyElement : configPropertyElements) {String name = configPropertyElement.getAttribute("name");String value = configPropertyElement.getAttribute("value");if (name != null) {@@ -119,7 +119,7 @@ public class ControllerDOM extends DOM {deploymentDefinition.setConfig(config);} catch (Exception ex) {- throw new RuntimeException("Error building controller model from XML document", ex);+ throw new RuntimeException("Error parsing agent deployment from XML document", ex);}}@@ -129,13 +129,13 @@ public class ControllerDOM extends DOM {}@Override- public ControllerElement getRoot(XPath xPath) {- return new ControllerElement(xPath, getW3CDocument().getDocumentElement());+ public AgentElement getRoot(XPath xPath) {+ return new AgentElement(xPath, getW3CDocument().getDocumentElement());}@Override- public ControllerDOM copy() {- return new ControllerDOM((Document) getW3CDocument().cloneNode(true), xpath);+ public AgentDOM copy() {+ return new AgentDOM((Document) getW3CDocument().cloneNode(true), xpath);}public DeploymentDefinition getDeploymentDefinition() {diff --git a/agent/src/main/java/org/openremote/agent/deploy/xml/AgentDOMParser.java b/agent/src/main/java/org/openremote/agent/deploy/xml/AgentDOMParser.javanew file mode 100644index 000000000..5ca3bf039--- /dev/null+++ b/agent/src/main/java/org/openremote/agent/deploy/xml/AgentDOMParser.java@@ -0,0 +1,46 @@+package org.openremote.agent.deploy.xml;++import org.openremote.container.xml.DOMParser;+import org.openremote.container.xml.NamespaceContextMap;+import org.w3c.dom.Document;++import javax.xml.transform.stream.StreamSource;+import javax.xml.xpath.XPath;++/**+ * Usage:+ *+ * <pre><code>+ * AgentDOM dom = new AgentDOMParser().parse(deploymentXml);+ * </code></pre>+ */+public class AgentDOMParser extends DOMParser<AgentDOM> {++ public static final String SCHEMA_XSD = "/org/openremote/agent/schemas/agent-3.xsd";++ public AgentDOMParser() {+ super(new StreamSource(AgentDOMParser.class.getResourceAsStream(SCHEMA_XSD)));+ }++ @Override+ protected AgentDOM createDOM(Document document) {+ return new AgentDOM(document, createXPath());+ }++ public NamespaceContextMap createDefaultNamespaceContext(String... optionalPrefixes) {+ NamespaceContextMap ctx = new NamespaceContextMap() {+ @Override+ protected String getDefaultNamespaceURI() {+ return AgentDOM.NAMESPACE_URI;+ }+ };+ for (String optionalPrefix : optionalPrefixes) {+ ctx.put(optionalPrefix, AgentDOM.NAMESPACE_URI);+ }+ return ctx;+ }++ public XPath createXPath() {+ return super.createXPath(createDefaultNamespaceContext(AgentElement.XPATH_PREFIX));+ }+}diff --git a/agent/src/main/java/org/openremote/agent/deploy/xml/AgentElement.java b/agent/src/main/java/org/openremote/agent/deploy/xml/AgentElement.javanew file mode 100644index 000000000..cad7ada69--- /dev/null+++ b/agent/src/main/java/org/openremote/agent/deploy/xml/AgentElement.java@@ -0,0 +1,45 @@+package org.openremote.agent.deploy.xml;++import org.openremote.container.xml.DOMElement;+import org.w3c.dom.Element;++import javax.xml.xpath.XPath;++public class AgentElement extends DOMElement<AgentElement, AgentElement> {++ public static final String XPATH_PREFIX = "c";++ public AgentElement(XPath xpath, Element element) {+ super(xpath, element);+ }++ @Override+ protected String prefix(String localName) {+ return XPATH_PREFIX + ":" + localName;+ }++ @Override+ protected Builder<AgentElement> createParentBuilder(DOMElement el) {+ return new Builder<AgentElement>(el) {+ @Override+ public AgentElement build(Element element) {+ return new AgentElement(getXpath(), element);+ }+ };+ }++ @Override+ protected ArrayBuilder<AgentElement> createChildBuilder(DOMElement el) {+ return new ArrayBuilder<AgentElement>(el) {+ @Override+ public AgentElement[] newChildrenArray(int length) {+ return new AgentElement[length];+ }++ @Override+ public AgentElement build(Element element) {+ return new AgentElement(getXpath(), element);+ }+ };+ }+}diff --git a/controller/src/main/java/org/openremote/controller/rules/LevelFacade.java b/agent/src/main/java/org/openremote/agent/rules/LevelFacade.javasimilarity index 91%rename from controller/src/main/java/org/openremote/controller/rules/LevelFacade.javarename to agent/src/main/java/org/openremote/agent/rules/LevelFacade.javaindex 89177336f..34e8b822b 100644--- a/controller/src/main/java/org/openremote/controller/rules/LevelFacade.java+++ b/agent/src/main/java/org/openremote/agent/rules/LevelFacade.java@@ -1,6 +1,6 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;-import org.openremote.controller.sensor.LevelSensorState;+import org.openremote.agent.sensor.LevelSensorState;public class LevelFacade extends SingleValueSensorFacade<LevelFacade.LevelAdapter, LevelSensorState> {diff --git a/controller/src/main/java/org/openremote/controller/rules/RangeFacade.java b/agent/src/main/java/org/openremote/agent/rules/RangeFacade.javasimilarity index 92%rename from controller/src/main/java/org/openremote/controller/rules/RangeFacade.javarename to agent/src/main/java/org/openremote/agent/rules/RangeFacade.javaindex 5d342d2a4..d7d09ff73 100644--- a/controller/src/main/java/org/openremote/controller/rules/RangeFacade.java+++ b/agent/src/main/java/org/openremote/agent/rules/RangeFacade.java@@ -1,6 +1,6 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;-import org.openremote.controller.sensor.RangeSensorState;+import org.openremote.agent.sensor.RangeSensorState;public class RangeFacade extends SingleValueSensorFacade<RangeFacade.RangeAdapter, RangeSensorState> {diff --git a/controller/src/main/java/org/openremote/controller/rules/RuleEngine.java b/agent/src/main/java/org/openremote/agent/rules/RuleEngine.javasimilarity index 95%rename from controller/src/main/java/org/openremote/controller/rules/RuleEngine.javarename to agent/src/main/java/org/openremote/agent/rules/RuleEngine.javaindex 172568810..ad1df757e 100644--- a/controller/src/main/java/org/openremote/controller/rules/RuleEngine.java+++ b/agent/src/main/java/org/openremote/agent/rules/RuleEngine.java@@ -18,7 +18,7 @@* 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.controller.rules;+package org.openremote.agent.rules;import org.kie.api.KieBase;import org.kie.api.KieServices;@@ -39,10 +39,10 @@ import org.kie.api.runtime.rule.FactHandle;import org.kie.internal.builder.DecisionTableConfiguration;import org.kie.internal.builder.DecisionTableInputType;import org.kie.internal.builder.KnowledgeBuilderFactory;+import org.openremote.agent.context.AgentContext;+import org.openremote.agent.sensor.SensorState;+import org.openremote.agent.sensor.SensorStateUpdate;import org.openremote.container.Container;-import org.openremote.controller.deploy.Deployment;-import org.openremote.controller.sensor.SensorState;-import org.openremote.controller.sensor.SensorStateUpdate;import java.util.Collection;import java.util.HashMap;@@ -54,8 +54,6 @@ public class RuleEngine {private static final Logger LOG = Logger.getLogger(RuleEngine.class.getName());- final protected Deployment deployment;-private KieBase kb;private KieSession knowledgeSession;private Map<Integer, FactHandle> stateSources = new HashMap<>();@@ -67,11 +65,8 @@ public class RuleEngine {private RulePersistence rulePersistence;private RuleUtil ruleUtil;- public RuleEngine(Deployment deployment) {- this.deployment = deployment;- }+ public void start(AgentContext agentContext) {- public void start() {KieServices kieServices = KieServices.Factory.get();KieModuleModel kieModuleModel = kieServices.newKieModuleModel();@@ -85,7 +80,7 @@ public class RuleEngine {KieFileSystem kfs = kieServices.newKieFileSystem();kfs.writeKModuleXML(kieModuleModel.toXML());- deployment.getRulesProvider().getResources(kieServices).forEach(resource ->+ agentContext.getDeployment().getRulesProvider().getResources(kieServices).forEach(resource ->addResource(resource, kieServices, kfs));@@ -95,7 +90,7 @@ public class RuleEngine {KieSessionConfiguration kieSessionConfiguration = kieServices.newKieSessionConfiguration();// Use this option to ensure timer rules are fired even in passive mode (triggered by fireAllRules.- // This ensures compatibility with the behaviour of previous controller using drools 5.1+ // This ensures compatibility with the behaviour of previously used Drools 5.1kieSessionConfiguration.setOption(TimedRuleExectionOption.YES);knowledgeSession = kb.newKieSession(kieSessionConfiguration, null);@@ -105,7 +100,7 @@ public class RuleEngine {rulePersistence = new RulePersistence();ruleUtil = new RuleUtil();- setGlobal("commands", deployment.getCommands());+ setGlobal("commands", agentContext.getDeployment().getCommands());setGlobal("switches", switchFacade);setGlobal("ranges", rangeFacade);setGlobal("levels", levelFacade);diff --git a/controller/src/main/java/org/openremote/controller/rules/RuleExecutionLogger.java b/agent/src/main/java/org/openremote/agent/rules/RuleExecutionLogger.javasimilarity index 97%rename from controller/src/main/java/org/openremote/controller/rules/RuleExecutionLogger.javarename to agent/src/main/java/org/openremote/agent/rules/RuleExecutionLogger.javaindex 0fadb071c..9cca841e1 100644--- a/controller/src/main/java/org/openremote/controller/rules/RuleExecutionLogger.java+++ b/agent/src/main/java/org/openremote/agent/rules/RuleExecutionLogger.java@@ -1,11 +1,11 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;import org.kie.api.definition.rule.Rule;import org.kie.api.event.rule.BeforeMatchFiredEvent;import org.kie.api.event.rule.DefaultAgendaEventListener;import org.kie.api.runtime.rule.Match;-import org.openremote.controller.sensor.SensorState;-import org.openremote.controller.sensor.Sensor;+import org.openremote.agent.sensor.SensorState;+import org.openremote.agent.sensor.Sensor;import java.util.List;import java.util.Map;diff --git a/controller/src/main/java/org/openremote/controller/rules/RulePersistence.java b/agent/src/main/java/org/openremote/agent/rules/RulePersistence.javasimilarity index 95%rename from controller/src/main/java/org/openremote/controller/rules/RulePersistence.javarename to agent/src/main/java/org/openremote/agent/rules/RulePersistence.javaindex 88c4e0fdd..2bc5ff4ff 100644--- a/controller/src/main/java/org/openremote/controller/rules/RulePersistence.java+++ b/agent/src/main/java/org/openremote/agent/rules/RulePersistence.java@@ -1,4 +1,4 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;import java.util.HashMap;import java.util.Map;diff --git a/controller/src/main/java/org/openremote/controller/rules/RuleUtil.java b/agent/src/main/java/org/openremote/agent/rules/RuleUtil.javasimilarity index 98%rename from controller/src/main/java/org/openremote/controller/rules/RuleUtil.javarename to agent/src/main/java/org/openremote/agent/rules/RuleUtil.javaindex 33195d97e..cba49f044 100644--- a/controller/src/main/java/org/openremote/controller/rules/RuleUtil.java+++ b/agent/src/main/java/org/openremote/agent/rules/RuleUtil.java@@ -1,4 +1,4 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;import java.text.ParseException;import java.text.SimpleDateFormat;diff --git a/controller/src/main/java/org/openremote/controller/rules/RulesProvider.java b/agent/src/main/java/org/openremote/agent/rules/RulesProvider.javasimilarity index 82%rename from controller/src/main/java/org/openremote/controller/rules/RulesProvider.javarename to agent/src/main/java/org/openremote/agent/rules/RulesProvider.javaindex f3ca3c1d4..1587551d1 100644--- a/controller/src/main/java/org/openremote/controller/rules/RulesProvider.java+++ b/agent/src/main/java/org/openremote/agent/rules/RulesProvider.java@@ -1,4 +1,4 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;import org.kie.api.KieServices;import org.kie.api.io.Resource;diff --git a/controller/src/main/java/org/openremote/controller/rules/SensorFacade.java b/agent/src/main/java/org/openremote/agent/rules/SensorFacade.javasimilarity index 76%rename from controller/src/main/java/org/openremote/controller/rules/SensorFacade.javarename to agent/src/main/java/org/openremote/agent/rules/SensorFacade.javaindex 6ca305416..da5d78eab 100644--- a/controller/src/main/java/org/openremote/controller/rules/SensorFacade.java+++ b/agent/src/main/java/org/openremote/agent/rules/SensorFacade.java@@ -1,7 +1,7 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;-import org.openremote.controller.sensor.SensorState;-import org.openremote.controller.sensor.SensorStateUpdate;+import org.openremote.agent.sensor.SensorState;+import org.openremote.agent.sensor.SensorStateUpdate;import java.util.logging.Logger;@@ -22,7 +22,7 @@ public abstract class SensorFacade<T> {sensorStateUpdate.terminate();LOG.fine("Terminated sensor state update, dispatching new update: " + newSensorState);Thread t = new Thread(- () -> sensorStateUpdate.getControllerContext().update(newSensorState)+ () -> sensorStateUpdate.getAgentContext().update(newSensorState));t.start();}diff --git a/controller/src/main/java/org/openremote/controller/rules/SingleValueSensorFacade.java b/agent/src/main/java/org/openremote/agent/rules/SingleValueSensorFacade.javasimilarity index 72%rename from controller/src/main/java/org/openremote/controller/rules/SingleValueSensorFacade.javarename to agent/src/main/java/org/openremote/agent/rules/SingleValueSensorFacade.javaindex 6f0b6b30b..edbb565dd 100644--- a/controller/src/main/java/org/openremote/controller/rules/SingleValueSensorFacade.java+++ b/agent/src/main/java/org/openremote/agent/rules/SingleValueSensorFacade.java@@ -1,19 +1,20 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;-import org.openremote.controller.sensor.SensorState;-import org.openremote.controller.sensor.Sensor;+import org.openremote.agent.sensor.SensorState;+import org.openremote.agent.sensor.Sensor;public abstract class SingleValueSensorFacade<T, U extends SensorState> extends SensorFacade<T> {@Overridepublic T name(String sensorName) throws Exception {- SensorState sensorState = sensorStateUpdate.getControllerContext().queryState(sensorName);+ SensorState sensorState = sensorStateUpdate.getAgentContext().queryState(sensorName);if (sensorState instanceof Sensor.UnknownState) {sensorState = createDefaultState(sensorState.getSensorID(), sensorState.getSensorName());}try {+ //noinspection uncheckedreturn createAdapter((U) sensorState);} catch (ClassCastException ex) {throw new Exception("Sensor type mismatch: " + sensorState, ex);diff --git a/controller/src/main/java/org/openremote/controller/rules/SwitchFacade.java b/agent/src/main/java/org/openremote/agent/rules/SwitchFacade.javasimilarity index 85%rename from controller/src/main/java/org/openremote/controller/rules/SwitchFacade.javarename to agent/src/main/java/org/openremote/agent/rules/SwitchFacade.javaindex cabe7c81e..961386cb7 100644--- a/controller/src/main/java/org/openremote/controller/rules/SwitchFacade.java+++ b/agent/src/main/java/org/openremote/agent/rules/SwitchFacade.java@@ -1,14 +1,14 @@-package org.openremote.controller.rules;+package org.openremote.agent.rules;-import org.openremote.controller.sensor.SensorState;-import org.openremote.controller.sensor.Sensor;-import org.openremote.controller.sensor.SwitchSensorState;+import org.openremote.agent.sensor.SensorState;+import org.openremote.agent.sensor.Sensor;+import org.openremote.agent.sensor.SwitchSensorState;public class SwitchFacade extends SensorFacade<SwitchFacade.SwitchAdapter> {@Overridepublic SwitchAdapter name(String sensorName) throws Exception {- SensorState evt = sensorStateUpdate.getControllerContext().queryState(sensorName);+ SensorState evt = sensorStateUpdate.getAgentContext().queryState(sensorName);if (evt instanceof Sensor.UnknownState) {evt = new SwitchSensorState(diff --git a/controller/src/main/java/org/openremote/controller/sensor/CustomSensor.java b/agent/src/main/java/org/openremote/agent/sensor/CustomSensor.javasimilarity index 94%rename from controller/src/main/java/org/openremote/controller/sensor/CustomSensor.javarename to agent/src/main/java/org/openremote/agent/sensor/CustomSensor.javaindex 69cbc73cb..2c957b7b2 100644--- a/controller/src/main/java/org/openremote/controller/sensor/CustomSensor.java+++ b/agent/src/main/java/org/openremote/agent/sensor/CustomSensor.java@@ -1,9 +1,9 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;-import org.openremote.controller.command.SensorUpdateCommand;-import org.openremote.controller.command.PullCommand;-import org.openremote.controller.command.PushCommand;-import org.openremote.controller.deploy.SensorDefinition;+import org.openremote.agent.command.PullCommand;+import org.openremote.agent.command.PushCommand;+import org.openremote.agent.command.SensorUpdateCommand;+import org.openremote.agent.deploy.SensorDefinition;import java.util.HashMap;import java.util.Map;@@ -54,7 +54,7 @@ public class CustomSensor extends Sensor {@Overridepublic SensorState process(String value) {if (!states.hasState(value)) {- if (isUnknownSensorValue(value)) {+ if (SensorState.isUnknownState(value)) {return new UnknownState(this);}@@ -169,12 +169,12 @@ public class CustomSensor extends Sensor {* Returns the mapped value of a state string.** @param state the state string which mapping is requested- * @return returns the translated value of a given state string or {@link #UNKNOWN_STATE_VALUE}+ * @return returns the translated value of a given state string or {@link SensorState#UNKNOWN_VALUE}*/public String getMapping(String state) {String mapping = states.get(state);if (mapping == null) {- return UNKNOWN_STATE_VALUE;+ return SensorState.UNKNOWN_VALUE;}return mapping;}diff --git a/controller/src/main/java/org/openremote/controller/sensor/CustomSensorState.java b/agent/src/main/java/org/openremote/agent/sensor/CustomSensorState.javasimilarity index 97%rename from controller/src/main/java/org/openremote/controller/sensor/CustomSensorState.javarename to agent/src/main/java/org/openremote/agent/sensor/CustomSensorState.javaindex ad370282c..eff9b6e18 100644--- a/controller/src/main/java/org/openremote/controller/sensor/CustomSensorState.java+++ b/agent/src/main/java/org/openremote/agent/sensor/CustomSensorState.java@@ -1,4 +1,4 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;/*** Holds the original raw value and the result of processing {@link CustomSensor.DistinctStates}.diff --git a/controller/src/main/java/org/openremote/controller/sensor/LevelSensor.java b/agent/src/main/java/org/openremote/agent/sensor/LevelSensor.javasimilarity index 84%rename from controller/src/main/java/org/openremote/controller/sensor/LevelSensor.javarename to agent/src/main/java/org/openremote/agent/sensor/LevelSensor.javaindex 4dd712daa..45df83fef 100644--- a/controller/src/main/java/org/openremote/controller/sensor/LevelSensor.java+++ b/agent/src/main/java/org/openremote/agent/sensor/LevelSensor.java@@ -1,7 +1,7 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;-import org.openremote.controller.command.SensorUpdateCommand;-import org.openremote.controller.deploy.SensorDefinition;+import org.openremote.agent.command.SensorUpdateCommand;+import org.openremote.agent.deploy.SensorDefinition;import java.util.logging.Logger;@@ -22,7 +22,7 @@ public class LevelSensor extends RangeSensor {new Integer(value.trim()));} catch (NumberFormatException e) {- if (!isUnknownSensorValue(value)) {+ if (!SensorState.isUnknownState(value)) {LOG.warning("Level sensor '" + getSensorDefinition() + "' produced a non-integer value: " + value);}return new UnknownState(this);diff --git a/controller/src/main/java/org/openremote/controller/sensor/LevelSensorState.java b/agent/src/main/java/org/openremote/agent/sensor/LevelSensorState.javasimilarity index 97%rename from controller/src/main/java/org/openremote/controller/sensor/LevelSensorState.javarename to agent/src/main/java/org/openremote/agent/sensor/LevelSensorState.javaindex 22c757479..7ac812678 100644--- a/controller/src/main/java/org/openremote/controller/sensor/LevelSensorState.java+++ b/agent/src/main/java/org/openremote/agent/sensor/LevelSensorState.java@@ -1,4 +1,4 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;import java.util.logging.Logger;diff --git a/controller/src/main/java/org/openremote/controller/sensor/RangeSensor.java b/agent/src/main/java/org/openremote/agent/sensor/RangeSensor.javasimilarity index 88%rename from controller/src/main/java/org/openremote/controller/sensor/RangeSensor.javarename to agent/src/main/java/org/openremote/agent/sensor/RangeSensor.javaindex c3ec73e84..a9543c663 100644--- a/controller/src/main/java/org/openremote/controller/sensor/RangeSensor.java+++ b/agent/src/main/java/org/openremote/agent/sensor/RangeSensor.java@@ -1,7 +1,7 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;-import org.openremote.controller.command.SensorUpdateCommand;-import org.openremote.controller.deploy.SensorDefinition;+import org.openremote.agent.command.SensorUpdateCommand;+import org.openremote.agent.deploy.SensorDefinition;import java.util.logging.Logger;@@ -39,7 +39,7 @@ public class RangeSensor extends Sensor {getMaxValue());} catch (NumberFormatException exception) {- if (!isUnknownSensorValue(value)) {+ if (!SensorState.isUnknownState(value)) {LOG.warning("Range sensor '" + getSensorDefinition() + "' produced a non-integer value: " + value);}return new UnknownState(this);diff --git a/controller/src/main/java/org/openremote/controller/sensor/RangeSensorState.java b/agent/src/main/java/org/openremote/agent/sensor/RangeSensorState.javasimilarity index 97%rename from controller/src/main/java/org/openremote/controller/sensor/RangeSensorState.javarename to agent/src/main/java/org/openremote/agent/sensor/RangeSensorState.javaindex 5a5560216..8c1e752e8 100644--- a/controller/src/main/java/org/openremote/controller/sensor/RangeSensorState.java+++ b/agent/src/main/java/org/openremote/agent/sensor/RangeSensorState.java@@ -1,4 +1,4 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;public class RangeSensorState extends SensorState<Integer> {diff --git a/controller/src/main/java/org/openremote/controller/sensor/Sensor.java b/agent/src/main/java/org/openremote/agent/sensor/Sensor.javasimilarity index 86%rename from controller/src/main/java/org/openremote/controller/sensor/Sensor.javarename to agent/src/main/java/org/openremote/agent/sensor/Sensor.javaindex aaf5dfcb1..b96ca4777 100644--- a/controller/src/main/java/org/openremote/controller/sensor/Sensor.java+++ b/agent/src/main/java/org/openremote/agent/sensor/Sensor.java@@ -1,10 +1,10 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;-import org.openremote.controller.command.SensorUpdateCommand;-import org.openremote.controller.command.PullCommand;-import org.openremote.controller.command.PushCommand;-import org.openremote.controller.context.ControllerContext;-import org.openremote.controller.deploy.SensorDefinition;+import org.openremote.agent.command.PullCommand;+import org.openremote.agent.command.PushCommand;+import org.openremote.agent.command.SensorUpdateCommand;+import org.openremote.agent.context.AgentContext;+import org.openremote.agent.deploy.SensorDefinition;import java.security.AccessController;import java.security.PrivilegedAction;@@ -14,7 +14,7 @@ import java.util.logging.Logger;/*** Sensors create {@link SensorState}s, which represent the data obtained from devices.* <p>- * A sensor is registered with a {@link ControllerContext}. State updates are obtained+ * A sensor is registered with a {@link AgentContext}. State updates are obtained* either through pulling/polling or listening to devices that actively push their state* changes.* <p>@@ -30,19 +30,9 @@ public abstract class Sensor {private static final Logger LOG = Logger.getLogger(Sensor.class.getName());- public static final String UNKNOWN_STATE_VALUE = "N/A";-- /**- * Helper method to allow subclasses to check if a given value matches the 'N/A' string that- * is used for uninitialized or error states in sensor implementations.- */- public static boolean isUnknownSensorValue(String value) {- return value.equals(UNKNOWN_STATE_VALUE);- }-final protected SensorDefinition sensorDefinition;final protected SensorUpdateCommand sensorUpdateCommand;- protected ControllerContext controllerContext;+ protected AgentContext agentContext;/*** This is a polling thread implementation for sensors that use {@link PullCommand}.@@ -65,8 +55,8 @@ public abstract class Sensor {return sensorUpdateCommand;}- public ControllerContext getControllerContext() {- return controllerContext;+ public AgentContext getAgentContext() {+ return agentContext;}/**@@ -81,9 +71,9 @@ public abstract class Sensor {* {@link PushCommand#start(Sensor)} method. For {@link PullCommand} implementations,* this will start a polling thread to invoke the {@link PullCommand#read(Sensor)} method.*/- public void start(ControllerContext controllerContext) {+ public void start(AgentContext agentContext) {LOG.info("Starting sensor: " + this);- this.controllerContext = controllerContext;+ this.agentContext = agentContext;if (isPushCommand()) {PushCommand pushCommand = (PushCommand) sensorUpdateCommand;try {@@ -107,7 +97,7 @@ public abstract class Sensor {*/public void stop() {LOG.info("Stopping sensor: " + this);- controllerContext = null;+ agentContext = null;if (isPushCommand()) {PushCommand pushCommand = (PushCommand) sensorUpdateCommand;try {@@ -122,24 +112,24 @@ public abstract class Sensor {}/**- * Callback for {@link PushCommand} implementations. Before updating the controller context, the+ * Callback for {@link PushCommand} implementations. Before updating the agent context, the* given value is first validated and/or transformed by concrete sensor implementation's* {@link Sensor#process} method.*/public void update(String state) {- if (controllerContext == null) {+ if (agentContext == null) {LOG.fine("Ignoring update, sensor is not running: " + getSensorDefinition());return;}SensorState evt = process(state);LOG.fine("Update on ID " + getSensorDefinition().getSensorID() + ", processed '" + state + "', created: " + evt);- controllerContext.update(evt);+ agentContext.update(evt);}/*** Callback to subclasses to apply their state validations and other processing* if necessary. This method is called both when a value is pulled and when a- * command pushes a new sensor value into {@link ControllerContext} state.+ * command pushes a new sensor value into {@link AgentContext} state.*/protected abstract SensorState process(String value);@@ -225,7 +215,7 @@ public abstract class Sensor {* this may yield an active request using the connecting transport to device unless the* command implementation caches certain values and returns them from memory.* <p>- * In case of errors, {@link #UNKNOWN_STATE_VALUE} is returned.+ * In case of errors, {@link SensorState#UNKNOWN_VALUE} is returned.* <p>* This default read() implementation does not validate the input from protocol pull commands* in any way (other than handling implementation errors that yield runtime exceptions).@@ -234,14 +224,14 @@ public abstract class Sensor {* adhere to its datatype.** @return sensor's value, according to its datatype and provided by commands or- * {@link #UNKNOWN_STATE_VALUE} if value cannot be found.+ * {@link SensorState#UNKNOWN_VALUE} if value cannot be found.*/private String read() {try {return pullCommand.read(Sensor.this);} catch (Throwable t) {LOG.log(Level.SEVERE, "Implementation error in pull command: " + sensorUpdateCommand, t);- return UNKNOWN_STATE_VALUE;+ return SensorState.UNKNOWN_VALUE;}}}@@ -251,7 +241,7 @@ public abstract class Sensor {* implementation (or in the underlying protocol implementation) or if the initial device* state has not been fetched yet.* <p>- * The value returned by this state is defined in {@link #UNKNOWN_STATE_VALUE}.+ * The value returned by this state is defined in {@link #UNKNOWN_VALUE}.*/public static class UnknownState extends SensorState<String> {@@ -276,7 +266,7 @@ public abstract class Sensor {@Overridepublic String serialize() {- return UNKNOWN_STATE_VALUE;+ return UNKNOWN_VALUE;}@Overridediff --git a/controller/src/main/java/org/openremote/controller/sensor/SensorState.java b/agent/src/main/java/org/openremote/agent/sensor/SensorState.javasimilarity index 75%rename from controller/src/main/java/org/openremote/controller/sensor/SensorState.javarename to agent/src/main/java/org/openremote/agent/sensor/SensorState.javaindex df0bc75e4..658c5a6ba 100644--- a/controller/src/main/java/org/openremote/controller/sensor/SensorState.java+++ b/agent/src/main/java/org/openremote/agent/sensor/SensorState.java@@ -1,4 +1,6 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;++import org.openremote.agent.context.AgentContext;/*** A state snapshot of a sensor, at a particular moment in time.@@ -7,6 +9,16 @@ package org.openremote.controller.sensor;*/public abstract class SensorState<T> {+ public static final String UNKNOWN_VALUE = "N/A";++ /**+ * Helper method to allow subclasses to check if a given value matches the 'N/A' string that+ * is used for uninitialized or error states in sensor implementations.+ */+ public static boolean isUnknownState(String value) {+ return value.equals(UNKNOWN_VALUE);+ }+final protected long timestamp = System.currentTimeMillis();final public int sensorID;final public String sensorName;@@ -36,7 +48,7 @@ public abstract class SensorState<T> {/*** This method implementation should return an appropriate string representation of the state value.- * This string will be returned by {@link org.openremote.controller.context.ControllerContext#queryValue}.+ * This string will be returned by {@link AgentContext#queryValue}.*/public abstract String serialize();diff --git a/controller/src/main/java/org/openremote/controller/sensor/SensorStateUpdate.java b/agent/src/main/java/org/openremote/agent/sensor/SensorStateUpdate.javasimilarity index 64%rename from controller/src/main/java/org/openremote/controller/sensor/SensorStateUpdate.javarename to agent/src/main/java/org/openremote/agent/sensor/SensorStateUpdate.javaindex 0281ec7fe..212c8a169 100644--- a/controller/src/main/java/org/openremote/controller/sensor/SensorStateUpdate.java+++ b/agent/src/main/java/org/openremote/agent/sensor/SensorStateUpdate.java@@ -1,27 +1,27 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;-import org.openremote.controller.context.ControllerContext;+import org.openremote.agent.context.AgentContext;import java.util.logging.Logger;/**- * Before the {@link ControllerContext} accepts a sensor state update, it+ * Before the {@link AgentContext} accepts a sensor state update, it* executes all rules with a fresh instance of {@link SensorStateUpdate}.* <p>* Rules can terminate the update of the context, effectively cancelling the* original sensor state update. This is the regular behavior when your rules- * write a sensor value through any {@link org.openremote.controller.rules.SensorFacade}.+ * write a sensor value through any {@link org.openremote.agent.rules.SensorFacade}.*/public class SensorStateUpdate {private static final Logger LOG = Logger.getLogger(SensorStateUpdate.class.getName());- private ControllerContext controllerContext;+ private AgentContext agentContext;private SensorState sensorState;private boolean terminated = false;- public SensorStateUpdate(ControllerContext controllerContext, SensorState evt) {- this.controllerContext = controllerContext;+ public SensorStateUpdate(AgentContext agentContext, SensorState evt) {+ this.agentContext = agentContext;this.sensorState = evt;}@@ -34,8 +34,8 @@ public class SensorStateUpdate {return terminated;}- public ControllerContext getControllerContext() {- return controllerContext;+ public AgentContext getAgentContext() {+ return agentContext;}public SensorState getSensorState() {diff --git a/controller/src/main/java/org/openremote/controller/sensor/SwitchSensor.java b/agent/src/main/java/org/openremote/agent/sensor/SwitchSensor.javasimilarity index 92%rename from controller/src/main/java/org/openremote/controller/sensor/SwitchSensor.javarename to agent/src/main/java/org/openremote/agent/sensor/SwitchSensor.javaindex 54c98b4a6..bbbad1466 100644--- a/controller/src/main/java/org/openremote/controller/sensor/SwitchSensor.java+++ b/agent/src/main/java/org/openremote/agent/sensor/SwitchSensor.java@@ -1,8 +1,8 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;import org.bouncycastle.util.Strings;-import org.openremote.controller.command.SensorUpdateCommand;-import org.openremote.controller.deploy.SensorDefinition;+import org.openremote.agent.command.SensorUpdateCommand;+import org.openremote.agent.deploy.SensorDefinition;import java.util.logging.Logger;@@ -56,7 +56,7 @@ public class SwitchSensor extends CustomSensor {SwitchSensorState.State.valueOf(Strings.toUpperCase(originalValue.trim())) // TODO WTF);} catch (IllegalArgumentException e) {- if (!isUnknownSensorValue(originalValue)) {+ if (!SensorState.isUnknownState(originalValue)) {LOG.warning("Switch sensor value must be 'on' or 'off', got '" + originalValue + "' in: " + getSensorDefinition());diff --git a/controller/src/main/java/org/openremote/controller/sensor/SwitchSensorState.java b/agent/src/main/java/org/openremote/agent/sensor/SwitchSensorState.javasimilarity index 97%rename from controller/src/main/java/org/openremote/controller/sensor/SwitchSensorState.javarename to agent/src/main/java/org/openremote/agent/sensor/SwitchSensorState.javaindex 37d3631b4..ff2038bf2 100644--- a/controller/src/main/java/org/openremote/controller/sensor/SwitchSensorState.java+++ b/agent/src/main/java/org/openremote/agent/sensor/SwitchSensorState.java@@ -1,4 +1,4 @@-package org.openremote.controller.sensor;+package org.openremote.agent.sensor;public class SwitchSensorState extends SensorState<String> {diff --git a/beehive/ccs/src/main/resources/logging.properties b/agent/src/main/resources/logging.propertiessimilarity index 100%rename from beehive/ccs/src/main/resources/logging.propertiesrename to agent/src/main/resources/logging.propertiesdiff --git a/agent/src/main/resources/org/openremote/agent/schemas/agent-3.xsd b/agent/src/main/resources/org/openremote/agent/schemas/agent-3.xsdnew file mode 100644index 000000000..2204ba035--- /dev/null+++ b/agent/src/main/resources/org/openremote/agent/schemas/agent-3.xsd@@ -0,0 +1,123 @@+<?xml version="1.0" encoding="UTF-8"?>+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"+ xmlns="http://www.openremote.org/schemas/agent/3"+ targetNamespace="http://www.openremote.org/schemas/agent/3">++ <xsd:element name="openremote">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:element ref="sensors"/>+ <xsd:element ref="commands"/>+ <xsd:element ref="config"/>+ </xsd:sequence>+ </xsd:complexType>+ <xsd:unique name="uniqueIdsAccrossWholeDocument">+ <xsd:selector xpath=".//*"/>+ <xsd:field xpath="@id"/>+ </xsd:unique>+ </xsd:element>++ <xsd:element name="sensors">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:element ref="sensor" minOccurs="0" maxOccurs="unbounded"/>+ </xsd:sequence>+ </xsd:complexType>+ </xsd:element>++ <xsd:element name="commands">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:element ref="command" minOccurs="0" maxOccurs="unbounded"/>+ </xsd:sequence>+ </xsd:complexType>+ </xsd:element>++ <xsd:simpleType name="idType">+ <xsd:restriction base="xsd:int">+ <xsd:minInclusive value="1"/>+ </xsd:restriction>+ </xsd:simpleType>++ <xsd:element name="sensor">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:group ref="sensorGroup" minOccurs="0" maxOccurs="unbounded"/>+ </xsd:sequence>+ <xsd:attribute name="id" type="idType" use="required"/>+ <xsd:attribute name="type" type="sensorType" use="required"/>+ <xsd:attribute name="name" type="xsd:string" use="required"/>+ </xsd:complexType>+ </xsd:element>++ <xsd:group name="sensorGroup">+ <xsd:choice>+ <xsd:element ref="include" minOccurs="0" maxOccurs="unbounded"/>+ <xsd:element ref="state" minOccurs="0" maxOccurs="unbounded"/>+ <xsd:element ref="min" minOccurs="0" maxOccurs="1"/>+ <xsd:element ref="max" minOccurs="0" maxOccurs="1"/>+ </xsd:choice>+ </xsd:group>++ <xsd:element name="min">+ <xsd:complexType>+ <xsd:attribute name="value" type="xsd:int" use="required"/>+ </xsd:complexType>+ </xsd:element>++ <xsd:element name="max">+ <xsd:complexType>+ <xsd:attribute name="value" type="xsd:int" use="required"/>+ </xsd:complexType>+ </xsd:element>++ <xsd:element name="state">+ <xsd:complexType>+ <xsd:attribute name="name" use="required"/>+ <xsd:attribute name="value" use="optional"/>+ </xsd:complexType>+ </xsd:element>++ <xsd:simpleType name="sensorType">+ <xsd:restriction base="xsd:string">+ <xsd:enumeration value="switch"/>+ <xsd:enumeration value="level"/>+ <xsd:enumeration value="range"/>+ <xsd:enumeration value="color"/>+ <xsd:enumeration value="custom"/>+ </xsd:restriction>+ </xsd:simpleType>++ <xsd:element name="command">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>+ </xsd:sequence>+ <xsd:attribute name="id" type="idType" use="required"/>+ <xsd:attribute name="protocol" type="xsd:string" use="required"/>+ </xsd:complexType>+ </xsd:element>++ <xsd:element name="include">+ <xsd:complexType>+ <xsd:attribute name="type" type="xsd:string"/>+ <xsd:attribute name="ref" type="idType"/>+ </xsd:complexType>+ </xsd:element>++ <xsd:element name="property">+ <xsd:complexType>+ <xsd:attribute name="name" type="xsd:string" use="required"/>+ <xsd:attribute name="value" type="xsd:string" use="required"/>+ </xsd:complexType>+ </xsd:element>++ <xsd:element name="config">+ <xsd:complexType>+ <xsd:sequence>+ <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>+ </xsd:sequence>+ </xsd:complexType>+ </xsd:element>++</xsd:schema>diff --git a/controller/src/test/groovy/org/openremote/test/rules/ClimateControlTest.groovy b/agent/src/test/groovy/org/openremote/test/rules/ClimateControlTest.groovysimilarity index 69%rename from controller/src/test/groovy/org/openremote/test/rules/ClimateControlTest.groovyrename to agent/src/test/groovy/org/openremote/test/rules/ClimateControlTest.groovyindex 32360f01d..fb01f7f42 100644--- a/controller/src/test/groovy/org/openremote/test/rules/ClimateControlTest.groovy+++ b/agent/src/test/groovy/org/openremote/test/rules/ClimateControlTest.groovy@@ -2,8 +2,8 @@ package org.openremote.test.rulesimport org.kie.api.KieServicesimport org.kie.api.io.Resource-import org.openremote.controller.ControllerService-import org.openremote.controller.rules.RulesProvider+import org.openremote.agent.AgentService+import org.openremote.agent.rules.RulesProviderimport org.openremote.test.ContainerTraitimport spock.lang.Specification@@ -13,9 +13,9 @@ class ClimateControlTest extends Specification implements ContainerTrait {def "Climate control basic test"() {- given: "a controller deployment with commands and sensors"- def controllerDeploymentXml = getClass().getResourceAsStream(- "/org/openremote/test/rules/climatecontrol/controller.xml"+ given: "a deployment with commands and sensors"+ def deploymentXml = getClass().getResourceAsStream(+ "/org/openremote/test/rules/climatecontrol/agent.xml")and: "some rules"@@ -30,14 +30,14 @@ class ClimateControlTest extends Specification implements ContainerTrait {}}- and: "the started controller server"+ and: "the started server"def testCommandBuilder = new TestCommandBuilder();- def controllerService = new ControllerService(- controllerDeploymentXml,+ def agentService = new AgentService(+ deploymentXml,testCommandBuilder,rulesProvider)- def services = Stream.of(controllerService)+ def services = Stream.of(agentService)def serverPort = findEphemeralPort()def container = startContainer(defaultConfig(serverPort), services)diff --git a/controller/src/test/groovy/org/openremote/test/rules/MixedWithErrorsTest.groovy b/agent/src/test/groovy/org/openremote/test/rules/MixedWithErrorsTest.groovysimilarity index 74%rename from controller/src/test/groovy/org/openremote/test/rules/MixedWithErrorsTest.groovyrename to agent/src/test/groovy/org/openremote/test/rules/MixedWithErrorsTest.groovyindex 43bd58dac..25037b896 100644--- a/controller/src/test/groovy/org/openremote/test/rules/MixedWithErrorsTest.groovy+++ b/agent/src/test/groovy/org/openremote/test/rules/MixedWithErrorsTest.groovy@@ -2,8 +2,8 @@ package org.openremote.test.rulesimport org.kie.api.KieServicesimport org.kie.api.io.Resource-import org.openremote.controller.ControllerService-import org.openremote.controller.rules.RulesProvider+import org.openremote.agent.AgentService+import org.openremote.agent.rules.RulesProviderimport org.openremote.test.ContainerTraitimport spock.lang.Specification@@ -18,9 +18,9 @@ class MixedWithErrorsTest extends Specification implements ContainerTrait {def "Execute good rules - ignore broken rules"() {- given: "a controller deployment with commands and sensors"- def controllerDeploymentXml = getClass().getResourceAsStream(- "/org/openremote/test/rules/mixed-with-errors/controller.xml"+ given: "a deployment with commands and sensors"+ def deploymentXml = getClass().getResourceAsStream(+ "/org/openremote/test/rules/mixed-with-errors/agent.xml")and: "some rules"@@ -44,14 +44,14 @@ class MixedWithErrorsTest extends Specification implements ContainerTrait {}}- and: "the started controller server"+ and: "the started server"def testCommandBuilder = new TestCommandBuilder();- def controllerService = new ControllerService(- controllerDeploymentXml,+ def agentService = new AgentService(+ deploymentXml,testCommandBuilder,rulesProvider)- def services = Stream.of(controllerService)+ def services = Stream.of(agentService)def serverPort = findEphemeralPort()def container = startContainer(defaultConfig(serverPort), services)@@ -59,8 +59,8 @@ class MixedWithErrorsTest extends Specification implements ContainerTrait {Thread.sleep(500)then: "the state should match"- controllerService.getContext().queryValue(444) == "12345" // TODO This should be limited to max, which is 1000- controllerService.getContext().queryValue(555) == "55"+ agentService.getContext().queryValue(444) == "12345" // TODO This should be limited to max, which is 1000+ agentService.getContext().queryValue(555) == "55"cleanup: "the server should be stopped"stopContainer(container)diff --git a/controller/src/test/groovy/org/openremote/test/rules/RuleExecutionLoggerTest.groovy b/agent/src/test/groovy/org/openremote/test/rules/RuleExecutionLoggerTest.groovysimilarity index 97%rename from controller/src/test/groovy/org/openremote/test/rules/RuleExecutionLoggerTest.groovyrename to agent/src/test/groovy/org/openremote/test/rules/RuleExecutionLoggerTest.groovyindex d5aeb5886..f62d31fee 100644--- a/controller/src/test/groovy/org/openremote/test/rules/RuleExecutionLoggerTest.groovy+++ b/agent/src/test/groovy/org/openremote/test/rules/RuleExecutionLoggerTest.groovy@@ -7,8 +7,8 @@ import org.kie.api.builder.model.KieSessionModelimport org.kie.api.runtime.KieContainerimport org.kie.api.runtime.KieSessionimport org.kie.internal.io.ResourceFactory-import org.openremote.controller.sensor.CustomSensorState-import org.openremote.controller.rules.RuleExecutionLogger+import org.openremote.agent.sensor.CustomSensorState+import org.openremote.agent.rules.RuleExecutionLoggerimport org.openremote.test.ContainerTraitimport spock.lang.Sharedimport spock.lang.Specificationdiff --git a/controller/src/test/groovy/org/openremote/test/rules/SimpleRuleTest.groovy b/agent/src/test/groovy/org/openremote/test/rules/SimpleRuleTest.groovysimilarity index 81%rename from controller/src/test/groovy/org/openremote/test/rules/SimpleRuleTest.groovyrename to agent/src/test/groovy/org/openremote/test/rules/SimpleRuleTest.groovyindex 9dd3ea788..d752110b6 100644--- a/controller/src/test/groovy/org/openremote/test/rules/SimpleRuleTest.groovy+++ b/agent/src/test/groovy/org/openremote/test/rules/SimpleRuleTest.groovy@@ -2,8 +2,8 @@ package org.openremote.test.rulesimport org.kie.api.KieServicesimport org.kie.api.io.Resource-import org.openremote.controller.ControllerService-import org.openremote.controller.rules.RulesProvider+import org.openremote.agent.AgentService+import org.openremote.agent.rules.RulesProviderimport org.openremote.test.ContainerTraitimport spock.lang.Specification@@ -17,9 +17,9 @@ class SimpleRuleTest extends Specification implements ContainerTrait {def "Sensor event replaced by rule-triggered event"() {- given: "a controller deployment with commands and sensors"- def controllerDeploymentXml = getClass().getResourceAsStream(- "/org/openremote/test/rules/simple/controller.xml"+ given: "a deployment with commands and sensors"+ def deploymentXml = getClass().getResourceAsStream(+ "/org/openremote/test/rules/simple/agent.xml")and: "some rules"@@ -34,13 +34,13 @@ class SimpleRuleTest extends Specification implements ContainerTrait {}}- and: "the started controller server"- def controllerService = new ControllerService(- controllerDeploymentXml,+ and: "the started server"+ def agentService = new AgentService(+ deploymentXml,new TestCommandBuilder(),rulesProvider)- def services = Stream.of(controllerService)+ def services = Stream.of(agentService)def serverPort = findEphemeralPort()def container = startContainer(defaultConfig(serverPort), services)@@ -48,10 +48,10 @@ class SimpleRuleTest extends Specification implements ContainerTrait {Thread.sleep(500);then: "the rules should immediately switch the sensor off again"- controllerService.getContext().queryValue(123) == "off"+ agentService.getContext().queryValue(123) == "off"and: "the deployment model should work"- def deployment = controllerService.getContext().getDeployment()+ def deployment = agentService.getContext().getDeployment()deployment.getCommandDefinition(456).getCommandID() == 456deployment.getCommandDefinition(123123) == nulldeployment.getCommandDefinition("TestDevice", "TestCommand").getCommandID() == 456diff --git a/controller/src/test/groovy/org/openremote/test/rules/TestCommandBuilder.java b/agent/src/test/groovy/org/openremote/test/rules/TestCommandBuilder.javasimilarity index 86%rename from controller/src/test/groovy/org/openremote/test/rules/TestCommandBuilder.javarename to agent/src/test/groovy/org/openremote/test/rules/TestCommandBuilder.javaindex ef5459f89..b30694bac 100644--- a/controller/src/test/groovy/org/openremote/test/rules/TestCommandBuilder.java+++ b/agent/src/test/groovy/org/openremote/test/rules/TestCommandBuilder.java@@ -1,10 +1,10 @@package org.openremote.test.rules;-import org.openremote.controller.command.Command;-import org.openremote.controller.command.CommandBuilder;-import org.openremote.controller.command.ExecutableCommand;-import org.openremote.controller.command.PullCommand;-import org.openremote.controller.deploy.CommandDefinition;+import org.openremote.agent.command.Command;+import org.openremote.agent.command.CommandBuilder;+import org.openremote.agent.command.ExecutableCommand;+import org.openremote.agent.command.PullCommand;+import org.openremote.agent.deploy.CommandDefinition;import java.util.logging.Logger;diff --git a/controller/src/test/groovy/org/openremote/test/rules/VacationTest.groovy b/agent/src/test/groovy/org/openremote/test/rules/VacationTest.groovysimilarity index 73%rename from controller/src/test/groovy/org/openremote/test/rules/VacationTest.groovyrename to agent/src/test/groovy/org/openremote/test/rules/VacationTest.groovyindex ddc6186c2..2a7cbf983 100644--- a/controller/src/test/groovy/org/openremote/test/rules/VacationTest.groovy+++ b/agent/src/test/groovy/org/openremote/test/rules/VacationTest.groovy@@ -2,10 +2,10 @@ package org.openremote.test.rulesimport org.kie.api.KieServicesimport org.kie.api.io.Resource-import org.openremote.controller.ControllerService-import org.openremote.controller.rules.RulesProvider-import org.openremote.controller.sensor.CustomSensorState-import org.openremote.controller.sensor.SwitchSensorState+import org.openremote.agent.AgentService+import org.openremote.agent.rules.RulesProvider+import org.openremote.agent.sensor.CustomSensorState+import org.openremote.agent.sensor.SwitchSensorStateimport org.openremote.test.ContainerTraitimport spock.lang.Specification@@ -17,9 +17,9 @@ class VacationTest extends Specification implements ContainerTrait {def "Vacation example"() {- given: "a controller deployment with commands and sensors"- def controllerDeploymentXml = getClass().getResourceAsStream(- "/org/openremote/test/rules/vacation/controller.xml"+ given: "a deployment with commands and sensors"+ def deploymentXml = getClass().getResourceAsStream(+ "/org/openremote/test/rules/vacation/agent.xml")and: "some rules"@@ -34,20 +34,20 @@ class VacationTest extends Specification implements ContainerTrait {}}- and: "the started controller server"+ and: "the started server"def testCommandBuilder = new TestCommandBuilder();- def controllerService = new ControllerService(- controllerDeploymentXml,+ def agentService = new AgentService(+ deploymentXml,testCommandBuilder,rulesProvider)- def services = Stream.of(controllerService)+ def services = Stream.of(agentService)def serverPort = findEphemeralPort()def container = startContainer(defaultConfig(serverPort), services)when: "the time of day is day"def customStateEvent = new CustomSensorState(123, "time of day", "day");- controllerService.getContext().update(customStateEvent);+ agentService.getContext().update(customStateEvent);and: "we wait a bit for the rules to fire"Thread.sleep(100);@@ -57,7 +57,7 @@ class VacationTest extends Specification implements ContainerTrait {when: "the time of day is night"customStateEvent = new CustomSensorState(123, "time of day", "night");- controllerService.getContext().update(customStateEvent);+ agentService.getContext().update(customStateEvent);and: "we wait a bit for the rules to fire"Thread.sleep(100);@@ -67,7 +67,7 @@ class VacationTest extends Specification implements ContainerTrait {when: "we go on vacation"def switchEvent = new SwitchSensorState(789, "vacation start", "on", SwitchSensorState.State.ON);- controllerService.getContext().update(switchEvent);+ agentService.getContext().update(switchEvent);and: "we wait a bit for the rules to fire"Thread.sleep(100);@@ -77,7 +77,7 @@ class VacationTest extends Specification implements ContainerTrait {when: "the time of day is day"customStateEvent = new CustomSensorState(123, "time of day", "day");- controllerService.getContext().update(customStateEvent);+ agentService.getContext().update(customStateEvent);and: "we wait a bit for the rules to fire"Thread.sleep(100);@@ -86,7 +86,7 @@ class VacationTest extends Specification implements ContainerTrait {testCommandBuilder.lastExecutionArgument == "15"when: "we manually set the temperature"- controllerService.getContext().getCommands().execute("temp", 19)+ agentService.getContext().getCommands().execute("temp", 19)then: "the temperature change should be executed"testCommandBuilder.lastExecutionArgument == "19"diff --git a/controller/src/test/resources/org/openremote/test/rules/climatecontrol/ClimateControl.drl b/agent/src/test/resources/org/openremote/test/rules/climatecontrol/ClimateControl.drlsimilarity index 99%rename from controller/src/test/resources/org/openremote/test/rules/climatecontrol/ClimateControl.drlrename to agent/src/test/resources/org/openremote/test/rules/climatecontrol/ClimateControl.drlindex 956d06fc3..304b17a7e 100644--- a/controller/src/test/resources/org/openremote/test/rules/climatecontrol/ClimateControl.drl+++ b/agent/src/test/resources/org/openremote/test/rules/climatecontrol/ClimateControl.drl@@ -1,14 +1,14 @@-package org.openremote.controller.test.rules;+package org.openremote.agent.test.rules;import java.util.concurrent.*;import java.util.Date;import java.text.SimpleDateFormat;import java.io.*;-import org.openremote.controller.sensor.*;+import org.openremote.agent.sensor.*;-global org.openremote.controller.command.Commands commands;-global org.openremote.controller.rules.RulePersistence persistence;-global org.openremote.controller.rules.RuleUtil util;+global org.openremote.agent.command.Commands commands;+global org.openremote.agent.rules.RulePersistence persistence;+global org.openremote.agent.rules.RuleUtil util;global com.fasterxml.jackson.databind.ObjectMapper JSON;global java.util.logging.Logger LOG;diff --git a/controller/src/test/resources/org/openremote/test/rules/climatecontrol/controller.xml b/agent/src/test/resources/org/openremote/test/rules/climatecontrol/agent.xmlsimilarity index 68%rename from controller/src/test/resources/org/openremote/test/rules/climatecontrol/controller.xmlrename to agent/src/test/resources/org/openremote/test/rules/climatecontrol/agent.xmlindex ebf43b4dd..435e37303 100755--- a/controller/src/test/resources/org/openremote/test/rules/climatecontrol/controller.xml+++ b/agent/src/test/resources/org/openremote/test/rules/climatecontrol/agent.xml@@ -1,932 +1,5 @@<?xml version="1.0" encoding="UTF-8"?>-<openremote xmlns="http://www.openremote.org"- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"- xsi:schemaLocation="http://www.openremote.org http://www.openremote.org/schemas/controller.xsd">- <components>- <switch id="1545">- <on />- <off />- </switch>- <switch id="1486">- <on />- <off />- </switch>- <switch id="1469">- <on />- <off />- </switch>- <switch id="1548">- <on />- <off />- </switch>- <switch id="2399">- <on />- <off />- </switch>- <switch id="1802">- <on />- <off />- </switch>- <switch id="2376">- <on />- <off />- </switch>- <switch id="1803">- <on />- <off />- </switch>- <switch id="1353">- <on />- <off />- </switch>- <switch id="1656">- <on />- <off />- </switch>- <switch id="1774">- <on />- <off />- </switch>- <switch id="1463">- <on />- <off />- </switch>- <switch id="1632">- <on />- <off />- </switch>- <switch id="2294">- <on />- <off />- </switch>- <switch id="2348">- <on />- <off />- </switch>- <switch id="1462">- <on />- <off />- </switch>- <switch id="1721">- <on />- <off />- </switch>- <switch id="1717">- <on />- <off />- </switch>- <switch id="2316">- <on />- <off />- </switch>- <switch id="1624">- <on />- <off />- </switch>- <switch id="1571">- <on />- <off />- </switch>- <switch id="1718">- <on />- <off />- </switch>- <switch id="1794">- <on />- <off />- </switch>- <switch id="1741">- <on />- <off />- </switch>- <switch id="2291">- <on />- <off />- </switch>- <switch id="2490">- <on>- <include type="command" ref="2637" />- </on>- <off>- <include type="command" ref="2639" />- </off>- <include type="sensor" ref="358549" />- </switch>- <switch id="1546">- <on />- <off />- </switch>- <switch id="1403">- <on />- <off />- </switch>- <switch id="2315">- <on />- <off />- </switch>- <switch id="1435">- <on />- <off />- </switch>- <switch id="2503">- <on>- <include type="command" ref="2636" />- </on>- <off>- <include type="command" ref="2643" />- </off>- <include type="sensor" ref="358548" />- </switch>- <switch id="1454">- <on />- <off />- </switch>- <switch id="1352">- <on />- <off />- </switch>- <switch id="1633">- <on />- <off />- </switch>- <switch id="2288">- <on />- <off />- </switch>- <switch id="1639">- <on />- <off />- </switch>- <switch id="2375">- <on />- <off />- </switch>- <switch id="1354">- <on />- <off />- </switch>- <switch id="1775">- <on />- <off />- </switch>- <switch id="1402">- <on />- <off />- </switch>- <switch id="1551">- <on />- <off />- </switch>- <switch id="2290">- <on />- <off />- </switch>- <switch id="2382">- <on />- <off />- </switch>- <switch id="2314">- <on />- <off />- </switch>- <switch id="1572">- <on />- <off />- </switch>- <switch id="1547">- <on />- <off />- </switch>- <switch id="1358">- <on />- <off />- </switch>- <switch id="1716">- <on />- <off />- </switch>- <switch id="1573">- <on />- <off />- </switch>- <switch id="2289">- <on />- <off />- </switch>- <switch id="1715">- <on />- <off />- </switch>- <switch id="1355">- <on />- <off />- </switch>- <switch id="1401">- <on />- <off />- </switch>- <switch id="1743">- <on />- <off />- </switch>- <switch id="1605">- <on />- <off />- </switch>- <switch id="1434">- <on />- <off />- </switch>- <switch id="1809">- <on />- <off />- </switch>- <switch id="2347">- <on />- <off />- </switch>- <switch id="1604">- <on />- <off />- </switch>- <switch id="1826">- <on />- <off />- </switch>- <switch id="1742">- <on />- <off />- </switch>- <switch id="2367">- <on />- <off />- </switch>- <button id="2334" />- <button id="2517">- <include type="command" ref="2611" />- </button>- <button id="1766" />- <button id="1476" />- <button id="1708" />- <button id="1391" />- <button id="2495">- <include type="command" ref="2633" />- </button>- <button id="1782" />- <button id="2013" />- <button id="1592" />- <button id="1345" />- <button id="2498">- <include type="command" ref="2629" />- </button>- <button id="1447" />- <button id="1392" />- <button id="1471" />- <button id="2306" />- <button id="1477" />- <button id="1810" />- <button id="2068" />- <button id="1657" />- <button id="2000" />- <button id="2339" />- <button id="2521">- <include type="command" ref="2621" />- </button>- <button id="1646" />- <button id="2402" />- <button id="2303" />- <button id="2337" />- <button id="1704" />- <button id="2281" />- <button id="2338" />- <button id="2122" />- <button id="1537" />- <button id="2518">- <include type="command" ref="2614" />- </button>- <button id="1829" />- <button id="1783" />- <button id="1445" />- <button id="1658" />- <button id="2500" />- <button id="1785" />- <button id="1731" />- <button id="1614" />- <button id="1784" />- <button id="2280" />- <button id="2305" />- <button id="2360" />- <button id="1421" />- <button id="1487" />- <button id="2358" />- <button id="1732" />- <button id="1343" />- <button id="1538" />- <button id="1706" />- <button id="1564" />- <button id="2357" />- <button id="1390" />- <button id="1811" />- <button id="2054" />- <button id="1342" />- <button id="2282" />- <button id="1612" />- <button id="1565" />- <button id="1762" />- <button id="1393" />- <button id="1705" />- <button id="1816" />- <button id="1613" />- <button id="1615" />- <button id="1640" />- <button id="2409" />- <button id="1617" />- <button id="2422" />- <button id="1563" />- <button id="1344" />- <button id="1596" />- <button id="1641" />- <button id="2109" />- <button id="1828" />- <button id="1536" />- <button id="1827" />- <button id="2108" />- <button id="2384" />- <button id="2307" />- <button id="1490" />- <button id="2121" />- <button id="2277" />- <button id="1660" />- <button id="2515">- <include type="command" ref="2616" />- </button>- <button id="2356" />- <button id="1561" />- <button id="2336" />- <button id="2067" />- <button id="2389" />- <button id="2519">- <include type="command" ref="2617" />- </button>- <button id="2516">- <include type="command" ref="2619" />- </button>- <button id="2390" />- <button id="1786" />- <button id="1341" />- <button id="1443" />- <button id="1423" />- <button id="1442" />- <button id="1659" />- <button id="1787" />- <button id="1593" />- <button id="1534" />- <button id="1817" />- <button id="2278" />- <button id="1734" />- <button id="1707" />- <button id="2400" />- <button id="1763" />- <button id="1426" />- <button id="1765" />- <button id="1709" />- <button id="1444" />- <button id="1394" />- <button id="1446" />- <button id="2304" />- <button id="1346" />- <button id="2355" />- <button id="1764" />- <button id="2279" />- <button id="2522">- <include type="command" ref="2607" />- </button>- <button id="1470" />- <button id="2359" />- <button id="1735" />- <button id="2308" />- <button id="2335" />- <button id="1488" />- <button id="1647" />- <button id="2408" />- <button id="1539" />- <button id="1733" />- <button id="1595" />- <button id="1830" />- <button id="1560" />- <button id="2014" />- <button id="2403" />- <button id="2525" />- <button id="2055" />- <button id="2496">- <include type="command" ref="2634" />- </button>- <button id="1395" />- <button id="2497">- <include type="command" ref="2644" />- </button>- <button id="1591" />- <button id="2520">- <include type="command" ref="2627" />- </button>- <button id="1425" />- <button id="1730" />- <button id="2383" />- <button id="1761" />- <button id="2401" />- <button id="1535" />- <button id="1489" />- <button id="2421" />- <button id="1422" />- <label id="2057" />- <label id="2494" />- <label id="2441" />- <label id="1652" />- <label id="1428" />- <label id="2489" />- <label id="1460" />- <label id="1412" />- <label id="2285" />- <label id="1654" />- <label id="2345" />- <label id="2509" />- <label id="1398" />- <label id="2085" />- <label id="1714" />- <label id="2419" />- <label id="2369" />- <label id="1485" />- <label id="2140" />- <label id="2072" />- <label id="1740" />- <label id="1449" />- <label id="1767" />- <label id="2366" />- <label id="2058" />- <label id="2153" />- <label id="2056" />- <label id="2073" />- <label id="2119" />- <label id="1739" />- <label id="1351" />- <label id="2434" />- <label id="1459" />- <label id="1543" />- <label id="2035" />- <label id="1584" />- <label id="2433" />- <label id="2146" />- <label id="2293" />- <label id="1712" />- <label id="2089" />- <label id="2295" />- <label id="2373" />- <label id="2453" />- <label id="1578" />- <label id="2310" />- <label id="1414" />- <label id="2079" />- <label id="2410" />- <label id="1599" />- <label id="2116" />- <label id="2088" />- <label id="1566" />- <label id="1479" />- <label id="2454" />- <label id="1629" />- <label id="2100" />- <label id="2092" />- <label id="2143" />- <label id="1574" />- <label id="2512" />- <label id="2530">- <include type="sensor" ref="358541" />- </label>- <label id="2418" />- <label id="1772" />- <label id="1585" />- <label id="1416" />- <label id="1723" />- <label id="2342" />- <label id="1602" />- <label id="2128" />- <label id="2008" />- <label id="1450" />- <label id="2029" />- <label id="2429" />- <label id="1406" />- <label id="2514" />- <label id="1722" />- <label id="1429" />- <label id="1483" />- <label id="2511" />- <label id="1430" />- <label id="1555" />- <label id="1790" />- <label id="1567" />- <label id="2398" />- <label id="2533">- <include type="sensor" ref="358532" />- </label>- <label id="2436" />- <label id="1350" />- <label id="2346" />- <label id="2312" />- <label id="1579" />- <label id="2096" />- <label id="2502">- <include type="sensor" ref="358542" />- </label>- <label id="1399" />- <label id="2133" />- <label id="1569" />- <label id="2424" />- <label id="2510" />- <label id="1808" />- <label id="2391" />- <label id="2341" />- <label id="2060" />- <label id="1637" />- <label id="1771" />- <label id="1824" />- <label id="2526">- <include type="sensor" ref="358538" />- </label>- <label id="2313" />- <label id="2003" />- <label id="2487" />- <label id="2097" />- <label id="1770" />- <label id="1756" />- <label id="1407" />- <label id="1801" />- <label id="2423" />- <label id="2009" />- <label id="2491" />- <label id="2080" />- <label id="1461" />- <label id="2137" />- <label id="2323" />- <label id="2044" />- <label id="2040" />- <label id="2531" />- <label id="1468" />- <label id="2321" />- <label id="2152" />- <label id="1554" />- <label id="2425" />- <label id="2322" />- <label id="2328" />- <label id="1415" />- <label id="2125" />- <label id="2318" />- <label id="2059" />- <label id="2041" />- <label id="2078" />- <label id="2371" />- <label id="1805" />- <label id="1746" />- <label id="1348" />- <label id="2126" />- <label id="1755" />- <label id="2283" />- <label id="2136" />- <label id="1719" />- <label id="2370" />- <label id="2066" />- <label id="1478" />- <label id="2457" />- <label id="1628" />- <label id="1467" />- <label id="2118" />- <label id="1650" />- <label id="2445" />- <label id="1357" />- <label id="2098" />- <label id="1432" />- <label id="2117" />- <label id="2112" />- <label id="2132" />- <label id="2317" />- <label id="2016" />- <label id="2023" />- <label id="2129" />- <label id="1457">- <include type="sensor" ref="358500" />- </label>- <label id="1577" />- <label id="2426" />- <label id="1630" />- <label id="1754" />- <label id="2141" />- <label id="1362" />- <label id="2047" />- <label id="2438" />- <label id="2414" />- <label id="2075" />- <label id="2456" />- <label id="2142" />- <label id="2027" />- <label id="2440" />- <label id="2015" />- <label id="1621" />- <label id="1753" />- <label id="2395" />- <label id="2037" />- <label id="2529">- <include type="sensor" ref="358529" />- </label>- <label id="1360" />- <label id="1653" />- <label id="2365" />- <label id="2061" />- <label id="1791" />- <label id="2048" />- <label id="2114" />- <label id="2534" />- <label id="2149" />- <label id="2101" />- <label id="1580" />- <label id="2439" />- <label id="1408" />- <label id="2145" />- <label id="1453" />- <label id="2138" />- <label id="1598" />- <label id="2161" />- <label id="1797" />- <label id="2444" />- <label id="1433" />- <label id="1751" />- <label id="2394" />- <label id="1396" />- <label id="2127" />- <label id="2430" />- <label id="1349" />- <label id="1436" />- <label id="1738" />- <label id="2036" />- <label id="1597" />- <label id="2099" />- <label id="2325" />- <label id="1792" />- <label id="2455" />- <label id="2042" />- <label id="2065" />- <label id="2363" />- <label id="2415" />- <label id="2039" />- <label id="2488" />- <label id="2428" />- <label id="2124" />- <label id="1724" />- <label id="2094" />- <label id="1745" />- <label id="1458" />- <label id="1586" />- <label id="2091" />- <label id="1821" />- <label id="1800" />- <label id="1544" />- <label id="1737" />- <label id="2397" />- <label id="2287" />- <label id="1720" />- <label id="1710" />- <label id="1825" />- <label id="2396" />- <label id="1568" />- <label id="2022" />- <label id="2006" />- <label id="2095" />- <label id="1413" />- <label id="2032" />- <label id="2340" />- <label id="2309" />- <label id="1464" />- <label id="2034" />- <label id="1819" />- <label id="1540" />- <label id="1437">- <include type="sensor" ref="358496" />- </label>- <label id="1552" />- <label id="1410" />- <label id="2028" />- <label id="2329" />- <label id="1581" />- <label id="1553" />- <label id="2372" />- <label id="2030" />- <label id="2007" />- <label id="2493" />- <label id="2070" />- <label id="1796" />- <label id="2435" />- <label id="2420" />- <label id="2033" />- <label id="1626" />- <label id="1736" />- <label id="2103" />- <label id="2102" />- <label id="1725" />- <label id="2378" />- <label id="2113" />- <label id="2045" />- <label id="2437" />- <label id="2298" />- <label id="2296" />- <label id="2082" />- <label id="2344" />- <label id="1400" />- <label id="2086" />- <label id="2350" />- <label id="1631" />- <label id="2018" />- <label id="1622" />- <label id="1623" />- <label id="2416" />- <label id="2019" />- <label id="1748" />- <label id="2062" />- <label id="1606" />- <label id="1431" />- <label id="1769" />- <label id="1749" />- <label id="2450" />- <label id="1636" />- <label id="1776" />- <label id="2324" />- <label id="2135" />- <label id="2524" />- <label id="1397" />- <label id="1620" />- <label id="2049" />- <label id="1655" />- <label id="1482" />- <label id="2020" />- <label id="1806" />- <label id="2131" />- <label id="1452" />- <label id="2046" />- <label id="2123" />- <label id="1356" />- <label id="2156" />- <label id="2417" />- <label id="2024" />- <label id="1638" />- <label id="1550" />- <label id="2069" />- <label id="2452" />- <label id="2492" />- <label id="1619" />- <label id="1576" />- <label id="1405" />- <label id="1427" />- <label id="2413" />- <label id="2111" />- <label id="2392" />- <label id="2412" />- <label id="2379" />- <label id="2081" />- <label id="2501">- <include type="sensor" ref="358545" />- </label>- <label id="2380" />- <label id="2148" />- <label id="1361" />- <label id="2026" />- <label id="2364" />- <label id="1807" />- <label id="2005" />- <label id="2084" />- <label id="2031" />- <label id="2527">- <include type="sensor" ref="358534" />- </label>- <label id="1480" />- <label id="1600" />- <label id="2074" />- <label id="1634" />- <label id="2284" />- <label id="2349" />- <label id="2377" />- <label id="1793" />- <label id="1635" />- <label id="2523" />- <label id="1627" />- <label id="2528">- <include type="sensor" ref="358531" />- </label>- <label id="1409" />- <label id="1484" />- <label id="2431" />- <label id="2090" />- <label id="1823" />- <label id="2381" />- <label id="1788" />- <label id="2374" />- <label id="2139" />- <label id="1798" />- <label id="2343" />- <label id="1481" />- <label id="2021" />- <label id="2446" />- <label id="1795" />- <label id="2134" />- <label id="1575" />- <label id="1820" />- <label id="2362" />- <label id="2011" />- <label id="1648" />- <label id="1789" />- <label id="2292" />- <label id="1818" />- <label id="1804" />- <label id="1465" />- <label id="2411" />- <label id="2025" />- <label id="1822" />- <label id="2012" />- <label id="1747" />- <label id="2002" />- <label id="2499" />- <label id="1744" />- <label id="2155" />- <label id="2010" />- <label id="1618" />- <label id="2286" />- <label id="2368" />- <label id="1541" />- <label id="2038" />- <label id="1455" />- <label id="2115" />- <label id="2147" />- <label id="2064" />- <label id="1542" />- <label id="2320" />- <label id="2087" />- <label id="2326" />- <label id="2443" />- <label id="2448" />- <label id="2513" />- <label id="1713" />- <label id="1411" />- <label id="2393" />- <label id="1404" />- <label id="1768" />- <label id="1651" />- <label id="2327" />- <label id="2120" />- <label id="2071" />- <label id="1649" />- <label id="1456" />- <label id="1773" />- <label id="1752" />- <label id="2427" />- <label id="2043" />- <label id="1582" />- <label id="1750" />- <label id="2150" />- <label id="1625" />- <label id="2319" />- <label id="1601" />- <label id="2442" />- <label id="1448" />- <label id="2151" />- <label id="2451" />- <label id="2361" />- <label id="1607" />- <label id="2157" />- <label id="1451" />- <label id="2004" />- <label id="2311" />- <label id="1603" />- <label id="2532" />- <label id="2083" />- <label id="2093" />- <label id="2504" />- <label id="2432" />- <label id="1549" />- <label id="2449" />- <label id="1711" />- <label id="2130" />- <label id="2110" />- <label id="1466" />- <label id="1777" />- <label id="2447" />- <label id="2297" />- <label id="2063" />- <label id="2077" />- <label id="1359" />- <label id="2017" />- <label id="1347" />- <label id="1570" />- <label id="1799" />- <label id="2154" />- <label id="1583" />- <label id="2144" />- </components>+<openremote xmlns="http://www.openremote.org/schemas/agent/3"><sensors><sensor id="358442" name="VETD.Sun" type="custom"><include type="command" ref="2549" />@@ -1983,46 +1056,6 @@</command></commands><config>- <property name="multicast.address" value="224.0.1.100" />- <property name="zwave.pad.host" value="localhost" />- <property name="resource.upload.enable" value="true" />- <property name="protocol.velbus.classname" value="org.openremote.controller.protocol.velbus.VelbusCommandBuilder" />- <property name="copy.lircd.conf.on" value="true" />- <property name="lagarto_network.broadcast" value="tcp://127.0.0.1:5001" />- <property name="domintell.address" value="192.168.1.1" />- <property name="enocean.commLayer" value="RXTX" />- <property name="zwave.pad.port" value="7876" />- <property name="zwave.commLayer" value="RXTX" />- <property name="webapp.port" value="8688" />- <property name="protocol.zwave.classname" value="org.openremote.controller.protocol.zwave.ZWaveCommandBuilder" />- <property name="controller.groupname" value="floor20" />- <property name="lircd.conf.path" value="/etc/lircd.conf" />- <property name="multicast.port" value="3333" />- <property name="protocol.vera.classname" value="org.openremote.controller.protocol.vera.VeraCommandBuilder" />- <property name="velbus.server.ports" value="6000" />- <property name="Macro.IR.Execution.Delay" value="500" />- <property name="enocean.comPort" value="/dev/ttyUSB0" />- <property name="controller.roundrobin.tcpserver.port" value="20000" />- <property name="amx_ni.port" value="50000" />- <property name="zwave.comPort" value="/dev/ttyUSB0" />- <property name="lutron_homeworks.password" value="openremote" />- <property name="lutron_homeworks.address" value="192.168.1.1" />- <property name="irsend.path" value="/usr/local/bin/irsend" />- <property name="controller.applicationname" value="controller" />- <property name="protocol.samsungTV.classname" value="org.openremote.controller.protocol.samsungtv.SamsungTVRemoteCommandBuilder" />- <property name="enocean.serialProtocol" value="ESP3" />- <property name="samsungTV.address" value="" />- <property name="controller.roundrobin.multicast.port" value="10000" />- <property name="domintell.port" value="17481" />- <property name="amx_ni.address" value="192.168.1.1" />- <property name="velbus.server.hostnames" value="127.0.0.1" />- <property name="lutron_homeworks.username" value="openremote" />- <property name="controller.roundrobin.multicast.address" value="224.0.1.200" />- <property name="lutron_homeworks.port" value="23" />- <property name="controller.groupmember.autodetect.on" value="true" />- <property name="marantz_avr.address" value="192.168.1.1" />- <property name="vera.address" value="" />- <property name="protocol.alarm.classname" value="org.openremote.controller.protocol.alarm.AlarmCommandBuilder" /></config></openremote>diff --git a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/BrokenDTable.csv b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/BrokenDTable.csvsimilarity index 83%rename from controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/BrokenDTable.csvrename to agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/BrokenDTable.csvindex abd748fe8..a8eeec069 100644--- a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/BrokenDTable.csv+++ b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/BrokenDTable.csv@@ -1,7 +1,7 @@, ,Ruleset, Cannot find the ruleset on this one-, ,Import, org.openremote.controller.sensors.SensorState+, ,Import, org.openremote.agent.sensors.SensorState,RuleTable,Event Moddiff --git a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/DTableTest.csv b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/DTableTest.csvsimilarity index 73%rename from controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/DTableTest.csvrename to agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/DTableTest.csvindex 31b5776d6..1ff1ce14a 100644--- a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/DTableTest.csv+++ b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/DTableTest.csv@@ -1,8 +1,8 @@Ruleset, My CSV Rules Examples-Import, org.openremote.controller.sensor.SensorState-Variables, org.openremote.controller.rules.RangeFacade ranges+Import, org.openremote.agent.sensor.SensorState+Variables, org.openremote.agent.rules.RangeFacade ranges,RuleTable,Modify Range Values in Decision Tablediff --git a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/EventMod.drl b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/EventMod.drlsimilarity index 63%rename from controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/EventMod.drlrename to agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/EventMod.drlindex 3a9c171ae..03d42fb9b 100644--- a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/EventMod.drl+++ b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/EventMod.drl@@ -1,8 +1,8 @@package org.openremote.test.rules;-import org.openremote.controller.sensor.*;+import org.openremote.agent.sensor.*;-global org.openremote.controller.rules.RangeFacade ranges;+global org.openremote.agent.rules.RangeFacade ranges;rule "Modify Level State Above Max"whendiff --git a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/IncorrectRule.drl b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/IncorrectRule.drlsimilarity index 81%rename from controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/IncorrectRule.drlrename to agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/IncorrectRule.drlindex ff96f2c2e..adf7f234a 100644--- a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/IncorrectRule.drl+++ b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/IncorrectRule.drl@@ -1,6 +1,6 @@package org.openremote.test.rules;-import org.openremote.controller.sensor.*;+import org.openremote.agent.sensor.*;rule "Incorrect Event Modification Attempt"whendiff --git a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/controller.xml b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/agent.xmlsimilarity index 77%rename from controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/controller.xmlrename to agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/agent.xmlindex 2648f958d..e4c679c83 100755--- a/controller/src/test/resources/org/openremote/test/rules/mixed-with-errors/controller.xml+++ b/agent/src/test/resources/org/openremote/test/rules/mixed-with-errors/agent.xml@@ -1,10 +1,5 @@<?xml version="1.0" encoding="UTF-8"?>-<openremote xmlns="http://www.openremote.org"- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"- xsi:schemaLocation="http://www.openremote.org http://www.openremote.org/schemas/controller.xsd">-- <components>- </components>+<openremote xmlns="http://www.openremote.org/schemas/agent/3"><sensors><sensor id="444" type="range" name="TestSensor444">diff --git a/controller/src/test/resources/org/openremote/test/rules/simple/EventMod.drl b/agent/src/test/resources/org/openremote/test/rules/simple/EventMod.drlsimilarity index 62%rename from controller/src/test/resources/org/openremote/test/rules/simple/EventMod.drlrename to agent/src/test/resources/org/openremote/test/rules/simple/EventMod.drlindex 629534317..d0c077705 100644--- a/controller/src/test/resources/org/openremote/test/rules/simple/EventMod.drl+++ b/agent/src/test/resources/org/openremote/test/rules/simple/EventMod.drl@@ -1,8 +1,8 @@package org.openremote.test.rules;-import org.openremote.controller.sensor.*;+import org.openremote.agent.sensor.*;-global org.openremote.controller.rules.SwitchFacade switches;+global org.openremote.agent.rules.SwitchFacade switches;rule "Modify Switch State"whendiff --git a/controller/src/test/resources/org/openremote/test/rules/simple/TestRuleFiring.drl b/agent/src/test/resources/org/openremote/test/rules/simple/TestRuleFiring.drlsimilarity index 65%rename from controller/src/test/resources/org/openremote/test/rules/simple/TestRuleFiring.drlrename to agent/src/test/resources/org/openremote/test/rules/simple/TestRuleFiring.drlindex a40b3995b..428fc04f8 100644--- a/controller/src/test/resources/org/openremote/test/rules/simple/TestRuleFiring.drl+++ b/agent/src/test/resources/org/openremote/test/rules/simple/TestRuleFiring.drl@@ -1,7 +1,7 @@package org.openremote.test.rules;-import org.openremote.controller.sensor.*;-import org.openremote.controller.rules.*+import org.openremote.agent.sensor.*;+import org.openremote.agent.rules.*rule "TestRuleFiring"whendiff --git a/controller/src/test/resources/org/openremote/test/rules/simple/controller.xml b/agent/src/test/resources/org/openremote/test/rules/simple/agent.xmlsimilarity index 76%rename from controller/src/test/resources/org/openremote/test/rules/simple/controller.xmlrename to agent/src/test/resources/org/openremote/test/rules/simple/agent.xmlindex 9ad372224..1f720d204 100755--- a/controller/src/test/resources/org/openremote/test/rules/simple/controller.xml+++ b/agent/src/test/resources/org/openremote/test/rules/simple/agent.xml@@ -1,10 +1,5 @@<?xml version="1.0" encoding="UTF-8"?>-<openremote xmlns="http://www.openremote.org"- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"- xsi:schemaLocation="http://www.openremote.org http://www.openremote.org/schemas/controller.xsd">-- <components>- </components>+<openremote xmlns="http://www.openremote.org/schemas/agent/3"><sensors><sensor id="123" type="switch" name="TestSensor">@@ -20,6 +15,7 @@<property name="what-are-we-testing" value="a-test-switch"/><property name="urn:openremote:device-command:device-name" value="TestDevice"/><property name="urn:openremote:device-command:device-id" value="111"/>+ <property name="urn:ooma:special" value="WindowSensorCommand"/></command></commands>diff --git a/controller/src/test/resources/org/openremote/test/rules/vacation/Vacation.drl b/agent/src/test/resources/org/openremote/test/rules/vacation/Vacation.drlsimilarity index 93%rename from controller/src/test/resources/org/openremote/test/rules/vacation/Vacation.drlrename to agent/src/test/resources/org/openremote/test/rules/vacation/Vacation.drlindex d5646a571..285a030ec 100644--- a/controller/src/test/resources/org/openremote/test/rules/vacation/Vacation.drl+++ b/agent/src/test/resources/org/openremote/test/rules/vacation/Vacation.drl@@ -1,8 +1,8 @@package org.openremote.test.rules;-global org.openremote.controller.command.Commands commands;+global org.openremote.agent.command.Commands commands;-import org.openremote.controller.sensor.*;+import org.openremote.agent.sensor.*;/** This example demonstrates creation of new facts from within the rules, in thisdiff --git a/controller/src/test/resources/org/openremote/test/rules/vacation/controller.xml b/agent/src/test/resources/org/openremote/test/rules/vacation/agent.xmlsimilarity index 66%rename from controller/src/test/resources/org/openremote/test/rules/vacation/controller.xmlrename to agent/src/test/resources/org/openremote/test/rules/vacation/agent.xmlindex 7e6e152a4..8eb67801d 100755--- a/controller/src/test/resources/org/openremote/test/rules/vacation/controller.xml+++ b/agent/src/test/resources/org/openremote/test/rules/vacation/agent.xml@@ -1,10 +1,5 @@<?xml version="1.0" encoding="UTF-8"?>-<openremote xmlns="http://www.openremote.org"- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"- xsi:schemaLocation="http://www.openremote.org http://www.openremote.org/schemas/controller.xsd">-- <components>- </components>+<openremote xmlns="http://www.openremote.org/schemas/agent/3"><sensors></sensors>diff --git a/base/README.md b/base/README.mddeleted file mode 100644index 9717f9c94..000000000--- a/base/README.md+++ /dev/null@@ -1,13 +0,0 @@-# OpenRemote Base Images--Build Docker base images before you build any other projects, in the main project root run:--```-./gradlew clean buildBaseImage-```--To publish base images, execute:--```-./gradlew clean pushImage -PdockerHubUsername=username -PdockerHubPassword=secret-```diff --git a/base/mysql/Dockerfile b/base/mysql/Dockerfiledeleted file mode 100644index 103c917e3..000000000--- a/base/mysql/Dockerfile+++ /dev/null@@ -1,3 +0,0 @@-FROM mysql:5.7--ADD scripts /docker-entrypoint-initdb.d/diff --git a/base/mysql/build.gradle b/base/mysql/build.gradledeleted file mode 100644index ab5008a88..000000000--- a/base/mysql/build.gradle+++ /dev/null@@ -1,12 +0,0 @@-import com.bmuschko.gradle.docker.tasks.image.*--task buildBaseImage(type: DockerBuildImage) {- inputDir = projectDir- dockerFile = file("$projectDir/Dockerfile")- tag = dockerImageName-}--task pushImage(type: DockerPushImage) {- dependsOn buildBaseImage- imageName = dockerImageName-}\ No newline at end of filediff --git a/base/mysql/scripts/10_CreateBeehiveSchema.sql b/base/mysql/scripts/10_CreateBeehiveSchema.sqldeleted file mode 100644index 6d16a7cda..000000000--- a/base/mysql/scripts/10_CreateBeehiveSchema.sql+++ /dev/null@@ -1,47 +0,0 @@-CREATE TABLE IF NOT EXISTS `account` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- PRIMARY KEY (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `user` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `password` VARCHAR(255) NOT NULL,- `username` VARCHAR(255) NOT NULL,- `account_oid` BIGINT(20) NULL DEFAULT NULL,- `email` VARCHAR(255) NULL DEFAULT NULL,- `register_time` DATETIME NULL DEFAULT NULL,- `token` VARCHAR(255) NULL DEFAULT NULL,- `valid` BIT(1) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- UNIQUE INDEX `username` (`username` ASC) ,- INDEX `IDX__USER__USERNAME` (`account_oid` ASC) ,- CONSTRAINT `FK__USER__ACCOUNT__ACCOUNT_OID`- FOREIGN KEY (`account_oid`)- REFERENCES `account` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `role` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `name` VARCHAR(255) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) )-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `user_role` (- `user_oid` BIGINT(20) NOT NULL,- `role_oid` BIGINT(20) NOT NULL,- INDEX `IDX__USER_OID` (`user_oid` ASC) ,- INDEX `IDX__ROLE_OID` (`role_oid` ASC) ,- CONSTRAINT `FK__USER_ROLE__ROLE__ROLE_OID`- FOREIGN KEY (`role_oid`)- REFERENCES `role` (`oid`),- CONSTRAINT `FK__USER_ROLE__USER__USER_OID`- FOREIGN KEY (`user_oid`)- REFERENCES `user` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE VIEW tomcat_user_role- AS SELECT u.username, r.name AS rolename FROM user_role ur JOIN user u ON ur.user_oid = u.oid JOIN role r ON ur.role_oid = r.oid;\ No newline at end of filediff --git a/base/mysql/scripts/11_CreateBeehiveDefaultData.sql b/base/mysql/scripts/11_CreateBeehiveDefaultData.sqldeleted file mode 100644index 129e452d0..000000000--- a/base/mysql/scripts/11_CreateBeehiveDefaultData.sql+++ /dev/null@@ -1,24 +0,0 @@-INSERT INTO role VALUES (1, 'service-admin');-INSERT INTO role VALUES (2, 'account-owner');--INSERT INTO account VALUES (1);-INSERT INTO user ( oid,- password ,- username,- account_oid,- email,- register_time ,- token ,- valid) VALUES (1, md5('password{admin}'), 'admin', 1, '[email protected]', now(), NULL, 1);-INSERT INTO user_role VALUES (1, 1);--INSERT INTO account VALUES (2);-INSERT INTO user ( oid,- password ,- username,- account_oid,- email,- register_time ,- token ,- valid) VALUES (2, md5('password{secret}'), 'openremote', 2, '[email protected]', now(), NULL, 1);-INSERT INTO user_role VALUES (2, 2);\ No newline at end of filediff --git a/base/mysql/scripts/20_CreateTables.sql b/base/mysql/scripts/20_CreateTables.sqldeleted file mode 100644index 19d251cb7..000000000--- a/base/mysql/scripts/20_CreateTables.sql+++ /dev/null@@ -1,21 +0,0 @@-CREATE TABLE IF NOT EXISTS discovered_device (- id BIGINT(20) NOT NULL AUTO_INCREMENT,- device_identifier VARCHAR(255) NOT NULL,- device_name VARCHAR(255) NOT NULL,- protocol VARCHAR(255),- model VARCHAR(255),- type VARCHAR(255),- account_id VARCHAR(64),- PRIMARY KEY (id))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS discovered_device_attributes (- discovered_device_id BIGINT(20) NOT NULL,- attribute_key VARCHAR(255) NOT NULL,- attribute_value VARCHAR(1000) NOT NULL,- PRIMARY KEY (discovered_device_id, attribute_key),- CONSTRAINT FOREIGN KEY (discovered_device_id)- REFERENCES discovered_device (id))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;\ No newline at end of filediff --git a/base/mysql/scripts/30_CreateTables.sql b/base/mysql/scripts/30_CreateTables.sqldeleted file mode 100644index 7bd6eb241..000000000--- a/base/mysql/scripts/30_CreateTables.sql+++ /dev/null@@ -1,135 +0,0 @@-CREATE TABLE IF NOT EXISTS `controller_config` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `category` VARCHAR(255) NULL DEFAULT NULL,- `name` VARCHAR(255) NOT NULL,- `value` TEXT NULL DEFAULT NULL,- `account_oid` BIGINT(20) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__CONTROLLER_CONFIG__ACCOUNT_OID` (`account_oid` ASC) ,- CONSTRAINT `FK__CONTROLLER_CONFIG__ACCOUNT__ACCOUNT_OID`- FOREIGN KEY (`account_oid`)- REFERENCES `account` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;---CREATE TABLE IF NOT EXISTS `device` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `model` VARCHAR(255) NULL DEFAULT NULL,- `name` VARCHAR(255) NOT NULL,- `vendor` VARCHAR(255) NULL DEFAULT NULL,- `account_oid` BIGINT(20) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__DEVICE__ACCOUNT_OID` (`account_oid` ASC) ,- CONSTRAINT `FK__DEVICE__ACCOUNT__ACCOUNT_OID`- FOREIGN KEY (`account_oid`)- REFERENCES `account` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;---CREATE TABLE IF NOT EXISTS `protocol` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `type` VARCHAR(255) NOT NULL,- PRIMARY KEY (`oid`) )-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `protocol_attr` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `name` VARCHAR(255) NOT NULL,- `value` TEXT NOT NULL,- `protocol_oid` BIGINT(20) NOT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__PROTOCOL_ATTR__PROTOCOL_OID` (`protocol_oid` ASC) ,- CONSTRAINT `FK_PROTOCOL_ATTR__PROTOCOL__PROTOCOL_OID`- FOREIGN KEY (`protocol_oid`)- REFERENCES `protocol` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;---CREATE TABLE IF NOT EXISTS `device_command` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `name` VARCHAR(255) NOT NULL,- `sectionId` VARCHAR(255) NULL DEFAULT NULL,- `device_oid` BIGINT(20) NULL DEFAULT NULL,- `protocol_oid` BIGINT(20) NOT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__DEVICE_COMMAND__DEVICE_OID` (`device_oid` ASC) ,- INDEX `IDX__DEVICE_COMMAND__PROTOCOL_OID` (`protocol_oid` ASC) ,- CONSTRAINT `FK__DEVICE_COMMAND__DEVICE__DEVICE_OID`- FOREIGN KEY (`device_oid`)- REFERENCES `device` (`oid`),- CONSTRAINT `FK__DEVICE_COMMAND__PROTOCOL__PROTOCOL_OID`- FOREIGN KEY (`protocol_oid`)- REFERENCES `protocol` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `sensor` (- `dtype` VARCHAR(31) NOT NULL,- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `name` VARCHAR(255) NOT NULL,- `type` INT(11) NULL DEFAULT NULL,- `device_oid` BIGINT(20) NULL DEFAULT NULL,- `account_oid` BIGINT(20) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__SENSOR__ACCOUNT_OID` (`account_oid` ASC) ,- INDEX `IDX__SENSOR__DEVICE_OID` (`device_oid` ASC) ,- CONSTRAINT `FK__SENSOR__ACCOUNT__ACCOUNT_OID`- FOREIGN KEY (`account_oid`)- REFERENCES `account` (`oid`),- CONSTRAINT `FK__SENSOR__DEVICE__DEVICE_OID`- FOREIGN KEY (`device_oid`)- REFERENCES `device` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `state` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `name` VARCHAR(255) NULL DEFAULT NULL,- `value` VARCHAR(255) NULL DEFAULT NULL,- `sensor_oid` BIGINT(20) NOT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__STATE__SENSOR_OID` (`sensor_oid` ASC) ,- CONSTRAINT `FK__STATE__SENSOR__SENSOIR_OID`- FOREIGN KEY (`sensor_oid`)- REFERENCES `sensor` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `range_sensor` (- `max_value` INT(11) NULL DEFAULT NULL,- `min_value` INT(11) NULL DEFAULT NULL,- `oid` BIGINT(20) NOT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__RANGE_SENSOR__OID` (`oid` ASC) ,- CONSTRAINT `FK__RANGE_SENSOR__SENSOR__OID`- FOREIGN KEY (`oid`)- REFERENCES `sensor` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `command_ref_item` (- `type` VARCHAR(31) NOT NULL,- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `sensor_oid` BIGINT(20) NULL DEFAULT NULL,- `slider_oid` BIGINT(20) NULL DEFAULT NULL,- `on_switch_oid` BIGINT(20) NULL DEFAULT NULL,- `off_switch_oid` BIGINT(20) NULL DEFAULT NULL,- `target_device_command_oid` BIGINT(20) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__COMMAND_REF_ITEM__SENSOR_OID` (`sensor_oid` ASC) ,- INDEX `IDX__COMMAND_REF_ITEM__TARGET_DEVICE_COMMAND_OID` (`target_device_command_oid` ASC) ,- INDEX `IDX__COMMAND_REF_ITEM__ON_SWITCH_OID` (`on_switch_oid` ASC) ,- INDEX `IDX__COMMAND_REF_ITEM__OFF_SWITCH_OID` (`off_switch_oid` ASC) ,- INDEX `IDX__COMMAND_REF_ITEM__SLIDER_OID` (`slider_oid` ASC) ,- CONSTRAINT `FK__COMMAND_REF_ITEM__DEVICE_COMMAND__TARGET_DEVICE_COMMAND_OID`- FOREIGN KEY (`target_device_command_oid`)- REFERENCES `device_command` (`oid`),- CONSTRAINT `FK__COMMAND_REF_ITEM__SENSOR__SENSOR_OID`- FOREIGN KEY (`sensor_oid`)- REFERENCES `sensor` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;\ No newline at end of filediff --git a/base/mysql/scripts/40_CreateTables.sql b/base/mysql/scripts/40_CreateTables.sqldeleted file mode 100644index 1cc108cc3..000000000--- a/base/mysql/scripts/40_CreateTables.sql+++ /dev/null@@ -1,38 +0,0 @@-CREATE TABLE IF NOT EXISTS `controller` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `linked` TINYINT(1) NOT NULL,- `macAddress` VARCHAR(255) NULL DEFAULT NULL,- `account_oid` BIGINT(20) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__CONTROLLER__ACCOUNT_OID` (`account_oid` ASC) ,- CONSTRAINT `FK__CONTROLLER__ACCOUNT__ACCOUNT_OID`- FOREIGN KEY (`account_oid`)- REFERENCES `account` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `controller_command` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `creationDate` DATETIME NULL DEFAULT NULL,- `state` VARCHAR(255) NULL DEFAULT NULL,- `type` VARCHAR(255) NULL DEFAULT NULL,- `account_oid` BIGINT(20) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__CONTROLLER_COMMAND__ACCOUNT_OID` (`account_oid` ASC) ,- CONSTRAINT `FK__CONTROLLER_COMMAND__ACCOUNT__ACCOUNT_OID`- FOREIGN KEY (`account_oid`)- REFERENCES `account` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `initiate_proxy_controller_command` (- `oid` BIGINT(20) NOT NULL,- `token` VARCHAR(255) NULL DEFAULT NULL,- `url` VARCHAR(255) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__INITIATE_PROXY_CONTROLLER_COMMAND__OID` (`oid` ASC) ,- CONSTRAINT `FK__INITIATE_PROXY_CONTROLLER_COMMAND__CONTROLLER_COMMAND__OID`- FOREIGN KEY (`oid`)- REFERENCES `controller_command` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;\ No newline at end of filediff --git a/beehive/ccs/Dockerfile b/beehive/ccs/Dockerfiledeleted file mode 100644index a159cbf5c..000000000--- a/beehive/ccs/Dockerfile+++ /dev/null@@ -1,6 +0,0 @@-FROM openremote/tomcat:latest--ADD build/libs/ccs.war webapps/-ADD conf/keystore.jks ./-ADD conf/logging.properties conf/-diff --git a/beehive/ccs/build.gradle b/beehive/ccs/build.gradledeleted file mode 100644index 0630faa87..000000000--- a/beehive/ccs/build.gradle+++ /dev/null@@ -1,56 +0,0 @@-apply plugin: "java"-apply plugin: "application"--mainClassName = "org.openremote.ccs.Server"--dependencies {-- compile project(":container")-- compile "org.openremote:or-commons:0.1.0"- compile "org.openremote:or-object-model:0.2.1"-- // TODO Replace with Jackson- compile "org.json:json:20090211"- compile "net.sf.flexjson:flexjson:$flexjsonVersion"-- compile "org.springframework.security:spring-security-core:$springVersion"-}--distributions {- main {- contents {- from("conf") {- into "conf"- }- }- }-}--installDist {- into "${buildDir}/install/$distributions.main.baseName"-}--import com.bmuschko.gradle.docker.tasks.image.*--task createDockerfile(type: Dockerfile) {- destFile = project.file("$project.buildDir/install/Dockerfile")- from "java:8"- environmentVariable "WEBSERVER_DOCROOT", "webapp"- environmentVariable "LOGGING_CONFIG_FILE", "conf/logging.properties"- addFile project(':beehive:ccs').distributions.main.baseName, "/opt/app"- exposePort 8080- workingDir "/opt/app"- entryPoint "/opt/app/bin/${project(":beehive:ccs").name}"-}--task buildImage(type: DockerBuildImage) {- dependsOn ":beehive:ccs:installDist", createDockerfile- inputDir = projectDir- tag = dockerImageName-}--task pushImage(type: DockerPushImage) {- dependsOn buildImage- imageName = dockerImageName-}diff --git a/beehive/ccs/conf/keystore.jks b/beehive/ccs/conf/keystore.jksdeleted file mode 100644index 1f8436961..000000000Binary files a/beehive/ccs/conf/keystore.jks and /dev/null differdiff --git a/beehive/ccs/conf/logging.properties b/beehive/ccs/conf/logging.propertiesdeleted file mode 100644index e9ff67d51..000000000--- a/beehive/ccs/conf/logging.properties+++ /dev/null@@ -1,28 +0,0 @@-# This configuration file is used in the Manager's Docker image, it's the default-# configuration we ship to users.--handlers=java.util.logging.ConsoleHandler--java.util.logging.ConsoleHandler.formatter=org.openremote.container.util.LogFormatter-java.util.logging.ConsoleHandler.level=FINEST--.level=WARNING--org.openremote.level=INFO-org.openremote.container.message.level=WARNING--# Low-level debugging-org.hibernate.level=WARNING-com.zaxxer.hikari.level=WARNING-javax.management.level=WARNING-org.xnio.level=WARNING-org.apache.camel.management.level=WARNING-org.apache.camel.impl.converter.DefaultTypeConverter.level=WARNING--# Set this to FINEST to log outgoing HTTP traffic-org.apache.http.level=WARNING-org.apache.http.impl.conn.DefaultClientConnection.level=WARNING--# Set this to FINEST to log SQL execution-#org.hibernate.SQL.level=FINEST-#org.hibernate.type.descriptor.sql.BasicBinder.level=FINESTdiff --git a/beehive/ccs/src/main/java/org/openremote/ccs/CCSIdentityService.java b/beehive/ccs/src/main/java/org/openremote/ccs/CCSIdentityService.javadeleted file mode 100644index 7d68a4c29..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/CCSIdentityService.java+++ /dev/null@@ -1,40 +0,0 @@-package org.openremote.ccs;--import org.keycloak.admin.client.resource.ClientResource;-import org.keycloak.admin.client.resource.ClientsResource;-import org.keycloak.admin.client.resource.RolesResource;-import org.keycloak.representations.idm.ClientRepresentation;-import org.keycloak.representations.idm.RoleRepresentation;-import org.openremote.container.Container;--import static org.openremote.ccs.Constants.APP_CLIENT_ID;-import static org.openremote.ccs.Constants.APP_NAME;--public class CCSIdentityService extends org.openremote.container.security.IdentityService {-- protected Container container;-- @Override- public void init(Container container) throws Exception {- this.container = container;- setClientId(APP_CLIENT_ID);- super.init(container);- }-- public void createClientApplication(String bearerAuth, String realm) {- ClientsResource clientsResource = getRealms(bearerAuth, false).realm(realm).clients();- ClientRepresentation client = createClientApplication(- realm, getClientId(), APP_NAME, container.isDevMode()- );- clientsResource.create(client);- client = clientsResource.findByClientId(client.getClientId()).get(0);- ClientResource clientResource = clientsResource.get(client.getId());- addDefaultRoles(clientResource.roles());- }-- public void addDefaultRoles(RolesResource rolesResource) {- rolesResource.create(new RoleRepresentation("account-owner", "Account owner", false));- rolesResource.create(new RoleRepresentation("service-admin", "Service administrator", false));- }--}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/CCSPersistenceService.java b/beehive/ccs/src/main/java/org/openremote/ccs/CCSPersistenceService.javadeleted file mode 100644index 0c6988a37..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/CCSPersistenceService.java+++ /dev/null@@ -1,108 +0,0 @@-package org.openremote.ccs;--import org.apache.commons.codec.binary.Base64;-import org.openremote.ccs.model.*;-import org.openremote.container.persistence.PersistenceService;-import org.openremote.controllercommand.domain.ControllerCommandDTO;-import org.springframework.security.authentication.encoding.Md5PasswordEncoder;--import javax.persistence.EntityManager;-import javax.persistence.NoResultException;-import javax.persistence.criteria.*;-import java.util.ArrayList;-import java.util.Collections;-import java.util.List;--public class CCSPersistenceService extends PersistenceService {-- public static final String HTTP_AUTH_HEADER_NAME = "Authorization";- public static final String HTTP_BASIC_AUTH_HEADER_VALUE_PREFIX = "Basic ";-- public User loadByUsername(EntityManager entityManager, String username) {- CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();- CriteriaQuery<User> query = criteriaBuilder.createQuery(User.class);- Root<User> root = query.from(User.class);- query.select(root);- query.where(criteriaBuilder.equal(root.get("username"), username));- return entityManager.createQuery(query).getSingleResult();- }-- public User loadByHTTPBasicCredentials(EntityManager entityManager, String credentials) {- if (credentials.startsWith(HTTP_BASIC_AUTH_HEADER_VALUE_PREFIX)) {- credentials = credentials.replaceAll(HTTP_BASIC_AUTH_HEADER_VALUE_PREFIX, "");- credentials = new String(Base64.decodeBase64(credentials.getBytes()));- String[] arr = credentials.split(":");- if (arr.length == 2) {- String username = arr[0];- String password = arr[1];- User user = loadByUsername(entityManager, username);- String encodedPassword = new Md5PasswordEncoder().encodePassword(password, username);- if (user != null && user.getPassword().equals(encodedPassword)) {- return user;- }- }- }- // let's be lax and not throw a BAD_REQUEST to allow the user to retry- return null;- }-- public void save(EntityManager entityManager, ControllerCommand c) {- entityManager.persist(c);- }-- public List<ControllerCommandDTO> queryByControllerOidForUser(EntityManager entityManager, Long oid, String username) {-- CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();- CriteriaQuery<User> query = criteriaBuilder.createQuery(User.class);- Root<User> root = query.from(User.class);- query.select(root);- query.where(criteriaBuilder.equal(root.get("username"), username));- User u = entityManager.createQuery(query).getSingleResult();-- CriteriaQuery<Controller> controllerQuery = criteriaBuilder.createQuery(Controller.class);- Root<Controller> controllerRoot = controllerQuery.from(Controller.class);- Fetch<Controller, Account> accountJoin = controllerRoot.fetch("account");- accountJoin.fetch("users");- controllerQuery.select(controllerRoot);- controllerQuery.where(criteriaBuilder.equal(controllerRoot.get("oid"), oid));- Controller controller;- try {- controller = entityManager.createQuery(controllerQuery).getSingleResult();- } catch (NoResultException e) {- return Collections.emptyList();- }-- // Only return commands if the user making the request has access to the account linked to the controller- if (!controller.getAccount().getUsers().contains(u)) {- return Collections.emptyList();- }-- CriteriaQuery<ControllerCommand> controllerCommandQuery = criteriaBuilder.createQuery(ControllerCommand.class);- Root<ControllerCommand> controllerCommandRoot = controllerCommandQuery.from(ControllerCommand.class);- controllerCommandQuery.select(controllerCommandRoot);- Predicate criteria = criteriaBuilder.equal(controllerCommandRoot.get("account"), controller.getAccount());- criteria = criteriaBuilder.and(criteria, criteriaBuilder.equal(controllerCommandRoot.get("state"), ControllerCommand.State.OPEN));- controllerCommandQuery.where(criteria);- controllerCommandQuery.orderBy(criteriaBuilder.asc(controllerCommandRoot.get("creationDate")));-- List<ControllerCommand> list = entityManager.createQuery(controllerCommandQuery).getResultList();- List<ControllerCommandDTO> result = new ArrayList<>(list.size());- for (ControllerCommand cmd : list) {- ControllerCommandDTO dto = new ControllerCommandDTO();- dto.setOid(cmd.getId());- dto.setCommandType(cmd.getType().getLabel());- if (cmd instanceof InitiateProxyControllerCommand) {- dto.addParameter("token", ((InitiateProxyControllerCommand) cmd).getToken());- dto.addParameter("url", ((InitiateProxyControllerCommand) cmd).getUrl());- }- result.add(dto);- }- return result;- }-- public InitiateProxyControllerCommand saveProxyControllerCommand(EntityManager entityManager, User user, String url) {- InitiateProxyControllerCommand command = new InitiateProxyControllerCommand(user.getAccount(), ControllerCommandDTO.Type.INITIATE_PROXY, url);- save(entityManager, command);- return command;- }-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/CCSWebService.java b/beehive/ccs/src/main/java/org/openremote/ccs/CCSWebService.javadeleted file mode 100644index aab852182..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/CCSWebService.java+++ /dev/null@@ -1,23 +0,0 @@-package org.openremote.ccs;--import org.openremote.container.Container;-import org.openremote.container.web.WebService;--public class CCSWebService extends WebService {-- @Override- public void init(Container container) throws Exception {- super.init(container);- setDefaultRealm(Constants.MASTER_REALM);- }-- @Override- public void configure(Container container) throws Exception {-- container.getService(WebService.class).getApiSingletons().add(- new ControllerCommandResourceImpl(container.getService(CCSPersistenceService.class))- );-- super.configure(container);- }-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/Constants.java b/beehive/ccs/src/main/java/org/openremote/ccs/Constants.javadeleted file mode 100644index e07a3b654..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/Constants.java+++ /dev/null@@ -1,29 +0,0 @@-/*- * Copyright 2016, 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.ccs;--public interface Constants {-- String APP_NAME = "OpenRemote Controller Command Service";- String APP_CLIENT_ID = "or-ccs";- String MASTER_REALM = "master";- String MASTER_REALM_ADMIN_USER = "admin";- String PERSISTENCE_SEQUENCE_ID_GENERATOR = "SEQUENCE_ID_GENERATOR";-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/ControllerCommandResource.java b/beehive/ccs/src/main/java/org/openremote/ccs/ControllerCommandResource.javadeleted file mode 100644index 9965de3cd..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/ControllerCommandResource.java+++ /dev/null@@ -1,46 +0,0 @@-package org.openremote.ccs;--import jsinterop.annotations.JsType;--import javax.annotation.security.RolesAllowed;-import javax.servlet.http.HttpServletRequest;-import javax.ws.rs.*;-import javax.ws.rs.core.Context;-import javax.ws.rs.core.MediaType;-import javax.ws.rs.core.Response;--@Path("command")-@JsType(isNative = true)-public interface ControllerCommandResource {-- @POST- @Consumes(MediaType.APPLICATION_JSON)- @Produces(MediaType.APPLICATION_JSON)- @RolesAllowed({"account-owner", "service-admin"})- Response saveCommand(@Context HttpServletRequest request, String jsonString);-- /**- * Mark the controllerCommand with the given id as DONE<p>- * REST Url: /rest/command/{commandId}- *- * @return ResultObject with String "ok"- */- @DELETE- @Path("{commandId}")- @Produces(MediaType.APPLICATION_JSON)- @RolesAllowed({"account-owner", "service-admin"})- Response ackControllerCommands(@Context HttpServletRequest request, @PathParam("commandId") String commandId);-- /**- * Return a list of all not finished ControllerCommands<p>- * REST Url: /rest/commands/{controllerOid} -> return all not finished controller commands for the given controllerOid- *- * @return a List of ControllerCommand- */- @GET- @Path("controller/{controllerId}")- @Produces(MediaType.APPLICATION_JSON)- @RolesAllowed({"account-owner", "service-admin"})- Response loadControllerCommands(@Context HttpServletRequest request, @PathParam("controllerId") String controllerId);--}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/ControllerCommandResourceImpl.java b/beehive/ccs/src/main/java/org/openremote/ccs/ControllerCommandResourceImpl.javadeleted file mode 100644index 0370cdf80..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/ControllerCommandResourceImpl.java+++ /dev/null@@ -1,138 +0,0 @@-/*- * OpenRemote, the Home of the Digital Home.- * Copyright 2008-2016, 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.ccs;--import flexjson.JSONSerializer;-import org.json.JSONException;-import org.json.JSONObject;-import org.openremote.ccs.model.Account;-import org.openremote.ccs.model.ControllerCommand;-import org.openremote.ccs.model.User;-import org.openremote.container.web.WebResource;-import org.openremote.controllercommand.domain.ControllerCommandDTO;-import org.openremote.controllercommand.domain.ControllerCommandDTO.Type;-import org.openremote.rest.GenericResourceResultWithErrorMessage;--import javax.servlet.http.HttpServletRequest;-import javax.ws.rs.BadRequestException;-import javax.ws.rs.core.Context;-import javax.ws.rs.core.Response;-import java.util.ArrayList;-import java.util.List;-import java.util.logging.Level;-import java.util.logging.Logger;--public class ControllerCommandResourceImpl extends WebResource implements ControllerCommandResource {-- private static final Logger LOG = Logger.getLogger(ControllerCommandResourceImpl.class.getName());-- final protected CCSPersistenceService persistenceService;-- public ControllerCommandResourceImpl(CCSPersistenceService persistenceService) {- this.persistenceService = persistenceService;- }-- @Override- public Response saveCommand(@Context HttpServletRequest request, String jsonString) {- if (jsonString == null) {- throw new BadRequestException("No data received");- }-- String username = request.getUserPrincipal().getName();-- return persistenceService.doReturningTransaction(entityManager -> {- try {- User user = persistenceService.loadByUsername(entityManager, username);- Account account = user.getAccount();-- JSONObject jsonData = new JSONObject(jsonString);- String typeAsString = jsonData.getString("type");- if (typeAsString == null) {- throw new BadRequestException("Type must be provided");- }- try {- ControllerCommandDTO.Type type = Type.valueOf(typeAsString.trim().toUpperCase());- if (Type.DOWNLOAD_DESIGN != type) {- throw new BadRequestException("Unsupported command type");- }- ControllerCommand command = new ControllerCommand(account, Type.DOWNLOAD_DESIGN);- persistenceService.save(entityManager, command);- GenericResourceResultWithErrorMessage result = new GenericResourceResultWithErrorMessage(null, command);- return Response.ok(new JSONSerializer().exclude("*.class").exclude("result.account").deepSerialize(result)).build();- } catch (IllegalArgumentException e) {- throw new BadRequestException("Unknown command type");- }-- } catch (JSONException e) {- throw new BadRequestException("Invalid JSON payload");- }- });- }-- @Override- public Response ackControllerCommands(@Context HttpServletRequest request, String commandId) {- GenericResourceResultWithErrorMessage result = null;- try {- if (commandId != null) {- LOG.info("Asked to acknowledge command with id " + commandId);- Long id = Long.valueOf(commandId);- persistenceService.doTransaction(entityManager -> {- ControllerCommand controllerCommand = entityManager.find(ControllerCommand.class, id);- controllerCommand.setState(ControllerCommand.State.DONE);- controllerCommand = entityManager.merge(controllerCommand);- });- result = new GenericResourceResultWithErrorMessage(null, "ok");- } else {- result = new GenericResourceResultWithErrorMessage("command not found", null);- }- } catch (Exception ex) {- LOG.log(Level.SEVERE, "Error while acknowledging a ControllerCommand", ex);- result = new GenericResourceResultWithErrorMessage(ex.getMessage(), null);- }- return Response.ok(new JSONSerializer().exclude("*.class").deepSerialize(result)).build();- }-- @Override- public Response loadControllerCommands(@Context HttpServletRequest request, String controllerId) {- GenericResourceResultWithErrorMessage result = null;- try {- if (controllerId != null) {- LOG.info("Asked to get controller commands list for controller id " + controllerId);- Long id = Long.valueOf(controllerId);-- String username = request.getUserPrincipal().getName();- LOG.info("Query done by " + username);-- result = persistenceService.doReturningTransaction(entityManager -> {- List<ControllerCommandDTO> commands = persistenceService.queryByControllerOidForUser(entityManager, id, username);- return new GenericResourceResultWithErrorMessage(null, commands);- });- } else {- LOG.info("No controller oid provided");- result = new GenericResourceResultWithErrorMessage(null, new ArrayList<ControllerCommandDTO>());- }- } catch (Exception ex) {- LOG.log(Level.SEVERE, "Error getting controller commands", ex);- result = new GenericResourceResultWithErrorMessage(ex.getMessage(), null);- }- return Response.ok(new JSONSerializer().exclude("*.class").deepSerialize(result)).build();- }-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/DemoDataService.java b/beehive/ccs/src/main/java/org/openremote/ccs/DemoDataService.javadeleted file mode 100644index 0eda6d27c..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/DemoDataService.java+++ /dev/null@@ -1,123 +0,0 @@-/*- * Copyright 2016, 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.ccs;--import org.apache.log4j.Logger;-import org.keycloak.admin.client.resource.*;-import org.keycloak.representations.idm.ClientRepresentation;-import org.keycloak.representations.idm.RealmRepresentation;-import org.openremote.container.Container;-import org.openremote.container.ContainerService;-import org.openremote.container.persistence.PersistenceService;-import org.openremote.container.security.AuthForm;-import rx.Observable;--import static org.openremote.ccs.Constants.*;-import static org.openremote.container.util.MapAccess.getBoolean;-import static rx.Observable.fromCallable;--public class DemoDataService implements ContainerService {-- private static final Logger LOG = Logger.getLogger(DemoDataService.class.getName());-- public static final String IMPORT_DEMO_DATA = "IMPORT_DEMO_DATA";- public static final boolean IMPORT_DEMO_DATA_DEFAULT = false;-- public static final String ADMIN_CLI_CLIENT_ID = "admin-cli";- public static final String ADMIN_PASSWORD = "admin";-- protected Container container;- protected PersistenceService persistenceService;- protected CCSIdentityService identityService;-- @Override- public void init(Container container) throws Exception {- this.container = container;- persistenceService = container.getService(PersistenceService.class);- identityService = container.getService(CCSIdentityService.class);- }-- @Override- public void configure(Container container) throws Exception {-- }-- @Override- public void start(Container container) {- if (!container.isDevMode() && !getBoolean(container.getConfig(), IMPORT_DEMO_DATA, IMPORT_DEMO_DATA_DEFAULT)) {- return;- }-- LOG.info("--- IMPORTING DEMO DATA ---");-- // Use a non-proxy client to get the access token- String accessToken = identityService.getKeycloak().getAccessToken(- MASTER_REALM, new AuthForm(ADMIN_CLI_CLIENT_ID, MASTER_REALM_ADMIN_USER, ADMIN_PASSWORD)- ).getToken();-- try {- configureMasterRealm(accessToken);-- LOG.info("--- DEMO DATA IMPORT COMPLETE ---");- } catch (Exception ex) {- throw new RuntimeException(ex);- }- }-- @Override- public void stop(Container container) {- }-- protected void configureMasterRealm(String accessToken) {- RealmResource realmResource = identityService.getRealms(accessToken, false).realm(MASTER_REALM);- ClientsResource clientsResource = identityService.getRealms(accessToken, false).realm(MASTER_REALM).clients();- UsersResource usersResource = identityService.getRealms(accessToken, false).realm(MASTER_REALM).users();-- RealmRepresentation masterRealm = realmResource.toRepresentation();-- masterRealm.setDisplayName("Master");-- identityService.configureRealm(masterRealm, 300);-- realmResource.update(masterRealm);-- // Find out if there is a client already present for this application, if so, delete it- fromCallable(clientsResource::findAll)- .flatMap(Observable::from)- .filter(clientRepresentation -> clientRepresentation.getClientId().equals(APP_CLIENT_ID))- .map(ClientRepresentation::getId)- .subscribe(clientObjectId -> {- clientsResource.get(clientObjectId).remove();- });-- identityService.createClientApplication(accessToken, masterRealm.getRealm());-- String clientObjectId = fromCallable(() -> clientsResource.findByClientId(APP_CLIENT_ID))- .flatMap(Observable::from)- .map(ClientRepresentation::getId)- .toBlocking().singleOrDefault(null);-- ClientResource clientResource = clientsResource.get(clientObjectId);- RolesResource rolesResource = clientResource.roles();-- // TODO User and role mappings- }--}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/Server.java b/beehive/ccs/src/main/java/org/openremote/ccs/Server.javadeleted file mode 100644index e689d0668..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/Server.java+++ /dev/null@@ -1,20 +0,0 @@-package org.openremote.ccs;--import org.openremote.ccs.proxy.ProxyService;-import org.openremote.container.Container;-import org.openremote.container.message.MessageBrokerService;--public class Server {-- public static void main(String[] args) throws Exception {- new Container(- new MessageBrokerService(),- new CCSWebService(),- new CCSIdentityService(),- new CCSPersistenceService(),- new ProxyService(),- new DemoDataService()- ).startBackground();- }--}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/model/Account.java b/beehive/ccs/src/main/java/org/openremote/ccs/model/Account.javadeleted file mode 100644index a3678b0e3..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/model/Account.java+++ /dev/null@@ -1,56 +0,0 @@-/* OpenRemote, the Home of the Digital Home.- * Copyright 2008-2011, 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.ccs.model;--import javax.persistence.Entity;-import javax.persistence.OneToMany;-import javax.persistence.Table;-import java.util.List;--/**- * The Class Account.- *- * @author Marcus- */-@Entity-@Table(name = "account")-public class Account extends BusinessEntity {-- private List<User> users;- private List<Controller> controllers;-- @OneToMany(mappedBy = "account")- public List<User> getUsers() {- return users;- }-- public void setUsers(List<User> users) {- this.users = users;- }-- @OneToMany(mappedBy = "account")- public List<Controller> getControllers() {- return controllers;- }-- public void setControllers(List<Controller> controllers) {- this.controllers = controllers;- }-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/model/BusinessEntity.java b/beehive/ccs/src/main/java/org/openremote/ccs/model/BusinessEntity.javadeleted file mode 100644index eaf95ec7b..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/model/BusinessEntity.java+++ /dev/null@@ -1,54 +0,0 @@-/* OpenRemote, the Home of the Digital Home.-* Copyright 2008-2011, 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.ccs.model;--import org.openremote.ccs.Constants;--import javax.persistence.GeneratedValue;-import javax.persistence.Id;-import javax.persistence.MappedSuperclass;-import java.io.Serializable;--@MappedSuperclass-public abstract class BusinessEntity implements Serializable {-- private Long id;-- public BusinessEntity() {- super();- }-- public BusinessEntity(long id) {- super();- this.id = id;- }-- @Id- @GeneratedValue(generator = Constants.PERSISTENCE_SEQUENCE_ID_GENERATOR)- public Long getId() {- return id;- }-- public void setId(long id) {- this.id = id;- }--}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/model/Controller.java b/beehive/ccs/src/main/java/org/openremote/ccs/model/Controller.javadeleted file mode 100644index ff5ddcc71..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/model/Controller.java+++ /dev/null@@ -1,78 +0,0 @@-/* OpenRemote, the Home of the Digital Home.- * Copyright 2008-2011, 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.ccs.model;--import org.openremote.ccs.model.Account;-import org.openremote.ccs.model.BusinessEntity;--import javax.persistence.Entity;-import javax.persistence.ManyToOne;-import javax.persistence.Table;--/**- * The Class Controller.- *- * @author Marcus- */-@Entity-@Table(name = "controller")-public class Controller extends BusinessEntity {-- private static final long serialVersionUID = -8631606687130231794L;-- /**- * The MAC address (can be a comma seperated list of multiple MAC address)- */- private String macAddress;-- /**- * The linked Account- */- private Account account;-- private boolean linked;-- public String getMacAddress() {- return macAddress;- }-- public void setMacAddress(String macAddress) {- this.macAddress = macAddress;- }-- @ManyToOne- public Account getAccount() {- return account;- }-- public void setAccount(Account account) {- this.account = account;- }-- public boolean isLinked() {- return linked;- }-- public void setLinked(boolean linked) {- this.linked = linked;- }---}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/model/ControllerCommand.java b/beehive/ccs/src/main/java/org/openremote/ccs/model/ControllerCommand.javadeleted file mode 100644index dd26350f8..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/model/ControllerCommand.java+++ /dev/null@@ -1,102 +0,0 @@-/* OpenRemote, the Home of the Digital Home.- * Copyright 2008-2011, 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.ccs.model;--import org.openremote.controllercommand.domain.ControllerCommandDTO;--import java.util.Date;--import javax.persistence.Entity;-import javax.persistence.EnumType;-import javax.persistence.Enumerated;-import javax.persistence.Inheritance;-import javax.persistence.InheritanceType;-import javax.persistence.ManyToOne;-import javax.persistence.Table;--/**- * Entity for commands sent from Beehive to the backend- *- * @author Stphane Epardaud <[email protected]>- */-@SuppressWarnings("serial")-@Entity-@Table(name = "controller_command")-@Inheritance(strategy = InheritanceType.JOINED)-public class ControllerCommand extends BusinessEntity {-- private Account account;- private Date creationDate;- private State state;- private ControllerCommandDTO.Type type;-- /**- * State of the command. They start as OPEN, then are marked as DONE when they have been treated by- * the controller.- */- public enum State {- OPEN, DONE;- }-- public ControllerCommand() {- }-- public ControllerCommand(Account account, ControllerCommandDTO.Type type) {- this.account = account;- this.creationDate = new Date();- this.state = State.OPEN;- this.type = type;- }-- @ManyToOne- public Account getAccount() {- return account;- }-- public void setAccount(Account account) {- this.account = account;- }-- public Date getCreationDate() {- return creationDate;- }-- public void setCreationDate(Date creationDate) {- this.creationDate = creationDate;- }-- @Enumerated(EnumType.STRING)- public State getState() {- return state;- }-- public void setState(State state) {- this.state = state;- }-- @Enumerated(EnumType.STRING)- public ControllerCommandDTO.Type getType() {- return type;- }-- public void setType(ControllerCommandDTO.Type type) {- this.type = type;- }-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/model/InitiateProxyControllerCommand.java b/beehive/ccs/src/main/java/org/openremote/ccs/model/InitiateProxyControllerCommand.javadeleted file mode 100644index 7c2a10695..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/model/InitiateProxyControllerCommand.java+++ /dev/null@@ -1,63 +0,0 @@-/*- * OpenRemote, the Home of the Digital Home.- * Copyright 2008-2016, 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.ccs.model;--import org.openremote.controllercommand.domain.ControllerCommandDTO;--import java.util.UUID;--import javax.persistence.Entity;-import javax.persistence.Table;--@SuppressWarnings("serial")-@Entity-@Table(name = "initiate_proxy_controller_command")-public class InitiateProxyControllerCommand extends ControllerCommand {- private String url;- private String token;-- public InitiateProxyControllerCommand() {- super();- }-- public InitiateProxyControllerCommand(Account account, ControllerCommandDTO.Type type, String url) {- super(account, type);- this.url = url;- // TODO Should this be SecureRandom?- this.token = UUID.randomUUID().toString();- }-- public void setUrl(String url) {- this.url = url;- }-- public String getUrl() {- return url;- }-- public void setToken(String token) {- this.token = token;- }-- public String getToken() {- return token;- }-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/model/User.java b/beehive/ccs/src/main/java/org/openremote/ccs/model/User.javadeleted file mode 100644index b6ae755e2..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/model/User.java+++ /dev/null@@ -1,82 +0,0 @@-/*- * OpenRemote, the Home of the Digital Home.- * Copyright 2008-2012, 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.ccs.model;--import javax.persistence.Column;-import javax.persistence.Entity;-import javax.persistence.ManyToOne;-import javax.persistence.Table;-import javax.persistence.Transient;--@Entity-@Table(name = "users")-public class User extends BusinessEntity {-- private String username;- private String password;- private String rawPassword;- private Account account;-- public User() {- account = new Account();- }-- public User(Account account) {- this.account = account;- }-- @Column(unique = true, nullable = false)- public String getUsername() {- return username;- }-- public void setUsername(String username) {- this.username = username;- }-- @Column(nullable = false)- public String getPassword() {- return password;- }-- public void setPassword(String password) {- this.password = password;- }-- @ManyToOne- public Account getAccount() {- return account;- }-- public void setAccount(Account account) {- this.account = account;- }-- @Transient- public String getRawPassword() {- return rawPassword;- }-- public void setRawPassword(String rawPassword) {- this.rawPassword = rawPassword;- }--}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/proxy/HTTPException.java b/beehive/ccs/src/main/java/org/openremote/ccs/proxy/HTTPException.javadeleted file mode 100644index 6e5679146..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/proxy/HTTPException.java+++ /dev/null@@ -1,48 +0,0 @@-/*- * OpenRemote, the Home of the Digital Home.- * Copyright 2008-2016, 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.ccs.proxy;--@SuppressWarnings("serial")-public class HTTPException extends Exception {-- private int status;- private boolean json;- private boolean options;-- public HTTPException(int status, boolean json, boolean options) {- super();- this.status = status;- this.json = json;- this.options = options;- }-- public int getStatus() {- return status;- }-- public boolean isJson() {- return json;- }-- public boolean isOptionsRequest() {- return options;- }-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyClient.java b/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyClient.javadeleted file mode 100644index 3c6aab604..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyClient.java+++ /dev/null@@ -1,412 +0,0 @@-/*- * OpenRemote, the Home of the Digital Home.- * Copyright 2008-2016, 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.ccs.proxy;--import org.openremote.ccs.CCSPersistenceService;-import org.openremote.ccs.model.ControllerCommand;-import org.openremote.ccs.model.InitiateProxyControllerCommand;-import org.openremote.ccs.model.User;--import javax.net.ssl.SSLServerSocketFactory;-import java.io.IOException;-import java.io.InputStream;-import java.io.OutputStream;-import java.net.HttpURLConnection;-import java.net.InetSocketAddress;-import java.net.ServerSocket;-import java.net.Socket;-import java.nio.charset.Charset;-import java.util.logging.Level;-import java.util.logging.Logger;-import java.util.regex.Matcher;-import java.util.regex.Pattern;--public class ProxyClient extends Thread {-- private static final Logger LOG = Logger.getLogger(ProxyClient.class.getName());-- protected Socket consoleSocket;- protected boolean halted;- protected int timeout;- protected byte[] consoleBuffer;- protected int consoleBytesRead;-- private ProxyServer server;- private String hostName;- private int minClientPort;- private int maxClientPort;- private CCSPersistenceService persistenceService;- private SSLServerSocketFactory sslServerSocketFactory;-- public ProxyClient(ProxyServer server, Socket clientSocket, int timeout, String hostName, int minClientPort, int maxClientPort,- CCSPersistenceService persistenceService, SSLServerSocketFactory sslServerSocketFactory) throws IOException {- this.consoleSocket = clientSocket;- this.timeout = timeout;- this.server = server;- this.hostName = hostName;- this.minClientPort = minClientPort;- this.maxClientPort = maxClientPort;- this.persistenceService = persistenceService;- this.sslServerSocketFactory = sslServerSocketFactory;- }-- @Override- public void run() {- try {- LOG.info("Client running");- // we first need to connect to the endpoint- Socket controllerSocket;- try {- controllerSocket = openDestinationSocket();- } catch (IOException e) {- LOG.log(Level.SEVERE, "Failed to connect to the destination", e);- return;- }- try {- LOG.info("We got connection to the destination");- final byte[] request = new byte[1024];- byte[] reply = new byte[4096];-- // Get client streams. Make them final so they can- // be used in the anonymous thread below.- final InputStream from_client = consoleSocket.getInputStream();- final OutputStream to_client = consoleSocket.getOutputStream();-- // Get server streams.- final InputStream from_server = controllerSocket.getInputStream();- final OutputStream to_server = controllerSocket.getOutputStream();-- //Write the HTTP request which was already read when checking the authentication header- to_server.write(consoleBuffer, 0, consoleBytesRead);- to_server.flush();-- // Make a thread to read the client's requests and pass them- // to the server. We have to use a separate thread because- // requests and responses may be asynchronous.- Thread t = new Thread() {- public void run() {- int bytes_read;- try {- while ((bytes_read = from_client.read(request)) != -1) {- to_server.write(request, 0, bytes_read);- to_server.flush();- }- } catch (IOException e) {- e.printStackTrace();- }-- // the client closed the connection to us, so close our- // connection to the server. This will also cause the- // server-to-client loop in the main thread exit.- try {- to_server.close();- } catch (IOException e) {-- }- }- };-- // Start the client-to-server request thread running- t.start();-- // Meanwhile, in the main thread, read the server's responses- // and pass them back to the client. This will be done in- // parallel with the client-to-server request thread above.- int bytes_read;- try {- while ((bytes_read = from_server.read(reply)) != -1) {- to_client.write(reply, 0, bytes_read);- to_client.flush();- }- } catch (IOException e) {- }-- // The server closed its connection to us, so we close our- // connection to our client.- // This will make the other thread exit.- to_client.close();-- LOG.info("Done with proxying");- } catch (Exception e) {- LOG.log(Level.SEVERE, "Proxy dead", e);- } finally {- // close the dst socket- try {- controllerSocket.close();- } catch (IOException x) {- }- }- } finally {- // close the src socket- try {- consoleSocket.close();- } catch (IOException x) {- }- onProxyExit();- }- }-- public void halt() {- halted = true;- }-- protected void onProxyExit() {- server.unregister(this);- }-- protected Socket openDestinationSocket() throws IOException {- // this either returns a good user, or throws- User user = authenticateUser();- ServerSocket serverSocket;- if (sslServerSocketFactory != null) {- serverSocket = sslServerSocketFactory.createServerSocket();- } else {- serverSocket = new ServerSocket();- }- int localPort;- try {- LOG.info("Binding socket for client");- for (localPort = minClientPort; localPort <= maxClientPort; localPort++) {- try {- serverSocket.bind(new InetSocketAddress(localPort));- if (serverSocket.getLocalPort() != -1) {- break;- }- } catch (IOException ignoreAndContinue) {- }- }-- localPort = serverSocket.getLocalPort();- if (localPort == -1) {- throw new IOException("Could not bind local socket between ports " + minClientPort + " and " + maxClientPort);- }- LOG.info("Socket bound to port " + localPort);-- // now let's tell the client we want connection here- InitiateProxyControllerCommand controllerCommand = contactController(user, localPort);- try {- serverSocket.setSoTimeout(timeout);- // now wait for the client to connect- while (true) {- Socket clientSocket = serverSocket.accept();- if (halted) {- break;- }- // we have a socket, let's cancel the key and return the client socket- LOG.info("We have a client, now let's check the token");- // this throws on error- checkToken(clientSocket, controllerCommand);- return clientSocket;- }- // we timed out- } finally {- // we got contacted, or not but let's drop this command since we're not listening anymore- persistenceService.doTransaction(entityManager -> {- controllerCommand.setState(ControllerCommand.State.DONE);- entityManager.merge(controllerCommand);- });- }- } finally {- try {- serverSocket.close();- } catch (IOException x) {- // ignore in finally- }-- }- LOG.info("Halted");- throw new IOException("We've been halted");- }-- private void checkToken(Socket clientSocket, InitiateProxyControllerCommand controllerCommand) throws IOException {- try {- byte[] token = controllerCommand.getToken().getBytes("ASCII");- byte[] readToken = new byte[token.length];- clientSocket.getInputStream().read(readToken);- LOG.info("Checking token");- // we have read it all, now compare- for (int i = 0; i < token.length; i++) {- if (token[i] != readToken[i]) {- throw new IOException("Client connected with invalid token");- }- }- LOG.info("Token is good");- return;- } catch (IOException x) {- clientSocket.close();- throw x;- }- }-- private User authenticateUser() throws IOException {- // we need to read data from the client until we get the Authentication header- try {- LOG.info("Reading HTTP headers");- if (halted) {- throw new IOException("Halted");- }- consoleBuffer = new byte[4096];- consoleBytesRead = consoleSocket.getInputStream().read(consoleBuffer);- if (consoleBytesRead == -1) {- // we've reached EOF, drop this client- throw new HTTPException(HttpURLConnection.HTTP_UNAUTHORIZED, false, false);- }-- /* We read some more if we only receive 1 byte- * see here: http://stackoverflow.com/questions/9358424/java-ssl-chrome-firefox-sends-g-in-http-header-instead-of-get-http-1-1- */- if (consoleBytesRead == 1) {- consoleBytesRead = consoleSocket.getInputStream().read(consoleBuffer, 1, 4096);- consoleBytesRead += 1;- }-- // we have new data, let's look at it- User user = getAuthenticatedUser(consoleBuffer, consoleBytesRead);- if (user != null) {- return user;- }- // for a timeout or were halted we just close the connection upstream by throwing- throw new IOException("Connection timed-out before we could read the authentication header");- } catch (HTTPException x) {- // we must reply with an error- throw sendError(consoleSocket, x.getStatus(), x.isJson(), x.isOptionsRequest());- }- }-- private IOException sendError(Socket srcSocket, int status, boolean json, boolean optionsRequest) throws IOException {- // Construct the message- String reason;- String maybeHeader = "";- String body = "";-- maybeHeader = "Access-Control-Allow-Origin: *\r\n";- maybeHeader = maybeHeader + "Access-Control-Allow-Methods: GET, POST\r\n";- maybeHeader = maybeHeader + "Access-Control-Allow-Headers: origin, authorization, accept\r\n";- maybeHeader = maybeHeader + "Access-Control-Max-Age: 99999\r\n";-- switch (status) {- case HttpURLConnection.HTTP_BAD_REQUEST:- reason = "Bad request";- break;- case HttpURLConnection.HTTP_UNAUTHORIZED:- reason = "Unauthorized";- if (json) {- status = 200;- reason = "OK";- body = "{\"error\": {\"code\": 401,\"message\": \"Not Authorized\"}}";- } else {- if (!optionsRequest) {- maybeHeader = maybeHeader + "WWW-Authenticate: Basic realm=\"OPENREMOTE_Beehive\"\r\n";- }- }- break;- case HttpURLConnection.HTTP_FORBIDDEN:- reason = "Forbidden";- break;- default:- reason = "Unknown error";- }- if (optionsRequest) {- status = 200;- reason = "OK";- }- String response = "HTTP/1.1 " + status + " " + reason + "\r\n" + maybeHeader;- if (body.length() != 0) {- response = response + "Content-Length: " + body.length() + "\r\n";- } else {- response = response + "\r\n";- }- response = response + "\r\n" + body;-- byte[] dataToSend = response.getBytes("ASCII");- // now send it- OutputStream out = srcSocket.getOutputStream();- out.write(dataToSend);- out.flush();- // we're done, let bail- return new IOException("Error message (most likely wrong authentication data) was sent to client.");- }-- private User getAuthenticatedUser(byte[] bytes, int length) throws HTTPException {- // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4 says we should look for \r\nAuthorization:(.*)\r\n([^ \t]) as long- // as it's not preceded by "\r\n\r\n" which indicates the end of the header section- // we cannot parse data after the headers, but the headers are always in ASCII, so find that limit first- int limit = length;- int headerEnd = limit;- for (int i = 0; i < limit - 3; i++) {- if (bytes[i] == '\r'- && bytes[i + 1] == '\n'- && bytes[i + 2] == '\r'- && bytes[i + 3] == '\n') {- headerEnd = i + 4;- break;- }- }- // in any case, non-ASCII is after the end of headers, or since we haven't reached that yet, after the whole limit- // so we can parse as ASCII characters- String headers = new String(bytes, 0, headerEnd, Charset.forName("ASCII"));- boolean optionsRequest = false;- if (headers.startsWith("OPTIONS")) {- optionsRequest = true;- }- // so do we have an Authentication header in there?- Pattern pattern = Pattern.compile("\r\nAuthorization: ([^\r\n]*)\r\n([^ \t])", Pattern.CASE_INSENSITIVE);- Pattern pattern2 = Pattern.compile("\r\nAccept:([^\r\n]*)\r\n([^ \t])", Pattern.CASE_INSENSITIVE);- Matcher matcher = pattern.matcher(headers);- Matcher matcher2 = pattern2.matcher(headers);- boolean json = false;- if (matcher2.find()) {- if (matcher2.group(1).toLowerCase().indexOf("json") != -1) {- json = true;- }- }- // nothing?- if (!matcher.find()) {- if (headerEnd <= limit) {- // we have seen every header, and found no good one, let's quit- throw new HTTPException(HttpURLConnection.HTTP_UNAUTHORIZED, json, optionsRequest);- }- // we haven't seen the end of headers yet, don't give up and read more- return null;- }- // we have a value!- String credentials = matcher.group(1).replaceAll("\r\n[ \t]+", " ").trim();- // and attempt to validate it- User user = persistenceService.doReturningTransaction(- entityManager -> persistenceService.loadByHTTPBasicCredentials(entityManager, credentials)- );- if (user == null) {- // authentication failed- throw new HTTPException(HttpURLConnection.HTTP_UNAUTHORIZED, json, optionsRequest);- }- return user;- }-- private InitiateProxyControllerCommand contactController(User user, int port) {- return persistenceService.doReturningTransaction(- entityManager -> persistenceService.saveProxyControllerCommand(- entityManager,- user,- ((sslServerSocketFactory != null) ? "https://" : "http://") + hostName + ":" + port- )- );- }-}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyServer.java b/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyServer.javadeleted file mode 100644index d92056fc7..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyServer.java+++ /dev/null@@ -1,226 +0,0 @@-/*- * OpenRemote, the Home of the Digital Home.- * Copyright 2008-2016, 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.ccs.proxy;--import org.openremote.ccs.CCSPersistenceService;--import javax.net.ssl.KeyManagerFactory;-import javax.net.ssl.SSLContext;-import javax.net.ssl.SSLServerSocketFactory;-import javax.net.ssl.TrustManagerFactory;-import java.io.FileInputStream;-import java.io.IOException;-import java.io.InputStream;-import java.net.ServerSocket;-import java.net.Socket;-import java.security.KeyStore;-import java.util.HashSet;-import java.util.Set;-import java.util.logging.Level;-import java.util.logging.Logger;--public class ProxyServer extends Thread {-- private static final Logger LOG = Logger.getLogger(ProxyServer.class.getName());-- private boolean halted = false;- final private Set<ProxyClient> clients = new HashSet<>();- private String hostName;- private int timeout;- private int port;- private int minClientPort;- private int maxClientPort;- private boolean useSSL;- private String keystore;- private String keystorePassword;- private CCSPersistenceService persistenceService;- private SSLServerSocketFactory sslServerSocketfactory = null;-- public ProxyServer(String proxyHostname, Integer proxyTimeout, Integer proxyPort, String proxyClientPortRange, Boolean useSSL, String keystore,- String keystorePassword, CCSPersistenceService persistenceService) {-- if (proxyHostname == null || proxyHostname.length() == 0) {- hostName = "localhost";- } else {- hostName = proxyHostname;- }-- if (proxyTimeout == null) {- timeout = 5000;- } else {- timeout = proxyTimeout;- }-- if (proxyPort == null) {- port = 10000;- } else {- port = proxyPort;- }-- if (proxyClientPortRange == null || proxyClientPortRange.length() == 0) {- minClientPort = 0;- maxClientPort = 0;- } else {- minClientPort = Integer.parseInt(proxyClientPortRange.trim().substring(0, proxyClientPortRange.indexOf("-")));- maxClientPort = Integer.parseInt(proxyClientPortRange.trim().substring(proxyClientPortRange.indexOf("-") + 1, proxyClientPortRange.length()));- }-- this.useSSL = useSSL != null ? useSSL : false;-- if (this.useSSL && (keystore == null || keystore.length() == 0)) {- throw new RuntimeException("A keystore has to be specified when using SSL");- } else {- this.keystore = keystore;- }-- if (this.useSSL && (keystorePassword == null || keystorePassword.length() == 0)) {- throw new RuntimeException("A keystore password has to be specified when using SSL");- } else {- this.keystorePassword = keystorePassword;- }-- if (useSSL) {- // Specifying the Keystore details- LOG.info("Load keystore: " + this.keystore);- InputStream keystoreStream = null;- try {- TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());- KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());- KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());-- // Path to keystore starts with a /, consider an absolute path and load as a file instead of a resource- if (this.keystore.startsWith("/")) {- try {- keystoreStream = new FileInputStream(this.keystore);- } catch (IOException e) {- LOG.severe("The specified keystore " + this.keystore + " can not be loaded");- throw new RuntimeException("The specified keystore " + this.keystore + " can not be loaded");- }- } else {- keystoreStream = this.getClass().getResourceAsStream(this.keystore);- }- if (keystoreStream == null) {- LOG.severe("The specified keystore " + this.keystore + " can not be loaded");- throw new RuntimeException("The specified keystore " + this.keystore + " can not be loaded");- }-- ks.load(keystoreStream, this.keystorePassword.toCharArray());- LOG.info("Keystore loaded, it contains " + ks.size() + ((ks.size() > 1) ? " entries" : " entry"));-- trustManagerFactory.init(ks);- keyManagerFactory.init(ks, this.keystorePassword.toCharArray());-- SSLContext sc = SSLContext.getInstance("SSL");- sc.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null);- sslServerSocketfactory = sc.getServerSocketFactory();- } catch (Exception e) {- throw new RuntimeException(e);- } finally {- if (keystoreStream != null) {- try {- keystoreStream.close();- } catch (IOException e) {- LOG.log(Level.WARNING, "Failed to close stream to keystore", e);- }- }- }- }-- }-- @Override- public void run() {- LOG.info("Proxy server starting up");- ServerSocket server = null;- try {- if (useSSL) {- // Initialize the SSL Server Socket- LOG.info("Starting SSL proxy server on port: " + port);- server = sslServerSocketfactory.createServerSocket(port);- } else {- // Create a ServerSocket to listen for incoming console connections- LOG.info("Starting proxy server on port: " + port);- server = new ServerSocket(port);- }-- LOG.info("Entering loop");- while (true) {- // Wait for a connection on the local port- Socket clientSocket = server.accept();- LOG.info("Accepting a client socket");- synchronized (clients) {- if (halted) {- break;- }- acceptConnection(clientSocket);- }- }- LOG.info("Exited loop");- } catch (Exception e) {- LOG.log(Level.SEVERE, "Server died", e);- } finally {- if (server != null)- try {- server.close();- } catch (IOException e) {- }- }- }-- private void acceptConnection(Socket clientSocket) {- try {- LOG.info("Got a client socket");- ProxyClient client = new ProxyClient(- this, clientSocket, timeout, hostName,- minClientPort, maxClientPort,- persistenceService,- sslServerSocketfactory- );- clients.add(client);- LOG.info("Starting client");- client.start();- LOG.info("Client started");- } catch (Exception x) {- // make sure we close this one if needed- try {- clientSocket.close();- } catch (IOException e) {- // ignore- }- }- }-- public void halt() {- synchronized (clients) {- halted = true;- for (ProxyClient client : clients) {- client.halt();- }- }- }-- public void unregister(ProxyClient proxyClient) {- synchronized (clients) {- clients.remove(proxyClient);- }- }--}diff --git a/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyService.java b/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyService.javadeleted file mode 100644index 50f84c69d..000000000--- a/beehive/ccs/src/main/java/org/openremote/ccs/proxy/ProxyService.java+++ /dev/null@@ -1,40 +0,0 @@-package org.openremote.ccs.proxy;--import org.openremote.container.Container;-import org.openremote.container.ContainerService;--public class ProxyService implements ContainerService {-- @Override- public void init(Container container) throws Exception {-- }-- @Override- public void configure(Container container) throws Exception {-/*-- String proxyHostname = config.getProperty("proxy.hostname", "localhost");- Integer proxyTimeout = getIntegerConfiguration(config, "proxy.timeout", 10000);- Integer proxyPort = getIntegerConfiguration(config, "proxy.port", 10000);- String proxyClientPortRange = config.getProperty("proxy.clientPortRange", "30000-30010");- Boolean useSSL = getBooleanConfiguration(config, "proxy.useSSL", true);- String keystore = config.getProperty("proxy.keystore", "keystore.jks");- String keystorePassword = config.getProperty("proxy.keystorePassword", "storepass");-*/- }-- @Override- public void start(Container container) throws Exception {-/*- ProxyServer ps = new ProxyServer(proxyHostname, proxyTimeout, proxyPort, proxyClientPortRange, useSSL, keystore, keystorePassword, controllerCommandService, accountService, this);- ps.start();-*/-- }-- @Override- public void stop(Container container) throws Exception {-- }-}diff --git a/beehive/ccs/src/main/resources/10-CreateSchema.sql b/beehive/ccs/src/main/resources/10-CreateSchema.sqldeleted file mode 100644index 1cc108cc3..000000000--- a/beehive/ccs/src/main/resources/10-CreateSchema.sql+++ /dev/null@@ -1,38 +0,0 @@-CREATE TABLE IF NOT EXISTS `controller` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `linked` TINYINT(1) NOT NULL,- `macAddress` VARCHAR(255) NULL DEFAULT NULL,- `account_oid` BIGINT(20) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__CONTROLLER__ACCOUNT_OID` (`account_oid` ASC) ,- CONSTRAINT `FK__CONTROLLER__ACCOUNT__ACCOUNT_OID`- FOREIGN KEY (`account_oid`)- REFERENCES `account` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `controller_command` (- `oid` BIGINT(20) NOT NULL AUTO_INCREMENT,- `creationDate` DATETIME NULL DEFAULT NULL,- `state` VARCHAR(255) NULL DEFAULT NULL,- `type` VARCHAR(255) NULL DEFAULT NULL,- `account_oid` BIGINT(20) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__CONTROLLER_COMMAND__ACCOUNT_OID` (`account_oid` ASC) ,- CONSTRAINT `FK__CONTROLLER_COMMAND__ACCOUNT__ACCOUNT_OID`- FOREIGN KEY (`account_oid`)- REFERENCES `account` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;--CREATE TABLE IF NOT EXISTS `initiate_proxy_controller_command` (- `oid` BIGINT(20) NOT NULL,- `token` VARCHAR(255) NULL DEFAULT NULL,- `url` VARCHAR(255) NULL DEFAULT NULL,- PRIMARY KEY (`oid`) ,- INDEX `IDX__INITIATE_PROXY_CONTROLLER_COMMAND__OID` (`oid` ASC) ,- CONSTRAINT `FK__INITIATE_PROXY_CONTROLLER_COMMAND__CONTROLLER_COMMAND__OID`- FOREIGN KEY (`oid`)- REFERENCES `controller_command` (`oid`))-ENGINE = InnoDB-DEFAULT CHARACTER SET = utf8;\ No newline at end of filediff --git a/beehive/ccs/src/main/resources/META-INF/persistence.xml b/beehive/ccs/src/main/resources/META-INF/persistence.xmldeleted file mode 100644index 90ba12aad..000000000--- a/beehive/ccs/src/main/resources/META-INF/persistence.xml+++ /dev/null@@ -1,27 +0,0 @@-<persistence- version="2.1"- xmlns="http://xmlns.jcp.org/xml/ns/persistence"- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"- xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence- http://xmlns.jcp.org/xml/ns/persistence_2_1.xsd">-- <persistence-unit name="OpenRemotePU" transaction-type="RESOURCE_LOCAL">-- <class>org.openremote.container.persistence</class>-- <class>org.openremote.ccs.model.Account</class>- <class>org.openremote.ccs.model.User</class>- <class>org.openremote.ccs.model.Controller</class>- <class>org.openremote.ccs.model.ControllerCommand</class>- <class>org.openremote.ccs.model.InitiateProxyControllerCommand</class>-- <exclude-unlisted-classes>true</exclude-unlisted-classes>- <properties>- <property name="hibernate.format_sql" value="true"/>- <property name="hibernate.use_sql_comments" value="true"/>- <property name="hibernate.archive.autodetection" value="none"/>- <property name="hibernate.current_session_context_class" value="thread"/>- </properties>- </persistence-unit>--</persistence>\ No newline at end of filediff --git a/beehive/ccs/src/main/resources/config.properties b/beehive/ccs/src/main/resources/config.propertiesdeleted file mode 100644index f14c0e2d2..000000000--- a/beehive/ccs/src/main/resources/config.properties+++ /dev/null@@ -1,10 +0,0 @@-persistenceUnitName=CCS-MySQL-persistenceCreateSchema=true--proxy.hostname=localhost-proxy.timeout=10000-proxy.port=10000-proxy.clientPortRange=30000-30010-proxy.useSSL=true-proxy.keystore=/keystore.jks-proxy.keystorePassword=storepassdiff --git a/build.gradle b/build.gradleindex 365094aff..02af64bd8 100644--- a/build.gradle+++ b/build.gradle@@ -28,7 +28,7 @@ allprojects {tasks.withType(JavaCompile) {sourceCompatibility = "1.8"- options.warnings = false+ // Don't even try to disable deprecation/unsafe warnings of javac, it will not work...}apply plugin: "com.bmuschko.docker-remote-api"diff --git a/container/src/main/java/org/openremote/container/web/ProxyWebClientBuilder.java b/container/src/main/java/org/openremote/container/web/ProxyWebClientBuilder.javaindex 4b0d506e3..868c40d75 100644--- a/container/src/main/java/org/openremote/container/web/ProxyWebClientBuilder.java+++ b/container/src/main/java/org/openremote/container/web/ProxyWebClientBuilder.java@@ -42,6 +42,7 @@ public class ProxyWebClientBuilder extends ResteasyClientBuilder {this.proxyPort = proxyPort;}+ @SuppressWarnings("deprecation")@Overrideprotected ClientHttpEngine initDefaultEngine() {ApacheHttpClient4Engine engine = (ApacheHttpClient4Engine) super.initDefaultEngine();diff --git a/controller/Dockerfile b/controller/Dockerfiledeleted file mode 100644index d75081631..000000000--- a/controller/Dockerfile+++ /dev/null@@ -1,33 +0,0 @@-FROM openremote/controller:latest--WORKDIR /opt/OpenRemote-Controller/bin--# TODO The Web Console should be retrieved as a dependency or it should be in platform project-ADD webconsole.war /opt/OpenRemote-Controller/webapps/--RUN rm -r /opt/or-resources/*--ADD conf/.password /opt/or-resources/.password-ADD conf/.user /opt/or-resources/.user-ADD conf/controller.xml /opt/or-resources/controller.xml--ADD conf/env.drl /opt/or-resources/rules/env.drl-ENV RULES_DATA /opt/or-resources/data/--ADD conf/GVconfig.txt /opt/or-resources/data/GVconfig.txt--# Fix some permissions-USER root-RUN chown -R openremote.openremote /opt/or-resources-USER openremote--# Automatically configure Tomcat from env variables on startup-ADD conf/server_tpl.xml ../conf/-ADD run.sh ./-RUN chmod +x ./run.sh--# SSL configuration-ADD conf/keystore.jks ../-ADD conf/truststore.jks ../--ENTRYPOINT ["/opt/OpenRemote-Controller/bin/run.sh"]diff --git a/controller/conf/.password b/controller/conf/.passworddeleted file mode 100644index d97c5eada..000000000--- a/controller/conf/.password+++ /dev/null@@ -1 +0,0 @@-secretdiff --git a/controller/conf/.user b/controller/conf/.userdeleted file mode 100644index e403209fe..000000000--- a/controller/conf/.user+++ /dev/null@@ -1 +0,0 @@-openremotediff --git a/controller/conf/GVconfig.txt b/controller/conf/GVconfig.txtdeleted file mode 100644index 4f0b8480b..000000000--- a/controller/conf/GVconfig.txt+++ /dev/null@@ -1 +0,0 @@-Demodiff --git a/controller/conf/controller.xml b/controller/conf/controller.xmldeleted file mode 100644index d418ef472..000000000--- a/controller/conf/controller.xml+++ /dev/null@@ -1,121 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<openremote xmlns="http://www.openremote.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openremote.org http://www.openremote.org/schemas/controller.xsd">- <components>- <switch id="10">- <on>- <include type="command" ref="17" />- </on>- <off>- <include type="command" ref="15" />- </off>- <include type="sensor" ref="107970902" />- </switch>- <button id="6">- <include type="command" ref="19" />- </button>- <button id="8">- <include type="command" ref="13" />- </button>- <slider id="12">- <setValue>- <include type="command" ref="18" />- </setValue>- <include type="sensor" ref="107970901" />- </slider>- </components>- <sensors>- <sensor id="107970902" name="Light1Switch" type="switch">- <include type="command" ref="16" />- <state name="on" />- <state name="off" />- </sensor>- <sensor id="107970901" name="Light1Slider" type="level">- <include type="command" ref="18" />- </sensor>- </sensors>- <commands>- <command id="13" protocol="virtual">- <property name="address" value="TV" />- <property name="command" value="OFF" />- <property name="name" value="TVOff" />- <property name="urn:openremote:device-command:device-name" value="TestDevice" />- <property name="urn:openremote:device-command:device-id" value="1" />- </command>- <command id="14" protocol="virtual">- <property name="address" value="LightOneBrightness" />- <property name="command" value="ON" />- <property name="name" value="Light1BrightnessSet" />- <property name="urn:openremote:device-command:device-name" value="TestDevice" />- <property name="urn:openremote:device-command:device-id" value="1" />- </command>- <command id="15" protocol="virtual">- <property name="address" value="LightOne" />- <property name="command" value="OFF" />- <property name="name" value="Light1Off" />- <property name="urn:openremote:device-command:device-name" value="TestDevice" />- <property name="urn:openremote:device-command:device-id" value="1" />- </command>- <command id="16" protocol="virtual">- <property name="address" value="LightOne" />- <property name="command" value="STATUS" />- <property name="name" value="Light1Status" />- <property name="urn:openremote:device-command:device-name" value="TestDevice" />- <property name="urn:openremote:device-command:device-id" value="1" />- </command>- <command id="17" protocol="virtual">- <property name="address" value="LightOne" />- <property name="command" value="ON" />- <property name="name" value="Light1On" />- <property name="urn:openremote:device-command:device-name" value="TestDevice" />- <property name="urn:openremote:device-command:device-id" value="1" />- </command>- <command id="18" protocol="virtual">- <property name="address" value="LightOneBrightness" />- <property name="command" value="STATUS" />- <property name="name" value="Light1BrightnessStatus" />- <property name="urn:openremote:device-command:device-name" value="TestDevice" />- <property name="urn:openremote:device-command:device-id" value="1" />- </command>- <command id="19" protocol="virtual">- <property name="address" value="TV" />- <property name="command" value="ON" />- <property name="name" value="TVOn" />- <property name="urn:openremote:device-command:device-name" value="TestDevice" />- <property name="urn:openremote:device-command:device-id" value="1" />- </command>- </commands>- <config>- <property name="controller.roundrobin.multicast.port" value="10000" />- <property name="controller.roundrobin.tcpserver.port" value="20000" />- <property name="controller.groupname" value="floor20" />- <property name="multicast.port" value="3333" />- <property name="enocean.commLayer" value="" />- <property name="enocean.comPort" value="" />- <property name="protocol.vera.classname" value="org.openremote.controller.protocol.vera.VeraCommandBuilder" />- <property name="controller.groupmember.autodetect.on" value="true" />- <property name="amx_ni.port" value="50000" />- <property name="enocean.serialProtocol" value="ESP3" />- <property name="zwave.commLayer" value="" />- <property name="copy.lircd.conf.on" value="true" />- <property name="irsend.path" value="/usr/local/bin/irsend" />- <property name="domintell.port" value="17481" />- <property name="controller.applicationname" value="controller" />- <property name="domintell.address" value="192.168.1.1" />- <property name="multicast.address" value="224.0.1.100" />- <property name="Macro.IR.Execution.Delay" value="500" />- <property name="zwave.pad.port" value="7876" />- <property name="controller.roundrobin.multicast.address" value="224.0.1.200" />- <property name="zwave.comPort" value="" />- <property name="lutron_homeworks.password" value="openremote" />- <property name="lagarto_network.broadcast" value="tcp://127.0.0.1:5001" />- <property name="lircd.conf.path" value="/etc/lircd.conf" />- <property name="lutron_homeworks.port" value="23" />- <property name="lutron_homeworks.address" value="192.168.1.1" />- <property name="zwave.pad.host" value="localhost" />- <property name="lutron_homeworks.username" value="openremote" />- <property name="webapp.port" value="8080" />- <property name="vera.address" value="" />- <property name="resource.upload.enable" value="true" />- <property name="amx_ni.address" value="192.168.1.1" />- </config>-</openremote>\ No newline at end of filediff --git a/controller/conf/env.drl b/controller/conf/env.drldeleted file mode 100644index c5e5b2595..000000000--- a/controller/conf/env.drl+++ /dev/null@@ -1,13 +0,0 @@-package org.openremote.controller.protocol;--import java.util.Map;--rule "ENV echo"-then- Map<String, String> env = System.getenv();- for (String envName : env.keySet()) {- System.out.format("%s=%s%n",- envName,- env.get(envName));- }-enddiff --git a/controller/conf/keystore.jks b/controller/conf/keystore.jksdeleted file mode 100644index 1f8436961..000000000Binary files a/controller/conf/keystore.jks and /dev/null differdiff --git a/controller/conf/server_tpl.xml b/controller/conf/server_tpl.xmldeleted file mode 100644index b1459f50d..000000000--- a/controller/conf/server_tpl.xml+++ /dev/null@@ -1,123 +0,0 @@-<?xml version='1.0' encoding='utf-8'?>-<!--- Licensed to the Apache Software Foundation (ASF) under one or more- contributor license agreements. See the NOTICE file distributed with- this work for additional information regarding copyright ownership.- The ASF licenses this file to You under the Apache License, Version 2.0- (the "License"); you may not use this file except in compliance with- the License. You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.--->--<!-- Documentation at /docs/config/server.html -->-<Server port="8005" shutdown="SHUTDOWN">-- <!--APR library loader. Documentation at /docs/apr.html -->- <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />- <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->- <Listener className="org.apache.catalina.core.JasperListener" />- <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->- <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />- <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />-- <!-- Global JNDI resources. Documentation at /docs/jndi-resources-howto.html -->-- <GlobalNamingResources>- <Resource name="UserDatabase" auth="Container"- type="org.apache.catalina.UserDatabase"- description="User database that can be updated and saved"- factory="org.apache.catalina.users.MemoryUserDatabaseFactory"- pathname="security/users.xml" />- </GlobalNamingResources>-- <!-- A "Service" is a collection of one or more "Connectors" that share- a single "Container". Documentation at /docs/config/service.html -->-- <Service name="Catalina">-- <!--The connectors can use a shared executor, you can define one or more named thread pools-->- <Executor name="HTTP-ThreadPool" namePrefix="HTTP-Thread-" maxThreads="150" minSpareThreads="4"/>--- <!-- Documentation at :- Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)- Java AJP Connector: /docs/config/ajp.html- APR (HTTP/AJP) Connector: /docs/apr.html- -->- <!--- <Connector executor="HTTP-ThreadPool"- port="8688" protocol="HTTP/1.1"- connectionTimeout="20000"- redirectPort="8443"- URIEncoding="UTF-8"/>- -->-- <!-- Define a SSL HTTP/1.1 Connector on port 8443- This connector uses the JSSE configuration, when using APR, the- connector should be using the OpenSSL style configuration- described in the APR documentation -->- <Connector port="8688" protocol="HTTP/1.1"- connectionTimeout="-1"- maxThreads="150" SSLEnabled="true" scheme="https" secure="true"- keystoreFile="keystore.jks" keystorePass="${SSL_KEY_STORE_PASSWORD}"- clientAuth="false" sslProtocol="TLS" />-- <!-- Define an AJP 1.3 Connector on port 8009 -->- <!--- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />- -->-- <!-- An Engine represents the entry point (within Catalina) that processes- every request. The Engine implementation for Tomcat stand alone- analyzes the HTTP headers included with the request, and passes them- on to the appropriate Host (virtual host).- Documentation at /docs/config/engine.html -->-- <!-- You should set jvmRoute to support load-balancing via AJP ie :- <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">- -->- <Engine name="Catalina" defaultHost="localhost">-- <!-- The request dumper valve dumps useful debugging information about- the request and response data received and sent by Tomcat.- Documentation at: /docs/config/valve.html -->- <!--- <Valve className="org.apache.catalina.valves.RequestDumperValve"/>- -->-- <!-- This Realm uses the UserDatabase configured in the global JNDI- resources under the key "UserDatabase". Any edits- that are performed against this UserDatabase are immediately- available for use by the Realm. -->- <Realm className="org.apache.catalina.realm.UserDatabaseRealm"- resourceName="UserDatabase"/>-- <!-- Define the default virtual host -->- <Host name="localhost" appBase="webapps"- unpackWARs="true" autoDeploy="true"- xmlValidation="false" xmlNamespaceAware="false">-- <!-- SingleSignOn valve, share authentication between web applications- Documentation at: /docs/config/valve.html -->- <!--- <Valve className="org.apache.catalina.authenticator.SingleSignOn" />- -->-- <!-- Access log processes all example.- Documentation at: /docs/config/valve.html -->- <!--- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"- prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>- -->-- </Host>- </Engine>- </Service>-</Server>diff --git a/controller/conf/truststore.jks b/controller/conf/truststore.jksdeleted file mode 100644index 8bca9b6e2..000000000Binary files a/controller/conf/truststore.jks and /dev/null differdiff --git a/controller/run.sh b/controller/run.shdeleted file mode 100755index 36368cf60..000000000--- a/controller/run.sh+++ /dev/null@@ -1,3 +0,0 @@-#!/usr/bin/env bash-perl -p -i -e 's/\$\{([^}]+)\}/defined $ENV{$1} ? $ENV{$1} : $&/eg' < ../conf/server_tpl.xml > ../conf/server.xml-./openremote.sh rundiff --git a/controller/src/main/java/org/openremote/controller/ControllerService.java b/controller/src/main/java/org/openremote/controller/ControllerService.javadeleted file mode 100644index 5b4b79580..000000000--- a/controller/src/main/java/org/openremote/controller/ControllerService.java+++ /dev/null@@ -1,63 +0,0 @@-package org.openremote.controller;--import org.openremote.container.Container;-import org.openremote.container.ContainerService;-import org.openremote.controller.command.CommandBuilder;-import org.openremote.controller.context.ControllerContext;-import org.openremote.controller.context.InMemorySensorStateStorage;-import org.openremote.controller.deploy.DeploymentDefinition;-import org.openremote.controller.deploy.xml.ControllerDOMParser;-import org.openremote.controller.deploy.Deployment;-import org.openremote.controller.rules.RulesProvider;--import java.io.InputStream;--public class ControllerService implements ContainerService {-- final protected ControllerDOMParser controllerDOMParser = new ControllerDOMParser();- final protected InputStream deploymentXml;- final protected CommandBuilder commandBuilder;- final protected RulesProvider rulesProvider;-- protected ControllerContext controllerContext;-- public ControllerService(InputStream deploymentXml, CommandBuilder commandBuilder, RulesProvider rulesProvider) {- this.deploymentXml = deploymentXml;- this.commandBuilder = commandBuilder;- this.rulesProvider = rulesProvider;- }-- @Override- public void init(Container container) throws Exception {- }-- @Override- public void configure(Container container) throws Exception {- // TODO Support booting of multiple controller instances- Deployment deployment = new Deployment(- controllerDOMParser.parse(deploymentXml, true).getDeploymentDefinition(),- commandBuilder,- new InMemorySensorStateStorage(),- rulesProvider- );- controllerContext = new ControllerContext("OpenRemoteController1", deployment);- }-- @Override- public void start(Container container) throws Exception {- if (controllerContext != null) {- controllerContext.start();- }- }-- @Override- public void stop(Container container) throws Exception {- if (controllerContext != null) {- controllerContext.stop();- }- }-- public ControllerContext getContext() {- return controllerContext;- }-}diff --git a/controller/src/main/java/org/openremote/controller/command/Command.java b/controller/src/main/java/org/openremote/controller/command/Command.javadeleted file mode 100644index 3c2889d65..000000000--- a/controller/src/main/java/org/openremote/controller/command/Command.java+++ /dev/null@@ -1,4 +0,0 @@-package org.openremote.controller.command;--public interface Command {-}diff --git a/controller/src/main/java/org/openremote/controller/context/ControllerContext.java b/controller/src/main/java/org/openremote/controller/context/ControllerContext.javadeleted file mode 100644index 3b103bdee..000000000--- a/controller/src/main/java/org/openremote/controller/context/ControllerContext.java+++ /dev/null@@ -1,125 +0,0 @@-package org.openremote.controller.context;--import org.openremote.controller.rules.RuleEngine;-import org.openremote.controller.sensor.SensorState;-import org.openremote.controller.sensor.SensorStateUpdate;-import org.openremote.controller.deploy.Deployment;-import org.openremote.controller.sensor.Sensor;-import org.openremote.controller.command.Commands;--import java.util.logging.Level;-import java.util.logging.Logger;--/**- * An instance of a controller, bootstrapped from {@link Deployment}, this is the main API.- */-public class ControllerContext {-- private static final Logger LOG = Logger.getLogger(ControllerContext.class.getName());-- final protected String controllerID;- final protected Deployment deployment;- final protected RuleEngine ruleEngine;-- private volatile Boolean shutdownInProgress = false;-- public ControllerContext(String controllerID, Deployment deployment) {- this.controllerID = controllerID;- this.deployment = deployment;- this.ruleEngine = new RuleEngine(deployment);- }-- public String getControllerID() {- return controllerID;- }-- public Deployment getDeployment() {- return deployment;- }-- public Commands getCommands() {- return getDeployment().getCommands();- }-- protected SensorStateStorage getStateStorage() {- return getDeployment().getSensorStateStorage();- }-- public synchronized void start() {- if (shutdownInProgress)- return;- LOG.info("Starting context: " + getControllerID());- ruleEngine.start();- for (Sensor sensor : deployment.getSensors()) {- // Put initial state "unknown" for each sensor- getStateStorage().put(new Sensor.UnknownState(sensor));- sensor.start(this);- }- }-- /**- * <ul>- * <li>rule engine is stopped</li>- * <li>sensors are stopped</li>- * <li>the current state is cleared</li>- * </ul>- */- public synchronized void stop() {- try {- LOG.info("Stopping context: " + getControllerID());- shutdownInProgress = true;- ruleEngine.stop();- for (Sensor sensor : deployment.getSensors()) {- try {- sensor.stop();- } catch (Throwable t) {- LOG.log(Level.SEVERE, "Failed to stop sensor: " + sensor, t);- }- }- getStateStorage().clear();- } finally {- shutdownInProgress = false;- }- }-- public synchronized void update(SensorState sensorState) {- LOG.fine("==> Update: " + sensorState);- if (shutdownInProgress) {- LOG.fine("<== Shutting down. Ignoring update for: " + sensorState);- return;- }-- SensorStateUpdate sensorStateUpdate = new SensorStateUpdate(this, sensorState);-- ruleEngine.process(sensorStateUpdate);-- if (sensorStateUpdate.hasTerminated()) {- LOG.fine("<== Update complete, processing terminated, no update was made for: " + sensorStateUpdate.getSensorState());- return;- }-- getStateStorage().put(sensorState);- LOG.fine("<== Update complete for: " + sensorState);- }-- public String queryValue(int sensorID) {- if (!getStateStorage().contains(sensorID)) {- LOG.info("Requested sensor id '" + sensorID + "' was not found. Defaulting to: " + Sensor.UNKNOWN_STATE_VALUE);- return Sensor.UNKNOWN_STATE_VALUE;- }- return getStateStorage().get(sensorID).serialize();- }-- public String queryValue(String sensorName) {- return queryValue(deployment.getSensorID(sensorName));- }-- public SensorState queryState(int sensorID) {- return getStateStorage().get(sensorID);- }-- public SensorState queryState(String sensorName) {- Integer sensorID = deployment.getSensorID(sensorName);- return sensorID != null ? queryState(sensorID) : null;- }-}diff --git a/controller/src/main/java/org/openremote/controller/context/SensorStateStorage.java b/controller/src/main/java/org/openremote/controller/context/SensorStateStorage.javadeleted file mode 100644index 6e69eb272..000000000--- a/controller/src/main/java/org/openremote/controller/context/SensorStateStorage.java+++ /dev/null@@ -1,24 +0,0 @@-package org.openremote.controller.context;--import org.openremote.controller.sensor.SensorState;--/**- * Store controller context (sensor) state.- */-public interface SensorStateStorage {-- void clear();-- // TODO: Trigger notification of client that stuff has changed? Put it in a message broker/queue/topic?- void put(SensorState sensorState);-- boolean contains(int sensorID);-- SensorState get(int sensorID);-- /* TODO For polling/pushing to external system we need to be able to continue processing state from a known offset- Iterator<SensorState> getSince(int timestamp);-- Iterator<SensorState> getSince(int timestamp, int sensorID);- */-}diff --git a/controller/src/main/java/org/openremote/controller/deploy/xml/ControllerDOMParser.java b/controller/src/main/java/org/openremote/controller/deploy/xml/ControllerDOMParser.javadeleted file mode 100644index 1078e2a80..000000000--- a/controller/src/main/java/org/openremote/controller/deploy/xml/ControllerDOMParser.java+++ /dev/null@@ -1,46 +0,0 @@-package org.openremote.controller.deploy.xml;--import org.openremote.container.xml.DOMParser;-import org.openremote.container.xml.NamespaceContextMap;-import org.w3c.dom.Document;--import javax.xml.transform.stream.StreamSource;-import javax.xml.xpath.XPath;--/**- * Usage:- *- * <pre><code>- * ControllerDOM dom = new ControllerDOMParser().parse(deploymentXml);- * </code></pre>- */-public class ControllerDOMParser extends DOMParser<ControllerDOM> {-- public static final String SCHEMA_XSD = "/org/openremote/controller/schemas/controller-2.0-M7.xsd";-- public ControllerDOMParser() {- super(new StreamSource(ControllerDOMParser.class.getResourceAsStream(SCHEMA_XSD)));- }-- @Override- protected ControllerDOM createDOM(Document document) {- return new ControllerDOM(document, createXPath());- }-- public NamespaceContextMap createDefaultNamespaceContext(String... optionalPrefixes) {- NamespaceContextMap ctx = new NamespaceContextMap() {- @Override- protected String getDefaultNamespaceURI() {- return ControllerDOM.NAMESPACE_URI;- }- };- for (String optionalPrefix : optionalPrefixes) {- ctx.put(optionalPrefix, ControllerDOM.NAMESPACE_URI);- }- return ctx;- }-- public XPath createXPath() {- return super.createXPath(createDefaultNamespaceContext(ControllerElement.XPATH_PREFIX));- }-}diff --git a/controller/src/main/java/org/openremote/controller/deploy/xml/ControllerElement.java b/controller/src/main/java/org/openremote/controller/deploy/xml/ControllerElement.javadeleted file mode 100644index 034a6afe8..000000000--- a/controller/src/main/java/org/openremote/controller/deploy/xml/ControllerElement.java+++ /dev/null@@ -1,45 +0,0 @@-package org.openremote.controller.deploy.xml;--import org.openremote.container.xml.DOMElement;-import org.w3c.dom.Element;--import javax.xml.xpath.XPath;--public class ControllerElement extends DOMElement<ControllerElement, ControllerElement> {-- public static final String XPATH_PREFIX = "c";-- public ControllerElement(XPath xpath, Element element) {- super(xpath, element);- }-- @Override- protected String prefix(String localName) {- return XPATH_PREFIX + ":" + localName;- }-- @Override- protected Builder<ControllerElement> createParentBuilder(DOMElement el) {- return new Builder<ControllerElement>(el) {- @Override- public ControllerElement build(Element element) {- return new ControllerElement(getXpath(), element);- }- };- }-- @Override- protected ArrayBuilder<ControllerElement> createChildBuilder(DOMElement el) {- return new ArrayBuilder<ControllerElement>(el) {- @Override- public ControllerElement[] newChildrenArray(int length) {- return new ControllerElement[length];- }-- @Override- public ControllerElement build(Element element) {- return new ControllerElement(getXpath(), element);- }- };- }-}diff --git a/controller/src/main/resources/logging.properties b/controller/src/main/resources/logging.propertiesdeleted file mode 100644index 00aa58ff9..000000000--- a/controller/src/main/resources/logging.properties+++ /dev/null@@ -1,28 +0,0 @@-# This configuration file is used in the Manager's Docker image, it's the default-# configuration we ship to users.--handlers=java.util.logging.ConsoleHandler--java.util.logging.ConsoleHandler.formatter=org.openremote.container.util.LogFormatter-java.util.logging.ConsoleHandler.level=FINEST--.level=INFO--org.openremote.level=FINEST-org.openremote.container.message.level=INFO--# Low-level debugging-org.hibernate.level=WARNING-com.zaxxer.hikari.level=WARNING-javax.management.level=WARNING-org.xnio.level=WARNING-org.apache.camel.management.level=WARNING-org.apache.camel.impl.converter.DefaultTypeConverter.level=WARNING--# Set this to FINEST to log outgoing HTTP traffic-org.apache.http.level=WARNING-org.apache.http.impl.conn.DefaultClientConnection.level=WARNING--# Set this to FINEST to log SQL execution-org.hibernate.SQL.level=FINEST-org.hibernate.type.descriptor.sql.BasicBinder.level=FINESTdiff --git a/controller/src/main/resources/org/openremote/controller/schemas/controller-2.0-M7.xsd b/controller/src/main/resources/org/openremote/controller/schemas/controller-2.0-M7.xsddeleted file mode 100644index b92df65af..000000000--- a/controller/src/main/resources/org/openremote/controller/schemas/controller-2.0-M7.xsd+++ /dev/null@@ -1,1181 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema"- xmlns = "http://www.openremote.org" targetNamespace = "http://www.openremote.org">-- <xsd:annotation>- <xsd:documentation><![CDATA[-- OpenRemote Controller XML Schema, version 2.0.- Authors: Juha Lindfors, Dan Cong, Javen Zhang.-- This defines the following:-- 1. device component: such as a switch or a slider... whose id is consistent with- the one in panel.xml- 2. status sensor : used to do polling to get current status of a device- 3. device command: such as "TV on", to support different device command protocol- 4. configuration: controller configuration properties-- ]]></xsd:documentation>- </xsd:annotation>-- <!--- =================================================================================================-- Top-level <openremote> tag-- =================================================================================================- -->- <xsd:element name = "openremote">- <xsd:annotation>- <xsd:documentation><![CDATA[-- The top level (typically root) element.-- The document is structured into four main sections: components, sensors, commands and- configuration.-- Components aggregate sets of commands and sensors into component level abstractions such- as switches, sliders, labels, and so on. These are directly mapped via their ID to their- corresponding panel UI widgets.-- Sensors abstract incoming events from devices, either through polling or listening to- devices that actively broadcast their state changes. Sensors are bound to components- that support displaying state changes via sensor's ID attribute. Sensors in this- revision support four distinct datatypes: boolean switches (on/off), arbitrary range- values (integers), a specific level range (integer between 0-100) and finite set of- custom state strings.-- Commands abstract device read and write requests to protocol level wire format. Commands- support set of properties that can be used to translate them to the desired protocol- payload or serialization format. Protocol integration and adding new protocols happens- via this abstraction.-- Configuration section are controller configuration properties that can be used to- change the behavior of the controller itself either by editing the configuration locally- or through online tools.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "components" />- <xsd:element ref = "sensors" />- <xsd:element ref = "commands" />- <xsd:element ref = "config" />- </xsd:sequence>- </xsd:complexType>-- <xsd:unique name="uniqueIdsAccrossWholeDocument">- <xsd:annotation>- <xsd:documentation><![CDATA[- Ensures that id field has unique value throught the whole document.- All such fields should be of type idType.- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:selector xpath=".//*"/>- <xsd:field xpath="@id"/>- </xsd:unique>- </xsd:element>---- <!--- =================================================================================================-- Section <components> tag-- =================================================================================================- -->- <xsd:element name = "components">- <xsd:annotation>- <xsd:documentation><![CDATA[-- A component collection which includes components such as button, switch,- gesture, label, etc.-- Each component is associated with an ID that is bound to a corresponding ID on the- panel UI via panel.xml definition. This ID is also exposed through the controller's- REST interface. Therefore, the panel definitions and implementations are independent- of the protocol details and mappings on the controller and operate purely on the- component ID (and to some extent, sensor ID) level of abstraction.-- Components aggregate protocol commands and sensors into a logical entity that can- also be referenced through the controller's rule and scripting interfaces.-- This element itself aggregates further component elements, i.e.-- <openremote ...>- <components>- <[component]>- ...- <[component]/>-- <[component]>- ...- <[component]/>-- <[component]>- ...- <[component]/>- </components>-- <sensors>- ...- </sensors>- ...- </openremote>-- Where [component] tags above are specific types of component elements, e.g. switch,- image, slider, label, etc.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:group ref = "componentGroup" minOccurs = "0" maxOccurs = "unbounded"></xsd:group>- </xsd:sequence>- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- Section <sensors> tag-- =================================================================================================- -->- <xsd:element name = "sensors">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Collection of sensors defined for the controller.-- Sensors operate on protocol handlers to execute read requests on devices to fetch the- current device state, either through polling commands (for 'passive' devices) or through- event listener implementations on devices that actively broadcast their state changes.-- A sensor can be bound to one or many components via its ID attribute. The currently held- in-memory state of the sensor can also be retrieved through controller's REST/XML/JSON- interface using the ID attribute.-- In the current controller revision, each polling sensor (passive devices) has an active- thread associated with it in the Java runtime. This facilitates concurrent retrieval of- device state. Sensors bound to event listeners do not create threads of their own but- the event listener implementations themselves are usually multi-threaded.-- This element itself groups all sensors in the controller, i.e.-- <openremote ...>- <components>- ...- </components>-- <sensors>- <sensor id = "nnn" name = "Sensor's human readable name"- type = "[switch|range|level|custom]">-- <include type = "command" ref = "nnn"/>-- <[property]/>- <[property]/>- </sensor>-- <sensor ...>- ...- </sensor>- </sensors>-- <commands>- ...- </commands>- ...- </openremote>-- Where in addition to an ID, each sensor has a (human-readable) name and a datatype.-- Sensors bind themselves to protocols via the command association through a child- <include> element. Whether a sensor is actively polling a device or actively listening- to device broadcasts depends on the protocol command implementation it is bound to.-- In addition, sensors may have specific list of property elements depending on its- datatype. For example, range-type sensors have additional propery elements <min> and- <max> that define the range boundaries. Custom-type sensors define a finite set of- states they may return via explicit <state> property elements.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "sensor" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- </xsd:complexType>- </xsd:element>--- <!--- =================================================================================================-- Section <commands> tag-- =================================================================================================- -->- <xsd:element name = "commands">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Commands represent protocol handlers that are used to bind actions through panel user- interfaces, scripts and rules to protocol-specific serialization or payload details.-- Commands are constructed as protocol-specific property lists where details of the- properties and their values are left to protocol implementers to resolve. A command- can represent either a read (poll) command or write command, an event listener, or some- other suitable protocol structure.-- Commands are bound to either sensors (read commands and event listeners) or to components- directly (write commands) through their ID referenced in the <include> of components- and sensors.-- This element itself groups all protocol handlers in the controller, i.e.-- <openremote ...>- ...- <sensors>- ...- </sensors>-- <commands>- <command id = "nnn" protocol = "protocol-id">- <property name = "property-name" value = "property-value"/>- <property name = "property-name" value = "property-value"/>- </command>-- <command id = "nnn" protocol = "protocol-id">- <property name = "property-name" value = "property-value"/>- <property name = "property-name" value = "property-value"/>- </command>-- <command id = "nnn" protocol = "protocol-id">- <property name = "property-name" value = "property-value"/>- <property name = "property-name" value = "property-value"/>- </command>- </commands>-- <config>- ...- </config>- </openremote>-- Where a "protocol-id" attribute uniquely identifies a protocol implementation, and- "property-name" and "property-value" attributes are name-value pairs that contain- protocol implementation-specific details.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "command" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- Identifier (component, sensor, command) definition.-- =================================================================================================- -->- <xsd:simpleType name = "idType">- <xsd:annotation>- <xsd:documentation><![CDATA[-- This is a unique natural number (upper bound 32-bit signed integer) identifier shared- by all types within a controller.xml document instance, including component IDs,- sensor IDs and command IDs.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:restriction base = "xsd:int">- <xsd:minInclusive value = "1"/>- </xsd:restriction>- </xsd:simpleType>-- <!--- =================================================================================================-- Component types (child element of <components>)-- =================================================================================================- -->- <xsd:group name = "componentGroup">- <xsd:annotation>- <xsd:documentation>- <![CDATA[-- Specific component definitions. Components aggregate protocol handling commands and- sensor into logical groups based on the type of the component. Component's ID is- directly bound to panel UI widget IDs at a logical level (but not exposing protocol- mapping details). Component definitions are also useful abstractions with the- scripting and rules used within the controller.-- Current revision supports the following types of components:-- 1. Switches - two write commands to set device to on/off, sensor for reading (boolean)- on/off state from device- 2. Slider - one write command to set device or property to a new (integer) value,- one sensor (range or level datatype) to read current device value- 3. Button - one write command to send a new value to device-- 4. Label - one sensor to display a text representation of a bound- sensor value- 5. Image - one sensor to display an image corresponding to a specified state value- returned by a sensor (switch-type sensor or custom sensor)- 6. ColorPicker - one write command to send a new value to device-- ]]>- </xsd:documentation>- </xsd:annotation>-- <xsd:choice>- <xsd:element ref = "switch" />- <xsd:element ref = "slider"/>- <xsd:element ref = "button"/>- <xsd:element ref = "label" />- <xsd:element ref = "gesture" />- <xsd:element ref = "image"/>- <xsd:element ref = "colorpicker"/>- </xsd:choice>- </xsd:group>----- <!--- =================================================================================================-- Switch Component (child element of <components>)-- =================================================================================================- -->- <xsd:element name = "switch">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Switch component is a two-state on/off switch with separate command sequences for- both 'on' and 'off' functionality and a configurable sensor to reflect the device's- current state.-- Both 'on' and 'off' command sequences may include multiple commands that are executed- in response to a switch state change. A sensor bound to a switch component must also- have 'switch' as its datatype.-- A switch component must have a controller unique integer identifier.-- An example of a switch component definition might look like this:-- <components>- <switch id = "nnn">- <on>- <include type = "command" ref = "nnn" />- <include type = "command" ref = "nnn" />- <include type = "command" ref = "nnn" />- </on>-- <off>- <include type = "command" ref = "nnn" />- </off>-- <include type = "sensor" ref = "nnn" />- </switch>- ...- </components>--- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "on" minOccurs = "1" maxOccurs = "1"/>- <xsd:element ref = "off" minOccurs = "1" maxOccurs = "1" />- <xsd:element ref = "include" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- <xsd:attribute name = "id" type = "idType" use = "required" />- </xsd:complexType>- </xsd:element>--- <!-- ===== SWITCH 'ON' OPERATION ===== -->-- <xsd:element name = "on">- <xsd:annotation>- <xsd:documentation><![CDATA[-- The 'on' operation of a switch. The contents can be one or more <include> and <delay>- elements that defines the sequence of write commands (and optional delays between- commands) that should be executed in response to a switch 'on' state change request.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:group ref = "macroGroup" />- </xsd:sequence>- </xsd:complexType>- </xsd:element>--- <!-- ===== SWITCH 'OFF' OPERATION ===== -->-- <xsd:element name = "off">- <xsd:annotation>- <xsd:documentation><![CDATA[-- The 'off' operation of a switch. The contents can be one or more <include> and <delay>- elements that defines the sequence of write commands (and optional delays between- commands) that should be executed in response to a switch 'off' state change request.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:group ref = "macroGroup" />- </xsd:sequence>- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- Slider Component (child element of <components>)-- =================================================================================================- -->- <xsd:element name = "slider">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Slider component can be used to send a range of integer values to a device depending- on slider state. Sliders can be 'active' in a sense that they can allow users to- actively change their value (usually through an UI widget that allows a new value to- be set), or passive ('read-only') in a sense that they only update and display current- sensor state without allowing user to make updates.-- The 'setValue' operation is used to reference a write command which sets a new device- value in response to a slider modification in the panel UI, or a script or rule in- the controller. A sensor bound using 'include' element to a slider component is- used to update the slider value in response to an event from a read command or event- listener.-- A slider component must have a controller unique integer identifier.-- An example of a slider component definition might look like this:-- <components>- <slider id = "nnn">- <setValue>- <include type = "command" ref = "nnn" />- </setValue>-- <include type = "sensor" ref = "nnn" />- </slider>- ...- </components>--- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "setValue" minOccurs = "0" maxOccurs = "unbounded"/>- <xsd:element ref = "include" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- <xsd:attribute name = "id" type = "idType" use = "required" />- </xsd:complexType>- </xsd:element>---- <!-- ===== SLIDER 'SETVALUE' OPERATION ===== -->-- <xsd:element name = "setValue">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Specifies one or more write commands (using a nested <include> elements) that is used- to update device(s) in response to a slider component update.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "include" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- Button Component (child element of <components>)-- =================================================================================================- -->- <xsd:element name = "button">- <xsd:annotation>- <xsd:documentation><![CDATA[-- A button component is a simple one-way component to send write commands to a device.- One or more commands may be sent in sequence, and delays can be used where necessary- between commands.-- A button component must have a controller unique integer identifier.-- An example button element is as follows:-- <components>- <button id = "nnn">- <include type = "command" ref = "nnn" />- <include type = "command" ref = "nnn" />- <delay>500</delay>- <include type = "command" ref = "nnn" />- </button>- ...- </components>-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:group ref = "macroGroup" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- <xsd:attribute name = "id" type = "idType" use = "required" />- </xsd:complexType>- </xsd:element>----- <!--- =================================================================================================-- ColorPicker Component (child element of <components>)-- =================================================================================================- -->- <xsd:element name="colorpicker">- <xsd:annotation>- <xsd:documentation><![CDATA[-- A color picker component is a simple one-way component to send write commands to a device.- One or more commands may be sent in sequence but no delays are allowed.-- A color picker component must have a controller unique integer identifier.-- An example color picker element is as follows:-- <components>- <colorpicker id = "nnn">- <include type = "command" ref = "nnn" />- <include type = "command" ref = "nnn" />- </colorpicker>- ...- </components>-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref="include" minOccurs="0" maxOccurs="unbounded"/>- </xsd:sequence>- <xsd:attribute name="id" type="idType" use="required" />- </xsd:complexType>- </xsd:element>----- <!--- =================================================================================================-- Label Component (child element of <components>)-- =================================================================================================- -->- <xsd:element name = "label">- <xsd:annotation>- <xsd:documentation><![CDATA[-- A 'label' component is controller-side representation of an UI label widget that may- be updated based on a sensor value.-- A label component may include a single 'sensor' type which is used as an input for- a dynamic UI labels content.-- A label component must have a controller unique integer identifier.-- An example label element is as follows:-- <components>- <label id = "nnn">- <include type = "sensor" ref = "nnn" />- </label>- ...- </components>-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "include" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- <xsd:attribute name = "id" type = "idType" use = "required" />- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- Image Component (child element of <components>)-- =================================================================================================- -->- <xsd:element name = "image">- <xsd:annotation>- <xsd:documentation><![CDATA[-- An 'image' component is controller-side representation of a panel UI image that may- be updated based on a sensor value.-- An image component may include a single 'sensor' type which is used as an input for- a dynamic UI image content.-- An image component must have a controller unique integer identifier.-- An example image element is as follows:-- <components>- <image id = "nnn">- <include type = "sensor" ref = "nnn" />- </image>- ...- </components>-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "include" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- <xsd:attribute name = "id" type = "idType" use = "required" />- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- Gesture (child element of <components>)-- =================================================================================================- -->- <xsd:element name = "gesture">- <xsd:annotation>- <xsd:documentation><![CDATA[-- A gesture component represents a command executed on the controller-side- in response to a user gesture on the panel UI.-- A gesture component must have a controller unique integer identifier.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:group ref = "macroGroup" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- <xsd:attribute name = "id" type = "idType" use = "required" />- </xsd:complexType>- </xsd:element>----- <!--- =================================================================================================-- Sensor definition (child element of <sensors>)-- =================================================================================================- -->- <xsd:element name = "sensor">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Sensor definition. Sensors abstract events of external device state, either through polling- (explicit device read requests) or through event listeners (listening for active device state- broadcasts).-- A sensor is bound to one or many components through its unique identifier. A sensor is- associated with a datatype that indicates the types of values it can return.-- The current revision supports following datatypes for sensors: switch, level,- range and custom state. Component types may place restrictions on what types of sensors- they can be associated with.-- Sensors are associated with an active thread in the Java runtime. Sensors associated with- read commands (polling) have a thread associated each. Sensors associated with event- listeners do not create active threads on behalf of the controller but often create- listening threads as part of the protocol implementation.-- Sensor state can be also retrieved directly through controller's REST API using the- sensor's unique identifier as key. See- http://www.openremote.org/display/docs/Controller+2.0+API+Documentation for additional- detail.-- A typical sensor element in a controller.xml document looks like this:-- ...- <sensors>- <sensor id = "nnn" type = "[switch|level|range|custom]" name = "Doorbell">- ...- </sensor>- </sensors>- ...-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:group ref = "sensorGroup" minOccurs = "0" maxOccurs = "unbounded" />- </xsd:sequence>- <xsd:attribute name = "id" type = "idType" use = "required" />- <xsd:attribute name = "type" type = "sensorType" use = "required" />- <xsd:attribute name = "name" type = "xsd:string" use = "required" />- </xsd:complexType>- </xsd:element>---- <!-- ===== SENSOR PROPERTIES ===== -->-- <xsd:group name="sensorGroup">- <xsd:annotation>- <xsd:documentation><![CDATA[-- A sensor may contain additional child elements that further defines its properties.- Sensor properties may be optional or mandatory depending the sensor's type.-- In addition, a sensor has an <include> element which references the 'event producer'- the sensor uses to collect its state values. An event producer is either a polling- read command or an event listener. Both types of event producers use the sensor's- unique identifier as a key to store device state to controller's in-memory state- cache.-- The following sensor properties are used with specified sensor types:-- 1. Switch sensor -- No mandatory additional sensor properties. May use <state> elements- to map "on" and "off" states to other values (for example to- "open" and "close" for a door sensor) which may in turn be bound to- a label component which is able to display customized values. This- state mapping mechanism may also be used to translate textual- descriptions of the switch state to localized languages.-- 2. Range sensor -- Mandatory <min> and <max> elements are used to define the boundary- values of the range sensor.-- 3. Level sensor -- No additional sensor properties. Has an implicit range of [0-100]- to which the device range values are scaled to.-- 4. Custom sensor -- Maps specific state values from device to an alternative values- exposed to panels via a <state> elements-- ]]></xsd:documentation>- </xsd:annotation>- <xsd:choice>- <xsd:element ref = "include" minOccurs = "0" maxOccurs = "unbounded" />- <xsd:element ref = "state" minOccurs = "0" maxOccurs = "unbounded" />- <xsd:element ref = "min" minOccurs = "0" maxOccurs = "1" />- <xsd:element ref = "max" minOccurs = "0" maxOccurs = "1" />- </xsd:choice>- </xsd:group>--- <!-- Sensor <min> property -->-- <xsd:element name = "min">- <xsd:annotation>- <xsd:documentation><![CDATA[-- The <min> property defines the lower boundary of a range. Valid (and mandatory)- for range-type sensors.-- An example of a range sensor definition:-- ...- <sensors>- <sensor id = "nnn" name = "Outdoor Temp" type = "range">- <min value = "-50"/>- <max value = "50"/>- <include type = "command" ref = "mmm"/>- </sensor>- </sensors>- ...-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:attribute name = "value" type = "xsd:int" use = "required" />- </xsd:complexType>- </xsd:element>--- <!-- Sensor <max> property -->-- <xsd:element name = "max">- <xsd:annotation>- <xsd:documentation><![CDATA[-- The <max> property defines the upper boundary of a range. Valid (and mandatory)- for range-type sensors.-- An example of a range sensor definition:-- ...- <sensors>- <sensor id = "nnn" name = "Outdoor Temp" type = "range">- <min value = "-50"/>- <max value = "50"/>-- <include type = "command" ref = "mmm"/>- </sensor>- </sensors>- ...-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:attribute name = "value" type = "xsd:int" use = "required" />- </xsd:complexType>- </xsd:element>--- <!-- Sensor <state> property -->-- <xsd:element name = "state">- <xsd:annotation>- <xsd:documentation><![CDATA[-- The <state> property defines a finite set of explicit state values that a custom-state- sensor may return. If a value is also defined then the sensor's return values are mapped- to the state names as well. This can be used for mapping explicit state values to more- human-consumable values for the panel UI for example, or as a translation mechanism for- localized interfaces.-- When both name and value attributes are defined in a <state> element, it can also be used- with a switch-type sensor to translate the usual on/off values to other values.-- An example of a custom-type sensor is as follows:-- ...- <sensors>- <sensor id = "nnn" name = "Cloud Report" type = "custom">- <state name = "Rain Clouds"/>- <state name = "Cloudy"/>- <state name = "Partly Cloudy"/>- <state name = "Sunny"/>-- <include type = "command" ref = "mmm"/>- </sensor>- </sensors>- ...-- Where in the above example, the sensor accepts four distinct values from the referenced- event producer (read command or event listener).-- A mapping sensor could be used as follows:-- ...- <sensors>- <sensor id = "nnn" name = "Cloud Report" type = "custom">- <state name = "Rain Clouds" value = "1" />- <state name = "Cloudy" value = "2" />- <state name = "Partly Cloudy" value = "3" />- <state name = "Sunny" value = "4" />-- <include type = "command" ref = "mmm"/>- </sensor>- </sensors>- ...-- In the example above, the event producer returns values ranging from one to four which- are then mapped to descriptive string values in the controller's in-memory device state- cache. This sensor with descriptive string values can then be bound to a label- component in the panel UI, for example, allowing it to display user-friendly description- of the data returned by the event producers.-- Finally, the same mechanism can be used to translate events from event producers, in- this case from a boolean switch sensor :-- ...- <sensors>- <sensor id = "nnn" name = "Localized Door Sensor" type = "switch">- <state name = "Ouvert" value = "on" />- <state name = "Ferme" value = "off" />-- <include type = "command" ref = "mmm"/>- </sensor>- </sensors>- ...-- Note that the event processing chain in the controller's in-memory state cache can- be used for similar effect and for more complex processing use-cases. Also bear in- mind that UI rendering components bound to such sensor must support the known state- strings or arbitrary state strings.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:attribute name = "name" use = "required" />- <xsd:attribute name = "value" use = "optional" />- </xsd:complexType>- </xsd:element>---- <!-- ===== SENSOR DATATYPES ===== -->-- <xsd:simpleType name = "sensorType">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Sensor data type definitions:-- 1) Switch: returns boolean 'on' or 'off' strings- 2) Level: An integer value as a string that is scaled to an implicit range of [0-100]- 3) Range: Integer value as a string within a given boundary range- 5) Custom: A customized finite set of state strings-- ]]>- </xsd:documentation>- </xsd:annotation>-- <xsd:restriction base = "xsd:string">- <xsd:enumeration value = "switch" />- <xsd:enumeration value = "level" />- <xsd:enumeration value = "range" />- <xsd:enumeration value = "color" />- <xsd:enumeration value = "custom" />- </xsd:restriction>- </xsd:simpleType>----- <!--- =================================================================================================-- Protocol Handler (Command) definition (child element of <commands>)-- =================================================================================================- -->- <xsd:element name = "command">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Defines a protocol handler (command). Commands are created to handle protocol specific- behavior when necessary to invoke either from sensors or components. Commands can- represent device write requests, device state read requests or other protocol specific- functionality, as necessary (for example, event listeners).-- A command has a mandatory per controller unique identifier that is used to bind it to- sensors and components. A single command definition can be bound to multiple components- and sensors.-- Command also has a protocol identifier which is used to map its implementation to an- appropriate protocol in the controller. The valid values for 'protocol' attribute- depend on the controller's configuration -- which protocols have been installed and- what protocol identifiers they use.-- A generic form of a <command> element in a controller.xml document is therefore:-- <command id = "nnn" protocol = "protocol-id">- <property ... />- <property ... />- ...- </command>-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "property" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:sequence>- <xsd:attribute name = "id" type = "idType" use = "required" />- <xsd:attribute name = "protocol" type = "xsd:string" use = "required"/>- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- INCLUDE ELEMENT-- =================================================================================================- -->- <xsd:element name="include">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Include element is used by components and sensors to reference to other components,- sensors or protocol handlers (commands).-- The 'type' attribute indicates what type of component is being included or referenced.- Currently valid values are either 'sensor' or 'command'.-- The 'ref' attribute must be the unique identifier of the referenced component or command.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:attribute name = "type" type = "xsd:string" />- <xsd:attribute name = "ref" type = "idType" />- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- PROPERTY ELEMENT-- =================================================================================================- -->- <xsd:element name = "property">- <xsd:annotation>- <xsd:documentation><![CDATA[-- Property element is used for setting protocol handler (command) properties, controller- configuration properties, etc.-- Property element is a name-value pair where name attributes are strings and value- attributes are string representations of datatypes (another string, integer as- string, etc.)-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:attribute name = "name" type = "xsd:string" use = "required" />- <xsd:attribute name = "value" type = "xsd:string" use = "required" />- </xsd:complexType>- </xsd:element>---- <!--- =================================================================================================-- Macro group definition.-- =================================================================================================- -->- <xsd:group name = "macroGroup">- <xsd:annotation>- <xsd:documentation><![CDATA[-- A macro group defines a sequence of write commands (and optionally delays) that are- executed in response to a component invocation for components that support macro- inclusion.-- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:choice>- <xsd:element ref = "delay" minOccurs = "0" maxOccurs = "unbounded"/>- <xsd:element ref = "include" minOccurs = "0" maxOccurs = "unbounded"/>- </xsd:choice>- </xsd:group>--- <!--- =================================================================================================-- DELAY ELEMENT-- =================================================================================================- -->- <xsd:element name = "delay" type = "xsd:int" >- <xsd:annotation>- <xsd:documentation><![CDATA[-- Defines a delay in milliseconds that can be used in a macro sequence.-- ]]></xsd:documentation>- </xsd:annotation>- </xsd:element>----- <!--- =================================================================================================-- Section <config> tag-- =================================================================================================- -->- <xsd:element name="config">- <xsd:annotation>- <xsd:documentation><![CDATA[-- The <config> section is used to override default system configurations of controller--- ]]></xsd:documentation>- </xsd:annotation>-- <xsd:complexType>- <xsd:sequence>- <xsd:element ref = "property" minOccurs = "0" maxOccurs = "unbounded" />- </xsd:sequence>- </xsd:complexType>- </xsd:element>--</xsd:schema>diff --git a/controller/webconsole.war b/controller/webconsole.wardeleted file mode 100644index b9de495de..000000000Binary files a/controller/webconsole.war and /dev/null differdiff --git a/gradle.properties b/gradle.propertiesindex 8bc6cc10e..ad088b0ad 100644--- a/gradle.properties+++ b/gradle.properties@@ -24,16 +24,12 @@ sqliteVersion = 3.8.11.2hibernateVersion = 5.2.2.FinalhibernateValidatorVersion = 5.2.3.FinalpostgresJdbcVersion = 9.4.1209-mariadbJdbcVersion = 1.5.5hikaricpVersion = 2.4.3junitVersion = 4.12spockVersion = 1.0-groovy-2.4objenesisVersion = 2.2camelVersion = 2.16.2tyrusVersion = 1.10-geojsonJacksonVersion = 1.6# Explicit dependency can be removed with Camel 2.18.x, then AHC 2.x is the defaultahcVersion = 1.9.39-flexjsonVersion = 2.1-springVersion = 3.1.1.RELEASEsunriseSunsetCalculatorVersion = 1.2diff --git a/base/keycloak/Dockerfile b/keycloak/Dockerfilesimilarity index 100%rename from base/keycloak/Dockerfilerename to keycloak/Dockerfilediff --git a/base/keycloak/Dockerfile-dev b/keycloak/Dockerfile-devsimilarity index 100%rename from base/keycloak/Dockerfile-devrename to keycloak/Dockerfile-devdiff --git a/base/keycloak/build.gradle b/keycloak/build.gradlesimilarity index 100%rename from base/keycloak/build.gradlerename to keycloak/build.gradlediff --git a/base/keycloak/changeDatabase.xsl b/keycloak/changeDatabase.xslsimilarity index 100%rename from base/keycloak/changeDatabase.xslrename to keycloak/changeDatabase.xsldiff --git a/base/keycloak/keycloak-server-json-dev.jq b/keycloak/keycloak-server-json-dev.jqsimilarity index 100%rename from base/keycloak/keycloak-server-json-dev.jqrename to keycloak/keycloak-server-json-dev.jqdiff --git a/base/keycloak/module.xml b/keycloak/module.xmlsimilarity index 100%rename from base/keycloak/module.xmlrename to keycloak/module.xmldiff --git a/base/keycloak/setProxyForwarding.xsl b/keycloak/setProxyForwarding.xslsimilarity index 100%rename from base/keycloak/setProxyForwarding.xslrename to keycloak/setProxyForwarding.xsldiff --git a/base/keycloak/theme/account/account.ftl b/keycloak/theme/account/account.ftlsimilarity index 100%rename from base/keycloak/theme/account/account.ftlrename to keycloak/theme/account/account.ftldiff --git a/base/keycloak/theme/account/password.ftl b/keycloak/theme/account/password.ftlsimilarity index 100%rename from base/keycloak/theme/account/password.ftlrename to keycloak/theme/account/password.ftldiff --git a/base/keycloak/theme/account/template.ftl b/keycloak/theme/account/template.ftlsimilarity index 100%rename from base/keycloak/theme/account/template.ftlrename to keycloak/theme/account/template.ftldiff --git a/base/keycloak/theme/account/theme.properties b/keycloak/theme/account/theme.propertiessimilarity index 100%rename from base/keycloak/theme/account/theme.propertiesrename to keycloak/theme/account/theme.propertiesdiff --git a/base/keycloak/theme/login/login.ftl b/keycloak/theme/login/login.ftlsimilarity index 100%rename from base/keycloak/theme/login/login.ftlrename to keycloak/theme/login/login.ftldiff --git a/base/keycloak/theme/login/template.ftl b/keycloak/theme/login/template.ftlsimilarity index 100%rename from base/keycloak/theme/login/template.ftlrename to keycloak/theme/login/template.ftldiff --git a/base/keycloak/theme/login/theme.properties b/keycloak/theme/login/theme.propertiessimilarity index 100%rename from base/keycloak/theme/login/theme.propertiesrename to keycloak/theme/login/theme.propertiesdiff --git a/base/keycloak/wait-for-it.sh b/keycloak/wait-for-it.shsimilarity index 100%rename from base/keycloak/wait-for-it.shrename to keycloak/wait-for-it.shdiff --git a/base/postgres/Dockerfile b/postgres/Dockerfilesimilarity index 100%rename from base/postgres/Dockerfilerename to postgres/Dockerfilediff --git a/base/postgres/build.gradle b/postgres/build.gradlesimilarity index 74%rename from base/postgres/build.gradlerename to postgres/build.gradleindex ab5008a88..507ce4509 100644--- a/base/postgres/build.gradle+++ b/postgres/build.gradle@@ -1,12 +1,12 @@import com.bmuschko.gradle.docker.tasks.image.*-task buildBaseImage(type: DockerBuildImage) {+task buildImage(type: DockerBuildImage) {inputDir = projectDirdockerFile = file("$projectDir/Dockerfile")tag = dockerImageName}task pushImage(type: DockerPushImage) {- dependsOn buildBaseImage+ dependsOn buildImageimageName = dockerImageName}\ No newline at end of filediff --git a/base/postgres/scripts/01-init-user.sh b/postgres/scripts/01-init-user.shsimilarity index 100%rename from base/postgres/scripts/01-init-user.shrename to postgres/scripts/01-init-user.shdiff --git a/base/postgres/scripts/02-init-postgis.sh b/postgres/scripts/02-init-postgis.shsimilarity index 100%rename from base/postgres/scripts/02-init-postgis.shrename to postgres/scripts/02-init-postgis.shdiff --git a/profile/README.md b/profile/README.mdindex 63c13b1b1..096487323 100644--- a/profile/README.md+++ b/profile/README.md@@ -1,5 +1,7 @@# OpenRemote Deployment Profiles+TODO: This doc is outdated+Mix and match these [Docker Compose](https://docs.docker.com/compose/) configurations to customize an OpenRemote system.## Configuring securitydiff --git a/profile/ccs.yml b/profile/ccs.ymldeleted file mode 100644index ce6d2c62a..000000000--- a/profile/ccs.yml+++ /dev/null@@ -1,49 +0,0 @@-#-# Controller Commmand Service (Remote Proxy)-#-# This profile requires dependencies:-#-# - mysql-#-# Create a RUN CONFIGURATION in your IDE:-#-# --version: '2'-services:-- controller:- build:- context: ../../controller- environment:- TZ: "Europe/Zurich"- JAVA_OPTS: -Djavax.net.ssl.trustStore=\/opt\/OpenRemote-Controller\/truststore.jks -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n- SSL_KEY_STORE_PASSWORD: "CHANGE_ME_SSL_KEY_STORE_PASSWORD"- SSL_DISABLE_HOSTNAME_VERIFICATION: "true"- BEEHIVE_REMOTE_SERVICE_URI: "https://ccs:8443/ccs/rest"- CONTROLLER_CONSOLE_THRESHOLD: "INFO"- links:- - ccs- ports:- - "8688:8688"- - "8000:8000"-- ccs:- build:- context: ../../beehive/ccs- environment:- BEEHIVE_DB_USERNAME: "openremote"- BEEHIVE_DB_PASSWORD: "CHANGE_ME_DB_USER_PASSWORD"- BEEHIVE_DB_DRIVER: "com.mysql.jdbc.Driver"- BEEHIVE_DB_URL: "jdbc:mysql://mysql:3306/openremote"- SSL_KEY_STORE_PASSWORD: "CHANGE_ME_SSL_KEY_STORE_PASSWORD"- TOMCAT_DEBUG: "true"- JPDA_ADDRESS: "5005"- JPDA_SUSPEND: "n"- links:- - mysql- ports:- - "8443:8443"- - "5005:5005"- # TODO Why is this necessary? Is CCS connecting with itself?- extra_hosts:- - "ccs:127.0.0.1"diff --git a/profile/dependencies/mysql.yml b/profile/dependencies/mysql.ymldeleted file mode 100644index d1f645d02..000000000--- a/profile/dependencies/mysql.yml+++ /dev/null@@ -1,19 +0,0 @@-#-# MySQL database service(s)-#-version: '2'-services:-- mysql:- build:- context: ../../base/mysql- environment:- TZ: "Europe/Zurich"- # This is the database superuser- MYSQL_ROOT_PASSWORD: "CHANGE_ME_DB_ROOT_PASSWORD"- # Create default database when started (see scripts)- MYSQL_DATABASE: openremote- MYSQL_USER: openremote- MYSQL_PASSWORD: "CHANGE_ME_DB_USER_PASSWORD"- ports:- - "3306:3306"\ No newline at end of filediff --git a/settings.gradle b/settings.gradleindex 6a12b87b0..ea5f142a1 100644--- a/settings.gradle+++ b/settings.gradle@@ -1,11 +1,9 @@rootProject.name = "openremote"-include "base:postgres",- "base:mysql",- "base:keycloak",+include "postgres",+ "keycloak","container",- "controller",- "beehive:ccs",+ "agent","manager:shared","manager:server","manager:client",