Class BaseModuleHandlerFactory
java.lang.Object
org.openhab.core.automation.handler.BaseModuleHandlerFactory
- All Implemented Interfaces:
- ModuleHandlerFactory
- Direct Known Subclasses:
- AnnotatedThingActionModuleTypeProvider
@NonNullByDefault
public abstract class BaseModuleHandlerFactory
extends Object
implements ModuleHandlerFactory
This class provides a 
ModuleHandlerFactory base implementation. It is used by its subclasses for base
 implementation of creating and disposing ModuleHandler instances. They only have to implement
 internalCreate(Module, String) method for creating concrete instances needed for the operation of the
 Modules.- Author:
- Kai Kreuzer - Initial contribution, Benedikt Niehues - change behavior for unregistering ModuleHandler
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidShould be overridden by the implementations that extend this base class.@Nullable ModuleHandlergetHandler(Module module, String ruleUID) protected Map<String, ModuleHandler> Provides all availableModuleHandlers created by concrete factory implementation.protected StringgetModuleIdentifier(String ruleUid, String moduleId) protected abstract @Nullable ModuleHandlerinternalCreate(Module module, String ruleUID) voidungetHandler(Module module, String ruleUID, ModuleHandler handler) Releases theModuleHandlerinstance when it is not needed anymore for handling the specifiedmodulein theRulewith the specifiedruleUID.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openhab.core.automation.handler.ModuleHandlerFactorygetTypes
- 
Constructor Details- 
BaseModuleHandlerFactorypublic BaseModuleHandlerFactory()
 
- 
- 
Method Details- 
deactivateprotected void deactivate()Should be overridden by the implementations that extend this base class. Called from DS to deactivate theModuleHandlerFactory.
- 
getHandlersProvides all availableModuleHandlers created by concrete factory implementation.- Returns:
- a map with keys calculated by concatenated rule UID and module Id and values representing
         ModuleHandlercreated for concrete module corresponding to the module Id and belongs to rule with such UID.
 
- 
getHandlerDescription copied from interface:ModuleHandlerFactory- Specified by:
- getHandlerin interface- ModuleHandlerFactory
- Parameters:
- module- the- Modulefor which a- ModuleHandlerinstance must be created.
- ruleUID- the identifier of the- Rulethat the given module belongs to.
- Returns:
- a new ModuleHandlerinstance, ornullif the type of themoduleparameter is not supported by this factory.
 
- 
internalCreate- Parameters:
- module- the- Modulefor which a handler should be created.
- ruleUID- the identifier of the- Rulethat the given module belongs to.
- Returns:
- a ModuleHandlerinstance ornullif this module type is not supported.
 
- 
ungetHandlerDescription copied from interface:ModuleHandlerFactoryReleases theModuleHandlerinstance when it is not needed anymore for handling the specifiedmodulein theRulewith the specifiedruleUID. If no otherRules andModules use thishandlerinstance, it should be disposed.- Specified by:
- ungetHandlerin interface- ModuleHandlerFactory
- Parameters:
- module- the- Modulefor which the- handlerwas created.
- ruleUID- the identifier of the- Rulethat the given module belongs to.
- handler- the- ModuleHandlerinstance that is no longer needed.
 
- 
getModuleIdentifier
 
-