Package org.openhab.core.semantics
Class ManagedSemanticTagProvider
java.lang.Object
org.openhab.core.common.registry.AbstractProvider<E>
org.openhab.core.common.registry.AbstractManagedProvider<SemanticTag,String,SemanticTagDTO>
org.openhab.core.semantics.ManagedSemanticTagProvider
- All Implemented Interfaces:
ManagedProvider<SemanticTag,
,String> Provider<SemanticTag>
,SemanticTagProvider
@NonNullByDefault
public class ManagedSemanticTagProvider
extends AbstractManagedProvider<SemanticTag,String,SemanticTagDTO>
implements SemanticTagProvider
ManagedSemanticTagProvider
is an OSGi service, that allows to add or remove
semantic tags at runtime by calling AbstractManagedProvider.add(E)
or AbstractManagedProvider.remove(K)
.
An added semantic tag is automatically exposed to the SemanticTagRegistry
.
Persistence of added semantic tags is handled by a StorageService
.- Author:
- Laurent Garnier - Initial contribution
-
Field Summary
Fields inherited from class org.openhab.core.common.registry.AbstractManagedProvider
logger
Fields inherited from class org.openhab.core.common.registry.AbstractProvider
listeners
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAll()
Returns a collection of all elements.protected String
Returns the name of storage, that is used to persist the elements.protected String
keyToString
(String key) Transforms the key into a string representation.protected @Nullable SemanticTag
toElement
(String uid, SemanticTagDTO persistedTag) Converts the persistable element into the original element.protected SemanticTagDTO
Converts the original element into an element that can be persisted.Methods inherited from class org.openhab.core.common.registry.AbstractManagedProvider
add, get, remove, update
Methods inherited from class org.openhab.core.common.registry.AbstractProvider
addProviderChangeListener, notifyListenersAboutAddedElement, notifyListenersAboutRemovedElement, notifyListenersAboutUpdatedElement, removeProviderChangeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.common.registry.Provider
addProviderChangeListener, removeProviderChangeListener
-
Constructor Details
-
ManagedSemanticTagProvider
-
-
Method Details
-
getStorageName
Description copied from class:AbstractManagedProvider
Returns the name of storage, that is used to persist the elements.- Specified by:
getStorageName
in classAbstractManagedProvider<SemanticTag,
String, SemanticTagDTO> - Returns:
- name of the storage
-
keyToString
Description copied from class:AbstractManagedProvider
Transforms the key into a string representation.- Specified by:
keyToString
in classAbstractManagedProvider<SemanticTag,
String, SemanticTagDTO> - Parameters:
key
- key- Returns:
- string representation of the key
-
getAll
Description copied from interface:Provider
Returns a collection of all elements.- Specified by:
getAll
in interfaceProvider<SemanticTag>
- Overrides:
getAll
in classAbstractManagedProvider<SemanticTag,
String, SemanticTagDTO> - Returns:
- collection of all elements
-
toElement
Description copied from class:AbstractManagedProvider
Converts the persistable element into the original element.- Specified by:
toElement
in classAbstractManagedProvider<SemanticTag,
String, SemanticTagDTO> - Parameters:
uid
- keypersistedTag
- persistable element- Returns:
- original element
-
toPersistableElement
Description copied from class:AbstractManagedProvider
Converts the original element into an element that can be persisted.- Specified by:
toPersistableElement
in classAbstractManagedProvider<SemanticTag,
String, SemanticTagDTO> - Parameters:
tag
- original element- Returns:
- persistable element
-