Examples of FileDAO


Examples of fi.foyt.hibernate.gae.search.persistence.dao.FileDAO

      fileDAO.updateDataLength(file, 0l)
    }
  }
 
  public void updateLength(long length) {
    FileDAO fileDAO = new FileDAO();
    fileDAO.updateDataLength(getFile(), length);
  }
View Full Code Here

Examples of fi.foyt.hibernate.gae.search.persistence.dao.FileDAO

    FileSegmentDAO fileSegmentDAO = new FileSegmentDAO();
    return fileSegmentDAO.create(getFile(), new Long(newIndex), null);
  }
 
  private synchronized File getFile() {
    FileDAO fileDAO = new FileDAO();
    File file = fileDAO.findByDirectoryAndName(directory.getDirectory(), fileName);
    if (file == null) {
      file = fileDAO.create(directory.getDirectory(), fileName, 0l, System.currentTimeMillis());
    }
   
    return file;
  }
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.dao.FileDAO

        driftServer = new TestMongoDBDriftServer();
        driftServer.setConnection(connection);
        driftServer.setMorphia(morphia);
        driftServer.setDatastore(ds);
        driftServer.setChangeSetDAO(changeSetDAO);
        driftServer.setFileDAO(new FileDAO(ds.getDB()));
    }
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.dao.FileDAO

        // store content in the database
        File file1 = createRandomFile(getBaseDir(), file1SHA, 1024);
        File file2 = createRandomFile(getBaseDir(), file2SHA, 1024);

        FileDAO fileDAO = new FileDAO(ds.getDB());
        fileDAO.save(file1);
        fileDAO.save(file2);

        File changeSetZip = createChangeSetZipFile(headers,
                addedFileEntry("1.bin", file1SHA),
                addedFileEntry("2.bin", file2SHA));
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.dao.FileDAO

        // store content in the database
        File oldFile1 = createRandomFile(getBaseDir(), oldFile1SHA, 1024);
        File file2 = createRandomFile(getBaseDir(), file2SHA, 1024);

        FileDAO fileDAO = new FileDAO(ds.getDB());
        fileDAO.save(oldFile1);
        fileDAO.save(file2);

        File changeSetZip = createChangeSetZipFile(headers,
                changedFileEntry("1.bin", oldFile1SHA, newFile1SHA),
                removedFileEntry("2.bin", file2SHA));
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.dao.FileDAO

        File file1 = createRandomFile(getBaseDir(), size);
        File file2 = createRandomFile(getBaseDir(), size);

        driftServer.saveChangeSetFiles(null, createChangeSetContentZipFile(file1, file2));

        FileDAO fileDAO = new FileDAO(ds.getDB());

        for (File expectedFile : asList(file1, file2)) {
            InputStream inputStream = fileDAO.findOne(expectedFile.getName());
            assertNotNull(inputStream, "Failed to find file in database with id " + expectedFile.getName());
            File actualFile = new File(getBaseDir(), "actualContent");
            actualFile.delete();
            StreamUtil.copy(inputStream, new FileOutputStream(actualFile));
            assertEquals(sha256(actualFile), sha256(expectedFile), "The SHA-256 hash in the database does not " +
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.dao.FileDAO

       
        changeSetDAO.save(changeSet);
       
        driftServer.purgeOrphanedContent();

        FileDAO fileDAO = new FileDAO(ds.getDB());
        assertNull(fileDAO.findById(file2.getName()), "Expected unreferenced file to be deleted");
        assertNotNull(fileDAO.findById(file1.getName()), "Referenced file should not be deleted");
    }
View Full Code Here

Examples of org.rhq.enterprise.server.plugins.drift.mongodb.dao.FileDAO

    public void initialize(ServerPluginContext context) throws Exception {
        connection = new Mongo("127.0.0.1");
        morphia = new Morphia().map(MongoDBChangeSet.class).map(MongoDBChangeSetEntry.class).map(MongoDBFile.class);
        ds = morphia.createDatastore(connection, "rhq");
        changeSetDAO =  new ChangeSetDAO(morphia, connection, "rhq");
        fileDAO = new FileDAO(ds.getDB());

        // Note that a write concern of SAFE does not cause the write operation
        // to wait for the server to flush to disk which occurrs every one
        // minute by default. With journaled enabled however (which is the
        // default), we get the ability to recover from errors such as failure
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.