diff --git a/agent/src/main/java/org/openremote/agent/custom/CustomAgent.java b/agent/src/main/java/org/openremote/agent/custom/CustomAgent.java
index 2a152dec8..4610d6490 100644
--- a/agent/src/main/java/org/openremote/agent/custom/CustomAgent.java
+++ b/agent/src/main/java/org/openremote/agent/custom/CustomAgent.java
@@ -1,9 +1,6 @@
/*
* Copyright 2017, OpenRemote Inc.
*
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -15,10 +12,14 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.agent.custom;
+import java.util.Optional;
+
import org.openremote.model.asset.Asset;
import org.openremote.model.asset.agent.Agent;
import org.openremote.model.asset.agent.AgentDescriptor;
@@ -27,57 +28,57 @@
import org.openremote.model.value.ValueDescriptor;
import jakarta.persistence.Entity;
-import java.util.Optional;
/**
- * This is an example of a custom {@link Agent} type; this must be registered via an
- * {@link org.openremote.model.AssetModelProvider} and must conform to the same requirements as custom {@link Asset}s and
- * in addition the following requirements:
+ * This is an example of a custom {@link Agent} type; this must be registered via an {@link
+ * org.openremote.model.AssetModelProvider} and must conform to the same requirements as custom
+ * {@link Asset}s and in addition the following requirements:
*
*
- * Optionally add a custom {@link org.openremote.model.asset.agent.AgentLink} (the {@link Class#getSimpleName} must
- * be unique compared to all other registered {@link org.openremote.model.asset.agent.AgentLink}s)
- * Must define a {@link org.openremote.model.asset.agent.Protocol} implementation that corresponds to this {@link Agent}
- * Must have a public static final {@link org.openremote.model.asset.agent.AgentDescriptor} rather than an
- * {@link org.openremote.model.asset.AssetDescriptor}
+ * Optionally add a custom {@link org.openremote.model.asset.agent.AgentLink} (the {@link
+ * Class#getSimpleName} must be unique compared to all other registered {@link
+ * org.openremote.model.asset.agent.AgentLink}s)
+ * Must define a {@link org.openremote.model.asset.agent.Protocol} implementation that
+ * corresponds to this {@link Agent}
+ * Must have a public static final {@link org.openremote.model.asset.agent.AgentDescriptor}
+ * rather than an {@link org.openremote.model.asset.AssetDescriptor}
*
*/
@Entity
public class CustomAgent extends Agent {
- public enum Option {
- ONE,
- TWO,
- THREE
- };
+ public enum Option {
+ ONE,
+ TWO,
+ THREE
+ };
- public static final ValueDescriptor OPTION_VALUE_DESCRIPTOR = new ValueDescriptor<>("customAgentOption", Option.class);
+ public static final ValueDescriptor OPTION_VALUE_DESCRIPTOR =
+ new ValueDescriptor<>("customAgentOption", Option.class);
- public static final AttributeDescriptor OPTION_ATTRIBUTE_DESCRIPTOR = new AttributeDescriptor<>("option", OPTION_VALUE_DESCRIPTOR);
+ public static final AttributeDescriptor OPTION_ATTRIBUTE_DESCRIPTOR =
+ new AttributeDescriptor<>("option", OPTION_VALUE_DESCRIPTOR);
- public static final AgentDescriptor DESCRIPTOR = new AgentDescriptor<>(
- CustomAgent.class, CustomProtocol.class, DefaultAgentLink.class
- );
+ public static final AgentDescriptor DESCRIPTOR =
+ new AgentDescriptor<>(CustomAgent.class, CustomProtocol.class, DefaultAgentLink.class);
- protected CustomAgent() {
- }
+ protected CustomAgent() {}
- public CustomAgent(String name) {
- super(name);
- }
+ public CustomAgent(String name) {
+ super(name);
+ }
- @Override
- public CustomProtocol getProtocolInstance() {
- return new CustomProtocol(this);
- }
+ @Override
+ public CustomProtocol getProtocolInstance() {
+ return new CustomProtocol(this);
+ }
- public Optional getOption() {
- return getAttributes().getValue(OPTION_ATTRIBUTE_DESCRIPTOR);
- }
+ public Optional getOption() {
+ return getAttributes().getValue(OPTION_ATTRIBUTE_DESCRIPTOR);
+ }
- public CustomAgent setOption(Option value) {
- getAttributes().getOrCreate(OPTION_ATTRIBUTE_DESCRIPTOR).setValue(value);
- return this;
- }
+ public CustomAgent setOption(Option value) {
+ getAttributes().getOrCreate(OPTION_ATTRIBUTE_DESCRIPTOR).setValue(value);
+ return this;
+ }
}
-
diff --git a/agent/src/main/java/org/openremote/agent/custom/CustomAgentModelProvider.java b/agent/src/main/java/org/openremote/agent/custom/CustomAgentModelProvider.java
index 6d1e4629f..ce1810d50 100644
--- a/agent/src/main/java/org/openremote/agent/custom/CustomAgentModelProvider.java
+++ b/agent/src/main/java/org/openremote/agent/custom/CustomAgentModelProvider.java
@@ -1,9 +1,6 @@
/*
* Copyright 2021, 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
@@ -15,17 +12,18 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
package org.openremote.agent.custom;
import org.openremote.model.AssetModelProvider;
public class CustomAgentModelProvider implements AssetModelProvider {
- @Override
- public boolean useAutoScan() {
- return true;
- }
+ @Override
+ public boolean useAutoScan() {
+ return true;
+ }
}
diff --git a/agent/src/main/java/org/openremote/agent/custom/CustomProtocol.java b/agent/src/main/java/org/openremote/agent/custom/CustomProtocol.java
index 6000f8693..87b714c52 100644
--- a/agent/src/main/java/org/openremote/agent/custom/CustomProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/custom/CustomProtocol.java
@@ -1,9 +1,6 @@
/*
* Copyright 2017, OpenRemote Inc.
*
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -15,10 +12,16 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.agent.custom;
+import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;
+
+import java.util.logging.Logger;
+
import org.openremote.agent.protocol.AbstractProtocol;
import org.openremote.model.Container;
import org.openremote.model.asset.agent.DefaultAgentLink;
@@ -26,57 +29,49 @@
import org.openremote.model.attribute.AttributeEvent;
import org.openremote.model.syslog.SyslogCategory;
-import java.util.logging.Logger;
-
-import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;
-
/**
- * A custom protocol that is used by the {@link CustomAgent}; there is a one-to-one mapping between an {@link
- * CustomAgent} {@link org.openremote.model.asset.Asset} and its' {@link org.openremote.model.asset.agent.Protocol}.
- * This example does nothing useful but is intended to show where protocol classes should be created.
+ * A custom protocol that is used by the {@link CustomAgent}; there is a one-to-one mapping between
+ * an {@link CustomAgent} {@link org.openremote.model.asset.Asset} and its' {@link
+ * org.openremote.model.asset.agent.Protocol}. This example does nothing useful but is intended to
+ * show where protocol classes should be created.
*/
public class CustomProtocol extends AbstractProtocol {
- public static final String PROTOCOL_DISPLAY_NAME = "Custom";
- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, CustomProtocol.class);
- protected boolean running;
-
- public CustomProtocol(CustomAgent agent) {
- super(agent);
- }
-
- @Override
- protected void doStart(Container container) throws Exception {
- running = true;
- }
-
- @Override
- protected void doStop(Container container) throws Exception {
-
- }
+ public static final String PROTOCOL_DISPLAY_NAME = "Custom";
+ private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, CustomProtocol.class);
+ protected boolean running;
- @Override
- protected void doLinkAttribute(String assetId, Attribute> attribute, DefaultAgentLink agentLink) throws RuntimeException {
+ public CustomProtocol(CustomAgent agent) {
+ super(agent);
+ }
- }
+ @Override
+ protected void doStart(Container container) throws Exception {
+ running = true;
+ }
- @Override
- protected void doUnlinkAttribute(String assetId, Attribute> attribute, DefaultAgentLink agentLink) {
+ @Override
+ protected void doStop(Container container) throws Exception {}
- }
+ @Override
+ protected void doLinkAttribute(String assetId, Attribute> attribute, DefaultAgentLink agentLink)
+ throws RuntimeException {}
- @Override
- protected void doLinkedAttributeWrite(DefaultAgentLink agentLink, AttributeEvent event, Object processedValue) {
+ @Override
+ protected void doUnlinkAttribute(
+ String assetId, Attribute> attribute, DefaultAgentLink agentLink) {}
- }
+ @Override
+ protected void doLinkedAttributeWrite(
+ DefaultAgentLink agentLink, AttributeEvent event, Object processedValue) {}
- @Override
- public String getProtocolName() {
- return PROTOCOL_DISPLAY_NAME;
- }
+ @Override
+ public String getProtocolName() {
+ return PROTOCOL_DISPLAY_NAME;
+ }
- @Override
- public String getProtocolInstanceUri() {
- return "custom://" + agent.getOption();
- }
+ @Override
+ public String getProtocolInstanceUri() {
+ return "custom://" + agent.getOption();
+ }
}
diff --git a/build.gradle b/build.gradle
index 0caedf150..95fbe20af 100644
--- a/build.gradle
+++ b/build.gradle
@@ -13,6 +13,15 @@ scmVersion {
}
}
+buildscript {
+ repositories {
+ maven { url 'https://plugins.gradle.org/m2' }
+ }
+ dependencies {
+ classpath 'com.diffplug.spotless:spotless-plugin-gradle:7.0.3'
+ }
+}
+
allprojects {
// Apply common project setup
apply from: "${project.rootDir}/project.gradle"
diff --git a/manager/src/main/java/org/openremote/manager/custom/CustomService.java b/manager/src/main/java/org/openremote/manager/custom/CustomService.java
index 7cf039cf0..46eb7a112 100644
--- a/manager/src/main/java/org/openremote/manager/custom/CustomService.java
+++ b/manager/src/main/java/org/openremote/manager/custom/CustomService.java
@@ -1,9 +1,6 @@
/*
* Copyright 2021, 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
@@ -15,7 +12,9 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.manager.custom;
@@ -23,18 +22,12 @@
import org.openremote.model.ContainerService;
public class CustomService implements ContainerService {
- @Override
- public void init(Container container) throws Exception {
-
- }
-
- @Override
- public void start(Container container) throws Exception {
-
- }
+ @Override
+ public void init(Container container) throws Exception {}
- @Override
- public void stop(Container container) throws Exception {
+ @Override
+ public void start(Container container) throws Exception {}
- }
+ @Override
+ public void stop(Container container) throws Exception {}
}
diff --git a/model/src/main/java/org/openremote/model/custom/CustomAsset.java b/model/src/main/java/org/openremote/model/custom/CustomAsset.java
index 0ae34c479..15a9f7799 100644
--- a/model/src/main/java/org/openremote/model/custom/CustomAsset.java
+++ b/model/src/main/java/org/openremote/model/custom/CustomAsset.java
@@ -1,9 +1,6 @@
/*
* Copyright 2021, 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
@@ -15,57 +12,64 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.model.custom;
+import java.util.Optional;
+
import org.openremote.model.asset.Asset;
import org.openremote.model.asset.AssetDescriptor;
import org.openremote.model.value.AttributeDescriptor;
import org.openremote.model.value.ValueDescriptor;
import jakarta.persistence.Entity;
-import java.util.Optional;
/**
- * This is an example of a custom {@link Asset} type; this must be registered via an
- * {@link org.openremote.model.AssetModelProvider} and must conform to the following requirements:
+ * This is an example of a custom {@link Asset} type; this must be registered via an {@link
+ * org.openremote.model.AssetModelProvider} and must conform to the following requirements:
*
*
- * Must have {@link Entity} annotation
- * Optionally add {@link org.openremote.model.value.ValueDescriptor}s
- * Optionally add {@link org.openremote.model.value.MetaItemDescriptor}s
- * Optionally add {@link org.openremote.model.value.AttributeDescriptor}s
- * Must have a public static final {@link org.openremote.model.asset.AssetDescriptor}
- * Must have a protected no args constructor (for hydrators i.e. JPA/Jackson)
- * For a given {@link Asset} type only one {@link org.openremote.model.asset.AssetDescriptor} can exist
- * {@link org.openremote.model.value.AttributeDescriptor}s that override a super class descriptor cannot change the
- * value type; just the formatting etc.
- * {@link org.openremote.model.value.MetaItemDescriptor}s names must be unique
- * {@link org.openremote.model.value.ValueDescriptor}s names must be unique
+ * Must have {@link Entity} annotation
+ * Optionally add {@link org.openremote.model.value.ValueDescriptor}s
+ * Optionally add {@link org.openremote.model.value.MetaItemDescriptor}s
+ * Optionally add {@link org.openremote.model.value.AttributeDescriptor}s
+ * Must have a public static final {@link org.openremote.model.asset.AssetDescriptor}
+ * Must have a protected no args constructor (for hydrators i.e. JPA/Jackson)
+ * For a given {@link Asset} type only one {@link org.openremote.model.asset.AssetDescriptor}
+ * can exist
+ * {@link org.openremote.model.value.AttributeDescriptor}s that override a super class
+ * descriptor cannot change the value type; just the formatting etc.
+ * {@link org.openremote.model.value.MetaItemDescriptor}s names must be unique
+ * {@link org.openremote.model.value.ValueDescriptor}s names must be unique
*
*/
@Entity
public class CustomAsset extends Asset {
- public enum CustomValueType {
- ONE,
- TWO,
- THREE
- }
+ public enum CustomValueType {
+ ONE,
+ TWO,
+ THREE
+ }
- public static final ValueDescriptor CUSTOM_VALUE_TYPE_VALUE_DESCRIPTOR = new ValueDescriptor<>("customValueType", CustomValueType.class);
+ public static final ValueDescriptor CUSTOM_VALUE_TYPE_VALUE_DESCRIPTOR =
+ new ValueDescriptor<>("customValueType", CustomValueType.class);
- public static final AttributeDescriptor CUSTOM_VALUE_TYPE_ATTRIBUTE_DESCRIPTOR = new AttributeDescriptor<>("customAttribute", CUSTOM_VALUE_TYPE_VALUE_DESCRIPTOR);
+ public static final AttributeDescriptor CUSTOM_VALUE_TYPE_ATTRIBUTE_DESCRIPTOR =
+ new AttributeDescriptor<>("customAttribute", CUSTOM_VALUE_TYPE_VALUE_DESCRIPTOR);
- public static final AssetDescriptor CUSTOM_ASSET_ASSET_DESCRIPTOR = new AssetDescriptor<>("brightness-auto", "00aaaa", CustomAsset.class);
+ public static final AssetDescriptor CUSTOM_ASSET_ASSET_DESCRIPTOR =
+ new AssetDescriptor<>("brightness-auto", "00aaaa", CustomAsset.class);
- public Optional getCustomAttribute() {
- return getAttributes().getValue(CUSTOM_VALUE_TYPE_ATTRIBUTE_DESCRIPTOR);
- }
+ public Optional getCustomAttribute() {
+ return getAttributes().getValue(CUSTOM_VALUE_TYPE_ATTRIBUTE_DESCRIPTOR);
+ }
- public CustomAsset setCustomAttribute(CustomValueType value) {
- getAttributes().getOrCreate(CUSTOM_VALUE_TYPE_ATTRIBUTE_DESCRIPTOR).setValue(value);
- return this;
- }
+ public CustomAsset setCustomAttribute(CustomValueType value) {
+ getAttributes().getOrCreate(CUSTOM_VALUE_TYPE_ATTRIBUTE_DESCRIPTOR).setValue(value);
+ return this;
+ }
}
diff --git a/model/src/main/java/org/openremote/model/custom/CustomAssetModelProvider.java b/model/src/main/java/org/openremote/model/custom/CustomAssetModelProvider.java
index 206f7cc4a..07c275b37 100644
--- a/model/src/main/java/org/openremote/model/custom/CustomAssetModelProvider.java
+++ b/model/src/main/java/org/openremote/model/custom/CustomAssetModelProvider.java
@@ -1,9 +1,6 @@
/*
* Copyright 2021, 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
@@ -15,7 +12,9 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.model.custom;
@@ -23,8 +22,8 @@
public class CustomAssetModelProvider implements AssetModelProvider {
- @Override
- public boolean useAutoScan() {
- return true;
- }
+ @Override
+ public boolean useAutoScan() {
+ return true;
+ }
}
diff --git a/model/src/main/java/org/openremote/model/custom/CustomData.java b/model/src/main/java/org/openremote/model/custom/CustomData.java
index 653cb1221..520c69c43 100644
--- a/model/src/main/java/org/openremote/model/custom/CustomData.java
+++ b/model/src/main/java/org/openremote/model/custom/CustomData.java
@@ -1,9 +1,6 @@
/*
* Copyright 2022, 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
@@ -15,23 +12,24 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.model.custom;
public class CustomData {
- protected String name;
- protected Integer age;
+ protected String name;
+ protected Integer age;
- protected CustomData() {
- }
+ protected CustomData() {}
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public Integer getAge() {
- return age;
- }
+ public Integer getAge() {
+ return age;
+ }
}
diff --git a/model/src/main/java/org/openremote/model/custom/CustomEndpointResource.java b/model/src/main/java/org/openremote/model/custom/CustomEndpointResource.java
index 59ef3c73b..a6f71696f 100644
--- a/model/src/main/java/org/openremote/model/custom/CustomEndpointResource.java
+++ b/model/src/main/java/org/openremote/model/custom/CustomEndpointResource.java
@@ -1,9 +1,6 @@
/*
* Copyright 2022, 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
@@ -15,7 +12,9 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.model.custom;
@@ -23,11 +22,12 @@
import jakarta.ws.rs.Path;
/**
- * This is an example custom JAX-RS endpoint; this will be compiled and made available in the typescript model as well
+ * This is an example custom JAX-RS endpoint; this will be compiled and made available in the
+ * typescript model as well
*/
@Path("custom")
public interface CustomEndpointResource {
- @POST
- void submitData(CustomData customData);
+ @POST
+ void submitData(CustomData customData);
}
diff --git a/project.gradle b/project.gradle
index 738eeb68c..ebe941bc0 100644
--- a/project.gradle
+++ b/project.gradle
@@ -389,4 +389,31 @@ plugins.withType(JavaPlugin).whenPluginAdded {
}
}
+plugins.apply('com.diffplug.spotless')
+
+spotless {
+ java {
+ target '**/*.java'
+
+ googleJavaFormat()
+ licenseHeaderFile rootProject.file('tools/spotless/openremote-license-header.txt')
+ importOrder('java', 'javax', 'com', 'org')
+ removeUnusedImports()
+ formatAnnotations()
+ trimTrailingWhitespace()
+ endWithNewline()
+ }
+
+ typescript {
+ target 'src/**/*.ts'
+ targetExclude(
+ 'src/model.ts',
+ 'src/restclient.ts'
+ )
+
+ eslint().configFile(rootProject.file('ui/.eslintrc.json')).tsconfigFile(rootProject.file('ui/tsconfig.json'))
+ licenseHeaderFile rootProject.file('tools/spotless/openremote-license-header.txt'), '(import|const|declare|export|var) '
+ }
+}
+
// POM generator
diff --git a/setup/src/main/java/org/openremote/manager/setup/custom/CustomKeycloakSetup.java b/setup/src/main/java/org/openremote/manager/setup/custom/CustomKeycloakSetup.java
index bc0bde234..b912f23f4 100644
--- a/setup/src/main/java/org/openremote/manager/setup/custom/CustomKeycloakSetup.java
+++ b/setup/src/main/java/org/openremote/manager/setup/custom/CustomKeycloakSetup.java
@@ -1,9 +1,6 @@
/*
* Copyright 2021, 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
@@ -15,43 +12,51 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.manager.setup.custom;
+import static org.openremote.container.util.MapAccess.getString;
+
import org.openremote.manager.setup.AbstractKeycloakSetup;
import org.openremote.model.Container;
import org.openremote.model.security.ClientRole;
import org.openremote.model.security.Realm;
import org.openremote.model.util.TextUtil;
-import static org.openremote.container.util.MapAccess.getString;
-
public class CustomKeycloakSetup extends AbstractKeycloakSetup {
- public static final String CUSTOM_USER_PASSWORD = "CUSTOM_USER_PASSWORD";
- public static final String CUSTOM_USER_PASSWORD_DEFAULT = "custom";
- protected final String customUserPassword;
-
- public CustomKeycloakSetup(Container container, boolean isProduction) {
- super(container);
+ public static final String CUSTOM_USER_PASSWORD = "CUSTOM_USER_PASSWORD";
+ public static final String CUSTOM_USER_PASSWORD_DEFAULT = "custom";
+ protected final String customUserPassword;
- customUserPassword = getString(container.getConfig(), CUSTOM_USER_PASSWORD, CUSTOM_USER_PASSWORD_DEFAULT);
-
- if (isProduction && TextUtil.isNullOrEmpty(customUserPassword)) {
- throw new IllegalStateException("Custom user password must be supplied in production");
- }
- }
+ public CustomKeycloakSetup(Container container, boolean isProduction) {
+ super(container);
- @Override
- public void onStart() throws Exception {
- // Create custom realm
- Realm customRealm = createRealm("custom", "Custom", true);
+ customUserPassword =
+ getString(container.getConfig(), CUSTOM_USER_PASSWORD, CUSTOM_USER_PASSWORD_DEFAULT);
- // Create user(s) for custom realm
- createUser("custom", "custom", customUserPassword, "First", "Last", null, true, new ClientRole[] {
- ClientRole.READ,
- ClientRole.WRITE
- });
+ if (isProduction && TextUtil.isNullOrEmpty(customUserPassword)) {
+ throw new IllegalStateException("Custom user password must be supplied in production");
}
+ }
+
+ @Override
+ public void onStart() throws Exception {
+ // Create custom realm
+ Realm customRealm = createRealm("custom", "Custom", true);
+
+ // Create user(s) for custom realm
+ createUser(
+ "custom",
+ "custom",
+ customUserPassword,
+ "First",
+ "Last",
+ null,
+ true,
+ new ClientRole[] {ClientRole.READ, ClientRole.WRITE});
+ }
}
diff --git a/setup/src/main/java/org/openremote/manager/setup/custom/CustomManagerSetup.java b/setup/src/main/java/org/openremote/manager/setup/custom/CustomManagerSetup.java
index 186b8127d..f5c9c1a58 100644
--- a/setup/src/main/java/org/openremote/manager/setup/custom/CustomManagerSetup.java
+++ b/setup/src/main/java/org/openremote/manager/setup/custom/CustomManagerSetup.java
@@ -1,9 +1,6 @@
/*
* Copyright 2021, 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
@@ -15,7 +12,9 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.manager.setup.custom;
@@ -26,15 +25,15 @@
public class CustomManagerSetup extends ManagerSetup {
- public CustomManagerSetup(Container container) {
- super(container);
- }
+ public CustomManagerSetup(Container container) {
+ super(container);
+ }
- @Override
- public void onStart() throws Exception {
- super.onStart();
+ @Override
+ public void onStart() throws Exception {
+ super.onStart();
- ThingAsset thing = new ThingAsset("Custom Thing").setRealm(Constants.MASTER_REALM);
- thing = assetStorageService.merge(thing);
- }
+ ThingAsset thing = new ThingAsset("Custom Thing").setRealm(Constants.MASTER_REALM);
+ thing = assetStorageService.merge(thing);
+ }
}
diff --git a/setup/src/main/java/org/openremote/manager/setup/custom/CustomSetupTasks.java b/setup/src/main/java/org/openremote/manager/setup/custom/CustomSetupTasks.java
index 478045003..4b36976cb 100644
--- a/setup/src/main/java/org/openremote/manager/setup/custom/CustomSetupTasks.java
+++ b/setup/src/main/java/org/openremote/manager/setup/custom/CustomSetupTasks.java
@@ -1,9 +1,6 @@
/*
* Copyright 2021, 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
@@ -15,30 +12,30 @@
* 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 .
+ * along with this program. If not, see .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
package org.openremote.manager.setup.custom;
+import java.util.Arrays;
+import java.util.List;
+
import org.openremote.model.Container;
import org.openremote.model.setup.Setup;
import org.openremote.model.setup.SetupTasks;
-import java.util.Arrays;
-import java.util.List;
-
public class CustomSetupTasks implements SetupTasks {
- public static final String PRODUCTION = "production";
+ public static final String PRODUCTION = "production";
- @Override
- public List createTasks(Container container, String setupType, boolean keycloakEnabled) {
+ @Override
+ public List createTasks(Container container, String setupType, boolean keycloakEnabled) {
- boolean isProduction = PRODUCTION.equalsIgnoreCase(setupType);
+ boolean isProduction = PRODUCTION.equalsIgnoreCase(setupType);
- // Add custom Setup task implementations here with tasks optionally dependent on setupType
- return Arrays.asList(
- new CustomKeycloakSetup(container, isProduction),
- new CustomManagerSetup(container)
- );
- }
+ // Add custom Setup task implementations here with tasks optionally dependent on setupType
+ return Arrays.asList(
+ new CustomKeycloakSetup(container, isProduction), new CustomManagerSetup(container));
+ }
}
diff --git a/tools/spotless/openremote-license-header.txt b/tools/spotless/openremote-license-header.txt
new file mode 100644
index 000000000..2a336e1ba
--- /dev/null
+++ b/tools/spotless/openremote-license-header.txt
@@ -0,0 +1,18 @@
+/*
+ * Copyright $YEAR, OpenRemote Inc.
+ *
+ * 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 .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
diff --git a/ui/app/custom/build.gradle b/ui/app/custom/build.gradle
index 797533f42..c61fa77b1 100644
--- a/ui/app/custom/build.gradle
+++ b/ui/app/custom/build.gradle
@@ -1,12 +1,10 @@
buildDir = "dist"
-tasks.register('clean') {
- dependsOn npmClean
-}
-
tasks.register('installDist', Copy) {
dependsOn npmBuild
mustRunAfter(resolveTask(":manager:installDist"))
from project.buildDir
into "${project(':deployment').buildDir}/image/manager/app/${projectDir.name}"
}
+
+clean.dependsOn(npmClean)
diff --git a/ui/app/custom/src/index.ts b/ui/app/custom/src/index.ts
index 918037da4..6f4b9ed73 100644
--- a/ui/app/custom/src/index.ts
+++ b/ui/app/custom/src/index.ts
@@ -1,11 +1,26 @@
-// Declare require method which we'll use for importing webpack resources (using ES6 imports will confuse typescript parser)
+/*
+ * Copyright 2025, OpenRemote Inc.
+ *
+ * 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 .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import {combineReducers, configureStore} from "@reduxjs/toolkit";
-import "@openremote/or-app";
import {AnyAction, appReducer, AppStateKeyed, HeaderConfig, HeaderItem, OrApp, PageProvider, RealmAppConfig} from "@openremote/or-app";
import {headerItemAccount, headerItemLanguage, headerItemLogout, headerItemMap, headerItemAssets} from "@openremote/manager/headers";
import {pageAssetsReducer, pageAssetsProvider} from "@openremote/manager/pages/page-assets";
import {pageMapReducer, pageMapProvider} from "@openremote/manager/pages/page-map";
-import "./pages/page-custom";
import {pageCustomProvider} from "./pages/page-custom";
const rootReducer = combineReducers({
diff --git a/ui/app/custom/src/pages/page-custom.ts b/ui/app/custom/src/pages/page-custom.ts
index 4631add62..5d033c5a8 100644
--- a/ui/app/custom/src/pages/page-custom.ts
+++ b/ui/app/custom/src/pages/page-custom.ts
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2025, OpenRemote Inc.
+ *
+ * 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 .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import {css, html, TemplateResult} from "lit";
import {customElement} from "lit/decorators.js";
import {AppStateKeyed, Page, PageProvider} from "@openremote/or-app";
@@ -50,7 +68,7 @@ export class PageCustom extends Page {
}
protected firstUpdated(changedProperties: Map) {
- let submitter = async() => {
+ const submitter = async() => {
// Crude custom REST API call example
return await rest.api.CustomEndpointResource.submitData({
name: "Commander Data",
diff --git a/ui/component/model/src/index.ts b/ui/component/model/src/index.ts
index e7d1b6224..b2ef71ba6 100644
--- a/ui/component/model/src/index.ts
+++ b/ui/component/model/src/index.ts
@@ -1,2 +1,20 @@
+/*
+ * Copyright 2025, OpenRemote Inc.
+ *
+ * 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 .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
export * from "./model";
export {AssetModelUtil} from "./util";
diff --git a/ui/component/model/src/util.ts b/ui/component/model/src/util.ts
index 540c929a4..d626d713e 100644
--- a/ui/component/model/src/util.ts
+++ b/ui/component/model/src/util.ts
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2025, OpenRemote Inc.
+ *
+ * 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 .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import {
AgentDescriptor,
AssetDescriptor,
diff --git a/ui/component/rest/src/index.ts b/ui/component/rest/src/index.ts
index 9c5788385..d5fecce65 100644
--- a/ui/component/rest/src/index.ts
+++ b/ui/component/rest/src/index.ts
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2025, OpenRemote Inc.
+ *
+ * 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 .
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import {ApiClient} from "./restclient";