com.sun.javatest
Class ExcludeListUpdateHandler

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

public class ExcludeListUpdateHandler
extends java.lang.Object

A class to handle downloading exclude lists from a server.


Constructor Summary
ExcludeListUpdateHandler(java.net.URL remoteURL, java.io.File localFile)
          Create a handler for downloading exclude lists from a server.
 
Method Summary
 java.io.File getLocalFile()
          Get the file to which the exclude list should be written.
 long getLocalFileLastModified()
          Get the time that the local file was last modified.
 java.net.URL getRemoteURL()
          Get the URL from which the exclude list should be downloaded.
 long getRemoteURLLastModified()
          Get the time that the remote URL was last modified.
 boolean isUpdateAvailable()
          Determine if an update is available; this is determined by comparing the last modified times of the remote URL and the local file.
 void update()
          Update the local file with the exclude list given by the remote URL.
 void updateIfNewer()
          Update the local file if the remote URL has been modified more recently than the local file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExcludeListUpdateHandler

public ExcludeListUpdateHandler(java.net.URL remoteURL,
                                java.io.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 Detail

getLocalFile

public java.io.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 java.net.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 java.io.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:
java.io.IOException - if there is a problem determining the information.

isUpdateAvailable

public boolean isUpdateAvailable()
                          throws java.io.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:
java.io.IOException - if there is a problem determining the result
See Also:
getLocalFileLastModified(), getRemoteURLLastModified()

update

public void update()
            throws java.io.IOException
Update the local file with the exclude list given by the remote URL.

Throws:
java.io.IOException - if there is a problem reading the exclude list

updateIfNewer

public void updateIfNewer()
                   throws java.io.IOException
Update the local file if the remote URL has been modified more recently than the local file.

Throws:
java.io.IOException - if there is a problem reading the exclude list


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.