Package org.syncany.database.dao

Examples of org.syncany.database.dao.DatabaseXmlSerializer


    assertNotNull(localDatabaseDir.listFiles());
    assertTrue(localDatabaseDir.listFiles().length > 0);
    assertTrue(remoteDatabaseFile.exists());

    // - Memory database
    DatabaseXmlSerializer dDAO = new DatabaseXmlSerializer(testConfig.getTransformer());

    MemoryDatabase remoteDatabase = new MemoryDatabase();
    dDAO.load(remoteDatabase, remoteDatabaseFile, null, null, DatabaseReadType.FULL, DatabaseVersionType.DEFAULT, null);

    DatabaseVersion remoteDatabaseVersion = remoteDatabase.getLastDatabaseVersion();

    // - Sql Database
    SqlDatabase localDatabase = new SqlDatabase(testConfig);
View Full Code Here


  }

  protected void saveDeltaDatabase(MemoryDatabase db, File localDatabaseFile) throws IOException {
    logger.log(Level.INFO, "- Saving database to " + localDatabaseFile + " ...");

    DatabaseXmlSerializer dao = new DatabaseXmlSerializer(config.getTransformer());
    dao.save(db.getDatabaseVersions(), localDatabaseFile);
  }
View Full Code Here

    this.options = options;
    this.result = new DownOperationResult();

    this.localDatabase = new SqlDatabase(config);
    this.databaseReconciliator = new DatabaseReconciliator();
    this.databaseSerializer = new DatabaseXmlSerializer(config.getTransformer());
  }
View Full Code Here

  }

  private File writePurgeFile(DatabaseVersion purgeDatabaseVersion, DatabaseRemoteFile newPurgeDatabaseFile) throws IOException {
    File localPurgeDatabaseFile = config.getCache().getDatabaseFile(newPurgeDatabaseFile.getName());

    DatabaseXmlSerializer xmlSerializer = new DatabaseXmlSerializer(config.getTransformer());
    xmlSerializer.save(Lists.newArrayList(purgeDatabaseVersion), localPurgeDatabaseFile);

    return localPurgeDatabaseFile;
  }
View Full Code Here

          toDeleteDatabaseFiles.get(0).getClientVersion(), lastRemoteMergeDatabaseFile.getClientVersion(), lastLocalMergeDatabaseFile });

      long lastLocalClientVersion = lastRemoteMergeDatabaseFile.getClientVersion();
      Iterator<DatabaseVersion> lastNDatabaseVersions = localDatabase.getDatabaseVersionsTo(client, lastLocalClientVersion);

      DatabaseXmlSerializer databaseDAO = new DatabaseXmlSerializer(config.getTransformer());
      databaseDAO.save(lastNDatabaseVersions, lastLocalMergeDatabaseFile);

      // Queue files for uploading and deletion
      allToDeleteDatabaseFiles.addAll(toDeleteDatabaseFiles);
      allMergedDatabaseFiles.put(lastLocalMergeDatabaseFile, lastRemoteMergeDatabaseFile);
View Full Code Here

  }
 
  public static MemoryDatabase readDatabaseFileFromDisk(File databaseFile, Transformer transformer) throws IOException {
    MemoryDatabase db = new MemoryDatabase();
   
    DatabaseXmlSerializer dao = new DatabaseXmlSerializer(transformer);
    dao.load(db, databaseFile, null, null, DatabaseReadType.FULL, DatabaseVersionType.DEFAULT, null);
   
    return db;
  }
View Full Code Here

   
    return db;
  }
 
  public static void writeDatabaseFileToDisk(MemoryDatabase db, File writtenDatabaseFile, Transformer transformer) throws IOException {
    DatabaseXmlSerializer dao = new DatabaseXmlSerializer(transformer);
    dao.save(db.getDatabaseVersions(), writtenDatabaseFile);
  }
View Full Code Here

TOP

Related Classes of org.syncany.database.dao.DatabaseXmlSerializer

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.