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.CacheManagerprotected org.springframework.core.env.Environmentprotected static final Stringprotected SystemPropertyServiceExtensionManagerprotected 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 Stringprotected static final Stringprotected SystemPropertiesDaoprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddPropertyToCache(String propertyName, String propertyValue) protected StringProperties can vary by site.protected Stringprotected Stringprotected StringbuildKey(SystemProperty systemProperty) Properties can vary by site.protected StringbuildKey(SystemProperty systemProperty, boolean forceEnvPrefix) Finds a SystemProperty by its internal idprotected Stringprotected StringgetPropertyFromCache(String propertyName) booleanisValueValidForType(String value, SystemPropertyFieldType type) Determines if the given value is valid for the specified typevoidremoveFromCache(SystemProperty systemProperty) Evicts the given SystemProperty from the cachebooleanResolves a boolean system property.booleanresolveBooleanSystemProperty(String name, boolean defaultValue) intResolves an int system property.intresolveIntSystemProperty(String name, int defaultValue) longResolves an long system property.longresolveLongSystemProperty(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:
resolveSystemPropertyin interfaceSystemPropertiesService
-
resolveSystemProperty
Description copied from interface:SystemPropertiesServicePreferred 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:
resolveSystemPropertyin 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:SystemPropertiesServiceFinds a SystemProperty by its internal id- Specified by:
findByIdin interfaceSystemPropertiesService- Returns:
- the
SystemProperty
-
removeFromCache
Description copied from interface:SystemPropertiesServiceEvicts the given SystemProperty from the cache- Specified by:
removeFromCachein interfaceSystemPropertiesService
-
resolveIntSystemProperty
Description copied from interface:SystemPropertiesServiceResolves an int system property. Returns 0 when no matching property is found.- Specified by:
resolveIntSystemPropertyin interfaceSystemPropertiesService- Returns:
-
resolveIntSystemProperty
- Specified by:
resolveIntSystemPropertyin interfaceSystemPropertiesService
-
resolveBooleanSystemProperty
Description copied from interface:SystemPropertiesServiceResolves a boolean system property. Returns false when no matching system property is found.- Specified by:
resolveBooleanSystemPropertyin interfaceSystemPropertiesService- Returns:
-
resolveBooleanSystemProperty
- Specified by:
resolveBooleanSystemPropertyin interfaceSystemPropertiesService
-
resolveLongSystemProperty
Description copied from interface:SystemPropertiesServiceResolves an long system property. Returns 0 when no matching property is found.- Specified by:
resolveLongSystemPropertyin interfaceSystemPropertiesService- Returns:
-
resolveLongSystemProperty
- Specified by:
resolveLongSystemPropertyin interfaceSystemPropertiesService
-
isValueValidForType
Description copied from interface:SystemPropertiesServiceDetermines if the given value is valid for the specified type- Specified by:
isValueValidForTypein interfaceSystemPropertiesService- Returns:
- whether or not the SystemProperty is in a valid state
-