Class ModuleService

java.lang.Object
de.bytestore.hostinger.modules.service.ModuleService

@Service @Component public class ModuleService extends Object
Service class responsible for managing and updating modules and plugins.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModuleService(org.springframework.context.ApplicationContext applicationContext, de.bytestore.plugin.service.PluginService pluginService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    cast(org.pf4j.PluginWrapper pluginInfo)
    Casts the plugin state of a PluginWrapper object to a ModuleStatus enum.
    Retrieves a list of extensions for the specified class.
    HashMap<String,com.vaadin.flow.component.Component>
    Retrieves the global settings for the specified provider.
    HashMap<String,com.vaadin.flow.component.Component>
    getIdBasedSettings(String providerIO, Object objectIO)
    Retrieves the global settings based on the provider name and object.
    Retrieves the value of a setting based on the class and key provided.
    getSetting(String keyIO, String defaultIO)
    Retrieves the value of a setting based on the class and key provided.
    boolean
    hasProvider(Class<?> extensionIO)
    Checks if there is at least one provider for the given extension class.
    com.google.gson.JsonArray
    Retrieves a JSON array of plugins from the internal plugin list.
    void
    setSetting(String keyIO, String valueIO)
    Sets the value of a setting based on the class and key provided.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ModuleService

      public ModuleService(org.springframework.context.ApplicationContext applicationContext, de.bytestore.plugin.service.PluginService pluginService)
  • Method Details

    • cast

      public ModuleStatus cast(org.pf4j.PluginWrapper pluginInfo)
      Casts the plugin state of a PluginWrapper object to a ModuleStatus enum.
      Parameters:
      pluginInfo - the PluginWrapper object whose plugin state will be casted
      Returns:
      the corresponding ModuleStatus enum value for the plugin state, or ModuleStatus.UNKNOWN if no matching enum value is found
    • getExtensions

      public List getExtensions(Class classIO)
      Retrieves a list of extensions for the specified class.
      Parameters:
      classIO - the class for which the extensions are needed
      Returns:
      a list of extensions for the specified class
    • getGlobalSettings

      public HashMap<String,com.vaadin.flow.component.Component> getGlobalSettings(String providerIO)
      Retrieves the global settings for the specified provider.
      Parameters:
      providerIO - the provider name
      Returns:
      a HashMap containing the global settings for the specified provider. The keys are String values representing the setting names, and the values are Component objects representing the corresponding setting information.
    • getIdBasedSettings

      public HashMap<String,com.vaadin.flow.component.Component> getIdBasedSettings(String providerIO, Object objectIO)
      Retrieves the global settings based on the provider name and object.
      Parameters:
      providerIO - the provider name
      objectIO - the object input/output
      Returns:
      a HashMap containing the global settings for the specified provider. The keys are String values representing the setting names, and the values are Component objects representing the corresponding setting information.
    • setSetting

      public void setSetting(String keyIO, String valueIO)
      Sets the value of a setting based on the class and key provided.
      Parameters:
      keyIO - the key of the setting
      valueIO - the value to set for the setting
    • getSetting

      public String getSetting(String keyIO)
      Retrieves the value of a setting based on the class and key provided.
      Parameters:
      keyIO - the key of the setting
      Returns:
      the value of the setting if found, null value otherwise
    • getSetting

      public String getSetting(String keyIO, String defaultIO)
      Retrieves the value of a setting based on the class and key provided.
      Parameters:
      keyIO - the key of the setting
      defaultIO - the default value to be returned if the setting is not found
      Returns:
      the value of the setting if found, the default value otherwise
    • list

      public com.google.gson.JsonArray list()
      Retrieves a JSON array of plugins from the internal plugin list.
      Returns:
      a JSON array of plugins if the request is successful, an empty JSON array otherwise
    • hasProvider

      public boolean hasProvider(Class<?> extensionIO)
      Checks if there is at least one provider for the given extension class.
      Parameters:
      extensionIO - the class for which the provider is checked
      Returns:
      true if there is at least one provider, false otherwise