Class SlaveUpdater
java.lang.Object
zleurtor.scanmanager.model.update.AbstractUpdater
zleurtor.scanmanager.model.update.SlaveUpdater
The class having in charge to search the updates and apply it (if needed).
- Author:
- Zleurtor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputeArchiveChecksums
(File archive) Compute the checksum of each entry in the specified archive.computeCurrentChecksums
(Collection<String> filenames) Compute the checksum of the specified files in the current installation.protected final Collection<String>
computePlan
(File archive) Compare the content of the archive and the actual files, then compute the files to extract.final boolean
update()
Check if an update is available (and install it).final void
Install the update contained in the specified update file.Methods inherited from class zleurtor.scanmanager.model.update.AbstractUpdater
mergeConfigurations
-
Constructor Details
-
SlaveUpdater
public SlaveUpdater()
-
-
Method Details
-
update
public final boolean update()Description copied from class:AbstractUpdater
Check if an update is available (and install it).- Specified by:
update
in classAbstractUpdater
- Returns:
- true if an update has been done, false otherwise.
-
update
public final void update(File updateFile) throws FileNotFoundException, IOException, NoSuchAlgorithmException, DigestException Install the update contained in the specified update file.- Parameters:
updateFile
- The file containing the update to install.- Throws:
FileNotFoundException
- If the update file cannot be found.IOException
- If an I/O error occurs during the update process.NoSuchAlgorithmException
- If no Provider supports MD5 or SHA-1 implementation.DigestException
- If a digest error occurs.
-
computePlan
protected final Collection<String> computePlan(File archive) throws FileNotFoundException, IOException, NoSuchAlgorithmException, DigestException Compare the content of the archive and the actual files, then compute the files to extract.- Specified by:
computePlan
in classAbstractUpdater
- Parameters:
archive
- The new 3D Scan Manager version archive.- Returns:
- The collection of files to extract from the archive.
- Throws:
IOException
- If the new version archive file can not be read.FileNotFoundException
- If the new version archive file does not exist.NoSuchAlgorithmException
- If no Provider supports MD5 or SHA-1 implementation.DigestException
- If a digest error occurs.
-
computeArchiveChecksums
protected Map<String,String> computeArchiveChecksums(File archive) throws NoSuchAlgorithmException, IOException, FileNotFoundException Compute the checksum of each entry in the specified archive.- Parameters:
archive
- The archive of which the checksum of each entry shall be computed.- Returns:
- A map containing, as keys the entry names, as values the checksums.
- Throws:
NoSuchAlgorithmException
- If no Provider supports MD5 or SHA-1 implementation.IOException
- If the new version archive file can not be read.FileNotFoundException
- If a digest error occurs.
-
computeCurrentChecksums
protected Map<String,String> computeCurrentChecksums(Collection<String> filenames) throws NoSuchAlgorithmException, IOException, FileNotFoundException Compute the checksum of the specified files in the current installation.- Parameters:
filenames
- The name of the files of which the checksum shall be computed.- Returns:
- A map containing, as keys the entry names, as values the checksums.
- Throws:
NoSuchAlgorithmException
- If no Provider supports MD5 or SHA-1 implementation.IOException
- If the new version archive file can not be read.FileNotFoundException
- If a digest error occurs.
-