Package org.hive2hive.core.model

Examples of org.hive2hive.core.model.MetaFile


    // check if the file is still in the DHT
    UserProfile userProfile = UseCaseTestUtil.getUserProfile(client, userCredentials);
    Assert.assertNull(userProfile.getFileById(metaKeyPair.getPublic()));

    MetaFile metaDocument = UseCaseTestUtil.getMetaFile(client, metaKeyPair, false);
    Assert.assertNull(metaDocument);

    for (FileVersion version : metaDocumentBeforeDeletion.getVersions()) {
      for (MetaChunk metaChunks : version.getMetaChunks()) {
        FutureGet get = client.getDataManager().getUnblocked(
View Full Code Here


    // check if the folder is still in the DHT
    Assert.assertNotNull(userProfile.getFileById(metaKeyPairFolder.getPublic()));

    // check the meta file is still in the DHT
    MetaFile metaFile = UseCaseTestUtil.getMetaFile(client, metaKeyPairFile, false);
    Assert.assertNull(metaFile);
  }
View Full Code Here

    Assert.assertNotNull(node);

    // verify the meta document
    KeyPair metaFileKeys = node.getFileKeys();
    if (originalFile.isFile()) {
      MetaFile metaFile = UseCaseTestUtil.getMetaFile(client, metaFileKeys);
      Assert.assertNotNull(metaFile);
      Assert.assertTrue(metaFile instanceof MetaFileSmall);
      MetaFileSmall metaFileSmall = (MetaFileSmall) metaFile;

      // get the meta file with the keys (decrypt it)
View Full Code Here

    this.ownPeerAddress = ownPeerAddress;
  }

  @Override
  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    MetaFile metaFile = context.consumeMetaFile();

    // support to store the file on another location than default (used for recovery)
    if (context.downloadToDefaultDestination()) {
      destination = FileUtil.getPath(session.getRoot(), context.consumeIndex()).toFile();
    } else {
      destination = context.getDestination();
    }

    if (metaFile.isSmall()) {
      downloadChunksFromDHT((MetaFileSmall) metaFile);
    } else {
      downloadChunksFromUsers((MetaFileLarge) metaFile);
    }
View Full Code Here

  }

  @Override
  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    try {
      MetaFile metaFile = context.consumeMetaFile();
      KeyPair protectionKeys = context.consumeProtectionKeys();

      logger.trace("Encrypting meta file of file '{}' in a hybrid manner.", context.getFile().getName());
      HybridEncryptedContent encrypted = H2HEncryptionUtil.encryptHybrid(metaFile, metaFile.getId());
      encrypted.setBasedOnKey(metaFile.getVersionKey());
      encrypted.generateVersionKey();

      Parameters parameters = new Parameters()
          .setLocationKey(H2HEncryptionUtil.key2String(metaFile.getId()))
          .setContentKey(H2HConstants.META_FILE).setVersionKey(encrypted.getVersionKey())
          .setData(encrypted).setProtectionKeys(protectionKeys).setTTL(metaFile.getTimeToLive());
      // data manager has to produce the hash, which gets used for signing
      parameters.setHashFlag(true);
      // put the encrypted meta file into the network
      put(parameters);
      // store the hash
View Full Code Here

          | BadPaddingException | IllegalStateException | InvalidCipherTextException
          | ClassNotFoundException | IOException e) {
        throw new ProcessExecutionException("Meta file could not be decrypted.", e);
      }

      MetaFile metaFile = (MetaFile) decryptedContent;
      metaFile.setVersionKey(loadedContent.getVersionKey());
      metaFile.setBasedOnKey(loadedContent.getBasedOnKey());

      metaContext.provideMetaFile(metaFile);
      metaContext.provideEncryptedMetaFile(encryptedContent);
      logger.debug("Got and decrypted the meta file.");
    }
View Full Code Here

    if (context.consumeProtectionKeys() == null) {
      throw new ProcessExecutionException("No protection keys given.");
    }

    List<MetaChunk> metaChunks = new ArrayList<MetaChunk>();
    MetaFile metaFile = context.consumeMetaFile();

    if (metaFile.isSmall()) {
      MetaFileSmall metaSmall = (MetaFileSmall) metaFile;
      // TODO rather delete file by file than all chunks mixed
      for (FileVersion version : metaSmall.getVersions()) {
        metaChunks.addAll(version.getMetaChunks());
      }
View Full Code Here

    this.dataManager = dataManager;
  }

  @Override
  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    MetaFile metaFile = context.consumeMetaFile();
    if (metaFile == null) {
      throw new ProcessExecutionException("Meta File not found");
    } else if (!(metaFile.isSmall())) {
      logger.debug("No need to update any chunks for a large meta file");
      return;
    }

    MetaFileSmall metaFileSmall = (MetaFileSmall) metaFile;
View Full Code Here

  protected void doExecute() throws InvalidProcessStateException {
    File file = context.getFile();

    logger.trace("Creating new meta file for file '{}'.", file.getName());

    MetaFile metaFile = null;
    if (context.isLargeFile()) {
      metaFile = new MetaFileLarge(context.generateOrGetMetaKeys().getPublic(), context.getMetaChunks());
    } else {
      // create new meta file with new version
      FileVersion version = new FileVersion(0, FileUtil.getFileSize(file), System.currentTimeMillis(),
View Full Code Here

    this.networkManager = networkManager;
  }

  @Override
  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    MetaFile metaFile = context.consumeMetaFile();
    if (metaFile == null) {
      throw new ProcessExecutionException("Meta document not found.");
    } else if (!metaFile.isSmall()) {
      throw new ProcessExecutionException("Meta document is not a small meta file.");
    }

    MetaFileSmall metaFileSmall = (MetaFileSmall) metaFile;
    // cast the versions to the public interface
View Full Code Here

TOP

Related Classes of org.hive2hive.core.model.MetaFile

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.