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
parent
28c86adeeb
commit
4ee9f0540a
|
@ -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.common.registry.ManagedProvider;
|
||||||
import org.eclipse.smarthome.core.storage.StorageService;
|
import org.eclipse.smarthome.core.storage.StorageService;
|
||||||
import org.openhab.ui.habot.card.Card;
|
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.Component;
|
||||||
import org.osgi.service.component.annotations.Reference;
|
import org.osgi.service.component.annotations.Reference;
|
||||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The @link {@link ManagedProvider} for {@link Card} elements
|
* 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)
|
@Component(service = CardProvider.class, immediate = true)
|
||||||
public class CardProvider extends DefaultAbstractManagedProvider<Card, String> {
|
public class CardProvider extends DefaultAbstractManagedProvider<Card, String> {
|
||||||
|
|
||||||
|
@Activate
|
||||||
|
public CardProvider(final @Reference StorageService storageService) {
|
||||||
|
super(storageService);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getStorageName() {
|
protected String getStorageName() {
|
||||||
return "habot_cards";
|
return "habot_cards";
|
||||||
|
@ -39,14 +44,4 @@ public class CardProvider extends DefaultAbstractManagedProvider<Card, String> {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Reference(policy = ReferencePolicy.DYNAMIC)
|
|
||||||
@Override
|
|
||||||
protected void setStorageService(StorageService storageService) {
|
|
||||||
super.setStorageService(storageService);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void unsetStorageService(StorageService storageService) {
|
|
||||||
super.unsetStorageService(storageService);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@ import org.eclipse.smarthome.core.common.registry.ManagedProvider;
|
||||||
import org.eclipse.smarthome.core.storage.StorageService;
|
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;
|
||||||
import org.openhab.ui.habot.notification.internal.webpush.Subscription.Keys;
|
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.Component;
|
||||||
import org.osgi.service.component.annotations.Reference;
|
import org.osgi.service.component.annotations.Reference;
|
||||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The @link {@link ManagedProvider} for {@link Subscription} elements
|
* 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)
|
@Component(service = SubscriptionProvider.class, immediate = true)
|
||||||
public class SubscriptionProvider extends DefaultAbstractManagedProvider<Subscription, Keys> {
|
public class SubscriptionProvider extends DefaultAbstractManagedProvider<Subscription, Keys> {
|
||||||
|
|
||||||
|
@Activate
|
||||||
|
public SubscriptionProvider(final @Reference StorageService storageService) {
|
||||||
|
super(storageService);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getStorageName() {
|
protected String getStorageName() {
|
||||||
return "habot_webpush_subscriptions";
|
return "habot_webpush_subscriptions";
|
||||||
|
@ -41,15 +46,4 @@ public class SubscriptionProvider extends DefaultAbstractManagedProvider<Subscri
|
||||||
return String.format("%s.%s", key.p256dh, key.auth);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue