public class PropertyResourceManager extends Object
Constructor and Description |
---|
PropertyResourceManager(String keyPrefix,
String minimizedSuffix)
Create a new manager
|
Modifier and Type | Method and Description |
---|---|
boolean |
addPropertyResource(String identifier,
String categoryName,
String propertyResourceFallback)
Add a property resource for the given category and plugin.
|
CachedFileDescriptor |
getPropertyResource(String categoryName)
Get the current property resource for the given category name
|
PropertyResourceContent |
getPropertyResourceContent(String identifier,
String categoryName)
The content of the property resource.
|
void |
init(File cacheDir)
Init the manager
|
boolean |
removePropertyResource(String identifier,
String categoryName)
Remove a property resource added by plugin for the given category.
|
boolean |
updatePropertyResource(String identifier,
String categoryName,
String propertyValue)
Update the property resource for the given category and plugin.
|
public PropertyResourceManager(String keyPrefix, String minimizedSuffix)
keyPrefix
- the prefix to use when creating the application property key. The category name
will be appended to that prefix.minimizedSuffix
- the filename suffix that marks a resource as the minimized versionpublic boolean addPropertyResource(String identifier, String categoryName, String propertyResourceFallback) throws PropertyResourceManagerException
removePropertyResource(String, String)
).identifier
- the identifier of the plugincategoryName
- the name of the categorypropertyResourceFallback
- absolute path to the location of the fallback resource file that should be
rendered when the property is not set. If null there will be no fallback.PropertyResourceManagerException
- in case the property resource could not be addedpublic CachedFileDescriptor getPropertyResource(String categoryName)
categoryName
- the name of the categorypublic PropertyResourceContent getPropertyResourceContent(String identifier, String categoryName) throws PropertyResourceManagerException
getPropertyResource(String)
should
be usedidentifier
- the plugin bundle namecategoryName
- name of the category whose resource content should be updated. The category name
is used for the property keyPropertyResourceManagerException
- in case reading the content failedpublic void init(File cacheDir)
cacheDir
- the directory where the property resource will be cachedpublic boolean removePropertyResource(String identifier, String categoryName)
identifier
- the identifier of the plugincategoryName
- the name of the categorypublic boolean updatePropertyResource(String identifier, String categoryName, String propertyValue) throws PropertyResourceManagerException
identifier
- the identifier of the plugincategoryName
- the name of the categorypropertyValue
- the new value. Can be null to clear the application property and use the fallback
of the plugin.PropertyResourceManagerException
- in case the category or plugin is not known or the update failedCopyright © 2019 Communote team. All rights reserved.