Node Director
|
Embed file checksums in text file. More...
Public Member Functions | |
ChecksumEmbedder (File file) | |
String | computeChecksum () |
Force computation of the files current checksum. | |
String | checksum () |
Returns the checksum most recently computed. | |
String | fetchChecksum () |
Extracts the currently embedded checksum from the text file. | |
String | embeddedSum () |
Returns the most recently fetched checksum. | |
boolean | isAltered () |
Check if a file has been altered since the last time the checksum was updated. | |
void | embedChecksum (String prefix) throws DirectorException |
Computes the current checksum and updates the copy embedded in the file. |
Embed file checksums in text file.
Maintains a checksum embedded as a comment within a checksummed text file. This allows to find out if the file has been changed without keeping a backup copy or a checksum in a separate file.
sfi.director.util.ChecksumEmbedder.ChecksumEmbedder | ( | File | file | ) |
String sfi.director.util.ChecksumEmbedder.checksum | ( | ) |
Returns the checksum most recently computed.
If no checksum has ever been computed, invokes computeChecksum first.
References sfi.director.util.ChecksumEmbedder.computeChecksum().
Referenced by sfi.director.util.ChecksumEmbedder.computeChecksum(), sfi.director.util.ChecksumEmbedder.embedChecksum(), and sfi.director.util.ChecksumEmbedder.isAltered().
String sfi.director.util.ChecksumEmbedder.computeChecksum | ( | ) |
Force computation of the files current checksum.
References sfi.director.util.ChecksumEmbedder.checksum(), and com.graeff.pwencode.EncoderImpl.digestToString().
Referenced by sfi.director.util.ChecksumEmbedder.checksum(), sfi.director.util.ChecksumEmbedder.embedChecksum(), sfi.director.application.scripttask.ReloadService.exec(), and sfi.director.application.scripttask.ZoneUpdated.updateSerial().
void sfi.director.util.ChecksumEmbedder.embedChecksum | ( | String | prefix | ) | throws DirectorException |
Computes the current checksum and updates the copy embedded in the file.
If no checksum has ever been embedded in the file, a new line containing the embedded checksum is added to the file. The string actually written to the file is prefixed with the given prefix string (usually a comment start string).
References sfi.director.util.ChecksumEmbedder.checksum(), sfi.director.util.ChecksumEmbedder.computeChecksum(), sfi.director.retriever.RemoteFile.connectSend(), sfi.director.util.ChecksumEmbedder.fetchChecksum(), sfi.director.retriever.RetrieverManager.getConnection(), and sfi.director.util.ChecksumEmbedder.isAltered().
Referenced by sfi.director.application.scripttask.ReloadService.exec(), and sfi.director.application.scripttask.ZoneUpdated.updateSerial().
String sfi.director.util.ChecksumEmbedder.embeddedSum | ( | ) |
Returns the most recently fetched checksum.
If fetchChecksum() has not yet been invoked, runs fetchChecksum() first.
References sfi.director.util.ChecksumEmbedder.fetchChecksum().
Referenced by sfi.director.util.ChecksumEmbedder.isAltered().
String sfi.director.util.ChecksumEmbedder.fetchChecksum | ( | ) |
Extracts the currently embedded checksum from the text file.
Referenced by sfi.director.util.ChecksumEmbedder.embedChecksum(), and sfi.director.util.ChecksumEmbedder.embeddedSum().
boolean sfi.director.util.ChecksumEmbedder.isAltered | ( | ) |
Check if a file has been altered since the last time the checksum was updated.
References sfi.director.util.ChecksumEmbedder.checksum(), and sfi.director.util.ChecksumEmbedder.embeddedSum().
Referenced by sfi.director.util.ChecksumEmbedder.embedChecksum(), sfi.director.application.scripttask.ReloadService.exec(), and sfi.director.application.scripttask.ZoneUpdated.updateSerial().