Class STPropertiesManager
java.lang.Object
it.uniroma2.art.semanticturkey.properties.STPropertiesManager
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.ObjectMapper
static com.fasterxml.jackson.databind.ObjectMapper
createObjectMapper
(ExtensionPointManager exptManager) static File
getPGBindingPropertyFolder
(Project project, UsersGroup group, String pluginID) Returns the folder/pu_bindings/ / /plugins/ / static <T extends STProperties>
TgetPGSettings
(Class<T> valueType, Project project, UsersGroup group, String pluginID) Returns the value of a pg_setting about the given project-group-plugin.static <T extends STProperties>
TgetPGSettings
(Class<T> valueType, Project project, UsersGroup group, String pluginID, boolean explicit) static File
getProjectPropertyFolder
(Project project, String pluginID) Returns the folder/projects/ /plugins/ / static <T extends STProperties>
TgetProjectSettings
(Class<T> valueType, Project project, String pluginID) Returns the project settings about a plugin.static <T extends STProperties>
TgetProjectSettings
(Class<T> valueType, Project project, String pluginID, boolean explicit) Returns the project settings about a plugin.static <T extends STProperties>
TgetProjectSettingsDefault
(Class<T> valueType, String pluginID) Returns the value of a default project settings at system levelstatic File
getProjectSettingsDefaultsFile
(String pluginID) Returns the Properties file/system/plugins/ /project-settings-defaults.props static File
getPUBindingPropertyFolder
(Project project, STUser user, String pluginID) Returns the folder/pu_bindings/ / /plugins/ / static <T extends STProperties>
TgetPUSettings
(Class<T> valueType, Project project, STUser user, String pluginID) Returns the pu_settings about a plugin.static <T extends STProperties>
TgetPUSettings
(Class<T> valueType, Project project, STUser user, String pluginID, boolean explicit) static <T extends STProperties>
TgetPUSettingsProjectDefault
(Class<T> valueType, Project project, String pluginID) Returns the value of a default pu_settings at project levelstatic <T extends STProperties>
TgetPUSettingsSystemDefault
(Class<T> valueType, String pluginID) Returns the value of a default pu_settings at system levelstatic File
getPUSettingsSystemDefaultsFile
(String pluginID) Returns the Properties file/system/plugins/ /pu-settings-defaults.props static <T extends STProperties>
TgetPUSettingsUserDefault
(Class<T> valueType, STUser user, String pluginID) Returns the value of a default pu_settings at user levelstatic Object
getSinglePropertyDefaultFromSettings
(STProperties props, Project project, STUser user, ExtensionPointManager exptManager, String prop) static File
getSystemPropertyFolder
(String pluginID) Returns the folder/system/plugins/ / static <T extends STProperties>
TgetSystemSettings
(Class<T> valueType, String pluginID) static File
getSystemSettingsFile
(String pluginID) Returns the Properties file/system/plugins/ /settings.props static File
getUserPropertyFolder
(STUser user, String pluginID) Returns the folder/users/ /plugins/ / static <T extends STProperties>
TgetUserSettings
(Class<T> valueType, STUser user, String pluginID) static <T extends STProperties>
TgetUserSettings
(Class<T> valueType, STUser user, String pluginID, boolean explicit) static <T extends STProperties>
TgetUserSettingsDefault
(Class<T> valueType, String pluginID) Returns the value of a default user settings at system levelstatic void
loadDefaultsFromSettings
(STProperties props, Project project, STUser user) static <T extends STProperties>
TloadSTPropertiesFromObjectNodes
(Class<T> valueType, boolean loadObjType, com.fasterxml.jackson.databind.node.ObjectNode... objs) static <T extends STProperties>
TloadSTPropertiesFromObjectNodes
(Class<T> valueType, boolean loadObjType, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.node.ObjectNode... objs) static <T extends STProperties>
TloadSTPropertiesFromYAMLFiles
(Class<T> valueType, boolean loadObjType, ExtensionPointManager exptManager, File... propFiles) static <T extends STProperties>
TloadSTPropertiesFromYAMLFiles
(Class<T> valueType, boolean loadObjType, File... propFiles) static void
setPGSettings
(STProperties settings, Project project, UsersGroup group, String pluginID) Convenience overload ofsetPGSettings(STProperties, Project, UsersGroup, String, boolean)
that disallows the storage of incomplete settings (i.e. missing values for required property).static void
setPGSettings
(STProperties preferences, Project project, UsersGroup group, String pluginID, boolean allowIncompletePropValueSet) Sets the values of pg_setting related to the given project-group-pluginstatic void
setProjectSettings
(STProperties settings, Project project, String pluginID) Convenience overload ofsetProjectSettings(STProperties, Project, String, boolean)
that disallows the storage of incomplete settings (i.e. missing values for required property).static void
setProjectSettings
(STProperties settings, Project project, String pluginID, boolean allowIncompletePropValueSet) Sets the values of project settings related to a plugin.static void
setProjectSettingsDefault
(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default project setting at system level.static void
setPUSettings
(STProperties settings, Project project, STUser user, String pluginID) Convenience overload ofsetPUSettings(STProperties, Project, STUser, String, boolean)
that disallows the storage of incomplete settings (i.e. missing values for required property).static void
setPUSettings
(STProperties preferences, Project project, STUser user, String pluginID, boolean allowIncompletePropValueSet) Sets the values of pu_setting related to the given project-user-pluginstatic void
setPUSettingsProjectDefault
(STProperties settings, Project project, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default pu-setting at project level.static void
setPUSettingsSystemDefault
(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default pu-setting at system level.static void
setPUSettingsUserDefault
(STProperties settings, STUser user, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default pu-setting at user level.static void
setSystemSettings
(STProperties settings, String pluginID) static void
setSystemSettings
(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) static void
setUserSettings
(STProperties preferences, STUser user, String pluginID) static void
setUserSettings
(STProperties preferences, STUser user, String pluginID, boolean allowIncompletePropValueSet) static void
setUserSettingsDefault
(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default user setting at system level.static void
storeObjectNodeInYAML
(com.fasterxml.jackson.databind.node.ObjectNode objectNode, File propertiesFile) static void
storeSTPropertiesInYAML
(STProperties properties, File propertiesFile, boolean storeObjType) static com.fasterxml.jackson.databind.node.ObjectNode
storeSTPropertiesToObjectNode
(com.fasterxml.jackson.databind.ObjectMapper mapper, STProperties properties, boolean storeObjType) static com.fasterxml.jackson.databind.node.ObjectNode
storeSTPropertiesToObjectNode
(STProperties properties, boolean storeObjType)
-
Field Details
-
PROJECT_SETTINGS_DEFAULTS_FILE_NAME
- See Also:
-
SETTINGS_TYPE_PROPERTY
- See Also:
-
-
Constructor Details
-
STPropertiesManager
public STPropertiesManager()
-
-
Method Details
-
getPUSettings
public static <T extends STProperties> T getPUSettings(Class<T> valueType, Project project, STUser user, String pluginID) throws STPropertyAccessException Returns the pu_settings about a plugin. If the setting has no value for the user, it looks for the value in the following order:- the value for the group of the user (if any)
- the default value at project level
- the default value at user level
- the default value at system level.
- Parameters:
valueType
-project
-user
-pluginID
-- Throws:
STPropertyAccessException
-
getPUSettings
public static <T extends STProperties> T getPUSettings(Class<T> valueType, Project project, STUser user, String pluginID, boolean explicit) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
setPUSettings
public static void setPUSettings(STProperties preferences, Project project, STUser user, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the values of pu_setting related to the given project-user-plugin- Parameters:
preferences
-project
-user
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
setPUSettings
public static void setPUSettings(STProperties settings, Project project, STUser user, String pluginID) throws STPropertyUpdateException Convenience overload ofsetPUSettings(STProperties, Project, STUser, String, boolean)
that disallows the storage of incomplete settings (i.e. missing values for required property).- Parameters:
settings
-project
-user
-pluginID
-- Throws:
STPropertyUpdateException
-
getPGSettings
public static <T extends STProperties> T getPGSettings(Class<T> valueType, Project project, UsersGroup group, String pluginID) throws STPropertyAccessException Returns the value of a pg_setting about the given project-group-plugin.- Parameters:
valueType
-project
-group
-pluginID
-- Throws:
STPropertyAccessException
-
getPGSettings
public static <T extends STProperties> T getPGSettings(Class<T> valueType, Project project, UsersGroup group, String pluginID, boolean explicit) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
setPGSettings
public static void setPGSettings(STProperties preferences, Project project, UsersGroup group, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the values of pg_setting related to the given project-group-plugin- Parameters:
preferences
-project
-group
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
setPGSettings
public static void setPGSettings(STProperties settings, Project project, UsersGroup group, String pluginID) throws STPropertyUpdateException Convenience overload ofsetPGSettings(STProperties, Project, UsersGroup, String, boolean)
that disallows the storage of incomplete settings (i.e. missing values for required property).- Parameters:
settings
-project
-group
-pluginID
-- Throws:
STPropertyUpdateException
-
getPUSettingsProjectDefault
public static <T extends STProperties> T getPUSettingsProjectDefault(Class<T> valueType, Project project, String pluginID) throws STPropertyAccessException Returns the value of a default pu_settings at project level- Parameters:
valueType
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
getPUSettingsUserDefault
public static <T extends STProperties> T getPUSettingsUserDefault(Class<T> valueType, STUser user, String pluginID) throws STPropertyAccessException Returns the value of a default pu_settings at user level- Parameters:
valueType
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
getPUSettingsSystemDefault
public static <T extends STProperties> T getPUSettingsSystemDefault(Class<T> valueType, String pluginID) throws STPropertyAccessException Returns the value of a default pu_settings at system level- Parameters:
valueType
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
setPUSettingsProjectDefault
public static void setPUSettingsProjectDefault(STProperties settings, Project project, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default pu-setting at project level.- Parameters:
settings
-project
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
setPUSettingsUserDefault
public static void setPUSettingsUserDefault(STProperties settings, STUser user, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default pu-setting at user level.- Parameters:
settings
-user
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
setPUSettingsSystemDefault
public static void setPUSettingsSystemDefault(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default pu-setting at system level.- Parameters:
settings
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
getUserSettings
public static <T extends STProperties> T getUserSettings(Class<T> valueType, STUser user, String pluginID) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
getUserSettings
public static <T extends STProperties> T getUserSettings(Class<T> valueType, STUser user, String pluginID, boolean explicit) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
setUserSettings
public static void setUserSettings(STProperties preferences, STUser user, String pluginID) throws STPropertyUpdateException - Throws:
STPropertyUpdateException
-
createObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper createObjectMapper() -
createObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper createObjectMapper(ExtensionPointManager exptManager) -
storeSTPropertiesToObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode storeSTPropertiesToObjectNode(STProperties properties, boolean storeObjType) -
storeSTPropertiesToObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode storeSTPropertiesToObjectNode(com.fasterxml.jackson.databind.ObjectMapper mapper, STProperties properties, boolean storeObjType) -
storeSTPropertiesInYAML
public static void storeSTPropertiesInYAML(STProperties properties, File propertiesFile, boolean storeObjType) throws IOException - Throws:
IOException
-
storeObjectNodeInYAML
public static void storeObjectNodeInYAML(com.fasterxml.jackson.databind.node.ObjectNode objectNode, File propertiesFile) throws IOException - Throws:
IOException
-
loadSTPropertiesFromYAMLFiles
public static <T extends STProperties> T loadSTPropertiesFromYAMLFiles(Class<T> valueType, boolean loadObjType, File... propFiles) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
loadSTPropertiesFromYAMLFiles
public static <T extends STProperties> T loadSTPropertiesFromYAMLFiles(Class<T> valueType, boolean loadObjType, ExtensionPointManager exptManager, File... propFiles) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
loadSTPropertiesFromObjectNodes
public static <T extends STProperties> T loadSTPropertiesFromObjectNodes(Class<T> valueType, boolean loadObjType, com.fasterxml.jackson.databind.node.ObjectNode... objs) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
loadSTPropertiesFromObjectNodes
public static <T extends STProperties> T loadSTPropertiesFromObjectNodes(Class<T> valueType, boolean loadObjType, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.databind.node.ObjectNode... objs) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
setUserSettings
public static void setUserSettings(STProperties preferences, STUser user, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException - Throws:
STPropertyUpdateException
-
getUserSettingsDefault
public static <T extends STProperties> T getUserSettingsDefault(Class<T> valueType, String pluginID) throws STPropertyAccessException Returns the value of a default user settings at system level- Parameters:
valueType
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
setUserSettingsDefault
public static void setUserSettingsDefault(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default user setting at system level.- Parameters:
settings
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
getProjectSettings
public static <T extends STProperties> T getProjectSettings(Class<T> valueType, Project project, String pluginID) throws STPropertyAccessException Returns the project settings about a plugin. The returned settings are (in descending order of priority):- the values stored in the project-settings for the plugin
- the default values stored at the system level
- the default value hard-wired in the provided
STProperties
object
- Parameters:
valueType
-project
-pluginID
-- Throws:
STPropertyAccessException
-
getProjectSettings
public static <T extends STProperties> T getProjectSettings(Class<T> valueType, Project project, String pluginID, boolean explicit) throws STPropertyAccessException Returns the project settings about a plugin. The returned settings are (in descending order of priority):- the values stored in the project-settings for the plugin
- the default values stored at the system level
- the default value hard-wired in the provided
STProperties
object
- Parameters:
valueType
-project
-pluginID
-explicit
-- Throws:
STPropertyAccessException
-
getProjectSettingsDefault
public static <T extends STProperties> T getProjectSettingsDefault(Class<T> valueType, String pluginID) throws STPropertyAccessException Returns the value of a default project settings at system level- Parameters:
valueType
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
setProjectSettings
public static void setProjectSettings(STProperties settings, Project project, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the values of project settings related to a plugin.- Parameters:
settings
-project
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
setProjectSettings
public static void setProjectSettings(STProperties settings, Project project, String pluginID) throws STPropertyUpdateException Convenience overload ofsetProjectSettings(STProperties, Project, String, boolean)
that disallows the storage of incomplete settings (i.e. missing values for required property).- Parameters:
settings
-project
-pluginID
-- Throws:
STPropertyUpdateException
-
setProjectSettingsDefault
public static void setProjectSettingsDefault(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default project setting at system level.- Parameters:
settings
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
getSystemSettings
public static <T extends STProperties> T getSystemSettings(Class<T> valueType, String pluginID) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
setSystemSettings
public static void setSystemSettings(STProperties settings, String pluginID) throws STPropertyUpdateException - Throws:
STPropertyUpdateException
-
setSystemSettings
public static void setSystemSettings(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException - Throws:
STPropertyUpdateException
-
getPUSettingsSystemDefaultsFile
Returns the Properties file/system/plugins/ /pu-settings-defaults.props - Parameters:
pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
getProjectSettingsDefaultsFile
Returns the Properties file/system/plugins/ /project-settings-defaults.props - Parameters:
pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
getSystemSettingsFile
Returns the Properties file/system/plugins/ /settings.props - Parameters:
pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
getSystemPropertyFolder
Returns the folder/system/plugins/ / - Parameters:
pluginID
-- Returns:
-
getProjectPropertyFolder
Returns the folder/projects/ /plugins/ / - Parameters:
project
-pluginID
-- Returns:
-
getUserPropertyFolder
Returns the folder/users/ /plugins/ / - Parameters:
user
-pluginID
-- Returns:
-
getPUBindingPropertyFolder
Returns the folder/pu_bindings/ / /plugins/ / - Parameters:
project
-user
-pluginID
-- Returns:
-
getPGBindingPropertyFolder
Returns the folder/pu_bindings/ / /plugins/ / - Parameters:
project
-group
-pluginID
-- Returns:
-
loadDefaultsFromSettings
-
getSinglePropertyDefaultFromSettings
public static Object getSinglePropertyDefaultFromSettings(STProperties props, Project project, STUser user, ExtensionPointManager exptManager, String prop)
-