public boolean deleteStructure ( String pdbId ) throws IOException { boolean deleted = false ; // Force getLocalFile to check in obsolete locations ObsoleteBehavior obsolete = getObsoleteBehavior ( ) ; setObsoleteBehavior ( ObsoleteBehavior . FETCH_OBSOLETE ) ; try { File existing = getLocalFile ( pdbId ) ; while ( existing != null ) { assert ( existing . exists ( ) ) ; // should exist unless concurrency problems if ( getFetchBehavior ( ) == FetchBehavior . LOCAL_ONLY ) { throw new RuntimeException ( "Refusing to delete from LOCAL_ONLY directory" ) ; } // delete file boolean success = existing . delete ( ) ; if ( success ) { logger . debug ( "Deleting " + existing . getAbsolutePath ( ) ) ; } deleted = deleted || success ; // delete parent if empty File parent = existing . getParentFile ( ) ; if ( parent != null ) { success = parent . delete ( ) ; if ( success ) { logger . debug ( "Deleting " + parent . getAbsolutePath ( ) ) ; } } existing = getLocalFile ( pdbId ) ; } return deleted ; } finally { setObsoleteBehavior ( obsolete ) ; } }
Attempts to delete all versions of a structure from the local directory .