protected void executeScript ( String scriptPath ) { URL scriptUrl = null ; try { if ( scriptPath . startsWith ( "classpath:" ) ) { String script = scriptPath . substring ( "classpath:" . length ( ) ) ; scriptUrl = ClassUtil . getResource ( script ) ; if ( scriptUrl == null ) { log . warn ( "Script '{}' not found!" , scriptPath ) ; } } else { File file = new File ( scriptPath ) ; if ( file . exists ( ) ) { scriptUrl = file . toURI ( ) . toURL ( ) ; } else { log . warn ( "Script '{}' not found!" , scriptPath ) ; } } // execute the script if ( scriptUrl != null ) { executeScript ( scriptUrl ) ; } } catch ( Exception e ) { log . error ( "Failed to parse '{}' as a url" , scriptPath ) ; } }
Execute a script located either in the classpath or on the filesystem .