@Component(value="properties")
public class PropertiesComponent
extends org.apache.camel.support.DefaultComponent
implements org.apache.camel.spi.PropertiesComponent
| Type | Property and Description |
|---|---|
boolean |
isFallbackToUnaugmented
Gets the value of the property fallbackToUnaugmentedProperty.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ENVIRONMENT_VARIABLES_MODE_FALLBACK
Check OS environment variables if not resolvable in the specified properties.
|
static int |
ENVIRONMENT_VARIABLES_MODE_NEVER
Never check OS environment variables.
|
static int |
ENVIRONMENT_VARIABLES_MODE_OVERRIDE
Check OS environment variables first, before trying the specified properties.
|
static String |
OVERRIDE_PROPERTIES
Key for stores special override properties that containers such as OSGi can store
in the OSGi service registry
|
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 variables) first, before trying the specified properties.
|
| Constructor and Description |
|---|
PropertiesComponent() |
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. |
void |
addLocation(String location) |
protected org.apache.camel.Endpoint |
createEndpoint(String uri,
String remaining,
Map<String,Object> parameters) |
protected Properties |
doLoadProperties(List<PropertiesLocation> paths) |
protected void |
doStart() |
protected void |
doStop() |
String |
getEncoding() |
int |
getEnvironmentVariableMode() |
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 |
isDefaultFallbackEnabled() |
boolean |
isFallbackToUnaugmentedProperty()
Gets the value of the property fallbackToUnaugmentedProperty.
|
boolean |
isIgnoreMissingLocation() |
boolean |
isResolvePropertyPlaceholders() |
Properties |
loadProperties() |
Properties |
loadProperties(String... locations) |
String |
parseUri(String uri) |
protected String |
parseUri(String uri,
List<PropertiesLocation> paths) |
String |
parseUri(String uri,
String... locations) |
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 |
setEnvironmentVariableMode(int environmentVariableMode)
Sets the OS environment variables mode.
|
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 (and environment variable) mode.
|
afterConfiguration, createEndpoint, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, getExtension, getSupportedExtensions, ifStartsWithReturnRemainder, preProcessUri, registerExtension, registerExtension, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, setCamelContext, setProperties, setProperties, setResolvePropertyPlaceholders, useIntrospectionOnEndpoint, useRawUri, validateParameters, validateURIdoInit, doResume, doShutdown, doSuspend, getStatus, init, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic boolean isFallbackToUnaugmentedProperty
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 int ENVIRONMENT_VARIABLES_MODE_NEVER
public static final int ENVIRONMENT_VARIABLES_MODE_FALLBACK
public static final int ENVIRONMENT_VARIABLES_MODE_OVERRIDE
public static final String OVERRIDE_PROPERTIES
public PropertiesComponent()
public PropertiesComponent(String location)
public PropertiesComponent(String... locations)
protected org.apache.camel.Endpoint createEndpoint(String uri, String remaining, Map<String,Object> parameters) throws Exception
createEndpoint in class org.apache.camel.support.DefaultComponentExceptionpublic String parseUri(String uri) throws Exception
parseUri in interface org.apache.camel.spi.PropertiesComponentExceptionpublic String parseUri(String uri, String... locations) throws Exception
parseUri in interface org.apache.camel.spi.PropertiesComponentExceptionpublic Properties loadProperties() throws Exception
loadProperties in interface org.apache.camel.spi.PropertiesComponentExceptionpublic Properties loadProperties(String... locations) throws Exception
loadProperties in interface org.apache.camel.spi.PropertiesComponentExceptionprotected Properties doLoadProperties(List<PropertiesLocation> paths) throws Exception
Exceptionprotected String parseUri(String uri, List<PropertiesLocation> paths) throws Exception
Exceptionpublic List<PropertiesLocation> getLocations()
public void setLocations(List<PropertiesLocation> locations)
public void setLocations(String[] locationStrings)
public void setLocations(Collection<String> locationStrings)
public void addLocation(String location)
addLocation in interface org.apache.camel.spi.PropertiesComponentpublic void setLocation(String location)
setLocation in interface org.apache.camel.spi.PropertiesComponentpublic 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)
setIgnoreMissingLocation in interface org.apache.camel.spi.PropertiesComponentpublic String getPrefixToken()
getPrefixToken in interface org.apache.camel.spi.PropertiesComponentpublic void setPrefixToken(String prefixToken)
null restores the default token (@link PropertiesComponent.DEFAULT_PREFIX_TOKEN).public String getSuffixToken()
getSuffixToken in interface org.apache.camel.spi.PropertiesComponentpublic void setSuffixToken(String suffixToken)
null restores the default token (@link PropertiesComponent.DEFAULT_SUFFIX_TOKEN).public Properties getInitialProperties()
public void setInitialProperties(Properties initialProperties)
setInitialProperties in interface org.apache.camel.spi.PropertiesComponentinitialProperties - properties that are added firstpublic Properties getOverrideProperties()
public void setOverrideProperties(Properties overrideProperties)
setOverrideProperties in interface org.apache.camel.spi.PropertiesComponentoverrideProperties - 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 int getEnvironmentVariableMode()
public void setEnvironmentVariableMode(int environmentVariableMode)
public boolean isResolvePropertyPlaceholders()
isResolvePropertyPlaceholders in class org.apache.camel.support.DefaultComponentprotected void doStart()
throws Exception
doStart in class org.apache.camel.support.DefaultComponentExceptionApache Camel