Package org.openhab.core.transform
Class FileTransformationConfigurationProvider
- java.lang.Object
-
- org.openhab.core.service.AbstractWatchService
-
- org.openhab.core.transform.FileTransformationConfigurationProvider
-
- All Implemented Interfaces:
Provider<TransformationConfiguration>
,TransformationConfigurationProvider
@NonNullByDefault public class FileTransformationConfigurationProvider extends AbstractWatchService implements TransformationConfigurationProvider
TheFileTransformationConfigurationProvider
implements aTransformationConfigurationProvider
for supporting configurations stored in configuration files- Author:
- Jan N. Klug - Initial contribution
-
-
Field Summary
-
Fields inherited from class org.openhab.core.service.AbstractWatchService
pathToWatch, watchQueueReader
-
-
Constructor Summary
Constructors Constructor Description FileTransformationConfigurationProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProviderChangeListener(ProviderChangeListener<TransformationConfiguration> listener)
Adds aProviderChangeListener
which must be notified if there are changes concerning the elements provided by theProvider
.Collection<TransformationConfiguration>
getAll()
Returns a collection of all elements.protected WatchEvent.Kind<?> @Nullable []
getWatchEventKinds(Path directory)
Provides theWatchKey
s for the registration of the directory, which will be registered in the watch service.protected void
processWatchEvent(WatchEvent<?> event, WatchEvent.Kind<?> kind, Path path)
Processes the given watch event.void
removeProviderChangeListener(ProviderChangeListener<TransformationConfiguration> listener)
Removes aProviderChangeListener
.protected boolean
watchSubDirectories()
Determines whether the subdirectories of the source path (determined by theAbstractWatchService.getSourcePath()
) will be watched or not.-
Methods inherited from class org.openhab.core.service.AbstractWatchService
activate, changeWatchDirectory, deactivate, getSourcePath
-
-
-
-
Method Detail
-
addProviderChangeListener
public void addProviderChangeListener(ProviderChangeListener<TransformationConfiguration> listener)
Description copied from interface:Provider
Adds aProviderChangeListener
which must be notified if there are changes concerning the elements provided by theProvider
.- Specified by:
addProviderChangeListener
in interfaceProvider<TransformationConfiguration>
- Parameters:
listener
- the listener to be added
-
removeProviderChangeListener
public void removeProviderChangeListener(ProviderChangeListener<TransformationConfiguration> listener)
Description copied from interface:Provider
Removes aProviderChangeListener
.- Specified by:
removeProviderChangeListener
in interfaceProvider<TransformationConfiguration>
- Parameters:
listener
- the listener to be removed.
-
getAll
public Collection<TransformationConfiguration> getAll()
Description copied from interface:Provider
Returns a collection of all elements.- Specified by:
getAll
in interfaceProvider<TransformationConfiguration>
- Returns:
- collection of all elements
-
watchSubDirectories
protected boolean watchSubDirectories()
Description copied from class:AbstractWatchService
Determines whether the subdirectories of the source path (determined by theAbstractWatchService.getSourcePath()
) will be watched or not.- Specified by:
watchSubDirectories
in classAbstractWatchService
- Returns:
true
if the subdirectories will be watched andfalse
if only the source path (determined by theAbstractWatchService.getSourcePath()
) will be watched
-
getWatchEventKinds
protected WatchEvent.Kind<?> @Nullable [] getWatchEventKinds(Path directory)
Description copied from class:AbstractWatchService
Provides theWatchKey
s for the registration of the directory, which will be registered in the watch service.- Specified by:
getWatchEventKinds
in classAbstractWatchService
- Parameters:
directory
- the directory, which will be registered in the watch service- Returns:
- The array of
WatchKey
s for the registration ornull
if no registration has been done.
-
processWatchEvent
protected void processWatchEvent(WatchEvent<?> event, WatchEvent.Kind<?> kind, Path path)
Description copied from class:AbstractWatchService
Processes the given watch event. Note that the kind and the number of the events for the watched directory is a platform dependent (see the "Platform dependencies" sections ofWatchService
).- Specified by:
processWatchEvent
in classAbstractWatchService
- Parameters:
event
- the watch event to be handledkind
- the event's kindpath
- the path of the event (resolved to theAbstractWatchService.pathToWatch
)
-
-