* @see net.sourceforge.squirrel_sql.client.update.UpdateController#isUpToDate()
*/
public boolean isUpToDate() throws Exception
{
IUpdateSettings settings = getUpdateSettings();
// 1. Find the local release.xml file
String releaseFilename = _util.getLocalReleaseFile().getAbsolutePath();
// 2. Load the local release.xml file as a ChannelXmlBean.
_installedChannelBean = _util.getLocalReleaseInfo(releaseFilename);
// 4. Get the release.xml file as a ChannelXmlBean from the server or
// filesystem.
if (settings.isRemoteUpdateSite())
{
// 4a. Determine the channel that the user wants (stable or snapshot)
String channelName = getDesiredChannel(settings);
StringBuilder releasePath = new StringBuilder("/");
releasePath.append(getUpdateServerPath());
releasePath.append("/");
releasePath.append(channelName);
releasePath.append("/");
_currentChannelBean =
_util.downloadCurrentRelease(getUpdateServerName(), getUpdateServerPortAsInt(),
releasePath.toString(), RELEASE_XML_FILENAME, _app.getSquirrelPreferences().getProxySettings());
}
else
{
// 4b. Copy the release.xml file to the download directory then load the current release channel bean
FileWrapper updateSiteReleaseXmlFilePath =
fileWrapperFactory.create(settings.getFileSystemUpdatePath(), RELEASE_XML_FILENAME);
FileWrapper downloadReleaseXmlFile =
fileWrapperFactory.create(_util.getDownloadsDir(), RELEASE_XML_FILENAME);
_util.copyFile(updateSiteReleaseXmlFilePath, downloadReleaseXmlFile);
_currentChannelBean = _util.loadUpdateFromFileSystem(settings.getFileSystemUpdatePath());
}
settings.setLastUpdateCheckTimeMillis("" + currentTimeMillis());
saveUpdateSettings(settings);
// 5. Is it the same as the local copy, which was placed either by the
// installer or the last update?
return _currentChannelBean.equals(_installedChannelBean);