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 StringCONFIGURATION_EPprotected Map<String,ConfigurationPropertyDescriptor>descriptorsXXX remove once we are able to get such a cached map from DefaultComponentprotected static org.apache.logging.log4j.Loggerlogprotected static com.fasterxml.jackson.databind.ObjectMapperOBJECT_MAPPERprotected static com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapperPROPERTIES_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.DurationgetDuration(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.intgetInteger(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.longgetLong(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.StringgetPropertiesAsJson(String namespace)Returns the json string representing the properties with key starting with the given namespace.StringgetProperty(String key)Deprecated.StringgetProperty(String key, String defaultValue)Deprecated.Optional<String>getString(String key)Returns the given property value if any.StringgetString(String key, String defaultValue)Returns the given property value if any, otherwise returns the given default value.booleanisBooleanFalse(String key)Returns true if given property exists and is false when compared to a boolean value.booleanisBooleanPropertyFalse(String key)Deprecated.booleanisBooleanPropertyTrue(String key)Deprecated.booleanisBooleanTrue(String key)Returns true if given property exists and is true when compared to a boolean value.voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)protected static booleanstartsWithNamespace(String string, String namespace)Returns true if a string starts with a namespace.voidunregisterContribution(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:ConfigurationServiceReturns the given property value if any, otherwise null.- Specified by:
getPropertyin interfaceConfigurationService- Parameters:
key- the property key
-
getProperty
@Deprecated public String getProperty(String key, String defaultValue)
Deprecated.Description copied from interface:ConfigurationServiceReturns the given property value if any, otherwise returns the given default value.- Specified by:
getPropertyin interfaceConfigurationService- Parameters:
key- the property keydefaultValue- the default value for this key
-
isBooleanPropertyTrue
@Deprecated public boolean isBooleanPropertyTrue(String key)
Deprecated.Description copied from interface:ConfigurationServiceReturns true if given property is true when compared to a boolean value.- Specified by:
isBooleanPropertyTruein interfaceConfigurationService
-
isBooleanPropertyFalse
@Deprecated public boolean isBooleanPropertyFalse(String key)
Deprecated.Description copied from interface:ConfigurationServiceReturns 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:
isBooleanPropertyFalsein interfaceConfigurationService
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContributionin classDefaultComponent
-
getProperties
public Map<String,Serializable> getProperties(String namespace)
Description copied from interface:ConfigurationServiceReturns the properties with key starting with the given namespace.- Specified by:
getPropertiesin 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:ConfigurationServiceReturns all the properties.- Specified by:
getPropertiesin interfaceConfigurationService- Returns:
- a map of properties
-
getPropertiesAsJson
public String getPropertiesAsJson(String namespace) throws IOException
Description copied from interface:ConfigurationServiceReturns the json string representing the properties with key starting with the given namespace.- Specified by:
getPropertiesAsJsonin 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:ConfigurationServiceReturns the given property value if any.- Specified by:
getStringin interfaceConfigurationService- Parameters:
key- the property key- Since:
- 11.1
-
getString
public String getString(String key, String defaultValue)
Description copied from interface:ConfigurationServiceReturns the given property value if any, otherwise returns the given default value.- Specified by:
getStringin 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:ConfigurationServiceReturns the given property value if any.- Specified by:
getIntegerin interfaceConfigurationService- Parameters:
key- the property key- Since:
- 11.1
-
getInteger
public int getInteger(String key, int defaultValue)
Description copied from interface:ConfigurationServiceReturns the given property value if any, otherwise returns the given default value.- Specified by:
getIntegerin 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:ConfigurationServiceReturns the given property value if any.- Specified by:
getLongin interfaceConfigurationService- Parameters:
key- the property key- Since:
- 11.1
-
getLong
public long getLong(String key, long defaultValue)
Description copied from interface:ConfigurationServiceReturns the given property value if any, otherwise returns the given default value.- Specified by:
getLongin 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:ConfigurationServiceReturns the given property value if any.- Specified by:
getBooleanin interfaceConfigurationService- Parameters:
key- the property key- Since:
- 11.1
-
isBooleanTrue
public boolean isBooleanTrue(String key)
Description copied from interface:ConfigurationServiceReturns 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:
isBooleanTruein interfaceConfigurationService- Since:
- 11.1
-
isBooleanFalse
public boolean isBooleanFalse(String key)
Description copied from interface:ConfigurationServiceReturns 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:
isBooleanFalsein interfaceConfigurationService- Since:
- 11.1
-
getDuration
public Optional<Duration> getDuration(String key)
Description copied from interface:ConfigurationServiceReturns the given property value if any.- Specified by:
getDurationin interfaceConfigurationService- Parameters:
key- the property key- Since:
- 11.1
-
getDuration
public Duration getDuration(String key, Duration defaultValue)
Description copied from interface:ConfigurationServiceReturns the given property value if any, otherwise returns the given default value.- Specified by:
getDurationin interfaceConfigurationService- Parameters:
key- the property keydefaultValue- the default value for this key- Since:
- 11.1
-
-