public class PropertiesComponent extends UriEndpointComponent
Type | Property and Description |
---|---|
boolean |
isFallbackToUnaugmented
Gets the value of the property fallbackToUnaugmentedProperty.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_PREFIX_TOKEN
The default prefix token.
|
static String |
DEFAULT_SUFFIX_TOKEN
The default suffix token.
|
static String |
OVERRIDE_PROPERTIES
Key for stores special override properties that containers such as OSGi can store
in the OSGi service registry
|
static String |
PREFIX_TOKEN
Deprecated.
Use
DEFAULT_PREFIX_TOKEN instead. |
static String |
SUFFIX_TOKEN
Deprecated.
Use
DEFAULT_SUFFIX_TOKEN instead. |
static int |
SYSTEM_PROPERTIES_MODE_FALLBACK
Check system properties if not resolvable in the specified properties.
|
static int |
SYSTEM_PROPERTIES_MODE_NEVER
Never check system properties.
|
static int |
SYSTEM_PROPERTIES_MODE_OVERRIDE
Check system properties first, before trying the specified properties.
|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
PropertiesComponent() |
PropertiesComponent(boolean isDefaultCreated) |
PropertiesComponent(String... locations) |
PropertiesComponent(String location) |
Modifier and Type | Method and Description |
---|---|
void |
addFunction(PropertiesFunction function)
Registers the
PropertiesFunction as a function to this component. |
protected Endpoint |
createEndpoint(String uri,
String remaining,
Map<String,Object> parameters)
A factory method allowing derived components to create a new endpoint
from the given URI, remaining path and optional parameters
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
String |
getEncoding() |
Map<String,PropertiesFunction> |
getFunctions()
Gets the functions registered in this properties component.
|
Properties |
getInitialProperties() |
List<PropertiesLocation> |
getLocations() |
Properties |
getOverrideProperties() |
String |
getPrefixToken() |
PropertiesParser |
getPropertiesParser() |
PropertiesResolver |
getPropertiesResolver() |
String |
getPropertyPrefix() |
String |
getPropertySuffix() |
String |
getSuffixToken() |
int |
getSystemPropertiesMode() |
boolean |
hasFunction(String name)
Is there a
PropertiesFunction with the given name? |
boolean |
isCache() |
boolean |
isDefaultCreated()
Is this component created as a default by
CamelContext during starting up Camel. |
boolean |
isDefaultFallbackEnabled() |
boolean |
isFallbackToUnaugmentedProperty()
Gets the value of the property fallbackToUnaugmentedProperty.
|
boolean |
isIgnoreMissingLocation() |
boolean |
isResolvePropertyPlaceholders()
Whether the component should resolve property placeholders on itself when starting.
|
String |
parseUri(String uri) |
String |
parseUri(String uri,
List<PropertiesLocation> paths) |
String |
parseUri(String uri,
String... uris) |
void |
setCache(boolean cache)
Whether or not to cache loaded properties.
|
void |
setDefaultFallbackEnabled(boolean defaultFallbackEnabled)
If false, the component does not attempt to find a default for the key by looking after the colon separator.
|
void |
setEncoding(String encoding)
Encoding to use when loading properties file from the file system or classpath.
|
void |
setFallbackToUnaugmentedProperty(boolean fallbackToUnaugmentedProperty)
If true, first attempt resolution of property name augmented with propertyPrefix and propertySuffix
before falling back the plain property name specified.
|
void |
setIgnoreMissingLocation(boolean ignoreMissingLocation)
Whether to silently ignore if a location cannot be located, such as a properties file not found.
|
void |
setInitialProperties(Properties initialProperties)
Sets initial properties which will be used before any locations are resolved.
|
void |
setLocation(String location)
A list of locations to load properties.
|
void |
setLocations(Collection<String> locationStrings)
A list of locations to load properties.
|
void |
setLocations(List<PropertiesLocation> locations)
A list of locations to load properties.
|
void |
setLocations(String[] locationStrings)
A list of locations to load properties.
|
void |
setOverrideProperties(Properties overrideProperties)
Sets a special list of override properties that take precedence
and will use first, if a property exist.
|
void |
setPrefixToken(String prefixToken)
Sets the value of the prefix token used to identify properties to replace.
|
void |
setPropertiesParser(PropertiesParser propertiesParser)
To use a custom PropertiesParser
|
void |
setPropertiesResolver(PropertiesResolver propertiesResolver)
To use a custom PropertiesResolver
|
void |
setPropertyPrefix(String propertyPrefix)
Optional prefix prepended to property names before resolution.
|
void |
setPropertySuffix(String propertySuffix)
Optional suffix appended to property names before resolution.
|
void |
setSuffixToken(String suffixToken)
Sets the value of the suffix token used to identify properties to replace.
|
void |
setSystemPropertiesMode(int systemPropertiesMode)
Sets the system property mode.
|
createComponentConfiguration, createParameterConfigurationMap, getEndpointClass, getParameterConfigurationMap, populateParameterConfigurationMap, setEndpointClass
afterConfiguration, createConfiguration, createEndpoint, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, getExtension, getSupportedExtensions, ifStartsWithReturnRemainder, preProcessUri, registerExtension, registerExtension, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, setCamelContext, setProperties, setProperties, setResolvePropertyPlaceholders, useIntrospectionOnEndpoint, useRawUri, validateParameters, validateURI
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public boolean isFallbackToUnaugmentedProperty
public static final String DEFAULT_PREFIX_TOKEN
public static final String DEFAULT_SUFFIX_TOKEN
@Deprecated public static final String PREFIX_TOKEN
DEFAULT_PREFIX_TOKEN
instead.@Deprecated public static final String SUFFIX_TOKEN
DEFAULT_SUFFIX_TOKEN
instead.public static final int SYSTEM_PROPERTIES_MODE_NEVER
public static final int SYSTEM_PROPERTIES_MODE_FALLBACK
public static final int SYSTEM_PROPERTIES_MODE_OVERRIDE
public static final String OVERRIDE_PROPERTIES
public PropertiesComponent()
public PropertiesComponent(boolean isDefaultCreated)
public PropertiesComponent(String location)
public PropertiesComponent(String... locations)
protected Endpoint createEndpoint(String uri, String remaining, Map<String,Object> parameters) throws Exception
DefaultComponent
createEndpoint
in class DefaultComponent
uri
- the full URI of the endpointremaining
- the remaining part of the URI without the query
parameters or component prefixparameters
- the optional parameters passed inException
- is thrown if error creating the endpointpublic String parseUri(String uri, List<PropertiesLocation> paths) throws Exception
Exception
public boolean isDefaultCreated()
CamelContext
during starting up Camel.public List<PropertiesLocation> getLocations()
public void setLocations(List<PropertiesLocation> locations)
public void setLocations(String[] locationStrings)
public void setLocations(Collection<String> locationStrings)
public void setLocation(String location)
public String getEncoding()
public void setEncoding(String encoding)
Properties.load(java.io.InputStream)
public PropertiesResolver getPropertiesResolver()
public void setPropertiesResolver(PropertiesResolver propertiesResolver)
public PropertiesParser getPropertiesParser()
public void setPropertiesParser(PropertiesParser propertiesParser)
public boolean isCache()
public void setCache(boolean cache)
public String getPropertyPrefix()
public void setPropertyPrefix(String propertyPrefix)
public String getPropertySuffix()
public void setPropertySuffix(String propertySuffix)
public boolean isFallbackToUnaugmentedProperty()
public void setFallbackToUnaugmentedProperty(boolean fallbackToUnaugmentedProperty)
public boolean isDefaultFallbackEnabled()
public void setDefaultFallbackEnabled(boolean defaultFallbackEnabled)
public boolean isIgnoreMissingLocation()
public void setIgnoreMissingLocation(boolean ignoreMissingLocation)
public String getPrefixToken()
public void setPrefixToken(String prefixToken)
null
restores the default token (@link DEFAULT_PREFIX_TOKEN
).public String getSuffixToken()
public void setSuffixToken(String suffixToken)
null
restores the default token (@link DEFAULT_SUFFIX_TOKEN
).public Properties getInitialProperties()
public void setInitialProperties(Properties initialProperties)
initialProperties
- properties that are added firstpublic Properties getOverrideProperties()
public void setOverrideProperties(Properties overrideProperties)
overrideProperties
- properties that is used firstpublic Map<String,PropertiesFunction> getFunctions()
public void addFunction(PropertiesFunction function)
PropertiesFunction
as a function to this component.public boolean hasFunction(String name)
PropertiesFunction
with the given name?public int getSystemPropertiesMode()
public void setSystemPropertiesMode(int systemPropertiesMode)
public boolean isResolvePropertyPlaceholders()
DefaultComponent
isResolvePropertyPlaceholders
in class DefaultComponent
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class DefaultComponent
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.doStop
in class DefaultComponent
Exception
ServiceSupport.doStart()
Apache Camel