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
Migrated to Docker community edition, minor bugs fixed
Christian Bauer872868e1f6e7
diff --git a/README.md b/README.mdindex 03d8e2e71..bfb9681e6 100644--- a/README.md+++ b/README.md@@ -14,13 +14,13 @@ If you want to try OpenRemote v2, [read the OpenRemote v2 documentation](https:/We work with Java, Groovy, JavaScript, Gradle, Docker, and a wide range of APIs and protocol implementations. Clone or checkout this project and send us pull requests.-A demo preview can be started with Docker Compose (install [Docker Toolbox](https://www.docker.com/products/docker-toolbox)):+A demo preview can be started with Docker Compose (install [Docker Community Edition](https://www.docker.com/)):```docker-compose -p openremote -f profile/demo.yml up```-Access the manager UI and API on https://192.168.99.100/ with username `admin` and password `secret`. Configuration options of the images are documented in the compose profiles.+Access the manager UI and API on https://localhost/ with username `admin` and password `secret` (accept the 'insecure' self-signed SSL certificate). Configuration options of the images are documented in the compose profiles.You can build the Docker images from source with:diff --git a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java b/container/src/main/java/org/openremote/container/persistence/PersistenceService.javaindex c50248d2b..f7ffb65b1 100644--- a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java+++ b/container/src/main/java/org/openremote/container/persistence/PersistenceService.java@@ -47,7 +47,7 @@ public class PersistenceService implements ContainerService {public static final String DATABASE_PRODUCT = "DATABASE_PRODUCT";public static final String DATABASE_PRODUCT_DEFAULT = Database.Product.POSTGRES.name();public static final String DATABASE_CONNECTION_URL = "DATABASE_CONNECTION_URL";- public static final String DATABASE_CONNECTION_URL_DEFAULT = "jdbc:postgresql://192.168.99.100:5432/openremote";+ public static final String DATABASE_CONNECTION_URL_DEFAULT = "jdbc:postgresql://localhost:5432/openremote";public static final String DATABASE_USERNAME = "DATABASE_USERNAME";public static final String DATABASE_USERNAME_DEFAULT = "openremote";public static final String DATABASE_PASSWORD = "DATABASE_PASSWORD";diff --git a/container/src/main/java/org/openremote/container/security/IdentityService.java b/container/src/main/java/org/openremote/container/security/IdentityService.javaindex ff54a0aac..40dd07ca2 100644--- a/container/src/main/java/org/openremote/container/security/IdentityService.java+++ b/container/src/main/java/org/openremote/container/security/IdentityService.java@@ -71,7 +71,7 @@ public abstract class IdentityService implements ContainerService {public static final int IDENTITY_SESSION_TIMEOUT_SECONDS_DEFAULT = 10800; // 3 hourspublic static final String KEYCLOAK_HOST = "KEYCLOAK_HOST";- public static final String KEYCLOAK_HOST_DEFAULT = "192.168.99.100";+ public static final String KEYCLOAK_HOST_DEFAULT = "localhost";public static final String KEYCLOAK_PORT = "KEYCLOAK_PORT";public static final int KEYCLOAK_PORT_DEFAULT = 8081;public static final String KEYCLOAK_CONNECT_TIMEOUT = "KEYCLOAK_CONNECT_TIMEOUT";diff --git a/manager/client/src/main/java/org/openremote/manager/client/assets/attributes/AttributesView.java b/manager/client/src/main/java/org/openremote/manager/client/assets/attributes/AttributesView.javaindex 451ec74d8..ecaccf503 100644--- a/manager/client/src/main/java/org/openremote/manager/client/assets/attributes/AttributesView.java+++ b/manager/client/src/main/java/org/openremote/manager/client/assets/attributes/AttributesView.java@@ -351,7 +351,7 @@ public abstract class AttributesView<AttributeEditor attributeEditor;if (attributeType == AttributeType.STRING || attributeType.getValueType() == ValueType.STRING) {attributeEditor = createStringEditor(attribute, defaultValueItem, style, formGroup);- } else if (attributeType == AttributeType.NUMBER) {+ } else if (attributeType == AttributeType.NUMBER || attributeType.getValueType() == ValueType.NUMBER) {attributeEditor = createNumberEditor(attribute, defaultValueItem, style, formGroup);} else if (attributeType == AttributeType.BOOLEAN || attributeType.getValueType() == ValueType.BOOLEAN) {attributeEditor = createBooleanEditor(attribute, defaultValueItem, style, formGroup);diff --git a/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties b/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.propertiesindex 4bba102e4..b3d2bb3b2 100644--- a/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties+++ b/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties@@ -207,7 +207,7 @@ attributeType[FLOW_CMPS]=Flow in cubic metres per secondattributeType[FLOW_SCCM]=Flow in cubic centimetres per minuteattributeType[FLOW_CFPS]=Flow in cubic feet per secondattributeType[FLOW_GPM]=Flow in gallons per minute-attributeType[TEMPLATE_FILTER]=Template filter+attributeType[RULES_TEMPLATE_FILTER]=Rules template filteremptyMetaItem=Empty iteminvalidAssetAttributes=Invalid asset attributes, please correct input.validationFailed=Validation faileddiff --git a/manager/server/src/main/java/org/openremote/manager/server/rules/RulesEngine.java b/manager/server/src/main/java/org/openremote/manager/server/rules/RulesEngine.javaindex 9ddc97f48..aadcd1ba0 100644--- a/manager/server/src/main/java/org/openremote/manager/server/rules/RulesEngine.java+++ b/manager/server/src/main/java/org/openremote/manager/server/rules/RulesEngine.java@@ -51,6 +51,7 @@ import org.openremote.manager.server.concurrent.ManagerExecutorService;import org.openremote.manager.server.notification.NotificationService;import org.openremote.manager.server.security.ManagerIdentityService;import org.openremote.model.asset.*;+import org.openremote.model.attribute.AttributeType;import org.openremote.model.rules.AssetRuleset;import org.openremote.model.rules.GlobalRuleset;import org.openremote.model.rules.Ruleset;@@ -75,6 +76,8 @@ import java.util.logging.Level;import java.util.logging.Logger;import java.util.stream.Collectors;+import static org.openremote.model.attribute.Attribute.isAttributeTypeEqualTo;+public class RulesEngine<T extends Ruleset> {public static final Logger LOG = Logger.getLogger(RulesEngine.class.getName());@@ -775,7 +778,7 @@ public class RulesEngine<T extends Ruleset> {throw new IllegalStateException("Template asset not found: " + templateAssetId);List<TemplateFilter> filters = templateAsset.getAttributesStream()- .filter(AssetAttribute::isRuleStateTemplateFilter)+ .filter(isAttributeTypeEqualTo(AttributeType.RULES_TEMPLATE_FILTER)).map(attribute -> new Pair<>(attribute.getName(), attribute.getValue())).filter(pair -> pair.key.isPresent() && pair.value.isPresent()).map(pair -> new Pair<>(pair.key.get(), pair.value.get()))diff --git a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoSetup.java b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoSetup.javaindex bb271b504..795c9cd6b 100644--- a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoSetup.java+++ b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoSetup.java@@ -680,7 +680,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {flightPriorityFilters.setAttributes(new AssetAttribute("originSwitzerland",- TEMPLATE_FILTER,+ RULES_TEMPLATE_FILTER,new TemplateFilter(new AttributeValueConstraintPattern("originCountry", new AttributeValueConstraint(ValueComparator.EQUALS_IGNORE_CASE, Values.create("switzerland"))@@ -690,8 +690,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {)).toModelValue()).setMeta(- new MetaItem(LABEL, Values.create("Origin Switzerland")),- new MetaItem(RULE_TEMPLATE_FILTER, Values.create(true))+ new MetaItem(LABEL, Values.create("Filter Origin Switzerland"))));flightPriorityFilters = assetStorageService.merge(flightPriorityFilters);diff --git a/model/src/main/java/org/openremote/model/asset/AssetAttribute.java b/model/src/main/java/org/openremote/model/asset/AssetAttribute.javaindex 1425207ab..5bf5f8aca 100644--- a/model/src/main/java/org/openremote/model/asset/AssetAttribute.java+++ b/model/src/main/java/org/openremote/model/asset/AssetAttribute.java@@ -320,15 +320,6 @@ public class AssetAttribute extends Attribute {getMeta().removeIf(isMetaNameEqualTo(RULE_STATE));}}-- public boolean isRuleStateTemplateFilter() {- return getMetaStream()- .filter(isMetaNameEqualTo(RULE_TEMPLATE_FILTER))- .findFirst()- .map(metaItem -> metaItem.getValueAsBoolean().orElse(false))- .orElse(false);- }-public boolean isRuleEvent() {return getMetaStream().filter(isMetaNameEqualTo(RULE_EVENT))diff --git a/model/src/main/java/org/openremote/model/asset/AssetMeta.java b/model/src/main/java/org/openremote/model/asset/AssetMeta.javaindex 9aaaabe57..76a4b63dc 100644--- a/model/src/main/java/org/openremote/model/asset/AssetMeta.java+++ b/model/src/main/java/org/openremote/model/asset/AssetMeta.java@@ -23,8 +23,6 @@ import org.openremote.model.HasUniqueResourceName;import org.openremote.model.ValidationFailure;import org.openremote.model.attribute.AttributeExecuteStatus;import org.openremote.model.attribute.MetaItem;-import org.openremote.model.rules.Ruleset;-import org.openremote.model.rules.template.TemplateFilter;import org.openremote.model.util.Pair;import org.openremote.model.value.Value;import org.openremote.model.value.ValueType;@@ -149,15 +147,6 @@ public enum AssetMeta implements HasUniqueResourceName {*/RULE_EVENT_EXPIRES(ASSET_META_NAMESPACE + ":ruleEventExpires", new Access(true, false, true), ValueType.STRING),- /**- * When {@link Ruleset#templateAssetId} references an asset, use the attribute to customize the template when- * the ruleset is deployed. The attribute name is available in the template as parameter {@link- * TemplateFilter#TEMPLATE_PARAM_FILTER_NAME}, the attribute value is converted into {@link TemplateFilter} and- * available in the template as {@link TemplateFilter#TEMPLATE_PARAM_ASSET_STATE} and- * {@link TemplateFilter#TEMPLATE_PARAM_ASSET_EVENT}.- */- RULE_TEMPLATE_FILTER(ASSET_META_NAMESPACE + ":ruleTemplateFilter", new Access(true, false, true), ValueType.BOOLEAN),-/*** Enable flag to be used by asset attributes that could require this functionality (e.g. {@link org.openremote.model.asset.agent.ProtocolConfiguration})*/diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeType.java b/model/src/main/java/org/openremote/model/attribute/AttributeType.javaindex 7c4e2e4f4..3e55fd732 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeType.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeType.java@@ -20,6 +20,8 @@package org.openremote.model.attribute;import org.openremote.model.ValidationFailure;+import org.openremote.model.rules.Ruleset;+import org.openremote.model.rules.template.TemplateFilter;import org.openremote.model.value.Value;import org.openremote.model.value.ValueType;import org.openremote.model.value.Values;@@ -47,7 +49,14 @@ public enum AttributeType {BOOLEAN(ValueType.BOOLEAN, value -> Optional.empty()),- TEMPLATE_FILTER(ValueType.ARRAY, value -> Optional.empty()),+ /**+ * When {@link Ruleset#templateAssetId} references an asset, use the attribute to customize the+ * template when the ruleset is deployed. The attribute name is available in the template as+ * parameter {@link TemplateFilter#TEMPLATE_PARAM_FILTER_NAME}, the attribute value is converted+ * into {@link TemplateFilter} and available in the template as+ * {@link TemplateFilter#TEMPLATE_PARAM_ASSET_STATE} and {@link TemplateFilter#TEMPLATE_PARAM_ASSET_EVENT}.+ */+ RULES_TEMPLATE_FILTER(ValueType.ARRAY, value -> Optional.empty()),PERCENTAGE(ValueType.NUMBER, value -> Values.getNumber(value).filter(number -> number < 0 || number > 100)diff --git a/profile/demo.yml b/profile/demo.ymlindex c79b8f60a..bac031b3d 100644--- a/profile/demo.yml+++ b/profile/demo.yml@@ -71,9 +71,8 @@ services:#SETUP_KEYCLOAK_EMAIL_FROM: '[email protected]'# The public host name of this OpenRemote installation. This name is used in bearer tokens- # and must be the name you access the web services under. If you are using Docker Toolbox,- # this is the IP of a virtual machine running the Linux Docker host (see VirtualBox).- IDENTITY_NETWORK_HOST: 192.168.99.100+ # and must be the name you access the web services under.+ IDENTITY_NETWORK_HOST: localhost# Set if SSL is enabled on the frontend reverse proxy and all internal proxies should assume httpsIDENTITY_NETWORK_SECURE: 'true'diff --git a/profile/manager_dev.yml b/profile/manager_dev.ymlindex a4231688e..6512b1113 100644--- a/profile/manager_dev.yml+++ b/profile/manager_dev.yml@@ -12,7 +12,7 @@ services:environment:TZ: Europe/ZurichDEV_MODE: 'true'- IDENTITY_NETWORK_HOST: 192.168.99.100+ IDENTITY_NETWORK_HOST: localhostIDENTITY_NETWORK_WEBSERVER_PORT: 443IDENTITY_NETWORK_SECURE: 'true'KEYCLOAK_HOST: keycloak