java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.tentackle.update.AbstractUpdateServiceImpl
- All Implemented Interfaces:
Serializable
,Remote
,UpdateService
public abstract class AbstractUpdateServiceImpl
extends UnicastRemoteObject
implements UpdateService
Server side update service implementation.
- See Also:
-
Field Summary
Fields inherited from class java.rmi.server.RemoteObject
ref
-
Constructor Summary
ConstructorDescriptionAbstractUpdateServiceImpl
(int port, String updateURL) Creates an update service object.AbstractUpdateServiceImpl
(int port, String updateURL, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) Creates an update service object. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
createBaseUrlName
(ClientInfo clientInfo) Creates the base URL name without extension.protected URL
createChecksumURL
(ClientInfo clientInfo) Creates the URL for the checksum hash file.protected String
createUpdateExecutor
(ClientInfo clientInfo) Creates the name of the update executor.protected UpdateInfo
createUpdateInfo
(String version, URL zipURL, String checksumHash, long size, String updateExecutor) Creates the update info to be returned to the client.protected URL
createZipURL
(ClientInfo clientInfo) Creates the URL for the ZIP file.protected String
determineChecksumHash
(URL checksumURL) Determines the checksum hash.protected long
determineDownloadSize
(URL zipURL) Determines the download size of the ZIP file.abstract String
Gets the artifact name excluding the version.getUpdateInfo
(ClientInfo clientInfo) Gets the info how to download and install the update.Gets the update base URL.abstract String
Gets the server version.void
setUpdateURL
(String updateURL) Sets the update base URL.Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
-
Constructor Details
-
AbstractUpdateServiceImpl
Creates an update service object.- Parameters:
port
- the tcp-port, 0 = system defaultupdateURL
- the http url where to download the updates from- Throws:
RemoteException
- if failed to export object
-
AbstractUpdateServiceImpl
public AbstractUpdateServiceImpl(int port, String updateURL, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException Creates an update service object.- Parameters:
port
- the tcp-port, 0 = system defaultupdateURL
- the http url where to download the updates fromcsf
- the client socket factoryssf
- the server socket factory- Throws:
RemoteException
- if failed to export object
-
-
Method Details
-
getArtifactName
Gets the artifact name excluding the version.Example:
admin-jlink-client
- Returns:
- the artifact name
-
getVersion
Gets the server version.- Returns:
- the version
-
getUpdateURL
Gets the update base URL.- Returns:
- the url (with trailing slash!)
-
setUpdateURL
Sets the update base URL.- Parameters:
updateURL
- the url
-
getUpdateInfo
Description copied from interface:UpdateService
Gets the info how to download and install the update.- Specified by:
getUpdateInfo
in interfaceUpdateService
- Parameters:
clientInfo
- the client application info- Returns:
- the update info
- Throws:
RemoteException
- if download info cannot be determined
-
createUpdateInfo
protected UpdateInfo createUpdateInfo(String version, URL zipURL, String checksumHash, long size, String updateExecutor) Creates the update info to be returned to the client.- Parameters:
version
- the new application versionzipURL
- the URL to download the zip filechecksumHash
- the checksum hashsize
- the download sizeupdateExecutor
- the filename to execute to perform the update- Returns:
- the update info
-
createUpdateExecutor
Creates the name of the update executor.- Parameters:
clientInfo
- the client info- Returns:
- the executor name
-
createZipURL
Creates the URL for the ZIP file.- Parameters:
clientInfo
- the client info- Returns:
- the URL
-
createChecksumURL
Creates the URL for the checksum hash file.- Parameters:
clientInfo
- the client info- Returns:
- the URL
-
createBaseUrlName
Creates the base URL name without extension.- Parameters:
clientInfo
- the client info- Returns:
- the URL string
-
determineChecksumHash
Determines the checksum hash.- Parameters:
checksumURL
- the URL of the checksum hash file- Returns:
- the hash value
- Throws:
IOException
- if failed
-
determineDownloadSize
Determines the download size of the ZIP file.- Parameters:
zipURL
- the download URL- Returns:
- the size in bytes, -1 if content-length in header response
- Throws:
IOException
- if failed
-