Class FCConfig

java.lang.Object
org.frontcache.FCConfig

public class FCConfig extends Object
  • Field Details

  • Constructor Details

    • FCConfig

      public FCConfig()
  • Method Details

    • getBotUserAgentKeywords

      public static Set<String> getBotUserAgentKeywords()
      Bare bot user-agent keywords from conf/bots.conf. One node serves one site, so there is one set. conf/bots.conf holds classification RULES as well as bare keywords as of 2.9.0, and BotClassifier is its only reader - this delegates rather than parsing the file a second time, because two readers of one config file is how a console ends up reporting something the engine is not doing.
    • destroy

      public static void destroy()
    • getProperty

      public static String getProperty(String key, String defaultValue)
    • getProperty

      public static String getProperty(String key)
    • setProperty

      public static void setProperty(String key, String value)
    • getProperties

      public static Properties getProperties()
      Returns:
    • getWritableConfigFile

      public static File getWritableConfigFile(String name)
      The file under FRONTCACHE_HOME/conf a management write should target, or null when this node has no conf directory on disk at all. Null means refuse the write, not pick somewhere else. getConfigInputStream(String) falls back to the classpath, so the file the console DISPLAYS may not be a file on disk - it can come from inside the war. There is then nothing to write, and inventing a location is worse than saying so. The returned file need not exist: a conf directory with no guard-rules.conf in it is the normal state of a node that has never used guard rules, and creating that file is exactly what an operator adding their first rule is asking for. The caller reports the creation - see FrontCacheIOServlet.setConfig.
    • getConfigInputStream

      public static InputStream getConfigInputStream(String name)
      1. get input stream from inside jars (/frontcache.properties) 2. get input stream from system variable frontcache.home 3. get input stream from environment variable FRONTCACHE_HOME/conf/frontcache.properties
      Parameters:
      name -
      Returns:
    • reloadDynamicURLs

      public static int reloadDynamicURLs()
      Re-reads conf/dynamic-urls.conf. Called by the reload-dynamic-urls management action. This file had no live reload before. It is read by init(), whose only caller is this class's static initializer - the call in FrontCacheEngine.getFrontCache() is commented out - so FrontCacheEngine.reload() does not re-read it either, and adding a URL pattern meant restarting the node.
      Returns:
      how many patterns are now active
    • getDynamicURLs

      public static Set<String> getDynamicURLs()
      Returns:
    • getDynamicURLPatterns

      public static Set<Pattern> getDynamicURLPatterns()
      URL patterns that are never cached, from conf/dynamic-urls.conf.