Class PropertiesCache


  • public class PropertiesCache
    extends java.lang.Object
    Caches properties files in order to improve performance.
    Version:
    $Id: $
    Author:
    Mathew Brozowski
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        PropertiesCache()  
      protected PropertiesCache​(com.google.common.cache.CacheBuilder<java.lang.Object,​java.lang.Object> cacheBuilder)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      clear
      java.util.Properties findProperties​(java.io.File propFile)
      findProperties
      java.util.Properties getProperties​(java.io.File propFile)
      Get the current properties object from the cache loading it in memory
      java.lang.String getProperty​(java.io.File propFile, java.lang.String key)
      getProperty
      void saveProperties​(java.io.File propFile, java.util.Map<java.lang.String,​java.lang.String> attributeMappings)  
      void saveProperties​(java.io.File propFile, java.util.Properties properties)
      saveProperties
      void setProperty​(java.io.File propFile, java.lang.String key, java.lang.String value)
      setProperty
      void updateProperties​(java.io.File propFile, java.util.Map<java.lang.String,​java.lang.String> props)
      updateProperties
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PropertiesCache

        public PropertiesCache()
      • PropertiesCache

        protected PropertiesCache​(com.google.common.cache.CacheBuilder<java.lang.Object,​java.lang.Object> cacheBuilder)
    • Method Detail

      • clear

        public void clear()

        clear

      • getProperties

        public java.util.Properties getProperties​(java.io.File propFile)
                                           throws java.io.IOException
        Get the current properties object from the cache loading it in memory
        Parameters:
        propFile - a File object.
        Returns:
        a Properties object.
        Throws:
        java.io.IOException - if any.
      • findProperties

        public java.util.Properties findProperties​(java.io.File propFile)
                                            throws java.io.IOException

        findProperties

        Parameters:
        propFile - a File object.
        Returns:
        a Properties object.
        Throws:
        java.io.IOException - if any.
      • saveProperties

        public void saveProperties​(java.io.File propFile,
                                   java.util.Properties properties)
                            throws java.io.IOException

        saveProperties

        Parameters:
        propFile - a File object.
        properties - a Properties object.
        Throws:
        java.io.IOException - if any.
      • saveProperties

        public void saveProperties​(java.io.File propFile,
                                   java.util.Map<java.lang.String,​java.lang.String> attributeMappings)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • updateProperties

        public void updateProperties​(java.io.File propFile,
                                     java.util.Map<java.lang.String,​java.lang.String> props)
                              throws java.io.IOException

        updateProperties

        Parameters:
        propFile - a File object.
        props - a Map object.
        Throws:
        java.io.IOException - if any.
      • setProperty

        public void setProperty​(java.io.File propFile,
                                java.lang.String key,
                                java.lang.String value)
                         throws java.io.IOException

        setProperty

        Parameters:
        propFile - a File object.
        key - a String object.
        value - a String object.
        Throws:
        java.io.IOException - if any.
      • getProperty

        public java.lang.String getProperty​(java.io.File propFile,
                                            java.lang.String key)
                                     throws java.io.IOException

        getProperty

        Parameters:
        propFile - a File object.
        key - a String object.
        Returns:
        a String object.
        Throws:
        java.io.IOException - if any.