Skip to content

Commit

Permalink
Specified OSGi service (#989)
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
  • Loading branch information
cweitkamp authored and kaikreuzer committed Aug 24, 2019
1 parent e2132a7 commit 5c5c9ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.core.common.registry.AbstractProvider;
import org.eclipse.smarthome.core.common.registry.RegistryChangeListener;
import org.eclipse.smarthome.core.items.GroupItem;
import org.eclipse.smarthome.core.items.Item;
import org.eclipse.smarthome.core.items.ItemRegistry;
import org.eclipse.smarthome.core.items.ItemRegistryChangeListener;
import org.eclipse.smarthome.core.items.Metadata;
import org.eclipse.smarthome.core.items.MetadataKey;
import org.eclipse.smarthome.core.items.MetadataProvider;
Expand All @@ -52,10 +52,10 @@
*
* @author Kai Kreuzer - Initial contribution
*/
@Component(immediate = true, service = MetadataProvider.class)
@NonNullByDefault
@Component(immediate = true)
public class SemanticsMetadataProvider extends AbstractProvider<Metadata>
implements MetadataProvider, RegistryChangeListener<Item> {
implements ItemRegistryChangeListener, MetadataProvider {

// the namespace to use for the metadata
public static final String NAMESPACE = "semantics";
Expand Down Expand Up @@ -231,6 +231,13 @@ private void initRelations() {
propertyRelations.put(Arrays.asList(Point.class), "relatesTo");
}

@Override
public void allItemsChanged(Collection<String> oldItemNames) {
for (Item item : itemRegistry.getItems()) {
added(item);
}
}

@Override
public void added(Item item) {
processItem(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public interface ItemRegistryChangeListener extends RegistryChangeListener<Item>
*
* @param oldItemNames a collection of all previous item names, so that references can be removed
*/
public void allItemsChanged(Collection<String> oldItemNames);
void allItemsChanged(Collection<String> oldItemNames);

}

0 comments on commit 5c5c9ae

Please sign in to comment.