public GlobusResource [ ] getResources ( String locationPattern ) { Vector < GlobusResource > pathsMatchingLocationPattern = new Vector < GlobusResource > ( ) ; String mainPath = "" ; if ( locationPattern . startsWith ( "classpath:" ) ) { String pathUntilWildcard = getPathUntilWildcard ( locationPattern . replaceFirst ( "classpath:/" , "" ) , false ) ; URL resourceURL = getClass ( ) . getClassLoader ( ) . getResource ( pathUntilWildcard ) ; this . mainClassPath = resourceURL . getPath ( ) ; this . locationPattern = Pattern . compile ( antToRegexConverter ( locationPattern . replaceFirst ( "classpath:/" , "" ) . replaceFirst ( pathUntilWildcard , "" ) ) ) ; parseDirectoryStructure ( new File ( this . mainClassPath ) , pathsMatchingLocationPattern ) ; } else if ( locationPattern . startsWith ( "file:" ) ) { if ( ( locationPattern . replaceFirst ( "file:" , "" ) . compareTo ( getPathUntilWildcard ( locationPattern . replaceFirst ( "file:" , "" ) , true ) ) ) == 0 ) { //Check to see if the pattern is not a pattern pathsMatchingLocationPattern . add ( new GlobusResource ( locationPattern . replaceFirst ( "file:" , "" ) ) ) ; } else { try { URL resourceURL = new File ( getPathUntilWildcard ( locationPattern . replaceFirst ( "file:" , "" ) , true ) ) . toURL ( ) ; mainPath = resourceURL . getPath ( ) ; this . locationPattern = Pattern . compile ( antToRegexConverter ( locationPattern . replaceFirst ( "file:" , "" ) ) ) ; parseDirectoryStructure ( new File ( mainPath ) , pathsMatchingLocationPattern ) ; } catch ( MalformedURLException ex ) { } } } else { mainPath = getPathUntilWildcard ( locationPattern , true ) ; this . locationPattern = Pattern . compile ( antToRegexConverter ( locationPattern ) ) ; parseDirectoryStructure ( new File ( mainPath ) , pathsMatchingLocationPattern ) ; } return pathsMatchingLocationPattern . toArray ( new GlobusResource [ 0 ] ) ; }
Finds all the resources that match the Ant - Style locationPattern