Class ModuleService
java.lang.Object
de.bytestore.hostinger.modules.service.ModuleService
Service class responsible for managing and updating modules and plugins.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionModuleService(org.springframework.context.ApplicationContext applicationContext, de.bytestore.plugin.service.PluginService pluginService) -
Method Summary
Modifier and TypeMethodDescriptioncast(org.pf4j.PluginWrapper pluginInfo) Casts the plugin state of aPluginWrapperobject to aModuleStatusenum.getExtensions(Class classIO) Retrieves a list of extensions for the specified class.getGlobalSettings(String providerIO) Retrieves the global settings for the specified provider.getIdBasedSettings(String providerIO, Object objectIO) Retrieves the global settings based on the provider name and object.getSetting(String keyIO) 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.booleanhasProvider(Class<?> extensionIO) Checks if there is at least one provider for the given extension class.com.google.gson.JsonArraylist()Retrieves a JSON array of plugins from the internal plugin list.voidsetSetting(String keyIO, String valueIO) Sets the value of a setting based on the class and key provided.
-
Field Details
-
directoryIO
- See Also:
-
-
Constructor Details
-
ModuleService
public ModuleService(org.springframework.context.ApplicationContext applicationContext, de.bytestore.plugin.service.PluginService pluginService)
-
-
Method Details
-
cast
Casts the plugin state of aPluginWrapperobject to aModuleStatusenum.- Parameters:
pluginInfo- thePluginWrapperobject whose plugin state will be casted- Returns:
- the corresponding
ModuleStatusenum value for the plugin state, orModuleStatus.UNKNOWNif no matching enum value is found
-
getExtensions
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
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 nameobjectIO- 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
Sets the value of a setting based on the class and key provided.- Parameters:
keyIO- the key of the settingvalueIO- the value to set for the setting
-
getSetting
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
Retrieves the value of a setting based on the class and key provided.- Parameters:
keyIO- the key of the settingdefaultIO- 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
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
-