protected void deleteEmptyRepositoryDirs ( ) { File [ ] directories = listRepositoryDirs ( ) ; //determine if the server/controller instance directory is empty for ( int i = 0 ; i < directories . length ; i ++ ) { // This is a directory we should not delete boolean currentDir = ivSubDirectory != null && ivSubDirectory . compareTo ( directories [ i ] ) == 0 ; //if a server instance directory does not have a key in parentFilesMap, then it does not have any files if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) debugLogger . logp ( Level . FINE , thisClass , "deleteEmptyRepositoryDirs" , "Instance directory name (controller): " + directories [ i ] . getAbsolutePath ( ) ) ; //now look for empty servant directories File [ ] childFiles = AccessHelper . listFiles ( directories [ i ] , subprocFilter ) ; for ( File curFile : childFiles ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) debugLogger . logp ( Level . FINE , thisClass , "deleteEmptyRepositoryDirs" , "Servant directory name: " + curFile . getAbsolutePath ( ) ) ; if ( ! currentDir && ! parentFilesMap . containsKey ( curFile ) ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) debugLogger . logp ( Level . FINE , thisClass , "deleteEmptyRepositoryDirs" , "Found an empty servant directory: " + curFile ) ; deleteDirectory ( curFile ) ; } else { incrementFileCount ( curFile ) ; } } //delete directory if empty if ( ! currentDir && ! parentFilesMap . containsKey ( directories [ i ] ) ) { if ( debugLogger . isLoggable ( Level . FINE ) && isDebugEnabled ( ) ) debugLogger . logp ( Level . FINE , thisClass , "listRepositoryFiles" , "Found an empty directory: " + directories [ i ] ) ; deleteDirectory ( directories [ i ] ) ; } } }
Deletes all empty server instance directories including empty servant directories