Class PropertiesUtil

java.lang.Object
org.cdlib.mrt.utility.PropertiesUtil

public class PropertiesUtil extends Object
Author:
DLoy
  • Field Details

    • NL

      protected static final String NL
  • Constructor Details

    • PropertiesUtil

      public PropertiesUtil()
  • Method Details

    • copyProperties

      public static Properties copyProperties(Properties fromProp)
      Copy an existing set of properties to another properties
      Parameters:
      fromProp - properties to copy from
      Returns:
      copied properties
    • equals

      public static boolean equals(Properties prop1, Properties prop2)
      compare 2 Properties
      Parameters:
      prop1 - first Properties
      prop2 - second Properties
      Returns:
      true=values of same keys match
    • copyProperty

      public static void copyProperty(Properties prop, String key, String value)
      Copy single property key-value
      Parameters:
      prop - Property to copy to
      key - key of property
      value - value of property
    • dumpProperties

      public static String dumpProperties(String msg, Properties prop)
      Build string containing display form of Properties contents
      Parameters:
      msg - Display message for this dump
      prop - Properties file to be dumped
      Returns:
      String containing display
    • buildLoadProperties

      public static String buildLoadProperties(Properties prop)
      Build string containing display form of Properties contents
      Parameters:
      msg - Display message for this dump
      prop - Properties file to be dumped
      Returns:
      String containing display
    • dumpProperties

      public static String dumpProperties(String msg, Properties prop, int maxlen)
      Build string containing display form of Properties contents
      Parameters:
      msg - Display message for this dump
      prop - Properties file to be dumped
      maxlen - maximum length for prop to add
      Returns:
      String containing display
    • mergeProperties

      public static void mergeProperties(Properties prop, Properties updateProp)
      merge updates property values into another properties
      Parameters:
      prop - merge to this Property
      updateProp - updates to merge
    • addRequestToProperties

      public static Properties addRequestToProperties(javax.servlet.ServletRequest request)
    • loadProperties

      public static Properties loadProperties(String propertiesFileName) throws TException
      Loads properties from one or more properties files.
      Parameters:
      Logger - , to be used to write log messages, and to call "getClassLoader( )".
      propertiesFileName - A property file name.
      Throws:
      TException
    • loadPropertiesFileName

      public static Properties loadPropertiesFileName(String propertiesFileName) throws TException
      Loads properties from one or more properties files.
      Parameters:
      Logger - , to be used to write log messages, and to call "getClassLoader( )".
      propertiesFileName - A property file name.
      Throws:
      TException
    • loadFileProperties

      public static Properties loadFileProperties(File loadFile) throws TException
      Loads properties from a properties files.
      Parameters:
      loadFile - Properties file to be loaded
      Returns:
      Properties
      Throws:
      org.cdlib.mrt.utility.MException
      TException
    • intProp

      public static int intProp(Properties prop, String key)
      return an int value from a properties
      Parameters:
      prop - Properties to be searched
      key - key of numeric value
      Returns:
      integer numeric
    • getInt

      public static int getInt(Properties prop, String key)
      return an int value from a properties
      Parameters:
      prop - Properties to be searched
      key - key of numeric value
      Returns:
      integer numeric
    • prop2LinkedHashList

      public static LinkedHashList<String,String> prop2LinkedHashList(Properties prop)
    • prop2File

      public static void prop2File(Properties prop, String header, File outFile) throws TException
      Throws:
      TException