Package org.hive2hive.core.network.data

Examples of org.hive2hive.core.network.data.DataManager


  @Override
  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    userId = networkManager.getUserId();

    DataManager dataManager;
    try {
      dataManager = networkManager.getDataManager();
    } catch (NoPeerConnectionException e) {
      throw new ProcessExecutionException(e);
    }

    logger.debug("Get the next user profile task of user '{}'.", userId);
    NetworkContent content = dataManager.getUserProfileTask(userId);

    if (content == null) {
      logger.warn("Did not get an user profile task. User ID = '{}'.", userId);
      context.provideUserProfileTask(null);
    } else {
View Full Code Here


  @Override
  protected void doExecute() throws InvalidProcessStateException, ProcessExecutionException {
    String userId = networkManager.getUserId();

    DataManager dataManager;
    try {
      dataManager = networkManager.getDataManager();
    } catch (NoPeerConnectionException e) {
      throw new ProcessExecutionException(e);
    }

    if (context.consumeUserProfileTask() == null) {
      throw new ProcessExecutionException("User profile task in context is null.");
    }

    boolean success = dataManager.removeUserProfileTask(userId, context.consumeUserProfileTask()
        .getContentKey(), context.consumeUserProfileTask().getProtectionKey());
    removePerformed = true;

    if (!success) {
      throw new ProcessExecutionException("Could not remove the user profile task.");
View Full Code Here

      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());
View Full Code Here

    try {
      logger.debug("Encrypting user profile task in a hybrid manner.");
      this.contentKey = userProfileTask.getContentKey();
      this.protectionKey = userProfileTask.getProtectionKey();
      DataManager dataManager = networkManager.getDataManager();
      HybridEncryptedContent encrypted = H2HEncryptionUtil.encryptHybrid(userProfileTask, publicKey);
      encrypted.setTimeToLive(userProfileTask.getTimeToLive());
      boolean success = dataManager.putUserProfileTask(userId, contentKey, encrypted, protectionKey);
      putPerformed = true;

      if (!success) {
        throw new PutFailedException();
      }
View Full Code Here

    if (!putPerformed) {
      logger.warn("Nothing to remove at rollback because nothing has been put.");
      return;
    }

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

    boolean success = dataManager.removeUserProfileTask(userId, contentKey, protectionKey);
    if (success) {
      logger.debug("Rollback of user profile task put succeeded. User ID = '{}', Content key = '{}'.",
          userId, contentKey);
    } else {
      logger.warn(
View Full Code Here

   * @return A registration process.
   * @throws NoPeerConnectionException
   */
  public ProcessComponent createRegisterProcess(UserCredentials credentials, NetworkManager networkManager)
      throws NoPeerConnectionException {
    DataManager dataManager = networkManager.getDataManager();
    RegisterProcessContext context = new RegisterProcessContext();

    // process composition
    SequentialProcess process = new SequentialProcess();

View Full Code Here

   * @return A login process.
   * @throws NoPeerConnectionException
   */
  public ProcessComponent createLoginProcess(UserCredentials credentials, SessionParameters params,
      NetworkManager networkManager) throws NoPeerConnectionException {
    DataManager dataManager = networkManager.getDataManager();
    LoginProcessContext context = new LoginProcessContext();

    // process composition
    SequentialProcess process = new SequentialProcess();

View Full Code Here

   * @throws NoPeerConnectionException
   * @throws NoSessionException
   */
  public ProcessComponent createLogoutProcess(NetworkManager networkManager) throws NoPeerConnectionException,
      NoSessionException {
    DataManager dataManager = networkManager.getDataManager();
    H2HSession session = networkManager.getSession();
    LogoutProcessContext context = new LogoutProcessContext(session);

    // process composition
    SequentialProcess process = new SequentialProcess();
View Full Code Here

   * tree.
   */
  public ProcessComponent createNewFileProcess(File file, NetworkManager networkManager) throws NoSessionException,
      NoPeerConnectionException {
    H2HSession session = networkManager.getSession();
    DataManager dataManager = networkManager.getDataManager();
    AddFileProcessContext context = new AddFileProcessContext(file);

    SequentialProcess process = new SequentialProcess();
    process.add(new ValidateFileSizeStep(context, session.getFileConfiguration(), true));
    process.add(new CheckWriteAccessStep(context, session.getProfileManager(), session.getRoot()));
View Full Code Here

    return process;
  }

  public ProcessComponent createUpdateFileProcess(File file, NetworkManager networkManager) throws NoSessionException,
      IllegalArgumentException, NoPeerConnectionException {
    DataManager dataManager = networkManager.getDataManager();
    UpdateFileProcessContext context = new UpdateFileProcessContext(file);

    H2HSession session = networkManager.getSession();

    SequentialProcess process = new SequentialProcess();
View Full Code Here

TOP

Related Classes of org.hive2hive.core.network.data.DataManager

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.