Class ExcludeListUpdateHandler

java.lang.Object
com.sun.javatest.ExcludeListUpdateHandler

public class ExcludeListUpdateHandler extends Object
A class to handle downloading exclude lists from a server.
  • Constructor Details

    • ExcludeListUpdateHandler

      public ExcludeListUpdateHandler(URL remoteURL, File localFile)
      Create a handler for downloading exclude lists from a server.
      Parameters:
      remoteURL - the URL from which the exclude list should be downloaded
      localFile - the file to which the exclude list should be written
  • Method Details

    • getLocalFile

      public File getLocalFile()
      Get the file to which the exclude list should be written.
      Returns:
      the file to which the exclude list should be written
    • getLocalFileLastModified

      public long getLocalFileLastModified()
      Get the time that the local file was last modified.
      Returns:
      the time the local file was last modified. The result is given in the standard way, in the number of seconds since January 1, 1970. The result may be -1 or if there was a problem determining the required information
    • getRemoteURL

      public URL getRemoteURL()
      Get the URL from which the exclude list should be downloaded.
      Returns:
      the URL from which the exclude list should be downloaded
    • getRemoteURLLastModified

      public long getRemoteURLLastModified() throws IOException
      Get the time that the remote URL was last modified.
      Returns:
      the time the remote URL was last modified The result is given in the standard way, in the number of seconds since January 1, 1970.
      Throws:
      IOException - if there is a problem determining the information.
    • isUpdateAvailable

      public boolean isUpdateAvailable() throws IOException
      Determine if an update is available; this is determined by comparing the last modified times of the remote URL and the local file.
      Returns:
      true if the remote URL has been modified more recently than the local file.
      Throws:
      IOException - if there is a problem determining the result
      See Also:
    • update

      public void update() throws IOException
      Update the local file with the exclude list given by the remote URL.
      Throws:
      IOException - if there is a problem reading the exclude list
    • updateIfNewer

      public void updateIfNewer() throws IOException
      Update the local file if the remote URL has been modified more recently than the local file.
      Throws:
      IOException - if there is a problem reading the exclude list