예제 #1
0
 public static <T extends ServiceConfiguration> T lookupByName(final String name) {
   for (ComponentId c : ComponentIds.list()) {
     ServiceConfiguration example = ServiceBuilders.lookup(c.getClass()).newInstance();
     example.setName(name);
     try {
       return (T) lookup(example);
     } catch (Exception ex) {
     }
   }
   throw new NoSuchElementException(
       "Failed to lookup any registered component with the name: " + name);
 }