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 Summary
Constructors - 
Method Summary
Modifier 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.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openhab.core.automation.handler.ModuleHandlerFactory
getTypes 
- 
Constructor Details
- 
BaseModuleHandlerFactory
public BaseModuleHandlerFactory() 
 - 
 - 
Method Details
- 
deactivate
protected void deactivate()Should be overridden by the implementations that extend this base class. Called from DS to deactivate theModuleHandlerFactory. - 
getHandlers
Provides 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. 
 - 
getHandler
Description copied from interface:ModuleHandlerFactory- Specified by:
 getHandlerin interfaceModuleHandlerFactory- Parameters:
 module- theModulefor which aModuleHandlerinstance must be created.ruleUID- the identifier of theRulethat the given module belongs to.- Returns:
 - a new 
ModuleHandlerinstance, ornullif the type of themoduleparameter is not supported by this factory. 
 - 
internalCreate
- Parameters:
 module- theModulefor which a handler should be created.ruleUID- the identifier of theRulethat the given module belongs to.- Returns:
 - a 
ModuleHandlerinstance ornullif this module type is not supported. 
 - 
ungetHandler
Description 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 interfaceModuleHandlerFactory- Parameters:
 module- theModulefor which thehandlerwas created.ruleUID- the identifier of theRulethat the given module belongs to.handler- theModuleHandlerinstance that is no longer needed.
 - 
getModuleIdentifier
 
 -