Examples of IUpdateSettings


Examples of net.sourceforge.squirrel_sql.client.preferences.IUpdateSettings

    expect(mockLocalReleaseFile.getAbsolutePath()).andStubReturn(LOCAL_RELEASE_FILENAME);
  }

  private IUpdateSettings setupUpdateSettings(boolean isRemoteUpdateSite)
  {
    IUpdateSettings result = mockHelper.createMock("mockUpdateSettings", IUpdateSettings.class);
    expect(result.getUpdateServerPath()).andStubReturn("pathForUpdates");
    expect(result.getFileSystemUpdatePath()).andStubReturn(FILE_SYSTEM_UPDATE_PATH);
    expect(result.isRemoteUpdateSite()).andStubReturn(isRemoteUpdateSite);
    return result;
  }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.preferences.IUpdateSettings

   * @see net.sourceforge.squirrel_sql.client.update.UpdateController#showUpdateDialog()
   */
  public void showUpdateDialog()
  {
    final JFrame parent = _app.getMainFrame();
    final IUpdateSettings settings = getUpdateSettings();
    final boolean isRemoteUpdateSite = settings.isRemoteUpdateSite();
    GUIUtils.processOnSwingEventThread(new Runnable()
    {

      @Override
      public void run()
      {
        UpdateManagerDialog dialog = new UpdateManagerDialog(parent, isRemoteUpdateSite);
        if (isRemoteUpdateSite)
        {
          dialog.setUpdateServerName(settings.getUpdateServer());
          dialog.setUpdateServerPort(settings.getUpdateServerPort());
          dialog.setUpdateServerPath(settings.getUpdateServerPath());
          dialog.setUpdateServerChannel(settings.getUpdateServerChannel());
        }
        else
        {
          dialog.setLocalUpdatePath(settings.getFileSystemUpdatePath());
        }
        dialog.addCheckUpdateListener(UpdateControllerImpl.this);
        dialog.setVisible(true);
      }
    });
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.preferences.IUpdateSettings

   * @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);
View Full Code Here

Examples of net.sourceforge.squirrel_sql.client.preferences.IUpdateSettings

  /**
   * @see net.sourceforge.squirrel_sql.client.update.UpdateController#isTimeToCheckForUpdates()
   */
  public boolean isTimeToCheckForUpdates()
  {
    IUpdateSettings settings = getUpdateSettings();

    if (!settings.isEnableAutomaticUpdates()) { return false; }

    long lastCheckTime = Long.parseLong(settings.getLastUpdateCheckTimeMillis());
    long delta = currentTimeMillis() - lastCheckTime;

    UpdateCheckFrequency updateCheckFrequency = _util.getUpdateCheckFrequency(settings);

    return updateCheckFrequency.isTimeForUpdateCheck(delta);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.