public class Configuration
extends java.lang.Object
implements java.lang.Cloneable
A configuration object contains the map between parameter names and values.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG_SCHEMA |
static java.lang.String |
OBFUSCATED_PREFIX |
Modifier and Type | Method and Description |
---|---|
void |
addParameterGroup(java.lang.String s) |
void |
addPropertiesChangeListener(PropertiesChangeListener l,
java.lang.String... props) |
boolean |
allowOnClient(java.lang.String param)
Returns true if this property may be send to the smartclient via ep/config
|
static java.lang.Object |
convertType(java.lang.Class<?> type,
java.lang.String key,
java.lang.String value)
converts the string value to the spezified data-type
|
static Configuration |
create(java.lang.String id)
Add a configuration to the internal map of configurations.
|
static java.lang.String |
demansch(java.lang.String arg)
Deprecated.
|
static Configuration |
get()
Return the @enterprise configuration.
|
static Configuration |
get(java.lang.String id)
Get the configuration by the given id.
|
java.lang.Boolean |
getBoolean(java.lang.String name)
Return the property value as Boolean.
|
java.util.Date |
getChangedAt() |
java.lang.Class<?> |
getClass(java.lang.String name)
Return the property value as class.
|
java.util.Set<java.lang.String> |
getClientParams()
returns all property names which are allowed to be used on the html-client
|
static TableContainer |
getConfigTable(java.util.List<java.lang.String> configIds) |
static java.util.Map<java.lang.String,Configuration> |
getConfigurations()
Return the whole map of configurations.
|
java.util.Date |
getDate(java.lang.String name) |
java.lang.Object |
getDefaultValue(java.lang.String propname) |
Element |
getDefinition()
Return the definition of a configuration.
|
java.lang.Double |
getDouble(java.lang.String name)
Return the property value as Double.
|
java.io.File |
getFile(java.lang.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.
|
java.lang.String |
getFileName()
Return the file name the configuration is loaded from.
|
java.util.List<java.io.File> |
getFiles() |
java.lang.Float |
getFloat(java.lang.String name)
Return the property value as Float.
|
java.lang.String |
getId()
Return the id of this configuration.
|
java.lang.Integer |
getInt(java.lang.String name)
Return the property value as Integer.
|
java.lang.String |
getLabel(java.lang.String name)
Return the label of the given property.
|
java.util.List<java.lang.String> |
getList(java.lang.String name)
Return the parameter as list.
|
java.lang.Long |
getLong(java.lang.String name)
Return the property value as Long.
|
java.lang.Object |
getObject(java.lang.String name)
Return the property value.
|
java.lang.String |
getPasswordProperty(java.lang.String name)
Get the value of a "mangled" property.
|
java.util.Properties |
getProperties()
Return the whole paramter map.
|
java.util.Properties |
getPropertiesStartingWith(java.lang.String prefix)
Returns the subset of properties with names thhat start with a given prefix.
|
java.lang.String |
getProperty(java.lang.String name)
Returns the value of the property with the given name.
|
java.lang.String |
getProperty(java.lang.String name,
java.lang.String defValue)
Deprecated.
define default values in the xml decsription of the configuration.
|
java.util.Properties |
getPropertyAsProperties(java.lang.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.
|
java.lang.Class<?> |
getType(java.lang.String name)
Return the type of the given property.
|
boolean |
isPasswordProperty(java.lang.String name) |
boolean |
load()
Load or reload the configuration.
|
void |
loadDefinition() |
static void |
loadTopLevel(java.lang.String filename)
Load the main configuration.
|
static java.lang.String |
mansch(java.lang.String arg)
Deprecated.
|
boolean |
needsRestart(java.lang.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(java.lang.String id)
Remove a configuration.
|
java.util.List<java.lang.String> |
restartList() |
static java.lang.String |
saveConvert(java.lang.String theString,
boolean escapeSpace) |
void |
setFileName(java.lang.String filename)
Set the file name for the configuration.
|
protected void |
setProperties(java.util.Properties props) |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Set a property to a value.
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Set a property to a value.
|
void |
setPropFile(java.lang.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(java.lang.String paramGroupId,
boolean visible)
Set the visibility of a parameter group in the configuration
|
void |
store() |
static void |
storeProps(java.util.LinkedHashMap<java.lang.String,java.lang.Object> props,
java.lang.String url) |
static java.lang.String |
valToString(java.lang.Object value)
Convert a value from the configuration to a string.
|
public static final java.lang.String CONFIG_SCHEMA
public static final java.lang.String OBFUSCATED_PREFIX
public java.util.Date getChangedAt()
public static Configuration create(java.lang.String id)
id
- the id of the applicationpublic static Configuration get(java.lang.String id)
id
- the id of the configuration, normally the id of an application.public static java.util.Map<java.lang.String,Configuration> getConfigurations()
public static Configuration get()
public static Configuration remove(java.lang.String id)
id
- the id of the configuration to be removedpublic void setResource(Resource res)
res
- a resource objectpublic Resource getResource()
public java.util.List<java.lang.String> restartList()
public void setVisibility(java.lang.String paramGroupId, boolean visible)
paramGroupId
- the id of the groupvisible
- the new visibilitypublic Element getDefinition()
public void setPropFile(java.lang.String url)
url
- public void addParameterGroup(java.lang.String s)
s
- public void addPropertiesChangeListener(PropertiesChangeListener l, java.lang.String... props)
public boolean needsRestart(java.lang.String param)
param
- name of the propertypublic boolean allowOnClient(java.lang.String param)
param
- name of the propertypublic boolean load() throws java.io.IOException
reload
- true if reloadjava.io.IOException
public boolean reload() throws java.io.IOException
java.io.IOException
public static java.lang.Object convertType(java.lang.Class<?> type, java.lang.String key, java.lang.String value)
type
- target-typekey
- property-idvalue
- property-valuepublic void loadDefinition()
public static void loadTopLevel(java.lang.String filename) throws java.io.IOException, java.io.FileNotFoundException
java.io.IOException
java.io.FileNotFoundException
@Deprecated public void setSystemProps()
public java.lang.String getFileName()
public java.util.List<java.io.File> getFiles()
public static TableContainer getConfigTable(java.util.List<java.lang.String> configIds)
public void setFileName(java.lang.String filename)
filename
- public java.lang.String getId()
public java.util.Properties getPropertiesStartingWith(java.lang.String prefix)
prefix
- the prefix to search forpublic java.util.Properties getPropertyAsProperties(java.lang.String name)
name
- name of a propertypublic java.lang.String getProperty(java.lang.String name)
name
- name of a property@Deprecated public java.lang.String getProperty(java.lang.String name, java.lang.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 java.lang.Boolean getBoolean(java.lang.String name)
name
- the name of the propertypublic java.lang.Integer getInt(java.lang.String name)
name
- the name of the propertypublic java.lang.Long getLong(java.lang.String name)
name
- the name of the propertypublic java.lang.Float getFloat(java.lang.String name)
name
- the name of the propertypublic java.lang.Double getDouble(java.lang.String name)
name
- the name of the propertypublic java.lang.Class<?> getClass(java.lang.String name)
name
- the name of the propertypublic java.util.Date getDate(java.lang.String name)
public java.lang.Object getObject(java.lang.String name)
name
- the name of the propertypublic java.util.List<java.lang.String> getList(java.lang.String name)
name
- the name of the propertypublic void setProperty(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the value stringpublic void setProperty(java.lang.String name, java.lang.Object value)
name
- the name of the propertyvalue
- the value objectpublic boolean isPasswordProperty(java.lang.String name)
public java.lang.String getPasswordProperty(java.lang.String name)
name
- public java.lang.Class<?> getType(java.lang.String name)
name
- the name of the propertypublic java.lang.String getLabel(java.lang.String name)
name
- the name of the propertypublic java.io.File getFile(java.lang.String propname)
propname
- public java.lang.Object getDefaultValue(java.lang.String propname)
public static void storeProps(java.util.LinkedHashMap<java.lang.String,java.lang.Object> props, java.lang.String url)
protected void setProperties(java.util.Properties props)
public void store()
public static java.lang.String valToString(java.lang.Object value)
value
- an object@Deprecated public static java.lang.String mansch(java.lang.String arg)
@Deprecated public static java.lang.String demansch(java.lang.String arg)
public java.util.Properties getProperties()
public static java.lang.String saveConvert(java.lang.String theString, boolean escapeSpace)
public java.util.Set<java.lang.String> getClientParams()
@enterprise 9.0.33982 Copyright © 2001-2023 Groiss Informatics GmbH. All Rights Reserved.