Class ConfigurationServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.runtime.services.config.ConfigurationServiceImpl
-
- All Implemented Interfaces:
Adaptable
,Component
,Extensible
,TimestampedService
,ConfigurationService
public class ConfigurationServiceImpl extends DefaultComponent implements ConfigurationService
- Since:
- 7.4
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIGURATION_EP
protected Map<String,ConfigurationPropertyDescriptor>
descriptors
XXX remove once we are able to get such a cached map from DefaultComponentprotected 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
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Fields inherited from interface org.nuxeo.runtime.services.config.ConfigurationService
LIST_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description ConfigurationServiceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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()
Returns all the properties.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)
-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
log
protected static final org.apache.logging.log4j.Logger log
-
CONFIGURATION_EP
public static final String CONFIGURATION_EP
- See Also:
- Constant Field Values
-
PROPERTIES_MAPPER
protected static final com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper PROPERTIES_MAPPER
-
OBJECT_MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
-
descriptors
protected volatile Map<String,ConfigurationPropertyDescriptor> descriptors
XXX remove once we are able to get such a cached map from DefaultComponent- Since:
- 10.3
-
-
Method Detail
-
getDescriptors
protected Map<String,ConfigurationPropertyDescriptor> getDescriptors()
XXX remove once we are able to get such a cached map from DefaultComponent.We'd ideally need a <T extends Descriptor> Map<String, T> getDescriptors(String xp) with cache method.
- Since:
- 10.3
-
getProperty
@Deprecated public String getProperty(String key)
Deprecated.Description copied from interface:ConfigurationService
Returns the given property value if any, otherwise null.- Specified by:
getProperty
in interfaceConfigurationService
- Parameters:
key
- the property key
-
getProperty
@Deprecated public String getProperty(String key, String defaultValue)
Deprecated.Description copied from interface:ConfigurationService
Returns the given property value if any, otherwise returns the given default value.- Specified by:
getProperty
in interfaceConfigurationService
- Parameters:
key
- the property keydefaultValue
- the default value for this key
-
isBooleanPropertyTrue
@Deprecated public boolean isBooleanPropertyTrue(String key)
Deprecated.Description copied from interface:ConfigurationService
Returns true if given property is true when compared to a boolean value.- Specified by:
isBooleanPropertyTrue
in interfaceConfigurationService
-
isBooleanPropertyFalse
@Deprecated public boolean isBooleanPropertyFalse(String key)
Deprecated.Description copied from interface:ConfigurationService
Returns true if given property is false when compared to a boolean value.Returns also true if property is not blank and is not equals to true.
- Specified by:
isBooleanPropertyFalse
in interfaceConfigurationService
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContribution
in classDefaultComponent
-
getProperties
public Map<String,Serializable> getProperties(String namespace)
Description copied from interface:ConfigurationService
Returns the properties with key starting with the given namespace.- Specified by:
getProperties
in interfaceConfigurationService
- Parameters:
namespace
- the namespace- Returns:
- a map of properties with trimmed keys (namespace removed)
-
getProperties
public Map<String,Serializable> getProperties()
Description copied from interface:ConfigurationService
Returns all the properties.- Specified by:
getProperties
in interfaceConfigurationService
- Returns:
- a map of properties
-
getPropertiesAsJson
public String getPropertiesAsJson(String namespace) throws IOException
Description copied from interface:ConfigurationService
Returns the json string representing the properties with key starting with the given namespace.- Specified by:
getPropertiesAsJson
in interfaceConfigurationService
- Parameters:
namespace
- the namespace of the properties- Throws:
IOException
-
startsWithNamespace
protected static boolean startsWithNamespace(String string, String namespace)
Returns true if a string starts with a namespace.- Parameters:
string
- a string- Since:
- 10.3
-
getString
public Optional<String> getString(String key)
Description copied from interface:ConfigurationService
Returns the given property value if any.- Specified by:
getString
in interfaceConfigurationService
- Parameters:
key
- the property key- Since:
- 11.1
-
getString
public String getString(String key, String defaultValue)
Description copied from interface:ConfigurationService
Returns the given property value if any, otherwise returns the given default value.- Specified by:
getString
in interfaceConfigurationService
- Parameters:
key
- the property keydefaultValue
- the default value for this key- Since:
- 11.1
-
getInteger
public Optional<Integer> getInteger(String key)
Description copied from interface:ConfigurationService
Returns the given property value if any.- Specified by:
getInteger
in interfaceConfigurationService
- Parameters:
key
- the property key- Since:
- 11.1
-
getInteger
public int getInteger(String key, int defaultValue)
Description copied from interface:ConfigurationService
Returns the given property value if any, otherwise returns the given default value.- Specified by:
getInteger
in interfaceConfigurationService
- Parameters:
key
- the property keydefaultValue
- the default value for this key- Since:
- 11.1
-
getLong
public Optional<Long> getLong(String key)
Description copied from interface:ConfigurationService
Returns the given property value if any.- Specified by:
getLong
in interfaceConfigurationService
- Parameters:
key
- the property key- Since:
- 11.1
-
getLong
public long getLong(String key, long defaultValue)
Description copied from interface:ConfigurationService
Returns the given property value if any, otherwise returns the given default value.- Specified by:
getLong
in interfaceConfigurationService
- Parameters:
key
- the property keydefaultValue
- the default value for this key- Since:
- 11.1
-
getBoolean
public Optional<Boolean> getBoolean(String key)
Description copied from interface:ConfigurationService
Returns the given property value if any.- Specified by:
getBoolean
in interfaceConfigurationService
- Parameters:
key
- the property key- Since:
- 11.1
-
isBooleanTrue
public boolean isBooleanTrue(String key)
Description copied from interface:ConfigurationService
Returns true if given property exists and is true when compared to a boolean value.prop=true | isBooleanTrue("prop") = true prop=trUe | isBooleanTrue("prop") = true prop=false | isBooleanTrue("prop") = false prop=any | isBooleanTrue("prop") = false prop= | isBooleanTrue("prop") = false
- Specified by:
isBooleanTrue
in interfaceConfigurationService
- Since:
- 11.1
-
isBooleanFalse
public boolean isBooleanFalse(String key)
Description copied from interface:ConfigurationService
Returns true if given property exists and is false when compared to a boolean value.prop=false | isBooleanFalse("prop") = true prop=fAlse | isBooleanFalse("prop") = true prop=true | isBooleanFalse("prop") = false prop=any | isBooleanFalse("prop") = false prop= | isBooleanFalse("prop") = false
- Specified by:
isBooleanFalse
in interfaceConfigurationService
- Since:
- 11.1
-
getDuration
public Optional<Duration> getDuration(String key)
Description copied from interface:ConfigurationService
Returns the given property value if any.- Specified by:
getDuration
in interfaceConfigurationService
- Parameters:
key
- the property key- Since:
- 11.1
-
getDuration
public Duration getDuration(String key, Duration defaultValue)
Description copied from interface:ConfigurationService
Returns the given property value if any, otherwise returns the given default value.- Specified by:
getDuration
in interfaceConfigurationService
- Parameters:
key
- the property keydefaultValue
- the default value for this key- Since:
- 11.1
-
-