fix code for new storage service handling (#63)

Related to: https://github.com/openhab/openhab-core/pull/787

Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
pull/68/head
Markus Rathgeb 2019-05-02 21:34:57 +02:00 committed by Kai Kreuzer
parent 28c86adeeb
commit 4ee9f0540a
2 changed files with 12 additions and 23 deletions

View File

@ -17,9 +17,9 @@ import org.eclipse.smarthome.core.common.registry.DefaultAbstractManagedProvider
import org.eclipse.smarthome.core.common.registry.ManagedProvider;
import org.eclipse.smarthome.core.storage.StorageService;
import org.openhab.ui.habot.card.Card;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferencePolicy;
/**
* The @link {@link ManagedProvider} for {@link Card} elements
@ -29,6 +29,11 @@ import org.osgi.service.component.annotations.ReferencePolicy;
@Component(service = CardProvider.class, immediate = true)
public class CardProvider extends DefaultAbstractManagedProvider<Card, String> {
@Activate
public CardProvider(final @Reference StorageService storageService) {
super(storageService);
}
@Override
protected String getStorageName() {
return "habot_cards";
@ -39,14 +44,4 @@ public class CardProvider extends DefaultAbstractManagedProvider<Card, String> {
return key;
}
@Reference(policy = ReferencePolicy.DYNAMIC)
@Override
protected void setStorageService(StorageService storageService) {
super.setStorageService(storageService);
}
@Override
protected void unsetStorageService(StorageService storageService) {
super.unsetStorageService(storageService);
}
}

View File

@ -18,9 +18,9 @@ import org.eclipse.smarthome.core.common.registry.ManagedProvider;
import org.eclipse.smarthome.core.storage.StorageService;
import org.openhab.ui.habot.notification.internal.webpush.Subscription;
import org.openhab.ui.habot.notification.internal.webpush.Subscription.Keys;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferencePolicy;
/**
* The @link {@link ManagedProvider} for {@link Subscription} elements
@ -30,6 +30,11 @@ import org.osgi.service.component.annotations.ReferencePolicy;
@Component(service = SubscriptionProvider.class, immediate = true)
public class SubscriptionProvider extends DefaultAbstractManagedProvider<Subscription, Keys> {
@Activate
public SubscriptionProvider(final @Reference StorageService storageService) {
super(storageService);
}
@Override
protected String getStorageName() {
return "habot_webpush_subscriptions";
@ -41,15 +46,4 @@ public class SubscriptionProvider extends DefaultAbstractManagedProvider<Subscri
return String.format("%s.%s", key.p256dh, key.auth);
}
@Reference(policy = ReferencePolicy.DYNAMIC)
@Override
protected void setStorageService(StorageService storageService) {
super.setStorageService(storageService);
}
@Override
protected void unsetStorageService(StorageService storageService) {
super.unsetStorageService(storageService);
}
}