public class Configuration extends Object implements Cloneable
A configuration object contains the map between parameter names and values.
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_SCHEMA |
static String |
OBFUSCATED_PREFIX |
Modifier and Type | Method and Description |
---|---|
void |
addParameterGroup(String s) |
void |
addPropertiesChangeListener(PropertiesChangeListener l,
String... props) |
boolean |
allowOnClient(String param)
Returns true if this property may be send to the smartclient via ep/config
|
static Object |
convertType(Class<?> type,
String key,
String value)
converts the string value to the spezified data-type
|
static Configuration |
create(String id)
Add a configuration to the internal map of configurations.
|
static String |
demansch(String arg)
Deprecated.
|
static Configuration |
get()
Return the @enterprise configuration.
|
static Configuration |
get(String id)
Get the configuration by the given id.
|
Boolean |
getBoolean(String name)
Return the property value as Boolean.
|
Date |
getChangedAt() |
Class<?> |
getClass(String name)
Return the property value as class.
|
Set<String> |
getClientParams()
returns all property names which are allowed to be used on the html-client
|
static Map<String,Configuration> |
getConfigurations()
Return the whole map of configurations.
|
Date |
getDate(String name) |
Object |
getDefaultValue(String propname) |
Element |
getDefinition()
Return the definition of a configuration.
|
Double |
getDouble(String name)
Return the property value as Double.
|
Duration |
getDuration(String name)
Return the property value as
Duration . |
File |
getFile(String propname)
return the file of the property, if the property is not yet in a file we return
the last file - this is the one where it will be stored.
|
String |
getFileName()
Return the file name the configuration is loaded from.
|
List<File> |
getFiles() |
static long |
getFileTime(File file) |
Float |
getFloat(String name)
Return the property value as Float.
|
String |
getId()
Return the id of this configuration.
|
Integer |
getInt(String name)
Return the property value as Integer.
|
String |
getLabel(String name)
Return the label of the given property.
|
List<String> |
getList(String name)
Return the parameter as list.
|
Long |
getLong(String name)
Return the property value as Long.
|
Object |
getObject(String name)
Return the property value.
|
String |
getPasswordProperty(String name)
Get the value of a "mangled" property.
|
Properties |
getProperties()
Return the whole paramter map.
|
Properties |
getPropertiesStartingWith(String prefix)
Returns the subset of properties with names thhat start with a given prefix.
|
String |
getProperty(String name)
Returns the value of the property with the given name.
|
String |
getProperty(String name,
String defValue)
Deprecated.
define default values in the xml decsription of the configuration.
|
Properties |
getPropertyAsProperties(String name)
Returns the value of the (multi-valued) property with the given name in the form of a property.
|
Resource |
getResource()
Return the resource for this configuration.
|
Class<?> |
getType(String name)
Return the type of the given property.
|
boolean |
isPasswordProperty(String name) |
boolean |
load()
Load or reload the configuration.
|
void |
loadDefinition() |
static void |
loadTopLevel(String filename)
Load the main configuration.
|
static String |
mansch(String arg)
Deprecated.
|
boolean |
needsRestart(String param)
Returns true if the property change needs a server restart to become
effective.
|
boolean |
reload()
Reload the configuration from the configured files.
|
static Configuration |
remove(String id)
Remove a configuration.
|
List<String> |
restartList() |
static String |
saveConvert(String theString,
boolean escapeSpace) |
void |
setFileName(String filename)
Set the file name for the configuration.
|
protected void |
setProperties(Properties props) |
void |
setProperty(String name,
Object value)
Set a property to a value.
|
void |
setProperty(String name,
String value)
Set a property to a value.
|
void |
setPropFile(String url)
Set the url for the description file for the configuration.
|
void |
setResource(Resource res)
Set a resource for internationalization of this configuration.
|
void |
setSystemProps()
Deprecated.
since @ep9.0
|
void |
setVisibility(String paramGroupId,
boolean visible)
Set the visibility of a parameter group in the configuration
|
void |
store() |
static void |
storeProps(LinkedHashMap<String,Object> props,
String url) |
static String |
valToString(Object value)
Convert a value from the configuration to a string.
|
public static final String CONFIG_SCHEMA
public static final String OBFUSCATED_PREFIX
public Date getChangedAt()
public static Configuration create(String id)
id
- the id of the applicationpublic static Configuration get(String id)
id
- the id of the configuration, normally the id of an application.public static Map<String,Configuration> getConfigurations()
public static Configuration get()
public static Configuration remove(String id)
id
- the id of the configuration to be removedpublic void setResource(Resource res)
res
- a resource objectpublic Resource getResource()
public void setVisibility(String paramGroupId, boolean visible)
paramGroupId
- the id of the groupvisible
- the new visibilitypublic Element getDefinition()
public void setPropFile(String url)
url
- public void addParameterGroup(String s)
s
- public void addPropertiesChangeListener(PropertiesChangeListener l, String... props)
public boolean needsRestart(String param)
param
- name of the propertypublic boolean allowOnClient(String param)
param
- name of the propertypublic boolean load() throws IOException
IOException
public static long getFileTime(File file) throws IOException
IOException
public boolean reload() throws IOException
IOException
public static Object convertType(Class<?> type, String key, String value)
type
- target-typekey
- property-idvalue
- property-valuepublic void loadDefinition()
public static void loadTopLevel(String filename) throws IOException
IOException
@Deprecated public void setSystemProps()
public String getFileName()
public void setFileName(String filename)
filename
- public String getId()
public Properties getPropertiesStartingWith(String prefix)
prefix
- the prefix to search forpublic Properties getPropertyAsProperties(String name)
name
- name of a propertypublic String getProperty(String name)
name
- name of a property@Deprecated public String getProperty(String name, String defValue)
defValue
, if the configuration entry is not found.name
- the configuration entry keydefValue
- the default valuedefValue
, if the configuration entry is not
found.public Boolean getBoolean(String name)
name
- the name of the propertypublic Integer getInt(String name)
name
- the name of the propertypublic Long getLong(String name)
name
- the name of the propertypublic Float getFloat(String name)
name
- the name of the propertypublic Double getDouble(String name)
name
- the name of the propertypublic Class<?> getClass(String name)
name
- the name of the propertypublic Duration getDuration(String name)
Duration
.name
- the name of the propertyDuration
public Object getObject(String name)
name
- the name of the propertypublic List<String> getList(String name)
name
- the name of the propertypublic void setProperty(String name, String value)
name
- the name of the propertyvalue
- the value stringpublic void setProperty(String name, Object value)
name
- the name of the propertyvalue
- the value objectpublic boolean isPasswordProperty(String name)
public String getPasswordProperty(String name)
name
- public Class<?> getType(String name)
name
- the name of the propertypublic String getLabel(String name)
name
- the name of the propertypublic File getFile(String propname)
propname
- public static void storeProps(LinkedHashMap<String,Object> props, String url)
protected void setProperties(Properties props)
public void store()
public static String valToString(Object value)
value
- an object@Deprecated public static String mansch(String arg)
@Deprecated public static String demansch(String arg)
public Properties getProperties()
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.