Package io.meeds.appcenter.service
Class ApplicationBadgePluginRegistry
java.lang.Object
io.meeds.appcenter.service.ApplicationBadgePluginRegistry
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReservedbadgeNamemeaning "an administrator turned this application's badge off", as opposed to a blank value which lets the url binding resolve. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPlugin(ApplicationBadgePlugin plugin) Registers a badge plugin, replacing any previously registered plugin with the same name.getBoundUrls(ApplicationBadgePlugin plugin) Resolves the urls a badge is bound to, in the form actually stored on the applications: aPORTLETentry stores a portlet instance id, so the declared portlet names have to be translated back to those ids.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.
-
Field Details
-
BADGE_DISABLED
ReservedbadgeNamemeaning "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
Resolves the urls a badge is bound to, in the form actually stored on the applications: aPORTLETentry 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
Registers a badge plugin, replacing any previously registered plugin with the same name.- Parameters:
plugin- the plugin to register
-
getPlugin
- Parameters:
badgeName- the badge identifier- Returns:
- the plugin registered under that name, or
null
-
getPlugins
- Returns:
- every registered plugin
-
getPluginNames
- Returns:
- the name of every registered plugin, sorted, for the administration suggester
-
resolveBadgeName
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
ApplicationBadgeServiceso thatApplicationCenterServicecan 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
-