Node Director
Public Member Functions | List of all members
sfi.director.util.ChecksumEmbedder Class Reference

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.

Detailed Description

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.

Constructor & Destructor Documentation

sfi.director.util.ChecksumEmbedder.ChecksumEmbedder ( File  file)

Member Function Documentation

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 ( )
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 ( )

The documentation for this class was generated from the following file: