super.initPropertyPlaceholder();
// if blueprint property resolver is enabled on CamelContext then bridge PropertiesComponent to blueprint
if (isUseBlueprintPropertyResolver()) {
// lookup existing configured properties component
PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
BlueprintPropertiesParser parser = new BlueprintPropertiesParser(pc, blueprintContainer, pc.getPropertiesParser());
BlueprintPropertiesResolver resolver = new BlueprintPropertiesResolver(pc.getPropertiesResolver(), parser);
// any extra properties
ServiceReference ref = bundleContext.getServiceReference(PropertiesComponent.OVERRIDE_PROPERTIES);
if (ref != null) {
Properties extra = (Properties) bundleContext.getService(ref);
if (extra != null) {
pc.setOverrideProperties(extra);
}
}
// no locations has been set, so its a default component
if (pc.getLocations() == null) {
StringBuilder sb = new StringBuilder();
String[] ids = parser.lookupPropertyPlaceholderIds();
for (String id : ids) {
sb.append("blueprint:").append(id).append(",");
}
if (sb.length() > 0) {
// location supports multiple separated by comma
pc.setLocation(sb.toString());
}
}
if (pc.getLocations() != null) {
// bridge camel properties with blueprint
pc.setPropertiesParser(parser);
pc.setPropertiesResolver(resolver);
}
}
}