public void updateChecksums ( File featureDir , ChecksumData checksumData ) { Collection < File > csFiles = new ArrayList < File > ( ) ; File featureChecksumsDir = new File ( featureDir , "checksums" ) ; getCheckSumFiles ( featureChecksumsDir , csFiles ) ; File libFeaturesChecksumsDir = new File ( Utils . getInstallDir ( ) , "lib/features/checksums" ) ; if ( libFeaturesChecksumsDir . getAbsoluteFile ( ) . equals ( featureChecksumsDir . getAbsoluteFile ( ) ) ) { File libPlatformChecksumsDir = new File ( Utils . getInstallDir ( ) , "lib/platform/checksums" ) ; getCheckSumFiles ( libPlatformChecksumsDir , csFiles ) ; } Properties existingChecksums = initChecksumProps ( checksumData . existingChecksums ) ; // Update existing cs files to new checksum for ( File csFile : csFiles ) { Properties csprops = loadChecksumFile ( csFile ) ; boolean modified = false ; for ( Entry < Object , Object > csEntry : csprops . entrySet ( ) ) { Object k = csEntry . getKey ( ) ; if ( checksumData . newChecksums . containsKey ( k ) ) { Object newChecksum = checksumData . newChecksums . get ( k ) ; if ( ! csEntry . getValue ( ) . equals ( newChecksum ) ) { csprops . put ( k , newChecksum ) ; modified = true ; } } if ( ! checksumData . isIgnoredCSFile ( csFile ) && existingChecksums . containsKey ( k ) ) { existingChecksums . put ( k , csEntry . getValue ( ) ) ; } } if ( modified ) { saveChecksumFile ( csFile , csprops , " for new checksum." ) ; } } // Update the new cs files to existing checksum for ( Entry < String , Set < String > > entry : checksumData . existingChecksums . entrySet ( ) ) { String f = entry . getKey ( ) ; File csFile = new File ( featureChecksumsDir , f + ".cs" ) ; if ( csFile . exists ( ) ) { Properties csprops = loadChecksumFile ( csFile ) ; boolean modified = false ; for ( String s : entry . getValue ( ) ) { if ( csprops . containsKey ( s ) && existingChecksums . containsKey ( s ) ) { String cs = ( String ) existingChecksums . get ( s ) ; if ( cs != null && ! cs . isEmpty ( ) ) { csprops . put ( s , cs ) ; modified = true ; } } } if ( modified ) { saveChecksumFile ( csFile , csprops , " for exising checksum." ) ; } } } }
Updates the check sum for a specific feature directory .