Class ApplicationBadgePluginRegistry

java.lang.Object
io.meeds.appcenter.service.ApplicationBadgePluginRegistry

@Service public class ApplicationBadgePluginRegistry extends Object
Holds the ApplicationBadgePlugin contributed by every addon, and resolves which badge a catalog entry displays.

Each plugin registers itself from its own module's @PostConstruct, so registration does not depend on the order in which the WARs boot.

  • Field Details

    • BADGE_DISABLED

      public static final String BADGE_DISABLED
      Reserved badgeName meaning "an administrator turned this application's badge off", as opposed to a blank value which lets the url binding resolve.
      See Also:
  • Constructor Details

    • ApplicationBadgePluginRegistry

      public ApplicationBadgePluginRegistry()
  • Method Details

    • getBoundUrls

      public List<String> getBoundUrls(ApplicationBadgePlugin plugin)
      Resolves the urls a badge is bound to, in the form actually stored on the applications: a PORTLET entry stores a portlet instance id, so the declared portlet names have to be translated back to those ids.
      Parameters:
      plugin - the badge plugin
      Returns:
      the stored urls this badge binds to, never null
    • addPlugin

      public void addPlugin(ApplicationBadgePlugin plugin)
      Registers a badge plugin, replacing any previously registered plugin with the same name.
      Parameters:
      plugin - the plugin to register
    • getPlugin

      public ApplicationBadgePlugin getPlugin(String badgeName)
      Parameters:
      badgeName - the badge identifier
      Returns:
      the plugin registered under that name, or null
    • getPlugins

      public Collection<ApplicationBadgePlugin> getPlugins()
      Returns:
      every registered plugin
    • getPluginNames

      public List<String> getPluginNames()
      Returns:
      the name of every registered plugin, sorted, for the administration suggester
    • resolveBadgeName

      public String resolveBadgeName(Application application)
      Resolves which badge an application displays: an explicitly bound name wins, otherwise a Drawer or Portlet entry matches the url a plugin declares.

      Lives here rather than in ApplicationBadgeService so that ApplicationCenterService can decorate the applications it returns without the two services depending on each other.

      Parameters:
      application - the catalog entry
      Returns:
      the badge identifier, or null when the application carries none or was explicitly opted out