Interface IServiceFactory<S extends org.apache.wicket.util.io.IClusterable>

  • Type Parameters:
    S - the service interface that is wrapped by the factory
    All Superinterfaces:
    org.apache.wicket.util.io.IClusterable, Serializable
    All Known Implementing Classes:
    DialogServiceFactory

    public interface IServiceFactory<S extends org.apache.wicket.util.io.IClusterable>
    extends org.apache.wicket.util.io.IClusterable
    A service factory intercepts access to a service. This allows the factory to create an implementation specific to the plugin requesting access, e.g. to maintain additional state or to be notified of the plugin's disappearance.
    • Method Detail

      • getServiceClass

        Class<? extends S> getServiceClass()
        The service class to be wrapped. Needs to be be present here since the type parameter is not available at run time. (FIXME: really?)
        Returns:
        the service interface class
      • getService

        S getService​(IPluginContext context)
        Invoked when the service is requested from the service registry with the provided plugin context.
        Parameters:
        context - the plugin context that was used to request access
        Returns:
        an instance of the service that can be used by the plugin
      • releaseService

        void releaseService​(IPluginContext context,
                            S service)
        When the plugin that requested an instance of the service, is stopped, this method is invoked. The service factory is encouraged to clean up any resources that have been allocated on behalf of the plugin.
        Parameters:
        context - the plugin context for the plugin that is stopped
        service - the instance of the service that was made available to the plugin