Interface ModuleHandlerFactory
- All Known Implementing Classes:
- AnnotatedThingActionModuleTypeProvider,- BaseModuleHandlerFactory
@NonNullByDefault
public interface ModuleHandlerFactory
This interface represents a factory for 
ModuleHandler instances. It is used for creating
 and disposing the TriggerHandlers, ConditionHandlers and ActionHandlers
 needed for the operation of the Modules included in Rules.
 
 ModuleHandlerFactory implementations must be registered as services in the OSGi framework.
- Author:
- Yordan Mihaylov - Initial contribution, Benedikt Niehues - change behavior for unregistering ModuleHandler
- 
Method SummaryModifier and TypeMethodDescription@Nullable ModuleHandlergetHandler(Module module, String ruleUID) getTypes()Returns the UIDs of the module types currently supported by this factory.voidungetHandler(Module module, String ruleUID, ModuleHandler handler) Releases theModuleHandlerinstance when it is not needed anymore for handling the specifiedmodulein theRulewith the specifiedruleUID.
- 
Method Details- 
getTypesCollection<String> getTypes()Returns the UIDs of the module types currently supported by this factory. AModuleHandlerFactoryinstance can add new types to this list, but should not remove. If a module type is no longer supported, theModuleHandlerFactoryservice must be unregistered, and then registered again with the new list.If two or more ModuleHandlerFactorys support the same module type, the Rule Engine will choose one of them randomly. Once a factory is chosen, it will be used to create instances of this module type until its service is unregistered.- Returns:
- collection of module type UIDs supported by this factory.
 
- 
getHandler- 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.
 
- 
ungetHandlerReleases theModuleHandlerinstance when it is not needed anymore for handling the specifiedmodulein theRulewith the specifiedruleUID. If no otherRules andModules use thishandlerinstance, it should be disposed.- 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.
 
 
-