public static <T extends ServiceConfiguration> Iterable<ServiceConfiguration> filter( final Predicate<T> pred) throws PersistenceException { List<ServiceConfiguration> configs = Lists.newArrayList(); for (ComponentId compId : ComponentIds.list()) { Iterables.addAll(configs, filter(compId.getClass(), pred)); } return configs; }
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); }