Class SystemPropertiesServiceImpl
java.lang.Object
org.broadleafcommerce.common.config.service.SystemPropertiesServiceImpl
- All Implemented Interfaces:
SystemPropertiesService
@Service("blSystemPropertiesService")
public class SystemPropertiesServiceImpl
extends Object
implements SystemPropertiesService
Service that retrieves property settings from the database. If not set in
the DB then returns the value from property files.
- Author:
- bpolster
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected javax.cache.CacheManager
protected org.springframework.core.env.Environment
protected static final String
protected SystemPropertyServiceExtensionManager
protected static final ThreadLocal<Boolean>
If the property resoltion comes from the Spring Environment I don't want to try to re-resolve a property from the Environment.static final String
protected static final String
protected SystemPropertiesDao
protected int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addPropertyToCache
(String propertyName, String propertyValue) protected String
Properties can vary by site.protected String
protected String
protected String
buildKey
(SystemProperty systemProperty) Properties can vary by site.protected String
buildKey
(SystemProperty systemProperty, boolean forceEnvPrefix) Finds a SystemProperty by its internal idprotected String
protected String
getPropertyFromCache
(String propertyName) boolean
isValueValidForType
(String value, SystemPropertyFieldType type) Determines if the given value is valid for the specified typevoid
removeFromCache
(SystemProperty systemProperty) Evicts the given SystemProperty from the cacheboolean
Resolves a boolean system property.boolean
resolveBooleanSystemProperty
(String name, boolean defaultValue) int
Resolves an int system property.int
resolveIntSystemProperty
(String name, int defaultValue) long
Resolves an long system property.long
resolveLongSystemProperty
(String name, long defaultValue) resolveSystemProperty
(String name) Preferred method for looking up properties.resolveSystemProperty
(String name, String defaultValue)
-
Field Details
-
PROPERTY_SOURCE_NAME
- See Also:
-
ENV_CACHE_PREFIX
- See Also:
-
SYSTEM_PROPERTY_CACHE_NAME
- See Also:
-
originatedFromEnvironment
If the property resoltion comes from the Spring Environment I don't want to try to re-resolve a property from the Environment. This ensures that we don't get a StackOverflowException -
systemPropertyCache
-
systemPropertiesDao
-
extensionManager
-
systemPropertyCacheTimeout
@Value("${system.property.cache.timeout}") protected int systemPropertyCacheTimeout -
cacheManager
protected javax.cache.CacheManager cacheManager -
env
@Autowired protected org.springframework.core.env.Environment env
-
-
Constructor Details
-
SystemPropertiesServiceImpl
public SystemPropertiesServiceImpl()
-
-
Method Details
-
resolveSystemProperty
- Specified by:
resolveSystemProperty
in interfaceSystemPropertiesService
-
resolveSystemProperty
Description copied from interface:SystemPropertiesService
Preferred method for looking up properties. The method will return the configured value or if no override value is found, it will return the value passed in to the method as the default value.- Specified by:
resolveSystemProperty
in interfaceSystemPropertiesService
- Returns:
-
addPropertyToCache
-
getPropertyFromCache
-
buildKey
Properties can vary by site. If a site is found on the request, use the site id as part of the cache-key.- Parameters:
propertyName
-- Returns:
-
buildKey
Properties can vary by site. If a site is found on the request, use the site id as part of the cache-key.- Parameters:
systemProperty
-- Returns:
-
buildKey
-
buildKey
-
buildKey
-
getSystemPropertyCache
-
getCacheName
-
findById
Description copied from interface:SystemPropertiesService
Finds a SystemProperty by its internal id- Specified by:
findById
in interfaceSystemPropertiesService
- Returns:
- the
SystemProperty
-
removeFromCache
Description copied from interface:SystemPropertiesService
Evicts the given SystemProperty from the cache- Specified by:
removeFromCache
in interfaceSystemPropertiesService
-
resolveIntSystemProperty
Description copied from interface:SystemPropertiesService
Resolves an int system property. Returns 0 when no matching property is found.- Specified by:
resolveIntSystemProperty
in interfaceSystemPropertiesService
- Returns:
-
resolveIntSystemProperty
- Specified by:
resolveIntSystemProperty
in interfaceSystemPropertiesService
-
resolveBooleanSystemProperty
Description copied from interface:SystemPropertiesService
Resolves a boolean system property. Returns false when no matching system property is found.- Specified by:
resolveBooleanSystemProperty
in interfaceSystemPropertiesService
- Returns:
-
resolveBooleanSystemProperty
- Specified by:
resolveBooleanSystemProperty
in interfaceSystemPropertiesService
-
resolveLongSystemProperty
Description copied from interface:SystemPropertiesService
Resolves an long system property. Returns 0 when no matching property is found.- Specified by:
resolveLongSystemProperty
in interfaceSystemPropertiesService
- Returns:
-
resolveLongSystemProperty
- Specified by:
resolveLongSystemProperty
in interfaceSystemPropertiesService
-
isValueValidForType
Description copied from interface:SystemPropertiesService
Determines if the given value is valid for the specified type- Specified by:
isValueValidForType
in interfaceSystemPropertiesService
- Returns:
- whether or not the SystemProperty is in a valid state
-