protected void prepareDirectories ( ) throws ManagedProcessException { baseDir = Util . getDirectory ( configuration . getBaseDir ( ) ) ; libDir = Util . getDirectory ( configuration . getLibDir ( ) ) ; try { String dataDirPath = configuration . getDataDir ( ) ; if ( Util . isTemporaryDirectory ( dataDirPath ) ) { FileUtils . deleteDirectory ( new File ( dataDirPath ) ) ; } dataDir = Util . getDirectory ( dataDirPath ) ; } catch ( Exception e ) { throw new ManagedProcessException ( "An error occurred while preparing the data directory" , e ) ; } }
If the data directory specified in the configuration is a temporary directory this deletes any previous version . It also makes sure that the directory exists .