Package org.rssowl.core.persist.service

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


        BooleanQuery.setMaxClauseCount(MAX_CLAUSE_COUNT);
        return doSearchNews(conditions, matchAllConditions);
      }

      /* Maximum reached */
      throw new PersistenceException(Messages.ModelSearchImpl_ERROR_WILDCARDS, e);
    }
  }
View Full Code Here


        return resultList;
      } finally {
        disposeIfNecessary(currentSearcher);
      }
    } catch (IOException e) {
      throw new PersistenceException(Messages.ModelSearchImpl_ERROR_SEARCH, e);
    }
  }
View Full Code Here

        }
        fSearchers.get(fSearcher).incrementAndGet();
        return fSearcher;
      }
    } catch (IOException e) {
      throw new PersistenceException(e.getMessage(), e);
    }
  }
View Full Code Here

               * We sleep with a lock held because the Threads that we're
               * waiting to make progress don't acquire a lock
               */
              Thread.sleep(100);
            } catch (InterruptedException e) {
              throw new PersistenceException("Failed to close IndexSearcher: " + fSearcher); //$NON-NLS-1$
            }
          }
        }
      }
    } catch (IOException e) {
      throw new PersistenceException(e.getMessage(), e);
    }
  }
View Full Code Here

   */
  public void optimize() {
    try {
      fIndexer.optimize();
    } catch (IOException e) {
      throw new PersistenceException(e.getMessage(), e);
    }
  }
View Full Code Here

        File recentBackup = fOPMLBackups.get(0);
        try {
          types = Owl.getInterpreter().importFrom(new FileInputStream(recentBackup));
        } catch (Exception e) {
          if (fOPMLBackups.size() == 1)
            throw new PersistenceException(e.getMessage(), e);
        }

        /* Second Try Weekly Backup */
        if (types == null && fOPMLBackups.size() == 2) {
          File weeklyBackup = fOPMLBackups.get(1);
          try {
            types = Owl.getInterpreter().importFrom(new FileInputStream(weeklyBackup));
          } catch (Exception e) {
            throw new PersistenceException(e.getMessage(), e);
          }
        }

        /* Do Import */
        if (types != null)
View Full Code Here

      mark.setPopularity(mark.getPopularity() + 1);
      preSave(mark);
      fDb.ext().set(mark, 1);
      fDb.commit();
    } catch (Db4oException e) {
      throw new PersistenceException(e);
    } finally {
      fWriteLock.unlock();
    }
    DBHelper.cleanUpAndFireEvents();
  }
View Full Code Here

      mark.setPopularity(mark.getPopularity() + 1);
      preSave(mark);
      fDb.ext().set(mark, 1);
      fDb.commit();
    } catch (Db4oException e) {
      throw new PersistenceException(e);
    } finally {
      fWriteLock.unlock();
    }
    DBHelper.cleanUpAndFireEvents();
  }
View Full Code Here

      /* Open DB */
      fObjectContainer = Db4o.openFile(config, forRestore ? getDBRestoreFilePath() : getDBFilePath());

      /* Handle Fatal Error while opening DB */
      if (fObjectContainer == null)
        throw new PersistenceException(Messages.DBManager_UNABLE_TO_OPEN_PROFILE);

      /* Keep date of last successfull profile opened */
      storeProfileLastUsed();
    }

    /* Error opening the DB */
    catch (Throwable e) {

      /* Generic Error */
      if (e instanceof Error)
        throw (Error) e;

      /* Persistence Exception */
      if (e instanceof PersistenceException)
        throw (PersistenceException) e;

      /* Profile locked by another running instance */
      if (e instanceof DatabaseFileLockedException)
        throw new ProfileLockedException(e.getMessage(), e);

      File file = new File(getDBFilePath());

      /* Disk Full Error */
      if (!file.exists())
        throw new DiskFullException(Messages.DBManager_DISK_FULL_ERROR, e);

      /* Permission Error */
      if (!file.canRead() || (!file.canWrite()))
        throw new InsufficientFilePermissionException(NLS.bind(Messages.DBManager_FILE_PERMISSION_ERROR, file), null);

      /* Any other Error */
      throw new PersistenceException(e);
    }
  }
View Full Code Here

            safeCreate(marker);

          /* Use a tmp file to guard against RSSOwl shutdown while backing up */
          tmpBackupFile = new File(backupFile.getParentFile(), TMP_BACKUP_NAME);
          if (tmpBackupFile.exists() && !tmpBackupFile.delete())
            throw new PersistenceException("Failed to delete file: " + tmpBackupFile); //$NON-NLS-1$

          /* Relies on fObjectContainer being set before calling backup */
          fObjectContainer.ext().backup(tmpBackupFile.getAbsolutePath());

          /* Store Backup as Weekly Backup if necessary */
          File weeklyBackup = onlineBackupService.getWeeklyBackupFile();
          boolean renameToWeekly = false;
          if (!weeklyBackup.exists()) //First Weekly
            renameToWeekly = true;
          else if (weeklyBackup.lastModified() < (System.currentTimeMillis() - MAX_ONLINE_BACKUP_AGE)) //Weekly older 1 Week
            renameToWeekly = true;

          /* Atomic Rename */
          DBHelper.rename(tmpBackupFile, renameToWeekly ? weeklyBackup : backupFile);
        } catch (IOException e) {
          throw new PersistenceException(e);
        } finally {
          safeDelete(marker);
          if (tmpBackupFile != null && tmpBackupFile.exists()) //Cleanup if something went wrong
            safeDelete(tmpBackupFile);
        }
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.