org.apache.camel.component.properties
Class DefaultPropertiesResolver

java.lang.Object
  extended by 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:

Constructor Summary
DefaultPropertiesResolver()
           
 
Method Summary
protected  Properties loadPropertiesFromClasspath(CamelContext context, boolean ignoreMissingLocation, String path)
           
protected  Properties loadPropertiesFromFilePath(CamelContext context, boolean ignoreMissingLocation, String path)
           
protected  Properties loadPropertiesFromRegistry(CamelContext context, boolean ignoreMissingLocation, String path)
           
protected  Properties prepareLoadedProperties(Properties properties)
          Strategy to prepare loaded properties before being used by Camel.
 Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri)
          Resolve properties from the given uri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPropertiesResolver

public DefaultPropertiesResolver()
Method Detail

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 context
ignoreMissingLocation - ignore silently if the property file is missing
uri - 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