public class PropertyService extends BaseService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BYPASSED |
static java.lang.String |
CONFIG_FILE_DIR |
static java.lang.String |
CONFIG_FILE_NAME |
static java.lang.String |
CONFIG_FILE_PATH |
static java.lang.String |
CONFIGURED |
static java.lang.String |
TEST_CONFIG_FILE_NAME |
static java.lang.String |
UNCONFIGURED |
_serviceName
Modifier and Type | Method and Description |
---|---|
static void |
addProperty(java.lang.String propertyName,
java.lang.String value)
Utility method to add a property value both in memory and to the
properties file
|
static boolean |
arePropertiesConfigured()
Reports whether properties are fully configured.
|
static void |
bypassConfiguration()
Reports whether the metacat configuration utility should be run.
|
static boolean |
checkAndSetProperty(javax.servlet.http.HttpServletRequest request,
java.lang.String propertyName)
Take input from the user in an HTTP request about an property to be
changed and update the metacat property file with that new value if it
has changed from the value that was originally set.
|
static boolean |
doBypass()
Determine if the system is configured to bypass configuration.
|
void |
doRefresh() |
static edu.ucsb.nceas.utilities.SortedProperties |
getAuthBackupProperties()
Get the auth backup properties file.
|
static edu.ucsb.nceas.utilities.PropertiesMetaData |
getAuthMetaData()
Get the auth properties metadata.
|
static PropertyService |
getInstance()
Get the single instance of PropertyService for test purposes.
|
static PropertyService |
getInstance(javax.servlet.ServletContext context)
Get the single instance of PropertyService.
|
static PropertyService |
getInstance(java.lang.String testConfigFileDir)
Get the single instance of PropertyService for test purposes.
|
static edu.ucsb.nceas.utilities.SortedProperties |
getMainBackupProperties()
Get the main backup properties file.
|
static edu.ucsb.nceas.utilities.PropertiesMetaData |
getMainMetaData()
Get the main properties metadata.
|
static java.util.Map<java.lang.String,java.lang.String> |
getPropertiesByGroup(java.lang.String groupName)
Get a Map of all properties that start with the groupName prefix.
|
static java.lang.String |
getProperty(java.lang.String propertyName)
Utility method to get a property value from the properties file
|
static java.util.Vector<java.lang.String> |
getPropertyNames()
Get a set of all property names.
|
static java.util.Vector<java.lang.String> |
getPropertyNamesByGroup(java.lang.String groupName)
Get a Set of all property names that start with the groupName prefix.
|
static java.lang.String |
getRecommendedExternalDir()
Returns the recommended external base directory.
|
static void |
persistAuthBackupProperties(javax.servlet.ServletContext servletContext)
Writes out backup configurable properties to a file.
|
static void |
persistMainBackupProperties()
Writes out backup configurable properties to a file.
|
static void |
persistProperties()
Save the properties to a properties file.
|
boolean |
refreshable() |
static void |
setProperty(java.lang.String propertyName,
java.lang.String newValue)
Utility method to set a property value both in memory and to the
properties file
|
static void |
setPropertyNoPersist(java.lang.String propertyName,
java.lang.String newValue)
Utility method to set a property value in memory.
|
static void |
setRecommendedExternalDir(java.lang.String extBaseDir)
Sets the recommended external directory.
|
void |
stop() |
static void |
syncToSettings()
The properties on the Setting class isn't synchronized with the change the Metacat properties file.
|
refresh
public static final java.lang.String CONFIGURED
public static final java.lang.String UNCONFIGURED
public static final java.lang.String BYPASSED
public static java.lang.String CONFIG_FILE_DIR
public static java.lang.String CONFIG_FILE_NAME
public static java.lang.String CONFIG_FILE_PATH
public static java.lang.String TEST_CONFIG_FILE_NAME
public static PropertyService getInstance(javax.servlet.ServletContext context) throws ServiceException
ServiceException
public static PropertyService getInstance(java.lang.String testConfigFileDir) throws ServiceException
configDir
- the configuration directory we need to look inServiceException
public static PropertyService getInstance() throws ServiceException
configDir
- the configuration directory we need to look inServiceException
public boolean refreshable()
refreshable
in class BaseService
public void doRefresh() throws ServiceException
doRefresh
in class BaseService
ServiceException
public void stop() throws ServiceException
stop
in class BaseService
ServiceException
public static java.lang.String getProperty(java.lang.String propertyName) throws edu.ucsb.nceas.utilities.PropertyNotFoundException
propertyName
- the name of the property requestededu.ucsb.nceas.utilities.PropertyNotFoundException
public static java.util.Vector<java.lang.String> getPropertyNames()
public static java.util.Vector<java.lang.String> getPropertyNamesByGroup(java.lang.String groupName)
groupName
- the prefix of the keys to search for.public static java.util.Map<java.lang.String,java.lang.String> getPropertiesByGroup(java.lang.String groupName) throws edu.ucsb.nceas.utilities.PropertyNotFoundException
groupName
- the prefix of the keys to search for.edu.ucsb.nceas.utilities.PropertyNotFoundException
public static void setProperty(java.lang.String propertyName, java.lang.String newValue) throws edu.ucsb.nceas.utilities.GeneralPropertyException
propertyName
- the name of the property requestednewValue
- the new value for the propertyedu.ucsb.nceas.utilities.GeneralPropertyException
public static void addProperty(java.lang.String propertyName, java.lang.String value) throws edu.ucsb.nceas.utilities.GeneralPropertyException
propertyName
- the name of the property to addnewValue
- the value for the propertyedu.ucsb.nceas.utilities.GeneralPropertyException
public static void setPropertyNoPersist(java.lang.String propertyName, java.lang.String newValue) throws edu.ucsb.nceas.utilities.GeneralPropertyException
propertyName
- the name of the property requestednewValue
- the new value for the propertyedu.ucsb.nceas.utilities.GeneralPropertyException
public static void persistProperties() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static edu.ucsb.nceas.utilities.SortedProperties getMainBackupProperties() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static edu.ucsb.nceas.utilities.SortedProperties getAuthBackupProperties() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static edu.ucsb.nceas.utilities.PropertiesMetaData getMainMetaData() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static edu.ucsb.nceas.utilities.PropertiesMetaData getAuthMetaData() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static void persistMainBackupProperties() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static void persistAuthBackupProperties(javax.servlet.ServletContext servletContext) throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static boolean arePropertiesConfigured() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static boolean doBypass() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static void bypassConfiguration() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
public static boolean checkAndSetProperty(javax.servlet.http.HttpServletRequest request, java.lang.String propertyName) throws edu.ucsb.nceas.utilities.GeneralPropertyException
request
- that was generated by the userresponse
- to send output back to the userpropertyName
- the name of the property to be checked and setedu.ucsb.nceas.utilities.GeneralPropertyException
public static void setRecommendedExternalDir(java.lang.String extBaseDir)
public static java.lang.String getRecommendedExternalDir()
public static void syncToSettings() throws edu.ucsb.nceas.utilities.GeneralPropertyException
edu.ucsb.nceas.utilities.GeneralPropertyException
Copyright © 2020 Regents of the University of California. All Rights Reserved.