Package net.sf.joafip.service

Examples of net.sf.joafip.service.IFilePersistence


    builder.setPathName("runtime");
    builder.setProxyMode(true);
    builder.setRemoveFiles(true);
    builder.setGarbageManagement(false);
    builder.setCrashSafeMode(false);
    final IFilePersistence filePersistence = builder.build();

    Bob1 bob1 = new Bob1();
    bob1.setVal(1000);
    final Bob2 bob2 = new Bob2();
    bob1.setBob2(bob2);

    final IDataAccessSession session = filePersistence
        .createDataAccessSession();

    session.open();
    session.setObject("key", bob1);
    session.close(EnumFilePersistenceCloseAction.SAVE);

    filePersistence.setChangeLogEnabled(true, 1);

    session.open();
    bob1 = (Bob1) session.getObject("key");
    bob1.setBob2(null);
    final Bob3 bob3 = new Bob3();
    bob1.setBob3(bob3);
    session.close(EnumFilePersistenceCloseAction.SAVE);

    // changeFileName = filePersistence.getChangeFileName();

    storageFileName = filePersistence.getStorageFileName();

    filePersistence.close();
  }
View Full Code Here


      FilePersistenceClassNotFoundException,
      FilePersistenceInvalidClassException,
      FilePersistenceDataCorruptedException,
      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException, TestException {
    final IFilePersistence filePersistence = newFilePersistence(
    /**/false/* cache disk */,
    /**/false/* crash safe mode */);
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    assertTrue(SESION_MUST_BE_OPENED, session.isOpened());// just for PMD
    // warning
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

      FilePersistenceClassNotFoundException,
      FilePersistenceInvalidClassException,
      FilePersistenceDataCorruptedException,
      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException, TestException {// NOPMD
    final IFilePersistence filePersistence = newFilePersistence(
    /**/true/* cache disk */,
    /**/false/* crash safe mode */);
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    assertTrue(SESION_MUST_BE_OPENED, session.isOpened());// just for PMD
    // warning
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

      FilePersistenceClassNotFoundException,
      FilePersistenceInvalidClassException,
      FilePersistenceDataCorruptedException,
      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException, TestException {// NOPMD
    final IFilePersistence filePersistence = newFilePersistence(
    /**/false/* cache disk */,
    /**/true/* crash safe mode */);
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    assertTrue(SESION_MUST_BE_OPENED, session.isOpened());// just for PMD
    // warning
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

      FilePersistenceInvalidClassException,
      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException, TestException {// NOPMD
    final IFilePersistence filePersistence = newFilePersistence(
    /**/true/* cache disk */,
    /**/true/* crash safe mode */);
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    assertTrue(SESION_MUST_BE_OPENED, session.isOpened());// just for PMD
    // warning
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException, TestException {
    final String repertoireDonnees = TestConstant.getWinRamDiskRuntimeDir();
    final int taillePageCacheDisque = 1024;
    final int nombreDePageDuCacheDisque = 1024;
    final IFilePersistence filePersistence;

    final FilePersistenceBuilder builder = new FilePersistenceBuilder();
    if (utiliserCacheDisque) {
      // filePersistence = new FilePersistence(1, null, repertoireDonnees,
      // /**/false /* efface pas les fichiers */,
      // /**/taillePageCacheDisque/* page size */,
      // /**/nombreDePageDuCacheDisque/* number of page */,
      // /**/false /* pas de gestion garbage */,
      // /**/crashSafeMode/* crash safe mode activé */);
      builder.setFileAccessMode(EnumFileAccessMode.MAPPED_RANDOM_FILE_ACCESS);
      builder.setMaxBufferSize(8 * 1024);
      builder.setMaxNumberOfBuffer(32);
      builder.setPathName(repertoireDonnees);
      builder.setFileCache(taillePageCacheDisque,
          nombreDePageDuCacheDisque);
      builder.setProxyMode(true);
      builder.setRemoveFiles(false);
      builder.setGarbageManagement(true);
      builder.setCrashSafeMode(crashSafeMode);
    } else {
      // filePersistence = new FilePersistence(1, null, repertoireDonnees,
      // /**/true/* use proxy */,
      // /**/false /* efface pas les fichiers */,
      // /**/false /* pas de gestion garbage */,
      // /**/crashSafeMode/* crash safe mode activé */);
      builder.setFileAccessMode(EnumFileAccessMode.MAPPED_RANDOM_FILE_ACCESS);
      builder.setMaxBufferSize(8 * 1024);
      builder.setMaxNumberOfBuffer(32);
      builder.setPathName(repertoireDonnees);
      builder.setProxyMode(true);
      builder.setRemoveFiles(false);
      builder.setGarbageManagement(true);
      builder.setCrashSafeMode(crashSafeMode);
    }
    filePersistence = builder.build();
    filePersistence.setChangeLogEnabled(true, 1);
    return filePersistence;
  }
View Full Code Here

      FilePersistenceInvalidClassException,
      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException, RBTException {
    final IFilePersistence filePersistence = createFilePersistence();
    // filePersistence.setAutoSaveEventListener(this);
    final IExclusiveDataAccessSession session = filePersistence
        .createExclusiveDataAccessSession();
    final IInstanceFactory instanceFactory = session.getInstanceFactory();

    session.open();

    try {
      final RBTree tree = RBTree.newInstance(instanceFactory);
      session.setObject("tree", tree);

      for (int count = 0; count < 1000000; count++) {
        tree.append("" + count);// NOPMD
        if (count % 1000 == 0) {
          System.out.println("c=" + count);// NOPMD
        }
        if (count > 8) {
          tree.remove("" + (count - 8));// NOPMD
        }
      }
    } catch (Exception e) {
      e.printStackTrace();// NOPMD
    } finally {
      session.close();
    }

    filePersistence.xmlExport("runtime", "runtime/temp", false);
    filePersistence.close();
  }
View Full Code Here

    builder.setPathName(path.getPath());
    builder.setProxyMode(true);
    builder.setRemoveFiles(true);
    builder.setGarbageManagement(false);
    builder.setCrashSafeMode(false);
    final IFilePersistence filePersistence = builder.build();
    Thread.sleep(10000);
    filePersistence.close();
  }
View Full Code Here

    builder.setPathName(path.getPath());
    builder.setProxyMode(true);
    builder.setRemoveFiles(true);
    builder.setGarbageManagement(false);
    builder.setCrashSafeMode(false);
    final IFilePersistence filePersistence = builder.build();
    final IDataAccessSession dataAccessSession = filePersistence
        .createDataAccessSession();
    for (int count = 0; count < 10000; count++) {
      dataAccessSession.open();
      dataAccessSession.setObject("" + count, Integer.valueOf(count));// NOPMD
      dataAccessSession.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    }
    filePersistence.close();
  }
View Full Code Here

      FilePersistenceInvalidClassException,
      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException, StoreClassNotFoundException {
    new File(RUNTIME_DIR).mkdirs();
    IFilePersistence filePersistence;
    try {
      filePersistence = newFilePersistence(removeFiles);
    } catch (FilePersistenceException exception) {
      final EnumFileState fileState = FilePersistence
          .fileState(exception);
View Full Code Here

TOP

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

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.