- java.lang.Object
-
- org.tentackle.update.ClientUpdateUtilities
-
@Service(ClientUpdateUtilities.class) public class ClientUpdateUtilities extends java.lang.Object
Utility methods to implement the application update.
-
-
Constructor Summary
Constructors Constructor Description ClientUpdateUtilities()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InstallationTypedetermineInstallationType()Determines the installation type of the running application.java.io.FiledetermineJPackageRoot()Determines the jpackage's root installation directory.java.io.FiledowloadZip(UpdateInfo updateInfo, java.io.File updateDir, java.util.function.Consumer<java.lang.Double> progressConsumer)Downloads the zipfile.static ClientUpdateUtilitiesgetInstance()The singleton.java.security.MessageDigestgetMessageDigest()Gets the message digest to create the checksum of the downloaded zip file.UpdateServicegetUpdateService(java.lang.String serviceName, java.rmi.server.RMIClientSocketFactory csf)Gets the remote update service object.booleanisUpdatableJlinkDirectory(java.io.File dir)Checks whether given directory an updatable jlink image.booleanisUpdatableJPackageApplication()Checks whetherbooleanisUpdateableJlinkApplication()Checks whether the application is running in an updatable jlink directory.
-
-
-
Method Detail
-
getInstance
public static ClientUpdateUtilities getInstance()
The singleton.- Returns:
- the singleton
-
isUpdatableJlinkDirectory
public boolean isUpdatableJlinkDirectory(java.io.File dir)
Checks whether given directory an updatable jlink image.- Parameters:
dir- the directory to check- Returns:
- true if updatable jlink structure found
-
isUpdateableJlinkApplication
public boolean isUpdateableJlinkApplication()
Checks whether the application is running in an updatable jlink directory.- Returns:
- true if current workling directory contains an updatable jlink image
-
isUpdatableJPackageApplication
public boolean isUpdatableJPackageApplication()
Checks whether- Returns:
- true if jlink structure and updatable
-
determineJPackageRoot
public java.io.File determineJPackageRoot()
Determines the jpackage's root installation directory.- Returns:
- the installation directory, null if not a jpackage installation
-
determineInstallationType
public InstallationType determineInstallationType()
Determines the installation type of the running application.- Returns:
- the installation type, null if not an updatable installation
-
getUpdateService
public UpdateService getUpdateService(java.lang.String serviceName, java.rmi.server.RMIClientSocketFactory csf)
Gets the remote update service object.- Parameters:
serviceName- the service name, for ex."rmi://localhost/Update:33002"csf- the optional socket factory, null if default- Returns:
- the update service
-
getMessageDigest
public java.security.MessageDigest getMessageDigest() throws java.security.NoSuchAlgorithmExceptionGets the message digest to create the checksum of the downloaded zip file.- Returns:
- the message digest
- Throws:
java.security.NoSuchAlgorithmException- if no such digest
-
dowloadZip
public java.io.File dowloadZip(UpdateInfo updateInfo, java.io.File updateDir, java.util.function.Consumer<java.lang.Double> progressConsumer)
Downloads the zipfile.- Parameters:
updateInfo- the update infoupdateDir- the directory to create for the update processprogressConsumer- the consumer receiving the progress from 0.0 to 1.0, null if none- Returns:
- the downloaded ZIP file in the created update directory
-
-