@ SuppressWarnings ( "unchecked" ) private Iterator < String > findConfigRefs ( @ NotNull final Resource startResource , @ NotNull final Collection < String > bucketNames ) { // collect all context path resources (but filter out those without config reference) final Iterator < ContextResource > contextResources = new FilterIterator ( contextPathStrategy . findContextResources ( startResource ) , new Predicate ( ) { @ Override public boolean evaluate ( Object object ) { ContextResource contextResource = ( ContextResource ) object ; return StringUtils . isNotBlank ( contextResource . getConfigRef ( ) ) ; } } ) ; // get config resource path for each context resource, filter out items where not reference could be resolved final Iterator < String > configPaths = new TransformIterator ( contextResources , new Transformer ( ) { @ Override public Object transform ( Object input ) { final ContextResource contextResource = ( ContextResource ) input ; String val = checkPath ( contextResource , contextResource . getConfigRef ( ) , bucketNames ) ; if ( val != null ) { log . trace ( "+ Found reference for context path {}: {}" , contextResource . getResource ( ) . getPath ( ) , val ) ; } return val ; } } ) ; return new FilterIterator ( configPaths , PredicateUtils . notNullPredicate ( ) ) ; }
Searches the resource hierarchy upwards for all config references and returns them .