Package de.xima.fc.config
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 keyXfcConfigKeys.Database.PROP_DBMS_SHORTNAME
). For environment variables the naming pattern is 'XFC_[UPPER_CASE_GROUP_NAME]_[UPPER_CASE_PARAMETER_NAME]'.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EXfcExternalParameter.Group
external parameter groups.
-
Enum Constant Summary
-
Field Summary
Fields Modifier and Type Field Description String
configPropertyName
the corresponding configuration key for this elementboolean
encrypt
flag deciding whether to use encryption for this element's value or notstatic String
ENV_VAR_PREFIX
String
envVarName
the environment variable name of this elementEXfcExternalParameter.Group
group
the group of this elementstatic String
JVM_ARGS_PREFIX
String
jvmArgName
the JVM argument name of this elementboolean
mask
flag deciding whether to use masking for this element's value (e.g.Class<?>
valueType
the expected value type this element
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EXfcExternalParameter
byEnvironmentVariableName(String varName)
static List<EXfcExternalParameter>
byGroup(EXfcExternalParameter.Group... paramGroups)
static EXfcExternalParameter
byJvmArgumentName(String argName)
String
getConfigPropertyName()
String
getValue()
Checks whether an external parameter value for this element is defined and if so, returns it.boolean
in(EXfcExternalParameter... extParams)
static boolean
isEnvironmentVariableSupported(String varName)
static boolean
isJvmArgumentSupported(String argName)
static Properties
relatedProperties(EXfcExternalParameter.Group... paramGroups)
static EXfcExternalParameter
valueOf(String name)
Returns the enum constant of this type with the specified name.static EXfcExternalParameter[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DB_SHORT_NAME
public static final EXfcExternalParameter DB_SHORT_NAME
-
DB_JDBC_URL
public static final EXfcExternalParameter DB_JDBC_URL
-
DB_LOGIN_NAME
public static final EXfcExternalParameter DB_LOGIN_NAME
-
DB_LOGIN_PASSWORD
public static final EXfcExternalParameter DB_LOGIN_PASSWORD
-
DB_MAX_CONNECTIONS
public static final EXfcExternalParameter DB_MAX_CONNECTIONS
-
DB_CONNECTION_TIMEOUT
public static final EXfcExternalParameter DB_CONNECTION_TIMEOUT
-
DB_ENCRYPTION_ALGORITHM
public static final EXfcExternalParameter DB_ENCRYPTION_ALGORITHM
-
DB_ENCRYPTION_PASSWORD
public static final EXfcExternalParameter DB_ENCRYPTION_PASSWORD
-
DB_ENCRYPT_FORM_DATA
public static final EXfcExternalParameter DB_ENCRYPT_FORM_DATA
-
DB_AUTO_UPDATE
public static final EXfcExternalParameter DB_AUTO_UPDATE
-
DB_AUTO_UPDATE_PLUGINS
public static final EXfcExternalParameter DB_AUTO_UPDATE_PLUGINS
-
DB_UPDATE_CALLBACK_EMAILS
public static final EXfcExternalParameter DB_UPDATE_CALLBACK_EMAILS
-
-
Field Detail
-
JVM_ARGS_PREFIX
public static final String JVM_ARGS_PREFIX
- See Also:
- Constant Field Values
-
ENV_VAR_PREFIX
public static final String ENV_VAR_PREFIX
- See Also:
- Constant Field Values
-
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 Detail
-
values
public static EXfcExternalParameter[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EXfcExternalParameter c : EXfcExternalParameter.values()) System.out.println(c);
- 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 nameNullPointerException
- 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- do a look-up in the system properties and return the value if one is present
- do a look-up in the environment variables and return the value if one is present
- return null
- Returns:
- the plain value of this parameter (as provided by
System.getProperty(java.lang.String)
orSystem.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
-
-