@SuppressWarnings("unchecked")
 protected Language noSpecificLanguageFound(String name, CamelContext context) {
   Class type = null;
   try {
     type = findLanguageResolver("default", context);
   } catch (NoFactoryAvailableException e) {
     // ignore
   } catch (Exception e) {
     throw new IllegalArgumentException(
         "Invalid URI, no LanguageResolver registered for scheme: " + name, e);
   }
   if (type != null) {
     if (LanguageResolver.class.isAssignableFrom(type)) {
       LanguageResolver resolver = (LanguageResolver) context.getInjector().newInstance(type);
       return resolver.resolveLanguage(name, context);
     } else {
       throw new IllegalArgumentException(
           "Resolving language: "
               + name
               + " detected type conflict: Not a LanguageResolver implementation. Found: "
               + type.getName());
     }
   }
   throw new NoSuchLanguageException(name);
 }
예제 #2
0
 public Language resolveLanguage(String name, CamelContext context) {
   LanguageResolver resolver = createInstance(this.name, path, context);
   return resolver.resolveLanguage(name, context);
 }