Package org.hive2hive.core.network.userprofiletask

Examples of org.hive2hive.core.network.userprofiletask.UserProfileTask


    } catch (NoSessionException e1) {
      logger.error("Could not roll back because no session.");
      return;
    }

    UserProfileTask upTask = context.consumeUserProfileTask();
    HybridEncryptedContent encrypted;
    try {
      encrypted = H2HEncryptionUtil.encryptHybrid(upTask, session.getKeyPair().getPublic());
    } catch (DataLengthException | InvalidKeyException | IllegalStateException
        | InvalidCipherTextException | IllegalBlockSizeException | BadPaddingException | IOException e) {
      logger.error("Could not encrypt the user profile task while rollback.");
      return;
    }

    String userId = networkManager.getUserId();
    DataManager dataManager;
    try {
      dataManager = networkManager.getDataManager();
    } catch (NoPeerConnectionException e) {
      logger.warn(
          "Rollback of remove user profile task failed. No connection. User ID = '{}', Content key = '{}'.",
          userId, upTask.getContentKey());
      return;
    }

    encrypted.setTimeToLive(upTask.getTimeToLive());
    boolean success = dataManager.putUserProfileTask(userId, upTask.getContentKey(), encrypted,
        upTask.getProtectionKey());
    if (success) {
      logger.debug(
          "Rollback of removing user profile task succeeded. User ID = '{}', Content key = '{}'.",
          userId, upTask.getContentKey());
    } else {
      logger.warn(
          "Rollback of removing user profile task failed. Re-put failed. User ID = '{}', Content key = '{}'.",
          userId, upTask.getContentKey());
    }
  }
View Full Code Here


      throw new IllegalArgumentException("Context can't be null.");
  }

  @Override
  protected void doExecute() throws InvalidProcessStateException {
    UserProfileTask userProfileTask = context.consumeUserProfileTask();
    String userId = networkManager.getUserId();

    if (userProfileTask == null) {
      logger.debug("No more user profile tasks in queue. Stopping handling. User ID = '{}'.", userId);
      // all user profile tasks are handled, stop process
      return;
    }

    logger.debug("Executing a '{}' user profile task. User ID = '{}'.", userProfileTask.getClass()
        .getSimpleName(), userId);
    // give the network manager reference to be able to run
    userProfileTask.setNetworkManager(networkManager);
    // run the user profile task in own thread
    userProfileTask.start();

    /*
     * Initialize next steps.
     * 1. Remove done user profile task from network.
     * 2. Get next user profile task.
View Full Code Here

  @Override
  protected void doExecute() throws InvalidProcessStateException {
    BaseNotificationMessageFactory messageFactory = context.consumeMessageFactory();

    UserProfileTask userProfileTask = messageFactory.createUserProfileTask(networkManager.getUserId());
    if (userProfileTask == null) {
      // skip that step
      return;
    }
View Full Code Here

TOP

Related Classes of org.hive2hive.core.network.userprofiletask.UserProfileTask

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.