Skip to content

Commit

Permalink
Fixes configuring dynamodb and influxdb using the UI
Browse files Browse the repository at this point in the history
* Update config.xml file paths
* Add missing annotations to DynamoDBPersistenceService
* Remove required configuration policy from DynamoDBPersistenceService causing the component to be not instantiated

See: openhab#5275 (comment)

Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn committed May 10, 2020
1 parent fdaf61a commit 78c8f13
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 119 deletions.
5 changes: 5 additions & 0 deletions bundles/org.openhab.persistence.dynamodb/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
Expand Down
117 changes: 0 additions & 117 deletions bundles/org.openhab.persistence.dynamodb/ESH-INF/config/config.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<DynamoDBItem<?>>
implements QueryablePersistenceService {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0
https://openhab.org/schemas/config-description-1.0.0.xsd">

<config-description uri="persistence:dynamodb">

<!--
############################ Amazon DynamoDB Persistence Service ##################################
#
# The following parameters are used to configure Amazon DynamoDB Persistence.
#
# Further details at https://docs.openhab.org/addons/persistence/dynamodb/readme.html
#
#
# CONNECTION SETTINGS (follow OPTION 1 or OPTION 2)
#
# OPTION 1 (using accessKey and secretKey)
#accessKey=AKIAIOSFODNN7EXAMPLE
#secretKey=3+AAAAABBBbbbCCCCCCdddddd+7mnbIOLH
#region=eu-west-1
# OPTION 2 (using profilesConfigFile and profile)
# where profilesConfigFile points to AWS credentials file
#profilesConfigFile=/etc/openhab2/aws_creds
#profile=fooprofile
#region=eu-west-1
# Credentials file example:
#
# [fooprofile]
# aws_access_key_id=AKIAIOSFODNN7EXAMPLE
# aws_secret_access_key=3+AAAAABBBbbbCCCCCCdddddd+7mnbIOLH
#
# ADVANCED CONFIGURATION (OPTIONAL)
#
# read capacity for the created tables
#readCapacityUnits=1
# write capacity for the created tables
#writeCapacityUnits=1
# table prefix used in the name of created tables
#tablePrefix=openhab-
-->

<parameter name="region" type="text" required="true">
<label>AWS region ID</label>
<description><![CDATA[AWS region ID as described in Step 2 in Setting up Amazon account.<br />
The region needs to match the region of the AWS user that will access Amazon DynamoDB.<br />
For example, eu-west-1.]]></description>
</parameter>

<parameter name="accessKey" type="text" required="false">
<label>AWS access key</label>
<description><![CDATA[AWS access key of the AWS user that will access Amazon DynamoDB.
<br />
Give either 1) access key and secret key, or 2) credentials file and profile name.
]]></description>
</parameter>

<parameter name="secretKey" type="text" required="false">
<label>AWS secret key</label>
<description><![CDATA[AWS secret key of the AWS user that will access Amazon DynamoDB.
<br />
Give either 1) access key and secret key, or 2) credentials file and profile name.
]]></description>
</parameter>


<parameter name="profilesConfigFile" type="text" required="false">
<label>AWS credentials file</label>
<description><![CDATA[Path to the AWS credentials file. <br />
For example, /etc/openhab2/aws_creds.
Please note that the user that runs openHAB must have approriate read rights to the credential file.
<br />
Give either 1) access key and secret key, or 2) credentials file and profile name.
]]></description>
</parameter>

<parameter name="profile" type="text" required="false">
<label>Profile name</label>
<description><![CDATA[Name of the profile to use in AWS credentials file
<br />
Give either 1) access key and secret key, or 2) credentials file and profile name.
]]></description>
</parameter>



<parameter name="readCapacityUnits" type="integer" required="false" min="1">
<description>Read capacity for the created tables. Default is 1.</description>
<label>Read capacity</label>
<advanced>true</advanced>
</parameter>

<parameter name="writeCapacityUnits" type="integer" required="false" min="1">
<label>Write capacity</label>
<description>Write capacity for the created tables. Default is 1.</description>
<advanced>true</advanced>
</parameter>

<parameter name="tablePrefix" type="text" required="false">
<label>Table prefix</label>
<description>Table prefix used in the name of created tables. Default is openhab-</description>
<advanced>true</advanced>
</parameter>

</config-description>

</config-description:config-descriptions>

0 comments on commit 78c8f13

Please sign in to comment.