Package org.hive2hive.core.processes.framework.exceptions

Examples of org.hive2hive.core.processes.framework.exceptions.ProcessExecutionException


  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    PublicKeyManager keyManager;
    try {
      keyManager = networkManager.getSession().getKeyManager();
    } catch (NoSessionException e) {
      throw new ProcessExecutionException("No session yet");
    }

    Locations locations = context.consumeLocations();
    waitForResponses = new CountDownLatch(locations.getPeerAddresses().size());
    if (!locations.getPeerAddresses().isEmpty()) {
View Full Code Here


      // find the parent node using the relative path to navigate there
      FolderIndex parentNode = (FolderIndex) userProfile.getFileByPath(file.getParentFile(), root);

      // validate the write protection
      if (!parentNode.canWrite()) {
        throw new ProcessExecutionException("This directory is write protected (and we don't have the keys).");
      }

      // create a file tree node in the user profile
      parentKey = parentNode.getFilePublicKey();
      // 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());
      modified = true;
    } catch (PutFailedException | GetFailedException e) {
      throw new ProcessExecutionException(e);
    }
  }
View Full Code Here

  private byte[] calculateHash(File file) throws ProcessExecutionException {
    try {
      return EncryptionUtil.generateMD5Hash(file);
    } catch (IOException e) {
      logger.error("Creating MD5 hash of file '{}' was not possible.", file.getName(), e);
      throw new ProcessExecutionException(
          String.format("Could not add file '%s' to the user profile.", file.getName()), e);
    }
  }
View Full Code Here

    KeyPair keyPair = keyContext.consumeKeyPair();
    NetworkContent loadedContent = get(keyPair.getPublic(), H2HConstants.META_FILE);

    if (loadedContent == null) {
      logger.warn("Meta file not found.");
      throw new ProcessExecutionException("Meta file not found.");
    } else {

      // decrypt meta document
      HybridEncryptedContent encryptedContent = (HybridEncryptedContent) loadedContent;

      NetworkContent decryptedContent = null;
      try {
        decryptedContent = H2HEncryptionUtil.decryptHybrid(encryptedContent, keyPair.getPrivate());
      } catch (InvalidKeyException | DataLengthException | IllegalBlockSizeException
          | 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());
View Full Code Here

        if (operation == Operation.PUT) {
          profileManager.readyToPut(userProfile, getID());
        }

      } catch (GetFailedException | PutFailedException e) {
        throw new ProcessExecutionException(e);
      }
    }
View Full Code Here

      } else if (!folder.mkdir()) {
        existedBefore = true;
        throw new IOException("Folder could not be created");
      }
    } catch (IOException | NoSessionException e) {
      throw new ProcessExecutionException(e);
    }

    // done with 'downloading' the file
    logger.debug("New folder '{}' has successfuly been created on disk.", file.getName());
  }
View Full Code Here

    UserPublicKey publicKey = new UserPublicKey(profile.getEncryptionKeys().getPublic());
    try {
      put(profile.getUserId(), H2HConstants.USER_PUBLIC_KEY, publicKey, profile.getProtectionKeys());
    } catch (PutFailedException e) {
      throw new ProcessExecutionException(e);
    }
  }
View Full Code Here

      // only private notification (or none)
      usersToNotify = new HashSet<>(1);
      if (context.consumeUsersToNotify().contains(userId))
        usersToNotify.add(userId);
      else
        throw new ProcessExecutionException(
            "Users can't be notified because the UserProfileTask is null and no notification of the own user.");
    }
  }
View Full Code Here

  @Override
  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    super.doExecute();

    if (context.consumeLocations() != null) {
      throw new ProcessExecutionException(new UserAlreadyRegisteredException(userId));
    }
  }
View Full Code Here

    // get the user profile
    UserProfile profile = null;
    try {
      profile = profileManager.getUserProfile(getID(), false);
    } catch (GetFailedException e) {
      throw new ProcessExecutionException("User profile could not be loaded.");
    }

    // the result set
    result.clear();
View Full Code Here

TOP

Related Classes of org.hive2hive.core.processes.framework.exceptions.ProcessExecutionException

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.