Interface IPromptServiceHandlerRegistry


  • public interface IPromptServiceHandlerRegistry
    Low-level registry for prompt service handlers. Lets you register, resolve and unregister handlers. Prompt service handler implementations can be provided in the following ways:
    • By explicitly registering them with this registry via registerHandler(scope, handler).
    • By making a prompt service handler implementation available via the CDI, with the application scope.
    • By installing a prompt service plugin (IPluginPromptService that provides a prompt service handler implementation.
    Since:
    8.5.0
    • Method Detail

      • findAllHandlers

        Iterable<IPromptServiceHandlerEntry<?,​?>> findAllHandlers​(UUID tenant)
        Returns all registered handlers for the given tenant scope. This includes handlers registered via registerType(tenant, handler) as well as handlers provided by plugins.
        Parameters:
        tenant - The tenant scope for which to retrieve all handlers, or null to retrieve all global handlers.
        Returns:
        An iterable over all registered handlers for the given tenant scope.
      • findAllHandlers

        Iterable<IPromptServiceHandlerEntry<?,​?>> findAllHandlers​(PromptScope scope)
        Returns all registered handlers for the given scope. This includes handlers registered via registerType(tenant, handler) as well as handlers provided by plugins.
        Parameters:
        scope - The scope for which to retrieve all handlers, or null to retrieve all global handlers.
        Returns:
        An iterable over all registered handlers for the given tenant scope.
      • registerHandler

        void registerHandler​(UUID tenant,
                             IPromptServiceHandler<?,​?> handler)
        Registers a prompt service type within a given tenant scope. When the scope is null, the type is registered globally and is available in all tenant scopes. If a type with the same ID was already registered in the given scope, it is replaced with the new handler.
        Parameters:
        tenant - The tenant scope in which to register the type, or null to register it globally.
        handler - The handler that implements the prompt service type. If null, the registration is removed.
      • resolveHandler

        IPromptServiceHandlerEntry<?,​?> resolveHandler​(UUID tenant,
                                                             String type)
        Finds the handler for the given prompt service type within the given tenant scope.

        This method considers various handler sources, such as handlers registered via registerType(tenant, handler) or handlers provided by plugins.

        When no handler is found in the given tenant scope, returns the handler registered in the global scope, if any.

        Parameters:
        tenant - The tenant scope in which to search for the handler, or null to search in the global scope.
        type - The type ID of the prompt service whose handler to find.
        Returns:
        The handler for the given type in the given tenant scope, or null if no such handler exists.
      • resolveHandler

        IPromptServiceHandlerEntry<?,​?> resolveHandler​(PromptScope scope,
                                                             String type)
        Finds the handler for the given prompt service type within the given scope.

        This method considers various handler sources, such as handlers registered via registerType(tenant, handler) or handlers provided by plugins.

        When no handler is found in the given tenant scope, returns the handler registered in the global scope, if any.

        Parameters:
        scope - The scope in which to search for the handler.
        type - The type ID of the prompt service whose handler to find.
        Returns:
        The handler for the given type in the given tenant scope, or null if no such handler exists.
      • resolvePlugin

        IPromptServicePluginId resolvePlugin​(UUID tenant,
                                             String type)
        Attempts to find the plugin that provides the prompt service handler for the given type within the given tenant scope. Returns null when no such handler exists, or it is not provided by a plugin.
        Parameters:
        tenant - The tenant scope in which to search for the handler, or null to search in the global scope.
        type - The type ID of the prompt service whose handler to find.
        Returns:
        The plugin ID that provides the handler for the given type in the given tenant scope, or null if no such handler exists, or it is not provided by a plugin.
      • unregisterHandler

        void unregisterHandler​(UUID tenant,
                               String type)
        Unregisters a prompt service type from a given tenant scope that was previously registered with registerType(tenant, handler).
        Parameters:
        tenant - The tenant scope from which to unregister the type, or null to unregister it globally.
        type - The type ID of the prompt service to unregister.
      • unregisterHandlers

        void unregisterHandlers​(UUID tenant)
        Unregisters all prompt service types from a given tenant scope that were previously registered with registerType(tenant, handler).
        Parameters:
        tenant - The tenant scope from which to unregister all types, or null to unregister all global types.