Class PluginState

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent

public class PluginState
extends AbstractInitializableComponent
A class which will answer questions about a plugin state as of now (by querying the information Resources for the current published state).
  • Field Details

    • SPACE_CONTAINING

      private static final Pattern SPACE_CONTAINING
      regexp for spaces.
    • plugin

      @Nonnull private final IdPPlugin plugin
      The plug in in question.
    • myPluginVersion

      @Nonnull private final PluginVersion myPluginVersion
      The version of this plugin.
    • versionInfo

      @Nonnull private final Map<PluginVersion,​PluginState.VersionInfo> versionInfo
      The support information.
    • downloadInfo

      @Nonnull private final Map<PluginVersion,​Pair<URL,​String>> downloadInfo
      The Download information.
    • myVersionInfo

      My support information.
    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • httpClient

      @NonnullAfterInit private org.apache.http.client.HttpClient httpClient
      The HttpClient to use.
    • updateOverrideURLs

      @Nonnull private final List<URL> updateOverrideURLs
      If overridden these are the urls to us for update (rather than what the plguin asks for.
  • Constructor Details

    • PluginState

      public PluginState​(@Nonnull IdPPlugin description, List<URL> updateOverrides)
      Constructor.
      Parameters:
      description - what we are talking about.
      updateOverrides - override for update locations. An empty list signifies no overrride.
  • Method Details

    • getUpdateURL

      @Nullable public URL getUpdateURL​(PluginVersion version)
      Get the base URL for this version.
      Parameters:
      version - which version
      Returns:
      the base URL
    • getUpdateBaseName

      @Nullable public String getUpdateBaseName​(PluginVersion version)
      Get the base Name for this version.
      Parameters:
      version - which version
      Returns:
      the base name
    • setHttpClient

      public void setHttpClient​(@Nonnull org.apache.http.client.HttpClient what)
      Set the client.
      Parameters:
      what - what to set.
    • getDefaultedValue

      @Nullable private String getDefaultedValue​(Properties props, String interfix, String version)
      Look up the key derived from the pluginId, the interfix and the version, but if that fails look for a templated definition.
      Parameters:
      props - what to look in
      interfix - the interface (between the ID and the version)
      version - the version.
      Returns:
      the suitable value
    • handleAvailableVersion

      private boolean handleAvailableVersion​(Properties props, String version)
      Given a version find out more.
      Parameters:
      props - the property files for this plugin we are looking at
      version - the version in question.
      Returns:
      true if we processed everything OK.
    • handleAvailableVersions

      private boolean handleAvailableVersions​(Properties props, String availableVersions)
      Given a list of versions find out more.
      Parameters:
      props - the property files for this plugin we are looking at
      availableVersions - a space delimited array of versions
      Returns:
      true if we processed everything OK.
    • populate

      protected boolean populate​(@Nonnull Resource propertyResource)
      (try to) populate the information about this plugin.
      Parameters:
      propertyResource - where to start looking
      Returns:
      whether it worked
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractInitializableComponent
      Throws:
      ComponentInitializationException
    • isSupportedWithIdPVersion

      public boolean isSupportedWithIdPVersion​(PluginVersion pluginVersion, PluginVersion idPVersion)
      Is the specified plugin supported with this IdP version.
      Parameters:
      pluginVersion - the version if the plugin as a PluginVersion
      idPVersion - the version if the IDP as a PluginVersion
      Returns:
      whether it is supported.
    • isSupportedWithIdPVersion

      public static boolean isSupportedWithIdPVersion​(PluginState.VersionInfo pluginVersionInfo, PluginVersion idPVersion)
      Is the specified plugin supported with this IdP version. Worker method for all 'isSupportedWith' classes.
      Parameters:
      pluginVersionInfo - the version info to consider
      idPVersion - the version as a PluginVersion
      Returns:
      whether it is supported.
    • getCurrentInfo

      public PluginState.VersionInfo getCurrentInfo()
      Return the current state (from provided plugin).
      Returns:
      Returns the Current Info.
    • getAvailableVersions

      @Nonnull @NotEmpty public Map<PluginVersion,​PluginState.VersionInfo> getAvailableVersions()
      Return all announced versions.
      Returns:
      the versions.