Package de.hybris.platform.util
Class Config
- java.lang.Object
-
- de.hybris.platform.util.Config
-
public abstract class Config extends java.lang.ObjectMain class that is used to load and store hybris platform configuration settings. When starting up the hybris Platform the system tries to load the system resource '/project.properties' which is normally inside the platform/ directory or the local.properties which is normally at the config folder of the deployed ear file. This file is a file with entries of the formkey1=value key2=value ...Important:- The configuration file is loaded only once at startup. If you change it manually it may get overridden when using methods to write the file. (Config.setParameter()) This issue may be addressed in a future release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfig.AppServerstatic interfaceConfig.ConfigSetterstatic classConfig.DatabaseNamestatic interfaceConfig.DatabaseNamesOffers fields which defines the names of the supported databases.static interfaceConfig.ParamsDefines all parameters configurable using project.properties.static interfaceConfig.SystemSpecificParams
-
Constructor Summary
Constructors Constructor Description Config()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>getAllParameters()Returns a copy of all parameters as a key/value pair map.static booleangetBoolean(java.lang.String key, boolean def)static chargetChar(java.lang.String key, char def)static java.lang.StringgetDatabase()Returns the database name.static Config.DatabaseNamegetDatabaseName()static java.lang.StringgetDatabaseURL()static java.lang.StringgetDatabaseVersion()static doublegetDouble(java.lang.String key, double def)static intgetInt(java.lang.String key, int def)static longgetLong(java.lang.String key, long def)static java.lang.StringgetParameter(java.lang.String key)Returns a parameter value for a given key.static java.util.Map<java.lang.String,java.lang.String>getParametersByPattern(java.lang.String pattern)Return a copy of all config parameters which starts with the given pattern.static java.lang.StringgetString(java.lang.String key, java.lang.String def)static booleanisHanaUsed()static booleanisHSQLDBUsed()static booleanisMySQL8Used()static booleanisMySQLUsed()static booleanisOracleUsed()static booleanisPostgreSQLUsed()static booleanisSQLServerUsed()static voidsetParameter(java.lang.String key, java.lang.String value)Changes a parameter.static java.lang.Stringtrim(java.lang.String value, char[] ignore)
-
-
-
Method Detail
-
getParametersByPattern
public static java.util.Map<java.lang.String,java.lang.String> getParametersByPattern(java.lang.String pattern)
Return a copy of all config parameters which starts with the given pattern.- Parameters:
pattern- the pattern to match- Returns:
- a new Map with the matching key/value pairs
-
getAllParameters
public static java.util.Map<java.lang.String,java.lang.String> getAllParameters()
Returns a copy of all parameters as a key/value pair map.- Returns:
- a new Map with all key/value pairs
-
getParameter
public static java.lang.String getParameter(java.lang.String key)
Returns a parameter value for a given key.- Parameters:
key- the key- Returns:
- the value mapped to the key or null, if this key was not mapped.
-
getString
public static java.lang.String getString(java.lang.String key, java.lang.String def)- Parameters:
key- the keydef- the default value- Returns:
- the value mapped to the key or the specified default value, if this key was not mapped.
-
getChar
public static char getChar(java.lang.String key, char def) throws java.lang.IndexOutOfBoundsException- Throws:
java.lang.IndexOutOfBoundsException
-
getBoolean
public static boolean getBoolean(java.lang.String key, boolean def)
-
getInt
public static int getInt(java.lang.String key, int def) throws java.lang.NumberFormatException- Throws:
java.lang.NumberFormatException
-
getLong
public static long getLong(java.lang.String key, long def) throws java.lang.NumberFormatException- Throws:
java.lang.NumberFormatException
-
getDouble
public static double getDouble(java.lang.String key, double def) throws java.lang.NumberFormatException- Throws:
java.lang.NumberFormatException
-
setParameter
public static void setParameter(java.lang.String key, java.lang.String value)Changes a parameter.- Parameters:
key- the keyvalue- the value
-
getDatabase
public static java.lang.String getDatabase()
Returns the database name.- Returns:
- the database name as interned String constant
-
getDatabaseVersion
public static java.lang.String getDatabaseVersion()
-
getDatabaseName
public static Config.DatabaseName getDatabaseName()
-
isOracleUsed
public static boolean isOracleUsed()
-
isHSQLDBUsed
public static boolean isHSQLDBUsed()
-
isMySQLUsed
public static boolean isMySQLUsed()
-
isMySQL8Used
public static boolean isMySQL8Used()
-
isSQLServerUsed
public static boolean isSQLServerUsed()
-
isHanaUsed
public static boolean isHanaUsed()
-
isPostgreSQLUsed
public static boolean isPostgreSQLUsed()
-
getDatabaseURL
public static java.lang.String getDatabaseURL()
-
trim
public static java.lang.String trim(java.lang.String value, char[] ignore)
-
-