Interface ConfigurationCache
-
- All Known Implementing Classes:
DefaultConfigurationCache
public interface ConfigurationCacheCache forConfigand all its related objects
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <C> voidcacheConfiguration(ConfigContext context, java.lang.Class<C> configType, C config)Sets configuration in cache.voidcacheContexts(Config config, java.util.Collection<Context> contexts, ConfigurationContextResolver resolver)Sets contexts for specified configuration.voidcacheRootConfiguration(Config config, long origin)Adds root configuration to cache.voidclear()Removes all values that has been cachedvoidclearAttributes()Removes all attributes for all contexts that has been cachedvoidclearAttributes(Context context)Removes all attributes for specified context that has been cachedvoidclearConfigurations()Removes all configurations that has been cached.ContextQuerycreateContextQuery(Config config, ContextAttributeComparator comparator)Initialises search for context basing on their attributesjava.util.Map<java.lang.String,java.lang.String>getAttributes(Context context)Gets cached attributes defined by provided context<C> CgetConfiguration(ConfigContext context, java.lang.Class<C> configType)Gets configuration from cache.java.util.Collection<Context>getContexts(Config config)Gets cached contexts for provided configurationConfiggetRootConfiguration()Returns root configuration from cachebooleanisValid(long origin)Checks whether configuration is up to dateConfigurationSearchFilterprepareSearchFilter(ContextSearchRequest request, java.util.Set<java.lang.String> constants, ContextAttributeComparator comparator)Prepares an object that is able to decide which queries should not be evaluated.
-
-
-
Method Detail
-
isValid
boolean isValid(long origin)
Checks whether configuration is up to date- Parameters:
origin- last modification time of configuration- Returns:
trueif cache was valid and no changes where done
-
clear
void clear()
Removes all values that has been cached
-
getRootConfiguration
Config getRootConfiguration()
Returns root configuration from cache- Returns:
- cached configuration or
nullif not available
-
cacheRootConfiguration
void cacheRootConfiguration(Config config, long origin)
Adds root configuration to cache.If any root configuration was already cached, then it is replaced
- Parameters:
config- configuration to cacheorigin- origin time of configuration that is being cached
-
getContexts
java.util.Collection<Context> getContexts(Config config)
Gets cached contexts for provided configuration- Parameters:
config- configuration which contexts are requested- Returns:
- contexts cached or
nullif unavailable
-
cacheContexts
void cacheContexts(Config config, java.util.Collection<Context> contexts, ConfigurationContextResolver resolver)
Sets contexts for specified configuration.If any contexts for this configuration was already cached, then they are replaced
- Parameters:
config- configuration which contexts are being cachedcontexts- contexts to cacheresolver- an object able to retrieve all needed data from context
-
clearAttributes
void clearAttributes()
Removes all attributes for all contexts that has been cached- See Also:
getAttributes(Context)
-
clearAttributes
void clearAttributes(Context context)
Removes all attributes for specified context that has been cached- See Also:
getAttributes(Context)
-
getAttributes
java.util.Map<java.lang.String,java.lang.String> getAttributes(Context context)
Gets cached attributes defined by provided context- Parameters:
context- context which attributes are requested- Returns:
- attributes <name, value> map or
nullif unavailable
-
prepareSearchFilter
ConfigurationSearchFilter prepareSearchFilter(ContextSearchRequest request, java.util.Set<java.lang.String> constants, ContextAttributeComparator comparator)
Prepares an object that is able to decide which queries should not be evaluated.- Parameters:
request- request that will be processedconstants- attributes that will not change during the search- Returns:
- exclusions or
nullif all queries should be applied
-
createContextQuery
ContextQuery createContextQuery(Config config, ContextAttributeComparator comparator)
Initialises search for context basing on their attributes- Parameters:
config- configuration which contexts are to be queriedcomparator- a object capable of comparing values of attributes- Returns:
- initialised query or
nullif configuration has been cached
-
clearConfigurations
void clearConfigurations()
Removes all configurations that has been cached.
-
getConfiguration
<C> C getConfiguration(ConfigContext context, java.lang.Class<C> configType)
Gets configuration from cache.- Type Parameters:
C- type of configuration- Parameters:
context- context of requested configurationconfigType- expected configuration model class- Returns:
- configuration found or
nullif not available
-
cacheConfiguration
<C> void cacheConfiguration(ConfigContext context, java.lang.Class<C> configType, C config)
Sets configuration in cache.If any configurations bound to provided context was already cached, then it is replaced
- Parameters:
context- context of requested configurationconfig- configuration to be cached
-
-