Class AbstractUpdateServiceImpl

  • All Implemented Interfaces:
    java.io.Serializable, java.rmi.Remote, UpdateService

    public abstract class AbstractUpdateServiceImpl
    extends java.rmi.server.UnicastRemoteObject
    implements UpdateService
    Server side update service implementation.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.rmi.server.RemoteObject

        ref
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractUpdateServiceImpl​(int port, java.lang.String updateURL)
      Creates an update service object.
      AbstractUpdateServiceImpl​(int port, java.lang.String updateURL, java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf)
      Creates an update service object.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String createBaseUrlName​(ClientInfo clientInfo)
      Creates the base URL name without extension.
      protected java.net.URL createChecksumURL​(ClientInfo clientInfo)
      Creates the URL for the checksum hash file.
      protected java.lang.String createUpdateExecutor​(ClientInfo clientInfo)
      Creates the name of the update executor.
      protected UpdateInfo createUpdateInfo​(java.lang.String version, java.net.URL zipURL, java.lang.String checksumHash, long size, java.lang.String updateExecutor)
      Creates the update info to be returned to the client.
      protected java.net.URL createZipURL​(ClientInfo clientInfo)
      Creates the URL for the ZIP file.
      protected java.lang.String determineChecksumHash​(java.net.URL checksumURL)
      Determines the checksum hash.
      protected long determineDownloadSize​(java.net.URL zipURL)
      Determines the download size of the ZIP file.
      abstract java.lang.String getArtifactName()
      Gets the artifact name excluding the version.
      UpdateInfo getUpdateInfo​(ClientInfo clientInfo)
      Gets the info how to download and install the update.
      java.lang.String getUpdateURL()
      Gets the update base URL.
      abstract java.lang.String getVersion()
      Gets the server version.
      void setUpdateURL​(java.lang.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
      • Methods inherited from class java.rmi.server.RemoteObject

        equals, getRef, hashCode, toString, toStub
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractUpdateServiceImpl

        public AbstractUpdateServiceImpl​(int port,
                                         java.lang.String updateURL)
                                  throws java.rmi.RemoteException
        Creates an update service object.
        Parameters:
        port - the tcp-port, 0 = system default
        updateURL - the http url where to download the updates from
        Throws:
        java.rmi.RemoteException - if failed to export object
      • AbstractUpdateServiceImpl

        public AbstractUpdateServiceImpl​(int port,
                                         java.lang.String updateURL,
                                         java.rmi.server.RMIClientSocketFactory csf,
                                         java.rmi.server.RMIServerSocketFactory ssf)
                                  throws java.rmi.RemoteException
        Creates an update service object.
        Parameters:
        port - the tcp-port, 0 = system default
        updateURL - the http url where to download the updates from
        csf - the client socket factory
        ssf - the server socket factory
        Throws:
        java.rmi.RemoteException - if failed to export object
    • Method Detail

      • getArtifactName

        public abstract java.lang.String getArtifactName()
        Gets the artifact name excluding the version.

        Example:

        admin-jlink-client
        Returns:
        the artifact name
      • getVersion

        public abstract java.lang.String getVersion()
        Gets the server version.
        Returns:
        the version
      • getUpdateURL

        public java.lang.String getUpdateURL()
        Gets the update base URL.
        Returns:
        the url (with trailing slash!)
      • setUpdateURL

        public void setUpdateURL​(java.lang.String updateURL)
        Sets the update base URL.
        Parameters:
        updateURL - the url
      • getUpdateInfo

        public UpdateInfo getUpdateInfo​(ClientInfo clientInfo)
                                 throws java.rmi.RemoteException
        Description copied from interface: UpdateService
        Gets the info how to download and install the update.
        Specified by:
        getUpdateInfo in interface UpdateService
        Parameters:
        clientInfo - the client application info
        Returns:
        the update info
        Throws:
        java.rmi.RemoteException - if download info cannot be determined
      • createUpdateInfo

        protected UpdateInfo createUpdateInfo​(java.lang.String version,
                                              java.net.URL zipURL,
                                              java.lang.String checksumHash,
                                              long size,
                                              java.lang.String updateExecutor)
        Creates the update info to be returned to the client.
        Parameters:
        version - the new application version
        zipURL - the URL to download the zip file
        checksumHash - the checksum hash
        size - the download size
        updateExecutor - the filename to execute to perform the update
        Returns:
        the update info
      • createUpdateExecutor

        protected java.lang.String createUpdateExecutor​(ClientInfo clientInfo)
        Creates the name of the update executor.
        Parameters:
        clientInfo - the client info
        Returns:
        the executor name
      • createZipURL

        protected java.net.URL createZipURL​(ClientInfo clientInfo)
        Creates the URL for the ZIP file.
        Parameters:
        clientInfo - the client info
        Returns:
        the URL
      • createChecksumURL

        protected java.net.URL createChecksumURL​(ClientInfo clientInfo)
        Creates the URL for the checksum hash file.
        Parameters:
        clientInfo - the client info
        Returns:
        the URL
      • createBaseUrlName

        protected java.lang.String createBaseUrlName​(ClientInfo clientInfo)
        Creates the base URL name without extension.
        Parameters:
        clientInfo - the client info
        Returns:
        the URL string
      • determineChecksumHash

        protected java.lang.String determineChecksumHash​(java.net.URL checksumURL)
                                                  throws java.io.IOException
        Determines the checksum hash.
        Parameters:
        checksumURL - the URL of the checksum hash file
        Returns:
        the hash value
        Throws:
        java.io.IOException - if failed
      • determineDownloadSize

        protected long determineDownloadSize​(java.net.URL zipURL)
                                      throws java.io.IOException
        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:
        java.io.IOException - if failed