use of org.apache.camel.dataformat.bindy.format.factories.DefaultFactoryRegistry in project camel by apache.
the class BindyAbstractDataFormat method tryToGetFactoryRegistry.
private FactoryRegistry tryToGetFactoryRegistry() {
Function<CamelContext, Registry> f = CamelContext::getRegistry;
Function<Registry, Set<FactoryRegistry>> g = r -> r.findByType(FactoryRegistry.class);
Function<Set<FactoryRegistry>, FactoryRegistry> h = factoryRegistries -> {
if (factoryRegistries.size() > 1) {
LOGGER.warn("Number of registered {}: {}", FactoryRegistry.class.getCanonicalName(), factoryRegistries.size());
}
if (factoryRegistries.iterator().hasNext()) {
return factoryRegistries.iterator().next();
} else {
return new DefaultFactoryRegistry();
}
};
return Optional.ofNullable(camelContext).map(f).map(g).map(h).orElse(new DefaultFactoryRegistry());
}
use of org.apache.camel.dataformat.bindy.format.factories.DefaultFactoryRegistry in project camel by apache.
the class BindyCarQuoteAndCommaDelimiterTest method setup.
@Before
public void setup() {
PropertyPlaceholderDelegateRegistry registry = (PropertyPlaceholderDelegateRegistry) context.getRegistry();
JndiRegistry reg = (JndiRegistry) registry.getRegistry();
reg.bind("defaultFactoryRegistry", new DefaultFactoryRegistry());
}
Aggregations