Interface ModuleHandlerFactory

    • Method Detail

      • getTypes

        Collection<String> getTypes()
        Returns the UIDs of the module types currently supported by this factory. A ModuleHandlerFactory instance can add new types to this list, but should not remove. If a module type is no longer supported, the ModuleHandlerFactory service 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

        @Nullable ModuleHandler getHandler​(Module module,
                                           String ruleUID)
        Creates a ModuleHandler instance needed for the operation of the Modules included in Rules.
        Parameters:
        module - the Module for which a ModuleHandler instance must be created.
        ruleUID - the identifier of the Rule that the given module belongs to.
        Returns:
        a new ModuleHandler instance, or null if the type of the module parameter is not supported by this factory.
      • ungetHandler

        void ungetHandler​(Module module,
                          String ruleUID,
                          ModuleHandler handler)
        Releases the ModuleHandler instance when it is not needed anymore for handling the specified module in the Rule with the specified ruleUID. If no other Rules and Modules use this handler instance, it should be disposed.
        Parameters:
        module - the Module for which the handler was created.
        ruleUID - the identifier of the Rule that the given module belongs to.
        handler - the ModuleHandler instance that is no longer needed.