Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Updated demo configuration

Christian Bauer5cede9108b7c
diff --git a/.gitignore b/.gitignore
index 419a2af46..2d5de10e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ bin/
*.ipr
*.iws
.idea/
+.local/
*~
manager/.factorypath
diff --git a/README.md b/README.md
index bf55138a7..d7475f890 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ function dcleanup(){
For authentication and authorization we are using [Keycloak](http://keycloak.jboss.org/).
-We are using the PostgreSQL as a database backend. Test and sample data will be installed fresh every time you start the services. Note that this is not suitable for a production configuration!
+We are using PostgreSQL as a database backend. Test and demo data will be installed fresh every time you start the services. Note that this is not suitable for a production configuration!
To access the database directly with an SQL console, run:
@@ -49,7 +49,7 @@ docker exec -it openremote_postgres_dev_1 su -s /bin/sh - postgres -c "sh -c 'ps
All services required for development can be deployed with Docker Compose, configured in `docker-compose.yml`. Execute `docker-compose up` in the project root to download required images (this might take a while and give no feedback) and run containers.
-The default configuration of all `*Service` classes is for host IP `192.168.99.100`. If this is not your Docker host IP, you must set various environment variables (see [Quickstart](https://raw.githubusercontent.com/openremote/openremote/master/docker-compose-quickstart.yml)).
+The default configuration of all `*Service` classes is for host IP `192.168.99.100`. If this is not your Docker host IP, you must set various environment variables (see [Demo](https://raw.githubusercontent.com/openremote/openremote/master/docker-compose-demo.yml)).
### Run GWT code server
@@ -103,6 +103,6 @@ You can extract smaller tilesets with the following procedure:
Build Docker images with `./gradlew clean buildImage`. Remove old images before if you don't want to use the Docker build cache.
-You can start and test these images with the `docker-compose-quickstart.yml` configuration.
+You can start and test these images with the `docker-compose-demo.yml` configuration.
You can also directly build and push the image to our [Docker Hub Account](https://hub.docker.com/u/openremote/): `/gradlew clean pushImage -PdockerHubUsername=username -PdockerHubPassword=secret`
diff --git a/connector/controller2/src/main/java/org/openremote/agent/controller2/Controller2Adapter.java b/connector/controller2/src/main/java/org/openremote/agent/controller2/Controller2Adapter.java
index a021b0c37..46a485c4d 100644
--- a/connector/controller2/src/main/java/org/openremote/agent/controller2/Controller2Adapter.java
+++ b/connector/controller2/src/main/java/org/openremote/agent/controller2/Controller2Adapter.java
@@ -59,7 +59,7 @@ public class Controller2Adapter {
}
public Controller2Adapter(URL url, String username, String password, Controller controller) {
- LOG.info("Creating adapter: " + url);
+ LOG.fine("Creating adapter: " + url);
this.url = url;
this.username = username;
this.password = password;
@@ -122,7 +122,7 @@ public class Controller2Adapter {
}
public synchronized void close() {
- LOG.info("Closing adapter: " + url);
+ LOG.fine("Closing adapter: " + url);
if (controller != null) {
forceDisconnect = true;
try {
@@ -148,7 +148,7 @@ public class Controller2Adapter {
// Push connection task onto separate thread to avoid blocking the caller when delaying reconnection
connectionScheduler.schedule(
() -> {
- LOG.info("Connecting to controller: " + url);
+ LOG.fine("Connecting to controller: " + url);
controller.connect(connectCallback);
},
doDelay ? RECONNECT_DELAY_SECONDS : 0L,
diff --git a/container/src/main/java/org/openremote/container/Container.java b/container/src/main/java/org/openremote/container/Container.java
index 154c5e6da..6067b35e0 100644
--- a/container/src/main/java/org/openremote/container/Container.java
+++ b/container/src/main/java/org/openremote/container/Container.java
@@ -30,6 +30,8 @@ import org.openremote.container.json.ElementalJsonModule;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
@@ -41,15 +43,27 @@ import java.util.stream.StreamSupport;
public class Container {
public static final Logger LOG;
+ public static final String LOGGING_CONFIG_FILE = "LOGGING_CONFIG_FILE";
static {
+ // If no JUL configuration is provided
if (System.getProperty("java.util.logging.config.file") == null) {
- try (InputStream is = Container.class.getClassLoader().getResourceAsStream("logging.properties")) {
- if (is != null) {
+ // Load the logging configuration file specified with an environment variable
+ if (System.getenv(LOGGING_CONFIG_FILE) != null) {
+ try (InputStream is = Files.newInputStream(Paths.get(System.getenv(LOGGING_CONFIG_FILE)))) {
LogManager.getLogManager().readConfiguration(is);
+ } catch (Exception ex) {
+ throw new ExceptionInInitializerError(ex);
+ }
+ // Or load a default configuration from the classpath
+ } else {
+ try (InputStream is = Container.class.getClassLoader().getResourceAsStream("logging.properties")) {
+ if (is != null) {
+ LogManager.getLogManager().readConfiguration(is);
+ }
+ } catch (Exception ex) {
+ throw new ExceptionInInitializerError(ex);
}
- } catch (IOException ignore) {
- // Ignore
}
}
diff --git a/docker-compose-demo.yml b/docker-compose-demo.yml
index 8d54c4248..9108d468f 100644
--- a/docker-compose-demo.yml
+++ b/docker-compose-demo.yml
@@ -1,28 +1,80 @@
+# Demo setup of OpenRemote v3
version: '2'
-
services:
+
+ # This is the API gateway for the whole system and hosting the public resources
+ # of the manager web application.
manager:
+
+ # Use installed or pull the latest image from Docker Hub.
image: openremote/manager:latest
+
+ # This application exposes a public web service that should be mapped to a host
+ # port. The default is '8080', this is the port on your Docker host to access
+ # the application. The second '8080' must match the service-internal port (see below).
+ ports:
+ - "8080:8080"
+
+ # This service needs access to other services on the Docker network.
links:
- postgres
- keycloak
- controller
+
environment:
+
+ # It is important that all services have the same timezone and are time synchronized.
+ # Bearer tokens are only valid for minutes, and authentication fails if Keycloak drifts.
TZ: "Europe/Zurich"
+
+ # If dev mode is enabled, caching and other performance-optimizations will be disabled.
DEV_MODE: 'false'
+
+ # If this is the first time you are starting this stack, and/or with non-durable
+ # database (the default), you need to have the database schema created.
DATABASE_CREATE_SCHEMA: 'true'
- IMPORT_SAMPLE_DATA: 'true'
- SAMPLE_CONTROLLER_HOST: controller
- SAMPLE_CONTROLLER_PORT: 8688
+
+ # If this is the first time you are starting this stack, and/or with non-durable
+ # database (the default), you might want to work with some automatically imported
+ # demo data.
+ IMPORT_DEMO_DATA: 'true'
+
+ # The demo data contains an Agent configuration, this Agent uses the OpenRemote 2.x
+ # Controller Connector. These are the settings for the Agent, how it can reach the
+ # example/demo Controller. You should set it to the same value as
+ # IDENTITY_NETWORK_HOST if you are exposting the controller on that host.
+ DEMO_CONTROLLER_HOST: controller
+ DEMO_CONTROLLER_PORT: 8688
+
+ # The service-internal interface and port to listen on. This should not be changed.
WEBSERVER_LISTEN_HOST: 0.0.0.0
WEBSERVER_LISTEN_PORT: 8080
- IDENTITY_NETWORK_HOST: demo2.openremote.com
- IDENTITY_NETWORK_WEBSERVER_PORT: 80
+
+ # 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'
+
+ # The public port of this OpenRemote installation. For simple installations without an
+ # HTTP proxy in front of this application, this will be the public webservice host-mapped
+ # port.
+ IDENTITY_NETWORK_WEBSERVER_PORT: 8080
+
+ # The service-internal JDBC connection URL for the database service.
DATABASE_CONNECTION_URL: jdbc:postgresql://postgres/openremote
+
+ # The database connection settings, passwords should be changed in production!
+ DATABASE_USERNAME: openremote
+ DATABASE_PASSWORD: secret
+ DATABASE_MIN_POOL_SIZE: 5
+ DATABASE_MAX_POOL_SIZE: 20
+ DATABASE_CONNECTION_TIMEOUT_SECONDS: 300
+
+ # The service-internal host name and port of the identity provider, configured automatically.
KEYCLOAK_HOST: keycloak
KEYCLOAK_PORT: 8080
- ports:
- - "8090:8080"
+
+ # The identity provider, we use OAuth2 and bearer tokens for all API access.
keycloak:
image: openremote/keycloak:latest
links:
@@ -30,20 +82,37 @@ services:
environment:
TZ: "Europe/Zurich"
KEYCLOAK_USER: admin
+
+ # Change the admin root password if you make this application publicly accessible! Note
+ # that imported demo data also creates a 'test' user with password 'test'. This should
+ # not be imported in production.
KEYCLOAK_PASSWORD: admin
- KEYCLOAK_LOGLEVEL: DEBUG
+
+ # Configure how Keycloak connects to the database
POSTGRES_DATABASE: openremote
POSTGRES_USER: openremote
POSTGRES_PASSWORD: secret
+
+ # The database service.
postgres:
image: openremote/postgres:latest
environment:
TZ: "Europe/Zurich"
+ # This is the database superuser and password. You should change this, especially if you
+ # expose the database port and make it accessible externally! Internally, we are using a
+ # different user/password combination to access the 'openremote' database (currently
+ # baked into the image).
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
POSTGRES_DB: openremote
+
+ # The demo controller (device gateway)
controller:
image: openremote/demo-controller:latest
environment:
TZ: "Europe/Zurich"
- BEEHIVE_REMOTE_SERVICE_URI: "urn:disabled"
\ No newline at end of file
+ BEEHIVE_REMOTE_SERVICE_URI: "urn:disabled"
+ # We expose the demo controller on the public network, so users can sync it with the
+ # OpenRemote Designer and access the Web Console.
+ ports:
+ - "8688:8688"
\ No newline at end of file
diff --git a/docker-compose-quickstart.yml b/docker-compose-quickstart.yml
deleted file mode 100644
index b0a86a5c9..000000000
--- a/docker-compose-quickstart.yml
+++ /dev/null
@@ -1,117 +0,0 @@
-version: '2'
-services:
-
- # This is the API gateway for the whole system and hosting the public resources
- # of the manager web application.
- manager:
-
- # Use installed or pull the latest image from Docker Hub.
- image: openremote/manager:latest
-
- # This application exposes a public web service that should be mapped to a host
- # port. The default is '8080', this is the port on your Docker host to access
- # the application. The second '8080' must match the service-internal port (see below).
- ports:
- - "8080:8080"
-
- # This service needs access to other services on the Docker network.
- links:
- - postgres
- - keycloak
- - controller
-
- environment:
-
- # It is important that all services have the same timezone and are time synchronized.
- # Bearer tokens are only valid for minutes, and authentication fails if Keycloak drifts.
- TZ: "Europe/Zurich"
-
- # If dev mode is enabled, caching and other performance-optimizations will be disabled.
- DEV_MODE: 'false'
-
- # If this is the first time you are starting this stack, and/or with non-durable
- # database (the default), you need to have the database schema created.
- DATABASE_CREATE_SCHEMA: 'true'
-
- # If this is the first time you are starting this stack, and/or with non-durable
- # database (the default), you might want to work with some automatically imported
- # sample data.
- IMPORT_SAMPLE_DATA: 'true'
-
- # The sample data contains an Agent configuration, this Agent uses the OpenRemote 2.x
- # Controller Connector. These are the settings for the Agent, how it can reach the
- # sample/demo Controller. You should set it to the same value as
- # IDENTITY_NETWORK_HOST if you are exposting the controller on that host.
- SAMPLE_CONTROLLER_HOST: controller
- SAMPLE_CONTROLLER_PORT: 8688
-
- # The service-internal interface and port to listen on. This should not be changed.
- WEBSERVER_LISTEN_HOST: 0.0.0.0
- WEBSERVER_LISTEN_PORT: 8080
-
- # 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'
-
- # The public port of this OpenRemote installation. For simple installations without an
- # HTTP proxy in front of this application, this will be the public webservice host-mapped
- # port.
- IDENTITY_NETWORK_WEBSERVER_PORT: 8080
-
- # The service-internal JDBC connection URL for the database service.
- DATABASE_CONNECTION_URL: jdbc:postgresql://postgres/openremote
-
- # The database connection settings, passwords should be changed in production!
- DATABASE_USERNAME: openremote
- DATABASE_PASSWORD: secret
- DATABASE_MIN_POOL_SIZE: 5
- DATABASE_MAX_POOL_SIZE: 20
- DATABASE_CONNECTION_TIMEOUT_SECONDS: 300
-
- # The service-internal host name and port of the identity provider, configured automatically.
- KEYCLOAK_HOST: keycloak
- KEYCLOAK_PORT: 8080
-
- # The identity provider, we use OAuth2 and bearer tokens for all API access.
- keycloak:
- image: openremote/keycloak:latest
- links:
- - postgres:postgresql
- environment:
- TZ: "Europe/Zurich"
- KEYCLOAK_USER: admin
-
- # Change the admin root password if you make this application publicly accessible! Note
- # that imported sample data also creates a 'test' user with password 'test'. This should
- # not be imported in production.
- KEYCLOAK_PASSWORD: admin
-
- # Configure how Keycloak connects to the database
- POSTGRES_DATABASE: openremote
- POSTGRES_USER: openremote
- POSTGRES_PASSWORD: secret
-
- # The database service.
- postgres:
- image: openremote/postgres:latest
- environment:
- TZ: "Europe/Zurich"
- # This is the database superuser and password. You should change this, especially if you
- # expose the database port and make it accessible externally! Internally, we are using a
- # different user/password combination to access the 'openremote' database (currently
- # baked into the image).
- POSTGRES_USER: postgres
- POSTGRES_PASSWORD: secret
- POSTGRES_DB: openremote
-
- # The demo controller (device gateway)
- controller:
- image: openremote/demo-controller:latest
- environment:
- TZ: "Europe/Zurich"
- BEEHIVE_REMOTE_SERVICE_URI: "urn:disabled"
- # We expose the demo controller on the public network, so users can sync it with the
- # OpenRemote Designer and access the Web Console.
- ports:
- - "8688:8688"
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 381ca16e0..e6b621a1f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,5 +1,5 @@
+# Development setup of OpenRemote v3
version: '2'
-
services:
keycloak_dev:
build:
diff --git a/manager/build.gradle b/manager/build.gradle
index 441b2a9d5..aef7ce762 100644
--- a/manager/build.gradle
+++ b/manager/build.gradle
@@ -6,8 +6,9 @@ task createDockerfile(type: Dockerfile) {
destFile = project.file("$project.buildDir/install/Dockerfile")
from "java:8"
environmentVariable "WEBSERVER_DOCROOT", "webapp"
- environmentVariable "MAP_TILES_PATH", "sample/mapdata.mbtiles"
- environmentVariable "MAP_SETTINGS_PATH", "sample/mapsettings.json"
+ environmentVariable "LOGGING_CONFIG_FILE", "config/logging.properties"
+ environmentVariable "MAP_TILES_PATH", "config/mapdata.mbtiles"
+ environmentVariable "MAP_SETTINGS_PATH", "config/mapsettings.json"
addFile project(':manager:server').distributions.main.baseName, "/opt/app"
addFile project(':manager:client').distributions.main.baseName, "/opt/app"
exposePort 8080
diff --git a/manager/server/build.gradle b/manager/server/build.gradle
index 1dd2fb53a..76a1fb5f2 100644
--- a/manager/server/build.gradle
+++ b/manager/server/build.gradle
@@ -20,8 +20,8 @@ dependencies {
distributions {
main {
contents {
- from("sample") {
- into "sample"
+ from("config") {
+ into "config"
}
}
}
diff --git a/manager/server/config/logging.properties b/manager/server/config/logging.properties
new file mode 100644
index 000000000..88671f73d
--- /dev/null
+++ b/manager/server/config/logging.properties
@@ -0,0 +1,32 @@
+# 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=FINEST
+
+# Debug HTTP communication with Controller 2.x
+#org.jboss.netty.level=FINEST
+#com.ning.level=FINEST
\ No newline at end of file
diff --git a/manager/server/sample/mapdata.mbtiles b/manager/server/config/mapdata.mbtiles
similarity index 100%
rename from manager/server/sample/mapdata.mbtiles
rename to manager/server/config/mapdata.mbtiles
diff --git a/manager/server/sample/mapsettings.json b/manager/server/config/mapsettings.json
similarity index 100%
rename from manager/server/sample/mapsettings.json
rename to manager/server/config/mapsettings.json
diff --git a/manager/server/src/main/java/org/openremote/manager/server/SampleDataService.java b/manager/server/src/main/java/org/openremote/manager/server/DemoDataService.java
similarity index 76%
rename from manager/server/src/main/java/org/openremote/manager/server/SampleDataService.java
rename to manager/server/src/main/java/org/openremote/manager/server/DemoDataService.java
index 61853c83f..00f377978 100644
--- a/manager/server/src/main/java/org/openremote/manager/server/SampleDataService.java
+++ b/manager/server/src/main/java/org/openremote/manager/server/DemoDataService.java
@@ -44,32 +44,31 @@ import rx.Observable;
import java.util.Arrays;
import java.util.List;
-import static org.openremote.manager.server.SampleDataService.SAMPLE_CONTROLLER_PORT_DEFAULT;
import static org.openremote.manager.shared.Constants.*;
import static rx.Observable.fromCallable;
-public class SampleDataService implements ContainerService {
+public class DemoDataService implements ContainerService {
- private static final Logger LOG = Logger.getLogger(SampleDataService.class.getName());
+ private static final Logger LOG = Logger.getLogger(DemoDataService.class.getName());
- public static final String IMPORT_SAMPLE_DATA = "IMPORT_SAMPLE_DATA";
- public static final boolean IMPORT_SAMPLE_DATA_DEFAULT = false;
+ public static final String IMPORT_DEMO_DATA = "IMPORT_DEMO_DATA";
+ public static final boolean IMPORT_DEMO_DATA_DEFAULT = false;
- public static final String SAMPLE_CONTROLLER_HOST = "SAMPLE_CONTROLLER_HOST";
- public static final String SAMPLE_CONTROLLER_HOST_DEFAULT = "192.168.99.100";
- public static final String SAMPLE_CONTROLLER_PORT = "SAMPLE_CONTROLLER_PORT";
- public static final int SAMPLE_CONTROLLER_PORT_DEFAULT = 8083;
- public static final String SAMPLE_CONTROLLER_USERNAME = "SAMPLE_CONTROLLER_USERNAME";
- public static final String SAMPLE_CONTROLLER_USERNAME_DEFAULT = "";
- public static final String SAMPLE_CONTROLLER_PASSWORD = "SAMPLE_CONTROLLER_PASSWORD";
- public static final String SAMPLE_CONTROLLER_PASSWORD_DEFAULT = "";
- public static final String SAMPLE_CONTROLLER_SECURE = "SAMPLE_CONTROLLER_SECURE";
- public static final boolean SAMPLE_CONTROLLER_SECURE_DEFAULT = false;
+ public static final String DEMO_CONTROLLER_HOST = "DEMO_CONTROLLER_HOST";
+ public static final String DEMO_CONTROLLER_HOST_DEFAULT = "192.168.99.100";
+ public static final String DEMO_CONTROLLER_PORT = "DEMO_CONTROLLER_PORT";
+ public static final int DEMO_CONTROLLER_PORT_DEFAULT = 8083;
+ public static final String DEMO_CONTROLLER_USERNAME = "DEMO_CONTROLLER_USERNAME";
+ public static final String DEMO_CONTROLLER_USERNAME_DEFAULT = "";
+ public static final String DEMO_CONTROLLER_PASSWORD = "DEMO_CONTROLLER_PASSWORD";
+ public static final String DEMO_CONTROLLER_PASSWORD_DEFAULT = "";
+ public static final String DEMO_CONTROLLER_SECURE = "DEMO_CONTROLLER_SECURE";
+ public static final boolean DEMO_CONTROLLER_SECURE_DEFAULT = false;
public static final String ADMIN_CLI_CLIENT_ID = "admin-cli";
public static final String ADMIN_PASSWORD = "admin";
- public String SAMPLE_AGENT_ID = null;
+ public String DEMO_AGENT_ID = null;
protected Container container;
protected PersistenceService persistenceService;
@@ -95,11 +94,11 @@ public class SampleDataService implements ContainerService {
@Override
public void start(Container container) {
- if (!container.isDevMode() && !container.getConfigBoolean(IMPORT_SAMPLE_DATA, IMPORT_SAMPLE_DATA_DEFAULT)) {
+ if (!container.isDevMode() && !container.getConfigBoolean(IMPORT_DEMO_DATA, IMPORT_DEMO_DATA_DEFAULT)) {
return;
}
- LOG.info("--- CREATING SAMPLE DATA ---");
+ LOG.info("--- IMPORTING DEMO DATA ---");
// Use a non-proxy client to get the access token
String accessToken = identityService.getKeycloak().getAccessToken(
@@ -110,9 +109,9 @@ public class SampleDataService implements ContainerService {
deleteRealms(accessToken);
configureMasterRealm(accessToken);
createTenants(accessToken);
- storeSampleAssets();
+ storeDemoAssets();
- LOG.info("--- SAMPLE DATA COMPLETE ---");
+ LOG.info("--- DEMO DATA IMPORT COMPLETE ---");
} catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -229,7 +228,7 @@ public class SampleDataService implements ContainerService {
identityService.createTenant(accessToken, customerB);
}
- protected void storeSampleAssets() {
+ protected void storeDemoAssets() {
GeometryFactory geometryFactory = new GeometryFactory();
@@ -252,41 +251,41 @@ public class SampleDataService implements ContainerService {
lobby.setType(AssetType.ROOM);
lobby = assetService.merge(lobby);
- ServerAsset sampleAgentAsset = new ServerAsset(lobby);
- sampleAgentAsset.setName("Sample Controller");
- sampleAgentAsset.setLocation(geometryFactory.createPoint(new Coordinate(5.460315214821094, 51.44541688237109)));
- sampleAgentAsset.setType(AssetType.AGENT);
+ ServerAsset agentAsset = new ServerAsset(lobby);
+ agentAsset.setName("Demo Controller");
+ agentAsset.setLocation(geometryFactory.createPoint(new Coordinate(5.460315214821094, 51.44541688237109)));
+ agentAsset.setType(AssetType.AGENT);
- Agent sampleAgent = new Agent(new Attributes(), true);
- sampleAgent.setEnabled(true);
- sampleAgent.setConnectorType("urn:openremote:connector:controller2");
+ Agent agent = new Agent(new Attributes(), true);
+ agent.setEnabled(true);
+ agent.setConnectorType("urn:openremote:connector:controller2");
for (Attribute connectorSetting : Controller2Component.SETTINGS.get()) {
- sampleAgent.getAttributes().put(connectorSetting.copy());
+ agent.getAttributes().put(connectorSetting.copy());
}
- sampleAgent.getAttributes().get("host").setValue(
- container.getConfig(SAMPLE_CONTROLLER_HOST, SAMPLE_CONTROLLER_HOST_DEFAULT)
+ agent.getAttributes().get("host").setValue(
+ container.getConfig(DEMO_CONTROLLER_HOST, DEMO_CONTROLLER_HOST_DEFAULT)
);
- sampleAgent.getAttributes().get("port").setValue(
- container.getConfigInteger(SAMPLE_CONTROLLER_PORT, SAMPLE_CONTROLLER_PORT_DEFAULT)
+ agent.getAttributes().get("port").setValue(
+ container.getConfigInteger(DEMO_CONTROLLER_PORT, DEMO_CONTROLLER_PORT_DEFAULT)
);
- sampleAgent.getAttributes().get("username").setValue(
- container.getConfig(SAMPLE_CONTROLLER_USERNAME, SAMPLE_CONTROLLER_USERNAME_DEFAULT)
+ agent.getAttributes().get("username").setValue(
+ container.getConfig(DEMO_CONTROLLER_USERNAME, DEMO_CONTROLLER_USERNAME_DEFAULT)
);
- sampleAgent.getAttributes().get("password").setValue(
- container.getConfig(SAMPLE_CONTROLLER_PASSWORD, SAMPLE_CONTROLLER_PASSWORD_DEFAULT)
+ agent.getAttributes().get("password").setValue(
+ container.getConfig(DEMO_CONTROLLER_PASSWORD, DEMO_CONTROLLER_PASSWORD_DEFAULT)
);
- sampleAgent.getAttributes().get("secure").setValue(
- container.getConfigBoolean(SAMPLE_CONTROLLER_SECURE, SAMPLE_CONTROLLER_SECURE_DEFAULT)
+ agent.getAttributes().get("secure").setValue(
+ container.getConfigBoolean(DEMO_CONTROLLER_SECURE, DEMO_CONTROLLER_SECURE_DEFAULT)
);
- sampleAgentAsset.setAttributes(sampleAgent.getAttributes().getJsonObject());
+ agentAsset.setAttributes(agent.getAttributes().getJsonObject());
- LOG.info("Adding sample agent: " + sampleAgentAsset);
- LOG.info("Configured sample agent attributes: " + sampleAgent.getAttributes());
+ LOG.info("Adding demo agent: " + agentAsset);
+ LOG.info("Configured demo agent attributes: " + agent.getAttributes());
- sampleAgentAsset = assetService.merge(sampleAgentAsset);
+ agentAsset = assetService.merge(agentAsset);
- SAMPLE_AGENT_ID = sampleAgentAsset.getId();
+ DEMO_AGENT_ID = agentAsset.getId();
}
}
diff --git a/manager/server/src/main/java/org/openremote/manager/server/Server.java b/manager/server/src/main/java/org/openremote/manager/server/Server.java
index 065542d30..82e01c41d 100644
--- a/manager/server/src/main/java/org/openremote/manager/server/Server.java
+++ b/manager/server/src/main/java/org/openremote/manager/server/Server.java
@@ -45,7 +45,7 @@ public class Server {
new AgentService(),
new AssetService(),
new MapService(),
- new SampleDataService()
+ new DemoDataService()
).startBackground();
}
}
diff --git a/manager/server/src/main/java/org/openremote/manager/server/map/MapService.java b/manager/server/src/main/java/org/openremote/manager/server/map/MapService.java
index 2ca4bb6c5..4aa46b732 100644
--- a/manager/server/src/main/java/org/openremote/manager/server/map/MapService.java
+++ b/manager/server/src/main/java/org/openremote/manager/server/map/MapService.java
@@ -41,9 +41,9 @@ public class MapService implements ContainerService {
private static final Logger LOG = Logger.getLogger(MapService.class.getName());
public static final String MAP_TILES_PATH = "MAP_TILES_PATH";
- public static final String MAP_TILES_PATH_DEFAULT = "manager/server/sample/mapdata.mbtiles";
+ public static final String MAP_TILES_PATH_DEFAULT = "manager/server/config/mapdata.mbtiles";
public static final String MAP_SETTINGS_PATH = "MAP_SETTINGS_PATH";
- public static final String MAP_SETTINGS_PATH_DEFAULT = "manager/server/sample/mapsettings.json";
+ public static final String MAP_SETTINGS_PATH_DEFAULT = "manager/server/config/mapsettings.json";
// Shared SQL connection is fine concurrently in SQLite
protected Connection connection;
diff --git a/manager/server/src/main/resources/logging.properties b/manager/server/src/main/resources/logging.properties
index 828a5dd8a..bec3263cf 100644
--- a/manager/server/src/main/resources/logging.properties
+++ b/manager/server/src/main/resources/logging.properties
@@ -1,3 +1,6 @@
+# This is the default configuration file for logging, used when no other option
+# is specified. Consider this the "default developer" configuration.
+
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.formatter=org.openremote.container.util.LogFormatter
diff --git a/test/src/main/groovy/org/openremote/test/ContainerTrait.groovy b/test/src/main/groovy/org/openremote/test/ContainerTrait.groovy
index 5b1c0de55..4350b54bb 100644
--- a/test/src/main/groovy/org/openremote/test/ContainerTrait.groovy
+++ b/test/src/main/groovy/org/openremote/test/ContainerTrait.groovy
@@ -28,7 +28,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClient
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget
import org.keycloak.representations.AccessTokenResponse
-import org.openremote.container.Constants
import org.openremote.container.Container
import org.openremote.container.ContainerService
import org.openremote.container.message.MessageBrokerService
@@ -37,7 +36,7 @@ import org.openremote.container.security.AuthForm
import org.openremote.container.security.IdentityService
import org.openremote.container.web.WebClient
import org.openremote.container.web.WebService
-import org.openremote.manager.server.SampleDataService
+import org.openremote.manager.server.DemoDataService
import org.openremote.manager.server.agent.AgentService
import org.openremote.manager.server.agent.ConnectorService
import org.openremote.manager.server.asset.AssetService
@@ -110,7 +109,7 @@ trait ContainerTrait {
new AgentService(),
new AssetService(),
new MapService(),
- new SampleDataService()
+ new DemoDataService()
)
)
}
diff --git a/test/src/test/groovy/org/openremote/test/controller2/Controller2Test.groovy b/test/src/test/groovy/org/openremote/test/controller2/Controller2Test.groovy
index 35092c9a9..8c73f8f08 100644
--- a/test/src/test/groovy/org/openremote/test/controller2/Controller2Test.groovy
+++ b/test/src/test/groovy/org/openremote/test/controller2/Controller2Test.groovy
@@ -2,7 +2,7 @@ package org.openremote.test.controller2
import org.openremote.manager.client.event.ServerSendEvent
import org.openremote.manager.client.event.bus.EventBus
-import org.openremote.manager.server.SampleDataService
+import org.openremote.manager.server.DemoDataService
import org.openremote.manager.server.asset.AssetService
import org.openremote.manager.server.event.EventService
import org.openremote.manager.shared.agent.DeviceResourceRead
@@ -46,7 +46,7 @@ class Controller2Test extends Specification implements ContainerTrait {
then: "the device assets should be the children of the agent asset"
def assetService = container.getService(AssetService.class)
- def agentAsset = assetService.get(container.getService(SampleDataService.class).SAMPLE_AGENT_ID)
+ def agentAsset = assetService.get(container.getService(DemoDataService.class).DEMO_AGENT_ID)
agentAsset != null
def deviceAssetInfos = assetService.getChildren(agentAsset.getId())
deviceAssetInfos.size() == 1
@@ -141,7 +141,7 @@ class Controller2Test extends Specification implements ContainerTrait {
when: "subscribing to device resource updates through an agent"
def assetService = container.getService(AssetService.class)
- def agentAsset = assetService.get(container.getService(SampleDataService.class).SAMPLE_AGENT_ID)
+ def agentAsset = assetService.get(container.getService(DemoDataService.class).DEMO_AGENT_ID)
eventBus.dispatch(new ServerSendEvent(new SubscribeDeviceResourceUpdates(
agentAsset.getId(), "testdevice"
)))