Class ConfigurationUtil

java.lang.Object
com.saperion.util.configuration.ConfigurationUtil

public final class ConfigurationUtil extends Object
This utility offers convenient configuration file usage.
Author:
sts
  • Field Details

    • BASE_PATH

      protected static String BASE_PATH
      The internal base path to the configuration files.
  • Method Details

    • setBasePath

      public static void setBasePath(String basepath)
      Sets the base path of all configurations files handled by this util.
      Parameters:
      basepath - the base path of all configuration files.
    • checkConfigFiles

      public static void checkConfigFiles(List<ConfigFileDescriptor> configs) throws Exception
      Checks if all required configurations files are existing.
      Parameters:
      configs - The required configurations.
      Throws:
      Exception - one of the required files is missing.
    • getPath

      public static String getPath(ConfigFileDescriptor config)
      Returns the path of the given config file.
      Parameters:
      config - The config file to get the path of.
      Returns:
      The config file's path.
    • getPath

      public static String getPath(ConfigurationFileHolder holder)
      Returns the path of the given config file holder.
      Parameters:
      holder - The config file holder to get the path of.
      Returns:
      The config file's path.
    • getProperties

      public static Properties getProperties(ConfigFileDescriptor config)
      Returns Properties object by the given config file.
      Parameters:
      config - The config file to build the Properties of.
      Returns:
      The built Properties object.
    • getProperties

      public static Properties getProperties(ConfigurationFileHolder holder)
      Returns Properties object by the given config file holder.
      Parameters:
      holder - The config file holder to build the Properties of.
      Returns:
      The built Properties object.
    • getProperties

      public static Properties getProperties(String config)
      Returns Properties object by the given path. Tries to load the properties files as XML and flat file.
      Parameters:
      config - The config path to the config file to build the Properties of.
      Returns:
      The built Properties object.
    • getAbsolutePath

      public static String getAbsolutePath(ConfigFileDescriptor configFile)
      Returns the absolute path of the given configuration file.
      Parameters:
      configFile - The configuration file in question.
      Returns:
      the absolute path of the given configuration file if found.
    • getAbsolutePath

      public static String getAbsolutePath(ConfigurationFileHolder holder)
      Returns the absolute path of the given configuration file holder.
      Parameters:
      holder - The configuration file in question.
      Returns:
      the absolute path of the given configuration file if found.