Class AbstractScriptDependencyTracker
java.lang.Object
org.openhab.core.automation.module.script.rulesupport.loader.AbstractScriptDependencyTracker
- All Implemented Interfaces:
ScriptDependencyTracker,WatchService.WatchEventListener
@NonNullByDefault
public abstract class AbstractScriptDependencyTracker
extends Object
implements ScriptDependencyTracker, WatchService.WatchEventListener
The
AbstractScriptDependencyTracker tracks dependencies between scripts and reloads dependees
It needs to be sub-classed for each ScriptEngineFactory
that wants to support dependency tracking- Author:
- Jonathan Gilbert - Initial contribution, Jan N. Klug - Refactored to OSGi service
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openhab.core.automation.module.script.ScriptDependencyTracker
ScriptDependencyTracker.Listener -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractScriptDependencyTracker(WatchService watchService, String fileDirectory) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a dependency change listener Since this is done via service injection and OSGi annotations are not inherited it is required that subclasses expose this method with proper annotationvoidprotected voiddependencyChanged(String dependency) getTracker(String scriptId) Get the tracker for a given script identifiervoidprocessWatchEvent(WatchService.Kind kind, Path fullPath) Notify Listener about watch eventvoidvoidremoveTracking(String scriptId) Remove all tracking data for a given scipt identifierprotected voidstartTracking(String scriptId, String libPath)
-
Field Details
-
libraryPath
-
-
Constructor Details
-
AbstractScriptDependencyTracker
-
-
Method Details
-
deactivate
public void deactivate() -
getLibraryPath
-
processWatchEvent
Description copied from interface:WatchService.WatchEventListenerNotify Listener about watch event- Specified by:
processWatchEventin interfaceWatchService.WatchEventListener- Parameters:
kind- theWatchService.Kindof this eventfullPath- the absolute path of the file associated with this event
-
dependencyChanged
-
getTracker
Description copied from interface:ScriptDependencyTrackerGet the tracker for a given script identifier- Specified by:
getTrackerin interfaceScriptDependencyTracker- Parameters:
scriptId- the unique id of the script- Returns:
- a
Consumer<String>that accepts a the path to a dependency
-
removeTracking
Description copied from interface:ScriptDependencyTrackerRemove all tracking data for a given scipt identifier- Specified by:
removeTrackingin interfaceScriptDependencyTracker- Parameters:
scriptId- the uniwue id of the script
-
startTracking
-
addChangeTracker
Add a dependency change listener Since this is done via service injection and OSGi annotations are not inherited it is required that subclasses expose this method with proper annotation- Parameters:
listener- the dependency change listener
-
removeChangeTracker
-