Package org.rssowl.core.persist.service

Examples of org.rssowl.core.persist.service.PersistenceException


  public void optimizeOnNextStartup() throws PersistenceException {
    try {
      DBManager.getDefault().getDefragmentFile().createNewFile();
    } catch (IOException e) {
      throw new PersistenceException(e);
    }
  }
View Full Code Here


    /* Create the Index if required */
    try {
      fIndexWriter = createIndexWriter(fIndexDirectory, !IndexReader.indexExists(fIndexDirectory));
    } catch (IOException e) {
      throw new PersistenceException(e.getMessage(), e);
    }
  }
View Full Code Here

      return;

    try {
      fIndexWriter.close();
    } catch (IOException e) {
      throw new PersistenceException(e);
    }
    fIndexWriter = null;
    fFlushRequired = false;
  }
View Full Code Here

    try {
      long lastBackupTimestamp = Long.parseLong(DBHelper.readFirstLineFromFile(fBackupTimestampFile));
      long now = System.currentTimeMillis();
      return (now - lastBackupTimestamp) >= fBackupFrequency.longValue();
    } catch (NumberFormatException e) {
      throw new PersistenceException(fBackupTimestampFile.getAbsolutePath() + " does not contain a number for the date as expected", e); //$NON-NLS-1$
    }
  }
View Full Code Here

    if (!fBackupTimestampFile.exists()) {
      try {
        fBackupTimestampFile.createNewFile();
      } catch (IOException e) {
        throw new PersistenceException("Failed to create new file", e); //$NON-NLS-1$
      }
    }
    DBHelper.writeToFile(fBackupTimestampFile, String.valueOf(System.currentTimeMillis()));
  }
View Full Code Here

  private void deleteOldBackups(List<File> backupFiles) {
    /* We're creating a new back-up, so must leave one space available */
    while (backupFiles.size() > (fMaxBackupsCount - 1)) {
      File fileToDelete = backupFiles.remove(backupFiles.size() - 1);
      if (!fileToDelete.delete()) {
        throw new PersistenceException("Failed to delete file: " + fileToDelete); //$NON-NLS-1$
      }
    }
  }
View Full Code Here

         * index is correct here because filesToRename includes a back up file
         * with no index as well as .0 index
         */
        File newFile = new File(fBackupFile.getAbsolutePath() + "." + index); //$NON-NLS-1$
        if (!fileToRename.renameTo(newFile)) {
          throw new PersistenceException("Failed to rename file from " + fileToRename + " to " + newFile); //$NON-NLS-1$ //$NON-NLS-2$
        }
      }
    }
View Full Code Here

          }
        }
        fSearcher = null;
      }
    } catch (IOException e) {
      throw new PersistenceException(e.getMessage(), e);
    }
  }
View Full Code Here

      /* Use custom hit collector for performance reasons */
      /* Perform the Search */
      currentSearcher.search(query, new SimpleHitCollector(currentSearcher, resultList));
      return resultList;
    } catch (IOException e) {
      throw new PersistenceException(e);
    }
  }
View Full Code Here

         * because dispose is safe to be called many times for the same
         * searcher.
         */
        dispose(currentSearcher);
      } catch (IOException e) {
        throw new PersistenceException(e);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.service.PersistenceException

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.