Package net.sourceforge.squirrel_sql.fw.util

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


  /**
   * @see net.sourceforge.squirrel_sql.client.update.UpdateUtil#getSquirrelHomeDir()
   */
  public FileWrapper getSquirrelHomeDir()
  {
    FileWrapper squirrelHomeDir = _appFileWrappers.getSquirrelHomeDir();
    if (!squirrelHomeDir.isDirectory())
    {
      s_log.error("SQuirreL Home Directory (" + squirrelHomeDir.getAbsolutePath()
        + " doesn't appear to be a directory");
    }
    return squirrelHomeDir;
  }
View Full Code Here


  /**
   * @see net.sourceforge.squirrel_sql.client.update.UpdateUtil#getSquirrelPluginsDir()
   */
  public FileWrapper getSquirrelPluginsDir()
  {
    FileWrapper squirrelHomeDir = _appFileWrappers.getPluginsDirectory();
    if (!squirrelHomeDir.isDirectory())
    {
      s_log.error("SQuirreL Plugins Directory (" + squirrelHomeDir.getAbsolutePath()
        + " doesn't appear to be a directory");
    }
    return squirrelHomeDir;
  }
View Full Code Here

  /**
   * @see net.sourceforge.squirrel_sql.client.update.UpdateUtil#getSquirrelLibraryDir()
   */
  public FileWrapper getSquirrelLibraryDir()
  {
    FileWrapper squirrelLibDir = _appFileWrappers.getLibraryDirectory();
    if (!squirrelLibDir.isDirectory())
    {
      s_log.error("SQuirreL Library Directory (" + squirrelLibDir.getAbsolutePath()
        + " doesn't appear to be a directory");
    }
    return squirrelLibDir;
  }
View Full Code Here

  /**
   * @see net.sourceforge.squirrel_sql.client.update.UpdateUtil#getChangeListFile()
   */
  public FileWrapper getChangeListFile()
  {
    FileWrapper updateDir = getSquirrelUpdateDir();
    FileWrapper changeListFile = _fileWrapperFactory.create(updateDir, CHANGE_LIST_FILENAME);
    return changeListFile;
  }
View Full Code Here

  /**
   * @see net.sourceforge.squirrel_sql.client.update.UpdateUtil#getLocalReleaseFile()
   */
  public FileWrapper getLocalReleaseFile() throws FileNotFoundException
  {
    FileWrapper result = null;
    try
    {
      FileWrapper[] files = getSquirrelHomeDir().listFiles();
      for (FileWrapper file : files)
      {
View Full Code Here

   * @see net.sourceforge.squirrel_sql.client.update.UpdateUtil#getInstalledTranslations()
   */
  public Set<String> getInstalledTranslations()
  {
    HashSet<String> result = new HashSet<String>();
    FileWrapper libDir = getSquirrelLibraryDir();
    for (String filename : libDir.list())
    {
      if (filename.startsWith("squirrel-sql_"))
      {
        result.add(filename);
      }
View Full Code Here

  /**
   * @see net.sourceforge.squirrel_sql.client.update.UpdateUtil#checkDir(FileWrapper, java.lang.String)
   */
  public FileWrapper checkDir(FileWrapper parent, String child)
  {
    FileWrapper dir = _fileWrapperFactory.create(parent, child);
    if (!dir.exists() && !dir.mkdir())
    {
      s_log.error("checkDir: Failed to mkdir - " + dir.getAbsolutePath());
    }
    return dir;
  }
View Full Code Here

        {
          checkDir(outputDirectory, name);
        }
        else
        {
          FileWrapper newFile = _fileWrapperFactory.create(outputDirectory, name);
          if (newFile.exists())
          {
            if (s_log.isInfoEnabled())
            {
              s_log.info("Deleting extraction file that already exists:" + newFile.getAbsolutePath());
            }
            newFile.delete();
          }
          fos = new FileOutputStream(newFile.getAbsolutePath());
          byte[] buffer = new byte[ZIP_EXTRACTION_BUFFER_SIZE];
          int n = 0;
          while ((n = zis.read(buffer, 0, ZIP_EXTRACTION_BUFFER_SIZE)) > -1)
          {
            fos.write(buffer, 0, n);
View Full Code Here

  }

  private String getArtifactDownloadDestDir(ArtifactStatus status)
  {

    FileWrapper destDir = _util.getCoreDownloadsDir();
    if (UpdateUtil.PLUGIN_ARTIFACT_ID.equals(status.getType()))
    {
      destDir = _util.getPluginDownloadsDir();
    }
    if (UpdateUtil.TRANSLATION_ARTIFACT_ID.equals(status.getType()))
    {
      destDir = _util.getI18nDownloadsDir();
    }
    return destDir.getAbsolutePath();
  }
View Full Code Here

  }

  @Test
  public void testGetSetFileToInstall()
  {
    FileWrapper mockNewFileToInstall = mockHelper.createMock(FileWrapper.class);
   
    mockHelper.replayAll();
    assertEquals(mockFileToInstall, classUnderTest.getFileToInstall());
    classUnderTest.setFileToInstall(mockNewFileToInstall);
    assertEquals(mockNewFileToInstall, classUnderTest.getFileToInstall());
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.fw.util.FileWrapper

Copyright © 2018 www.massapicom. 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.