public class ConfigurationServiceImpl extends DefaultComponent implements ConfigurationService
Modifier and Type | Field and Description |
---|---|
static String |
CONFIGURATION_EP |
protected Map<String,ConfigurationPropertyDescriptor> |
descriptors
XXX remove once we are able to get such a cached map from DefaultComponent
|
protected static org.apache.logging.log4j.Logger |
log |
protected static com.fasterxml.jackson.databind.ObjectMapper |
OBJECT_MAPPER |
protected static com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper |
PROPERTIES_MAPPER |
lastModified, name
LIST_SEPARATOR
Constructor and Description |
---|
ConfigurationServiceImpl() |
Modifier and Type | Method and Description |
---|---|
Optional<Boolean> |
getBoolean(String key)
Returns the given property value if any.
|
protected Map<String,ConfigurationPropertyDescriptor> |
getDescriptors()
XXX remove once we are able to get such a cached map from DefaultComponent.
|
Optional<Duration> |
getDuration(String key)
Returns the given property value if any.
|
Duration |
getDuration(String key,
Duration defaultValue)
Returns the given property value if any, otherwise returns the given default value.
|
Optional<Integer> |
getInteger(String key)
Returns the given property value if any.
|
int |
getInteger(String key,
int defaultValue)
Returns the given property value if any, otherwise returns the given default value.
|
Optional<Long> |
getLong(String key)
Returns the given property value if any.
|
long |
getLong(String key,
long defaultValue)
Returns the given property value if any, otherwise returns the given default value.
|
Map<String,Serializable> |
getProperties(String namespace)
Returns the properties with key starting with the given namespace.
|
String |
getPropertiesAsJson(String namespace)
Returns the json string representing the properties with key starting with the given namespace.
|
String |
getProperty(String key)
Deprecated.
|
String |
getProperty(String key,
String defaultValue)
Deprecated.
|
Optional<String> |
getString(String key)
Returns the given property value if any.
|
String |
getString(String key,
String defaultValue)
Returns the given property value if any, otherwise returns the given default value.
|
boolean |
isBooleanFalse(String key)
Returns true if given property exists and is false when compared to a boolean value.
|
boolean |
isBooleanPropertyFalse(String key)
Deprecated.
|
boolean |
isBooleanPropertyTrue(String key)
Deprecated.
|
boolean |
isBooleanTrue(String key)
Returns true if given property exists and is true when compared to a boolean value.
|
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
protected static boolean |
startsWithNamespace(String string,
String namespace)
Returns true if a string starts with a namespace.
|
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
activate, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applicationStarted, getApplicationStartedOrder
protected static final org.apache.logging.log4j.Logger log
public static final String CONFIGURATION_EP
protected static final com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper PROPERTIES_MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
protected volatile Map<String,ConfigurationPropertyDescriptor> descriptors
public ConfigurationServiceImpl()
protected Map<String,ConfigurationPropertyDescriptor> getDescriptors()
We'd ideally need a
@Deprecated public String getProperty(String key)
ConfigurationService
getProperty
in interface ConfigurationService
key
- the property key@Deprecated public String getProperty(String key, String defaultValue)
ConfigurationService
getProperty
in interface ConfigurationService
key
- the property keydefaultValue
- the default value for this key@Deprecated public boolean isBooleanPropertyTrue(String key)
ConfigurationService
isBooleanPropertyTrue
in interface ConfigurationService
@Deprecated public boolean isBooleanPropertyFalse(String key)
ConfigurationService
Returns also true if property is not blank and is not equals to true.
isBooleanPropertyFalse
in interface ConfigurationService
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public Map<String,Serializable> getProperties(String namespace)
ConfigurationService
getProperties
in interface ConfigurationService
namespace
- the namespacepublic String getPropertiesAsJson(String namespace) throws IOException
ConfigurationService
getPropertiesAsJson
in interface ConfigurationService
namespace
- the namespace of the propertiesIOException
protected static boolean startsWithNamespace(String string, String namespace)
string
- a stringpublic Optional<String> getString(String key)
ConfigurationService
getString
in interface ConfigurationService
key
- the property keypublic String getString(String key, String defaultValue)
ConfigurationService
getString
in interface ConfigurationService
key
- the property keydefaultValue
- the default value for this keypublic Optional<Integer> getInteger(String key)
ConfigurationService
getInteger
in interface ConfigurationService
key
- the property keypublic int getInteger(String key, int defaultValue)
ConfigurationService
getInteger
in interface ConfigurationService
key
- the property keydefaultValue
- the default value for this keypublic Optional<Long> getLong(String key)
ConfigurationService
getLong
in interface ConfigurationService
key
- the property keypublic long getLong(String key, long defaultValue)
ConfigurationService
getLong
in interface ConfigurationService
key
- the property keydefaultValue
- the default value for this keypublic Optional<Boolean> getBoolean(String key)
ConfigurationService
getBoolean
in interface ConfigurationService
key
- the property keypublic boolean isBooleanTrue(String key)
ConfigurationService
prop=true | isBooleanTrue("prop") = true prop=trUe | isBooleanTrue("prop") = true prop=false | isBooleanTrue("prop") = false prop=any | isBooleanTrue("prop") = false prop= | isBooleanTrue("prop") = false
isBooleanTrue
in interface ConfigurationService
public boolean isBooleanFalse(String key)
ConfigurationService
prop=false | isBooleanFalse("prop") = true prop=fAlse | isBooleanFalse("prop") = true prop=true | isBooleanFalse("prop") = false prop=any | isBooleanFalse("prop") = false prop= | isBooleanFalse("prop") = false
isBooleanFalse
in interface ConfigurationService
public Optional<Duration> getDuration(String key)
ConfigurationService
getDuration
in interface ConfigurationService
key
- the property keypublic Duration getDuration(String key, Duration defaultValue)
ConfigurationService
getDuration
in interface ConfigurationService
key
- the property keydefaultValue
- the default value for this keyCopyright © 2019 Nuxeo. All rights reserved.