Interface ConfigurationCache

    • Method Detail

      • isValid

        boolean isValid​(long origin)
        Checks whether configuration is up to date
        Parameters:
        origin - last modification time of configuration
        Returns:
        true if 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 null if 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 cache
        origin - 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 null if 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 cached
        contexts - contexts to cache
        resolver - 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 null if 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 processed
        constants - attributes that will not change during the search
        Returns:
        exclusions or null if 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 queried
        comparator - a object capable of comparing values of attributes
        Returns:
        initialised query or null if configuration 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 configuration
        configType - expected configuration model class
        Returns:
        configuration found or null if 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 configuration
        config - configuration to be cached