Examples of FileWrapper


Examples of br.com.datawatcher.entity.FileWrapper

  private static final Logger log = Logger.getLogger(MappedFolderListener.class.getName());

  @Override
  public void delete(SimpleRegister oldFile) {
    try {
      FileWrapper invokerFile = (FileWrapper) oldFile;
      this.removeInvoker(new File(invokerFile.getFile().getCanonicalPath()));
     
      log.info("An invokerFile has been removed. File : " + invokerFile.getFile().getName());
    } catch (IOException e) {
      throw new HPIRuntimeException(e);
    }
  }
View Full Code Here

Examples of br.com.datawatcher.entity.FileWrapper

  }

  @Override
  public void insert(SimpleRegister newFile) {
    try {
      FileWrapper invokerFile = (FileWrapper) newFile;
      this.addInvokerFile(new File(invokerFile.getFile().getCanonicalPath()));
     
      log.info("A new invokerFile has been added. File : " + invokerFile.getFile().getName());
    } catch (IOException e) {
      throw new HPIRuntimeException(e);
    }
  }
View Full Code Here

Examples of com.android.io.FileWrapper

    }

    @Override
    public Object getMinSdkVersion(@NonNull File manifestFile) {
        try {
            return AndroidManifest.getMinSdkVersion(new FileWrapper(manifestFile));
        } catch (XPathExpressionException e) {
            // won't happen.
        } catch (StreamException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

   * @see net.sourceforge.squirrel_sql.client.update.gui.installer.PreLaunchHelper#installUpdates(boolean)
   */
  @Override
  public void installUpdates(boolean prompt)
  {
    FileWrapper changeListFile = updateUtil.getChangeListFile();
    if (hasChangesToBeApplied(changeListFile))
    {
      logInfo("Pre-launch update app detected a changeListFile to be processed");
      if (prompt)
      {
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

    if (showConfirmDialog(RESTORE_FROM_BACKUP_MESSAGE, RESTORE_FROM_BACKUP_TITLE))
    {

      try
      {
        FileWrapper backupDir = updateUtil.getBackupDir();
        FileWrapper changeListFile = updateUtil.getFile(backupDir, UpdateUtil.CHANGE_LIST_FILENAME);
        ChangeListXmlBean changeList = updateUtil.getChangeList(changeListFile);

        ArtifactInstaller installer = artifactInstallerFactory.create(changeList, null);
        if (!installer.restoreBackupFiles())
        {
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

  public boolean backupFiles() throws FileNotFoundException, IOException
  {
    boolean result = true;
    sendBackupStarted(_changeList.size());

    FileWrapper localReleaseFile = _util.getLocalReleaseFile();
    _util.copyFile(localReleaseFile, _util.getBackupDir());

    for (ArtifactStatus status : _changeList)
    {
      String artifactName = status.getName();
      sendFileBackupStarted(artifactName);
      // Skip files that are not installed - new files
      if (!status.isInstalled())
      {
        if (s_log.isInfoEnabled())
        {
          s_log.info("Skipping backup of artifact (" + status + ") which isn't installed.");
        }
        sendFileBackupComplete(artifactName);
        continue;
      }
      if (status.isCoreArtifact())
      {
        FileWrapper installDir = getCoreArtifactLocation(artifactName, installRootDir, coreInstallDir);
        FileWrapper coreFile = _util.getFile(installDir, artifactName);
        FileWrapper backupFile = _util.getFile(coreBackupDir, artifactName);
        _util.copyFile(coreFile, backupFile);
      }
      if (status.isPluginArtifact())
      {
        // artifact name for plugins is <plugin internal name>.zip
        FileWrapper pluginBackupFile = _util.getFile(pluginBackupDir, artifactName);
        String pluginDirectory = artifactName.replace(".zip", "");
        String pluginJarFilename = artifactName.replace(".zip", ".jar");

        ArrayList<FileWrapper> filesToZip = new ArrayList<FileWrapper>();
        FileWrapper pluginDirectoryFile = _util.getFile(pluginInstallDir, pluginDirectory);
        if (pluginDirectoryFile.exists())
        {
          filesToZip.add(pluginDirectoryFile);
        }
        FileWrapper pluginJarFile = _util.getFile(pluginInstallDir, pluginJarFilename);
        if (pluginJarFile.exists())
        {
          filesToZip.add(pluginJarFile);
        }
        if (filesToZip.size() > 0)
        {
          _util.createZipFile(pluginBackupFile, filesToZip.toArray(new FileWrapper[filesToZip.size()]));
        }
        else
        {
          s_log.error("Plugin (" + status.getName() + ") was listed as already installed, but it's "
            + "files didn't exist and couldn't be backed up: pluginDirectoryFile="
            + pluginDirectoryFile.getAbsolutePath() + " pluginJarFile="
            + pluginJarFile.getAbsolutePath());
        }
      }
      if (status.isTranslationArtifact())
      {
        FileWrapper translationFile = _util.getFile(i18nInstallDir, artifactName);
        FileWrapper backupFile = _util.getFile(translationBackupDir, artifactName);
        if (translationFile.exists())
        {
          _util.copyFile(translationFile, backupFile);
        }
      }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

    List<InstallFileOperationInfo> filesToInstall = new ArrayList<InstallFileOperationInfo>();

    for (ArtifactStatus status : _changeList)
    {
      ArtifactAction action = status.getArtifactAction();
      FileWrapper installDir = null;
      FileWrapper fileToCopy = null;
      FileWrapper fileToRemove = null;
      String artifactName = status.getName();
      boolean isPlugin = false;

      if (status.isCoreArtifact())
      {
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

  public boolean restoreBackupFiles() throws FileNotFoundException, IOException
  {
    for (ArtifactStatus status : _changeList)
    {
      String name = status.getName();
      FileWrapper backupDir = null;
      FileWrapper installDir = null;

      if (status.isCoreArtifact())
      {
        backupDir = coreBackupDir;
        installDir = getCoreArtifactLocation(name, installRootDir, coreInstallDir);
      }
      if (status.isPluginArtifact())
      {
        backupDir = pluginBackupDir;
        installDir = pluginInstallDir;
      }
      if (status.isTranslationArtifact())
      {
        backupDir = translationBackupDir;
        installDir = coreInstallDir; // translations are most likely to be found in core lib dir.
      }
      FileWrapper backupJarPath = _util.getFile(backupDir, name);
      FileWrapper installJarPath = _util.getFile(installDir, name);

      if (!_util.deleteFile(installJarPath))
      {
        return false;
      }
      else
      {
        _util.copyFile(backupJarPath, installJarPath);
      }
    }
    if (!_util.deleteFile(_util.getLocalReleaseFile()))
    {
      return false;
    }
    else
    {
      FileWrapper backupReleaseFile = _util.getFile(_util.getBackupDir(), UpdateUtil.RELEASE_XML_FILENAME);
      _util.copyFile(backupReleaseFile, updateDir);
    }

    return true;
  }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

        continue;
      }

      if (status.getArtifactAction() == ArtifactAction.INSTALL)
      {
        FileWrapper installedFileLocation = null;
        // Skip the artifact if it is identical to the one that is already installed
        if (status.isCoreArtifact())
        {
          installedFileLocation =
            _util.getFile(getCoreArtifactLocation(status.getName(), installRootDir, coreInstallDir),
              status.getName());
        }
        if (status.isTranslationArtifact())
        {
          installedFileLocation = _util.getFile(coreInstallDir, status.getName());
        }

        long installedSize = installedFileLocation.length();
        if (installedSize == status.getSize())
        {
          long installedCheckSum = _util.getCheckSum(installedFileLocation);
          if (installedCheckSum == status.getChecksum())
          {
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

      if (s_log.isInfoEnabled())
      {
        s_log.info("installNewReleaseXmlFile: release file to be replaced was missing.");
      }
    }
    FileWrapper downloadReleaseFile = _util.getFile(downloadsRootDir, UpdateUtil.RELEASE_XML_FILENAME);
    try
    {
      _util.copyFile(downloadReleaseFile, updateDir);
    }
    catch (FileNotFoundException e)
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.