question: public static String derivePath ( String baseDir , String fileName ) { Logger logger = Logger . getLogger ( COMPONENT ) ; if ( logger . isLoggable ( Level . FINE ) ) logger . log ( Level . FINE , "Derive path for file: " + fileName + " | baseDir: " + baseDir ) ; if ( baseDir == null ) throw new NullPointerException ( "baseDir is null" ) ; if ( fileName == null ) throw new NullPointerException ( "fileName is null" ) ; if ( baseDir . startsWith ( "$" ) ) { String sysProp = baseDir . substring ( 1 ) ; baseDir = System . getProperty ( sysProp ) ; if ( baseDir == null ) throw new IllegalArgumentException ( "baseDir [" + sysProp + "] " + "does not reference a valid " + "System Property" ) ; } File base = new File ( baseDir ) ; if ( ! base . exists ( ) ) throw new IllegalArgumentException ( baseDir + " does not exist" ) ; if ( ! base . isDirectory ( ) ) throw new IllegalArgumentException ( baseDir + " is not a directory" ) ; if ( ! base . canRead ( ) ) throw new IllegalArgumentException ( "cannot read from " + baseDir ) ; String path = locate ( base , fileName ) ; if ( path != null ) { File checkDir = new File ( path ) ; if ( checkDir . isDirectory ( ) ) path = checkDirFormat ( path ) ; } return ( path ) ; }
target:  Derive the location of a file or subdirectory, starting from the GigaSpaces base directory and scanning sub-directories.