Class STPropertiesManager
java.lang.Object
it.uniroma2.art.semanticturkey.properties.STPropertiesManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.ObjectMapper
static com.fasterxml.jackson.databind.ObjectMapper
createObjectMapper
(ExtensionPointManager exptManager) static File
getPGBindingPropertyFolder
(World world, Project project, UsersGroup group, String pluginID) Returns the folder/pu_bindings/ / /plugins/ / static <T extends STProperties>
TgetPGSettings
(Class<T> valueType, World world, Project project, UsersGroup group, String pluginID, boolean explicit) static String
getPluginsSubfolder
(World world) Returns the "plugins" directory suitable for the provided world.static File
getProjectPropertyFolder
(World world, Project project, String pluginID) Returns the folder/projects/ /plugins/ / static <T extends STProperties>
TgetProjectSettings
(Class<T> valueType, World world, Project project, String pluginID) Returns the project settings about a plugin.static <T extends STProperties>
TgetProjectSettings
(Class<T> valueType, World world, Project project, String pluginID, boolean explicit) Returns the project settings about a plugin.static <T extends STProperties>
TgetProjectSettingsDefault
(Class<T> valueType, World world, String pluginID) Returns the value of a default project settings at system levelstatic File
getProjectSettingsDefaultsFile
(World world, String pluginID) Returns the Properties file/system/plugins_ / /project-settings-defaults.props static File
getPUBindingPropertyFolder
(World world, Project project, STUser user, String pluginID) Returns the folder/pu_bindings/ / /plugins/ / static <T extends STProperties>
TReturns the pu_settings about a plugin.static <T extends STProperties>
TgetPUSettings
(Class<T> valueType, World world, Project project, STUser user, String pluginID, boolean explicit) static <T extends STProperties>
TgetPUSettingsProjectDefault
(Class<T> valueType, World world, Project project, String pluginID) Returns the value of a default pu_settings at project levelstatic <T extends STProperties>
TgetPUSettingsSystemDefault
(Class<T> valueType, World world, String pluginID) Returns the value of a default pu_settings at system levelstatic File
getPUSettingsSystemDefaultsFile
(World world, String pluginID) static <T extends STProperties>
TgetPUSettingsUserDefault
(Class<T> valueType, World world, 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
(World world, 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
(World world, STUser user, String pluginID) Returns the folder/users/ /plugins/ / static <T extends STProperties>
TgetUserSettings
(Class<T> valueType, World world, STUser user, String pluginID, boolean explicit) static <T extends STProperties>
TgetUserSettingsDefault
(Class<T> valueType, World world, 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 preferences, World world, 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, World world, Project project, String pluginID, boolean allowIncompletePropValueSet) Sets the values of project settings related to a plugin.static void
setProjectSettingsDefault
(STProperties settings, World world, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default project setting at system level.static void
setPUSettings
(STProperties preferences, World world, 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, World world, Project project, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default pu-setting at project level.static void
setPUSettingsSystemDefault
(STProperties settings, World world, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default pu-setting at system level.static void
setPUSettingsUserDefault
(STProperties settings, World world, STUser user, String pluginID, boolean allowIncompletePropValueSet) Sets the value of a default pu-setting at user level.static void
static void
setSystemSettings
(STProperties settings, String pluginID) static void
setSystemSettings
(STProperties settings, String pluginID, boolean allowIncompletePropValueSet) static void
setUserSettings
(STProperties preferences, World world, STUser user, String pluginID, boolean allowIncompletePropValueSet) static void
setUserSettingsDefault
(STProperties settings, World world, 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, World world, 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
-world
-project
-user
-pluginID
-- Throws:
STPropertyAccessException
-
getPUSettings
public static <T extends STProperties> T getPUSettings(Class<T> valueType, World world, Project project, STUser user, String pluginID, boolean explicit) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
setPUSettings
public static void setPUSettings(STProperties preferences, World world, 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
-world
-project
-user
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
getPGSettings
public static <T extends STProperties> T getPGSettings(Class<T> valueType, World world, Project project, UsersGroup group, String pluginID, boolean explicit) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
setPGSettings
public static void setPGSettings(STProperties preferences, World world, 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
-world
-project
-group
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
getPUSettingsProjectDefault
public static <T extends STProperties> T getPUSettingsProjectDefault(Class<T> valueType, World world, Project project, String pluginID) throws STPropertyAccessException Returns the value of a default pu_settings at project level- Parameters:
valueType
-world
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
getPUSettingsUserDefault
public static <T extends STProperties> T getPUSettingsUserDefault(Class<T> valueType, World world, STUser user, String pluginID) throws STPropertyAccessException Returns the value of a default pu_settings at user level- Parameters:
valueType
-world
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
getPUSettingsSystemDefault
public static <T extends STProperties> T getPUSettingsSystemDefault(Class<T> valueType, World world, String pluginID) throws STPropertyAccessException Returns the value of a default pu_settings at system level- Parameters:
valueType
-world
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
setPUSettingsProjectDefault
public static void setPUSettingsProjectDefault(STProperties settings, World world, Project project, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default pu-setting at project level.- Parameters:
settings
-world
-project
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
setPUSettingsUserDefault
public static void setPUSettingsUserDefault(STProperties settings, World world, STUser user, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default pu-setting at user level.- Parameters:
settings
-world
-user
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
setPUSettingsSystemDefault
public static void setPUSettingsSystemDefault(STProperties settings, World world, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default pu-setting at system level.- Parameters:
settings
-world
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
getUserSettings
public static <T extends STProperties> T getUserSettings(Class<T> valueType, World world, STUser user, String pluginID, boolean explicit) throws STPropertyAccessException - Throws:
STPropertyAccessException
-
setUserSettings
public static void setUserSettings(STProperties preferences, World world, STUser user, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException - Throws:
STPropertyUpdateException
-
getUserSettingsDefault
public static <T extends STProperties> T getUserSettingsDefault(Class<T> valueType, World world, String pluginID) throws STPropertyAccessException Returns the value of a default user settings at system level- Parameters:
valueType
-world
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
setUserSettingsDefault
public static void setUserSettingsDefault(STProperties settings, World world, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default user setting at system level.- Parameters:
settings
-world
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
getProjectSettings
public static <T extends STProperties> T getProjectSettings(Class<T> valueType, World world, 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
-world
-project
-pluginID
-- Throws:
STPropertyAccessException
-
getProjectSettings
public static <T extends STProperties> T getProjectSettings(Class<T> valueType, World world, 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
-world
-project
-pluginID
-explicit
-- Throws:
STPropertyAccessException
-
getProjectSettingsDefault
public static <T extends STProperties> T getProjectSettingsDefault(Class<T> valueType, World world, String pluginID) throws STPropertyAccessException Returns the value of a default project settings at system level- Parameters:
valueType
-world
-pluginID
-- Returns:
- Throws:
STPropertyAccessException
-
setProjectSettings
public static void setProjectSettings(STProperties settings, World world, Project project, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the values of project settings related to a plugin.- Parameters:
settings
-world
-project
-pluginID
-allowIncompletePropValueSet
-- Throws:
STPropertyUpdateException
-
setProjectSettingsDefault
public static void setProjectSettingsDefault(STProperties settings, World world, String pluginID, boolean allowIncompletePropValueSet) throws STPropertyUpdateException Sets the value of a default project setting at system level.- Parameters:
settings
-world
-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
-
getProjectSettingsDefaultsFile
Returns the Properties file/system/plugins_ / /project-settings-defaults.props - Parameters:
world
-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:
world
-project
-pluginID
-- Returns:
-
getPluginsSubfolder
Returns the "plugins" directory suitable for the provided world. The directory will be "plugins_", except for the main world in which case it is simply "plugins". - Parameters:
world
-- Returns:
-
getUserPropertyFolder
Returns the folder/users/ /plugins/ / - Parameters:
world
-user
-pluginID
-- Returns:
-
getPUBindingPropertyFolder
public static File getPUBindingPropertyFolder(World world, Project project, STUser user, String pluginID) Returns the folder/pu_bindings/ / /plugins/ / - Parameters:
world
-project
-user
-pluginID
-- Returns:
-
getPGBindingPropertyFolder
public static File getPGBindingPropertyFolder(World world, Project project, UsersGroup group, String pluginID) Returns the folder/pu_bindings/ / /plugins/ / - Parameters:
world
-project
-group
-pluginID
-- Returns:
-
loadDefaultsFromSettings
public static void loadDefaultsFromSettings(STProperties props, Project project, STUser user) throws PropertyNotFoundException - Throws:
PropertyNotFoundException
-
getSinglePropertyDefaultFromSettings
public static Object getSinglePropertyDefaultFromSettings(STProperties props, Project project, STUser user, ExtensionPointManager exptManager, String prop) -
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
-
setSnakeYAMLCodePointLimit
-