protected void initPropertyPlaceholder() throws Exception {
if (getCamelPropertyPlaceholder() != null) {
CamelPropertyPlaceholderDefinition def = getCamelPropertyPlaceholder();
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation(def.getLocation());
if (def.isCache() != null) {
pc.setCache(def.isCache());
}
if (def.isIgnoreMissingLocation() != null) {
pc.setIgnoreMissingLocation(def.isIgnoreMissingLocation());
}
// if using a custom resolver
if (ObjectHelper.isNotEmpty(def.getPropertiesResolverRef())) {
PropertiesResolver resolver = CamelContextHelper.mandatoryLookup(getContext(), def.getPropertiesResolverRef(),
PropertiesResolver.class);
pc.setPropertiesResolver(resolver);
}
// if using a custom parser
if (ObjectHelper.isNotEmpty(def.getPropertiesParserRef())) {
PropertiesParser parser = CamelContextHelper.mandatoryLookup(getContext(), def.getPropertiesParserRef(),
PropertiesParser.class);
pc.setPropertiesParser(parser);
}
pc.setPropertyPrefix(def.getPropertyPrefix());
pc.setPropertySuffix(def.getPropertySuffix());
if (def.isFallbackToUnaugmentedProperty() != null) {
pc.setFallbackToUnaugmentedProperty(def.isFallbackToUnaugmentedProperty());
}
pc.setPrefixToken(def.getPrefixToken());
pc.setSuffixToken(def.getSuffixToken());
// register the properties component
getContext().addComponent("properties", pc);
}
}