From 78c8f132ff9bf278bdc0f80eb20885064f7ab9bb Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Sun, 10 May 2020 21:01:50 +0200 Subject: [PATCH] Fixes configuring dynamodb and influxdb using the UI * Update config.xml file paths * Add missing annotations to DynamoDBPersistenceService * Remove required configuration policy from DynamoDBPersistenceService causing the component to be not instantiated See: https://github.com/openhab/openhab-addons/pull/5275#issuecomment-626187471 Signed-off-by: Wouter Born --- .../.classpath | 5 + .../ESH-INF/config/config.xml | 117 ----------------- .../internal/DynamoDBPersistenceService.java | 9 +- .../main/resources/OH-INF/config/config.xml | 118 ++++++++++++++++++ .../{ESH-INF => OH-INF}/config/config.xml | 0 5 files changed, 130 insertions(+), 119 deletions(-) delete mode 100644 bundles/org.openhab.persistence.dynamodb/ESH-INF/config/config.xml create mode 100644 bundles/org.openhab.persistence.dynamodb/src/main/resources/OH-INF/config/config.xml rename bundles/org.openhab.persistence.influxdb/src/main/resources/{ESH-INF => OH-INF}/config/config.xml (100%) diff --git a/bundles/org.openhab.persistence.dynamodb/.classpath b/bundles/org.openhab.persistence.dynamodb/.classpath index 19368e503c1f5..4328dab553644 100644 --- a/bundles/org.openhab.persistence.dynamodb/.classpath +++ b/bundles/org.openhab.persistence.dynamodb/.classpath @@ -6,6 +6,11 @@ + + + + + diff --git a/bundles/org.openhab.persistence.dynamodb/ESH-INF/config/config.xml b/bundles/org.openhab.persistence.dynamodb/ESH-INF/config/config.xml deleted file mode 100644 index 6abf96b5ee850..0000000000000 --- a/bundles/org.openhab.persistence.dynamodb/ESH-INF/config/config.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - The region needs to match the region of the AWS user that will access Amazon DynamoDB.
- For example, eu-west-1.]]>
-
- - - - - Give either 1) access key and secret key, or 2) credentials file and profile name. - ]]> - - - - - - Give either 1) access key and secret key, or 2) credentials file and profile name. - ]]> - - - - - - - For example, /etc/openhab2/aws_creds. - Please note that the user that runs openHAB must have approriate read rights to the credential file. -
- Give either 1) access key and secret key, or 2) credentials file and profile name. - ]]>
-
- - - - - Give either 1) access key and secret key, or 2) credentials file and profile name. - ]]> - - - - - - Read capacity for the created tables. Default is 1. - - true - - - - - Write capacity for the created tables. Default is 1. - true - - - - - Table prefix used in the name of created tables. Default is openhab- - true - - -
- -
\ No newline at end of file diff --git a/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java b/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java index 031c665f7e46a..e8f7c0fd85ad0 100644 --- a/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java +++ b/bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java @@ -32,6 +32,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.common.NamedThreadFactory; +import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemRegistry; @@ -43,9 +44,9 @@ import org.openhab.core.persistence.strategy.PersistenceStrategy; import org.openhab.core.types.State; import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.ConfigurationPolicy; import org.osgi.service.component.annotations.Deactivate; import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; @@ -83,7 +84,11 @@ */ @NonNullByDefault @Component(service = { PersistenceService.class, - QueryablePersistenceService.class }, configurationPid = "org.openhab.dynamodb", configurationPolicy = ConfigurationPolicy.REQUIRE) + QueryablePersistenceService.class }, configurationPid = "org.openhab.dynamodb", property = { + Constants.SERVICE_PID + "=org.openhab.dynamodb", + ConfigurableService.SERVICE_PROPERTY_DESCRIPTION_URI + "=persistence:dynamodb", + ConfigurableService.SERVICE_PROPERTY_LABEL + "=DynamoDB Persistence Service", + ConfigurableService.SERVICE_PROPERTY_CATEGORY + "=persistence" }) public class DynamoDBPersistenceService extends AbstractBufferedPersistenceService> implements QueryablePersistenceService { diff --git a/bundles/org.openhab.persistence.dynamodb/src/main/resources/OH-INF/config/config.xml b/bundles/org.openhab.persistence.dynamodb/src/main/resources/OH-INF/config/config.xml new file mode 100644 index 0000000000000..d89b90c1ae613 --- /dev/null +++ b/bundles/org.openhab.persistence.dynamodb/src/main/resources/OH-INF/config/config.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + The region needs to match the region of the AWS user that will access Amazon DynamoDB.
+ For example, eu-west-1.]]>
+
+ + + + + Give either 1) access key and secret key, or 2) credentials file and profile name. + ]]> + + + + + + Give either 1) access key and secret key, or 2) credentials file and profile name. + ]]> + + + + + + + For example, /etc/openhab2/aws_creds. + Please note that the user that runs openHAB must have approriate read rights to the credential file. +
+ Give either 1) access key and secret key, or 2) credentials file and profile name. + ]]>
+
+ + + + + Give either 1) access key and secret key, or 2) credentials file and profile name. + ]]> + + + + + + Read capacity for the created tables. Default is 1. + + true + + + + + Write capacity for the created tables. Default is 1. + true + + + + + Table prefix used in the name of created tables. Default is openhab- + true + + +
+ +
diff --git a/bundles/org.openhab.persistence.influxdb/src/main/resources/ESH-INF/config/config.xml b/bundles/org.openhab.persistence.influxdb/src/main/resources/OH-INF/config/config.xml similarity index 100% rename from bundles/org.openhab.persistence.influxdb/src/main/resources/ESH-INF/config/config.xml rename to bundles/org.openhab.persistence.influxdb/src/main/resources/OH-INF/config/config.xml