org.apache.camel.component.properties
Class DefaultPropertiesResolver
java.lang.Object
org.apache.camel.component.properties.DefaultPropertiesResolver
- All Implemented Interfaces:
- PropertiesResolver
public class DefaultPropertiesResolver
- extends Object
- implements PropertiesResolver
Default PropertiesResolver
which can resolve properties
from file and classpath.
You can denote classpath: or file: as prefix in the uri to select whether the file
is located in the classpath or on the file system.
- Version:
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultPropertiesResolver
public DefaultPropertiesResolver()
resolveProperties
public Properties resolveProperties(CamelContext context,
boolean ignoreMissingLocation,
String... uri)
throws Exception
- Description copied from interface:
PropertiesResolver
- Resolve properties from the given uri
- Specified by:
resolveProperties
in interface PropertiesResolver
- Parameters:
context
- the camel contextignoreMissingLocation
- ignore silently if the property file is missinguri
- uri(s) defining the source(s)
- Returns:
- the properties
- Throws:
Exception
- is thrown if resolving the properties failed
loadPropertiesFromFilePath
protected Properties loadPropertiesFromFilePath(CamelContext context,
boolean ignoreMissingLocation,
String path)
throws IOException
- Throws:
IOException
loadPropertiesFromClasspath
protected Properties loadPropertiesFromClasspath(CamelContext context,
boolean ignoreMissingLocation,
String path)
throws IOException
- Throws:
IOException
loadPropertiesFromRegistry
protected Properties loadPropertiesFromRegistry(CamelContext context,
boolean ignoreMissingLocation,
String path)
throws IOException
- Throws:
IOException
prepareLoadedProperties
protected Properties prepareLoadedProperties(Properties properties)
- Strategy to prepare loaded properties before being used by Camel.
This implementation will ensure values are trimmed, as loading properties from
a file with values having trailing spaces is not automatic trimmed by the Properties API
from the JDK.
- Parameters:
properties
- the properties
- Returns:
- the prepared properties
Apache Camel