Enum EXfcExternalParameter

java.lang.Object
java.lang.Enum<EXfcExternalParameter>
de.xima.fc.config.EXfcExternalParameter
All Implemented Interfaces:
Serializable, Comparable<EXfcExternalParameter>

public enum EXfcExternalParameter extends Enum<EXfcExternalParameter>
Contains mappings from JVM argument and environment variable names to already existing configuration keys. JVM application arguments follow the naming pattern 'xfc[GroupName][ParameterName]' and may be used to override configuration settings by specifying an appropriate '-D' argument at start-up (e.g. '-DxfcDatabaseShortName=mariadb' to override the value of the configuration key XfcConfigKeys.Database.PROP_DBMS_SHORTNAME). For environment variables the naming pattern is 'XFC_[UPPER_CASE_GROUP_NAME]_[UPPER_CASE_PARAMETER_NAME]'.
  • Enum Constant Details

  • Field Details

    • JVM_ARGS_PREFIX

      public static final String JVM_ARGS_PREFIX
      See Also:
    • ENV_VAR_PREFIX

      public static final String ENV_VAR_PREFIX
      See Also:
    • group

      public final EXfcExternalParameter.Group group
      the group of this element
    • jvmArgName

      public final String jvmArgName
      the JVM argument name of this element
    • envVarName

      public final String envVarName
      the environment variable name of this element
    • configPropertyName

      public final String configPropertyName
      the corresponding configuration key for this element
    • valueType

      public final Class<?> valueType
      the expected value type this element
    • encrypt

      public final boolean encrypt
      flag deciding whether to use encryption for this element's value or not
    • mask

      public final boolean mask
      flag deciding whether to use masking for this element's value (e.g. in GUI or log) or not
  • Method Details

    • values

      public static EXfcExternalParameter[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static EXfcExternalParameter valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getConfigPropertyName

      public String getConfigPropertyName()
      Returns:
      the corresponding configuration key of this element
    • getValue

      public String getValue()
      Checks whether an external parameter value for this element is defined and if so, returns it. The algorithm works as follows
      1. do a look-up in the system properties and return the value if one is present
      2. do a look-up in the environment variables and return the value if one is present
      3. return null
      Returns:
      the plain value of this parameter (as provided by System.getProperty(java.lang.String) or System.getenv(java.lang.String)) - null, if no such parameter was set.
    • in

      public boolean in(EXfcExternalParameter... extParams)
      Parameters:
      extParams - the enum elements to check this element against
      Returns:
      true if this element is contained in the set of the provided elements, otherwise false
    • isJvmArgumentSupported

      public static boolean isJvmArgumentSupported(String argName)
      Parameters:
      argName - the JVM argument name to be checked
      Returns:
      true if the provided argument name is a valid one, otherwise false
    • isEnvironmentVariableSupported

      public static boolean isEnvironmentVariableSupported(String varName)
      Parameters:
      varName - the environment variable name to be checked
      Returns:
      true if the provided environment variable name is a valid one, otherwise false
    • byJvmArgumentName

      public static EXfcExternalParameter byJvmArgumentName(String argName)
      Parameters:
      argName - the JVM argument name of the desired enum element
      Returns:
      the matching enum element (null, if no such element could be found)
    • byEnvironmentVariableName

      public static EXfcExternalParameter byEnvironmentVariableName(String varName)
      Parameters:
      varName - the environment variable name of the desired enum element
      Returns:
      the matching enum element (null, if no such element could be found)
    • byGroup

      public static List<EXfcExternalParameter> byGroup(EXfcExternalParameter.Group... paramGroups)
      Parameters:
      paramGroups - the argument group(s) to filter by
      Returns:
      a list containing all of the enum elements belonging to the provided group(s)
    • relatedProperties

      public static Properties relatedProperties(EXfcExternalParameter.Group... paramGroups)
      Parameters:
      paramGroups - the parameter group(s) to filter by
      Returns:
      all the non-empty property values (encrypted if necessary) belonging to the passed parameter group(s), each of them mapped to its corresponding configuration key