Interface Plugin

  • public interface Plugin
    An ArSystem plugin.

    A plugin attaches to one or more systems in order to react to certain life-cycle events. A plugin could, for example, modify services about to be provided by its system, react to services being dismissed, or help resolve service consumption queries.

    At a technical level, implementations of this interface can be regarded as factory classes for creating PluginAttached instances via the attachTo(ArSystem, Map) method each of them provides.

    • Method Detail

      • dependencies

        default java.util.Set<java.lang.Class<? extends Plugin>> dependencies()
        Names plugins, if any, this plugin depend on.

        If a plugin depended upon would be not be explicitly provided to the same system as this plugin, instances of the dependencies will be created automatically, if possible, and provided to the system in question. Automatic dependency creation is possible only if each dependency has either (1) a public static instance() method that returns an instance of the plugin, or (2) a public constructor that takes no arguments. Not having provided a dependency that cannot be created automatically will prevent the ArSystem in question from being instantiated at all.

        Dependencies are always attachTo(ArSystem, Map) attached} before the plugins that depend on them.

      • ordinal

        default int ordinal()
        Indication of when this Plugin should be attached in relation to to other such provided to the same ArSystem. Plugins with lower ordinals are loaded first.

        If this Plugin has any dependencies, it will be loaded after the plugins depended upon, irrespective of the ordinals those plugins state.

        Explicitly stating an ordinal by overriding this method will primarily be relevant to plugins that provide functionality indirectly depended upon by other plugins, or that indirectly depend on all other plugins. If, for example, a plugin performs service query resolution, it might be relevant to ensure it is loaded before other plugins that may depend on it being available.

        Ordinal used for determining plugin attachment order.
      • attachTo

        Future<PluginAttached> attachTo​(ArSystem system,
                                        java.util.Map<java.lang.Class<? extends Plugin>,​PluginFacade> dependencies)
                                 throws java.lang.Exception
        Attaches plugin to given system.
        system - System to which this plugin is attached.
        dependencies - Mappings between the dependencies of this plugin who provided facades when attached.
        Future that, if successful, completes with an object useful for concretely handling the life-cycle events of the given system.