Package org.openhab.core.transform
Class FileTransformationProvider
java.lang.Object
org.openhab.core.service.AbstractWatchService
org.openhab.core.transform.FileTransformationProvider
- All Implemented Interfaces:
Provider<Transformation>
,TransformationProvider
@NonNullByDefault
public class FileTransformationProvider
extends AbstractWatchService
implements TransformationProvider
The
FileTransformationProvider
implements a TransformationProvider
for
supporting transformations 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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds aProviderChangeListener
which must be notified if there are changes concerning the elements provided by theProvider
.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
Removes aProviderChangeListener
.protected boolean
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
-
Constructor Details
-
FileTransformationProvider
public FileTransformationProvider()
-
-
Method Details
-
addProviderChangeListener
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<Transformation>
- Parameters:
listener
- the listener to be added
-
removeProviderChangeListener
Description copied from interface:Provider
Removes aProviderChangeListener
.- Specified by:
removeProviderChangeListener
in interfaceProvider<Transformation>
- Parameters:
listener
- the listener to be removed.
-
getAll
Description copied from interface:Provider
Returns a collection of all elements.- Specified by:
getAll
in interfaceProvider<Transformation>
- 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
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
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
)
-