Package net.sf.joafip.service

Examples of net.sf.joafip.service.FilePersistenceException


      FilePersistenceInvalidClassException,
      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException {
    if (filePersistence != null) {
      throw new FilePersistenceException("already openned");
    }
    final FilePersistenceBuilder builder = new FilePersistenceBuilder();
    builder.setDataModelIdentifier(1);
    builder.setDataModelConversionDefInputStream(null);
    builder.setFileAccessMode(EnumFileAccessMode.MAPPED_RANDOM_FILE_ACCESS);
View Full Code Here


   *
   * @throws FilePersistenceException
   */
  public void close() throws FilePersistenceException {
    if (filePersistence == null) {
      throw new FilePersistenceException("already closed");
    }
    try {
      if (session.isOpened()) {
        try {
          session.close(EnumFilePersistenceCloseAction.DO_NOT_SAVE);
View Full Code Here

      FilePersistenceInvalidClassException,
      FilePersistenceDataCorruptedException,
      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException {
    if (filePersistence == null) {
      throw new FilePersistenceException("not openned");
    }
    final ObjectContainer container = new ObjectContainer(object);
    session.open();
    session.setObject(key, container);
    session.close(EnumFilePersistenceCloseAction.SAVE);
View Full Code Here

      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException {
    if (filePersistence == null) {
      throw new FilePersistenceException("not openned");
    }
    session.open();
    final ObjectContainer container = (ObjectContainer) session
        .getObject(key);
    final Object result;
View Full Code Here

        try {
          reader.close();
        } catch (Exception exception) {
          closeException=exception;
        }
        throw new FilePersistenceException("must found #" + identifier
            + " to be deleted",closeException);
      }
      if (++count == BATCH_SIZE) {
        count = 0;
        session.close(EnumFilePersistenceCloseAction.SAVE);
        session.open();
        consistencyCheck();
        ++batchCount;
        logger.info("delete batch #" + batchCount);
      }
    }
    reader.close();
    session.close(EnumFilePersistenceCloseAction.SAVE);

    session.open();
    batchCount = 0;
    count = 0;
    reader = new BufferedReader(new FileReader(insertLogFilePath));
    // "runtime_perf/toSearch.txt"));
    while (reader.readLine() != null && (line = reader.readLine()) != null) {// NOPMD
      final int identifier = Integer.parseInt(line);
      final ItemList itemList = getItemList(session);
      final Item item = itemList.get(identifier);
      if (item == null) {
        throw new FilePersistenceException("must found #" + identifier
            + " because not deleted");
      }
      if (++count == BATCH_SIZE) {
        count = 0;
        session.close(EnumFilePersistenceCloseAction.SAVE);
        session.open();
        ++batchCount;
        logger.info("search batch #" + batchCount);
      }
    }
    reader.close();
    session.close(EnumFilePersistenceCloseAction.SAVE);

    session.open();
    batchCount = 0;
    count = 0;
    reader = new BufferedReader(new FileReader(insertLogFilePath));
    // "runtime_perf/toDelete.txt"));
    while ((line = reader.readLine()) != null) { // NOPMD
      reader.readLine();// skip
      final int identifier = Integer.parseInt(line);
      final ItemList itemList = getItemList(session);
      final Item item = itemList.getItem(identifier);
      if (item != null) {
        throw new FilePersistenceException("must not found #"
            + identifier + " because deleted");
      }
      if (++count == BATCH_SIZE) {
        count = 0;
        session.close(EnumFilePersistenceCloseAction.SAVE);
View Full Code Here

        break;
      case STATE_UNSTABLE:
        /* need file maintenance */
        throw exception;
      default:
        throw new FilePersistenceException("unknow state " + fileState,
            exception);
      }
    }
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
View Full Code Here

    if (rootDir.exists()) {
      if (rootDir.isDirectory()) {
        deleteDir(rootDir);
      } else {
        if (!rootDir.delete()) {
          throw new FilePersistenceException(FAILED_DELETE + rootDir);
        }
      }
    }
    if (!rootDir.mkdirs()) {
      throw new FilePersistenceException("failed create " + rootDir);
    }
  }
View Full Code Here

    for (File file : files) {
      if (file.isDirectory()) {
        deleteDir(file);
      } else {
        if (!file.delete()) {
          throw new FilePersistenceException(FAILED_DELETE + file);
        }
      }
    }
    if (!dir.delete()) {
      throw new FilePersistenceException(FAILED_DELETE + dir);
    }
  }
View Full Code Here

                                 * manager
                                 */);
      helperBinaryConversion
          .initialize(classInfoFactory, objectIOManager);
    } catch (HeapException exception) {
      throw new FilePersistenceException(exception);
    } catch (ObjectIOException exception) {
      throw new FilePersistenceException(exception);
    } catch (BinaryConverterException exception) {
      throw new FilePersistenceException(exception);
    }
  }
View Full Code Here

        }
        final byte[] data = entry.getValue();
        final byte[] storedData = objectIOManager
            .getDataOfDataRecord(dataRecordIdentifier);
        if (!Arrays.equals(data, storedData)) {
          throw new FilePersistenceException("for data record "
              + dataRecordIdentifier + " data differs");
        }
      }
    } catch (ObjectIOException exception) {
      throw new FilePersistenceException(exception);
    } catch (HeapException exception) {
      throw new FilePersistenceException(exception);
    } catch (ObjectIODataCorruptedException exception) {
      throw new FilePersistenceDataCorruptedException(exception);
    } catch (ObjectIODataRecordNotFoundException exception) {
      throw new FilePersistenceException(exception);
    } finally {
      try {
        dataManager.stopService();
      } catch (HeapException exception) {
        // ignore error
View Full Code Here

TOP

Related Classes of net.sf.joafip.service.FilePersistenceException

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.