protected Language getLanguage(String name, CamelContext context) {
LOG.trace("Finding Language: {}", name);
try {
ServiceReference[] refs = bundleContext.getServiceReferences(LanguageResolver.class.getName(), "(language=" + name + ")");
if (refs != null && refs.length > 0) {
LanguageResolver resolver = (LanguageResolver) bundleContext.getService(refs[0]);
return resolver.resolveLanguage(name, context);
}
return null;
} catch (InvalidSyntaxException e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}