Examples of SequentialProcess


Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

      throws NoPeerConnectionException {
    DataManager dataManager = networkManager.getDataManager();
    RegisterProcessContext context = new RegisterProcessContext();

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

    process.add(new CheckIsUserRegisteredStep(credentials.getUserId(), context, dataManager));
    process.add(new LocationsCreationStep(credentials.getUserId(), context));
    process.add(new UserProfileCreationStep(credentials.getUserId(), context));
    process.add(new AsyncComponent(new PutUserProfileStep(credentials, context, dataManager)));
    process.add(new AsyncComponent(new PutUserLocationsStep(context, context, dataManager)));
    process.add(new AsyncComponent(new PutPublicKeyStep(context, dataManager)));

    return process;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

      NetworkManager networkManager) throws NoPeerConnectionException {
    DataManager dataManager = networkManager.getDataManager();
    LoginProcessContext context = new LoginProcessContext();

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

    process.add(new GetUserProfileStep(credentials, context, dataManager));
    process.add(new SessionCreationStep(params, context, networkManager));
    process.add(new GetUserLocationsStep(credentials.getUserId(), context, networkManager.getDataManager()));
    process.add(new ContactOtherClientsStep(context, networkManager));
    process.add(new PutUserLocationsStep(context, context, dataManager));
    process.add(new SynchronizeFilesStep(context, networkManager));

    return process;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

    return process;
  }

  public ProcessComponent createUserProfileTaskStep(NetworkManager networkManager) {
    SequentialProcess process = new SequentialProcess();
    UserProfileTaskContext context = new UserProfileTaskContext();
    process.add(new GetUserProfileTaskStep(context, networkManager));
    // Note: this step will add the next steps since it depends on the get result
    process.add(new HandleUserProfileTaskStep(context, networkManager));

    return process;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

    DataManager dataManager = networkManager.getDataManager();
    H2HSession session = networkManager.getSession();
    LogoutProcessContext context = new LogoutProcessContext(session);

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

    process.add(new GetUserLocationsStep(session.getCredentials().getUserId(), context, dataManager));
    process.add(new RemoveOwnLocationsStep(context, networkManager));
    process.add(new StopDownloadsStep(session.getDownloadManager()));
    process.add(new WritePersistentStep(session.getRoot(), session.getKeyManager(), session.getDownloadManager()));
    process.add(new DeleteSessionStep(networkManager));

    // TODO to be implemented:
    // // stop all running processes
    // ProcessManager.getInstance().stopAll("Logout stopped all processes.");
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

      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()));
    if (file.isFile()) {
      // file needs to upload the chunks and a meta file
      process.add(new InitializeChunksStep(context, dataManager, session.getFileConfiguration()));
      process.add(new CreateMetaFileStep(context));
      process.add(new PutMetaFileStep(context, dataManager));
    }
    process.add(new AddIndexToUserProfileStep(context, session.getProfileManager(), session.getRoot()));
    process.add(new PrepareNotificationStep(context));
    process.add(createNotificationProcess(context, networkManager));

    return process;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

    DataManager dataManager = networkManager.getDataManager();
    UpdateFileProcessContext context = new UpdateFileProcessContext(file);

    H2HSession session = networkManager.getSession();

    SequentialProcess process = new SequentialProcess();
    process.add(new ValidateFileSizeStep(context, session.getFileConfiguration(), false));
    process.add(new CheckWriteAccessStep(context, session.getProfileManager(), session.getRoot()));
    process.add(new File2MetaFileComponent(file, context, context, networkManager));
    process.add(new InitializeChunksStep(context, dataManager, session.getFileConfiguration()));
    process.add(new CreateNewVersionStep(context, session.getFileConfiguration()));
    process.add(new PutMetaFileStep(context, dataManager));
    process.add(new UpdateMD5inUserProfileStep(context, session.getProfileManager()));

    // TODO: cleanup can be made async because user operation does not depend on it
    process.add(new CleanupChunksStep(context, dataManager));
    process.add(new PrepareNotificationStep(context));
    process.add(createNotificationProcess(context, networkManager));

    return process;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

  public ProcessComponent createDownloadFileProcess(PublicKey fileKey, int versionToDownload, File destination,
      NetworkManager networkManager) throws NoSessionException {
    // precondition: session is existent
    networkManager.getSession();

    SequentialProcess process = new SequentialProcess();
    DownloadFileContext context = new DownloadFileContext(fileKey, destination, versionToDownload);
    process.add(new FindInUserProfileStep(context, networkManager));

    return process;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

  public ProcessComponent createDeleteFileProcess(File file, NetworkManager networkManager) throws NoSessionException,
      NoPeerConnectionException {
    DeleteFileProcessContext context = new DeleteFileProcessContext(file.isDirectory());

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

    // hint: this step automatically adds additional process steps when the meta file and the chunks need
    // to be deleted
    process.add(new DeleteFromUserProfileStep(file, context, networkManager));
    process.add(new DeleteFileOnDiskStep(file)); // TODO make asynchronous
    process.add(new PrepareDeleteNotificationStep(context));
    process.add(createNotificationProcess(context, networkManager));

    return process;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

  public ProcessComponent createMoveFileProcess(File source, File destination, NetworkManager networkManager)
      throws NoSessionException, NoPeerConnectionException {
    MoveFileProcessContext context = new MoveFileProcessContext(source, destination, networkManager.getUserId());

    SequentialProcess process = new SequentialProcess();
    process.add(new MoveOnDiskStep(context, networkManager));
    process.add(new RelinkUserProfileStep(context, networkManager));
    process.add(createNotificationProcess(context.getMoveNotificationContext(), networkManager));
    process.add(createNotificationProcess(context.getDeleteNotificationContext(), networkManager));
    process.add(createNotificationProcess(context.getAddNotificationContext(), networkManager));

    return process;
  }
View Full Code Here

Examples of org.hive2hive.core.processes.framework.concretes.SequentialProcess

  }

  public ProcessComponent createRecoverFileProcess(File file, IVersionSelector selector, NetworkManager networkManager)
      throws NoSessionException, NoPeerConnectionException {
    RecoverFileContext context = new RecoverFileContext(file);
    SequentialProcess process = new SequentialProcess();
    process.add(new File2MetaFileComponent(file, context, context, networkManager));
    process.add(new SelectVersionStep(context, selector, networkManager));

    return process;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.