Package org.openhab.core.model.core
Interface ModelRepository
@NonNullByDefault
public interface ModelRepository
The model repository stores the configuration files (EMF models).
It takes care of loading these resources and serving them to clients.
By this abstraction, the clients do not need to know where the models
come from.
- Author:
- Kai Kreuzer - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a change listenerboolean
addOrRefreshModel
(String name, InputStream inputStream) Adds a model to the repository or refreshes it if it already existsgetAllModelNamesOfType
(String modelType) Returns all names of models of a given type (file extension)@Nullable org.eclipse.emf.ecore.EObject
Returns a model of a given namevoid
reloadAllModelsOfType
(String modelType) Reload and parse all models of the given typeremoveAllModelsOfType
(String modelType) Remove all models of the given typeboolean
removeModel
(String name) Removes a model from the repositoryvoid
Removes a change listener
-
Method Details
-
getModel
Returns a model of a given name- Parameters:
name
- name of the requested model- Returns:
- the model or null, if not found
-
addOrRefreshModel
Adds a model to the repository or refreshes it if it already exists- Parameters:
name
- the model name to add/refreshinputStream
- an input stream with the model's content, optional if the file already exists- Returns:
- true, if it was successfully processed, false otherwise
-
removeModel
Removes a model from the repository- Parameters:
name
- the name of the model to remove- Returns:
- true, if model was removed, false, if it did not exist
-
getAllModelNamesOfType
Returns all names of models of a given type (file extension)- Parameters:
modelType
- the model type to get the names for- Returns:
- all names of available models
-
reloadAllModelsOfType
Reload and parse all models of the given type- Parameters:
modelType
- the model type to reload
-
removeAllModelsOfType
Remove all models of the given type- Parameters:
modelType
- the model type to remove- Returns:
- all names of the removed models
-
addModelRepositoryChangeListener
Adds a change listener- Parameters:
listener
- the listener to add
-
removeModelRepositoryChangeListener
Removes a change listener- Parameters:
listener
- the listener to remove
-