Package org.hive2hive.core.model

Examples of org.hive2hive.core.model.FileIndex


        // file not found --> skip, this is not the task of this method
        // file node is a folder --> cannot compare the modification
        continue;
      }

      FileIndex fileNode = (FileIndex) index;

      // has been modified --> check if profile has same md5 as 'before'. If not, there are three
      // different versions. Thus, the profile wins.
      if (H2HEncryptionUtil.compareMD5(fileNode.getMD5(), before.get(path))
          && !H2HEncryptionUtil.compareMD5(fileNode.getMD5(), now.get(path))) {
        logger.debug("File '{}' has been updated locally during absence.", path);
        updatedLocally.add(FileUtil.getPath(root, fileNode));
      }
    }
View Full Code Here


      if (index.isFolder()) {
        // folder cannot be modified
        continue;
      }

      FileIndex fileIndex = (FileIndex) index;
      if (before.containsKey(fileIndex.getFullPath().toString())
          && now.containsKey(fileIndex.getFullPath().toString())) {
        if (!H2HEncryptionUtil.compareMD5(fileIndex.getMD5(), now.get(fileIndex.getFullPath().toString()))
            && !H2HEncryptionUtil.compareMD5(fileIndex.getMD5(), before.get(fileIndex.getFullPath().toString()))) {
          // different md5 hashes than 'before' and 'now'
          logger.debug("File '{}' has been updated remotely during absence.", fileIndex.getFullPath());
          updatedRemotely.add(fileIndex);
        }
      }
    }
View Full Code Here

      } else {
        // copy the md5 parameter of the received file
        Index existing = parentNode.getChildByName(index.getName());
        if (existing.isFile() && index.isFile()) {
          logger.debug("File update in a shared folder received: '{}'.", index.getName());
          FileIndex existingFile = (FileIndex) existing;
          FileIndex newFile = (FileIndex) index;
          existingFile.setMD5(newFile.getMD5());
        }
      }

      // upload the changes
      profileManager.readyToPut(userProfile, randomPID);
View Full Code Here

      // use the file keys generated above is stored
      if (file.isDirectory()) {
        FolderIndex folderIndex = new FolderIndex(parentNode, metaKeys, file.getName());
        context.provideIndex(folderIndex);
      } else {
        FileIndex fileIndex = new FileIndex(parentNode, metaKeys, file.getName(), md5);
        context.provideIndex(fileIndex);
      }

      // put the updated user profile
      profileManager.readyToPut(userProfile, getID());
View Full Code Here

      List<FolderIndex> indexes = getIndexList(profile.getRoot());

      if (isFolder) {
        new FolderIndex(indexes.get(random.nextInt(indexes.size())), null, NetworkTestUtil.randomString());
      } else {
        new FileIndex(indexes.get(random.nextInt(indexes.size())), keys, file.getName(), md5Hash);
      }

      profileManager.readyToPut(profile, pid);
    }
  }
View Full Code Here

      File file = new File(rootFile, path.toString());

      byte[] md5Hash = null;
      Set<UserPermission> userPermissions;
      if (index.isFile()) {
        FileIndex fileIndex = ((FileIndex) index);
        md5Hash = fileIndex.getMD5();
        userPermissions = fileIndex.getParent().getCalculatedUserPermissions();
      } else {
        userPermissions = ((FolderIndex) index).getCalculatedUserPermissions();
      }

      result.add(new FileTaste(file, path, md5Hash, userPermissions));
View Full Code Here

    try {
      if (index.isFolder()) {
        FolderIndex folderIndex = (FolderIndex) index;
        initForFolder(folderIndex);
      } else {
        FileIndex fileIndex = (FileIndex) index;
        initForFile(fileIndex);
      }
    } catch (NoSessionException | NoPeerConnectionException e) {
      throw new ProcessExecutionException(e);
    }
View Full Code Here

  private void initForFolder(FolderIndex folderIndex) throws ProcessExecutionException, NoSessionException,
      NoPeerConnectionException {
    List<Index> indexList = Index.getIndexList(folderIndex);
    for (Index index : indexList) {
      if (index.isFile()) {
        FileIndex fileIndex = (FileIndex) index;
        initForFile(fileIndex);
      }
    }
  }
View Full Code Here

TOP

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

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.