Package org.hive2hive.core.processes.framework.concretes

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


   *
   * @param processes the processes to align to a center
   * @return the process chain
   */
  public static IProcessComponent createProcessChain(List<ProcessComponent> processes) {
    SequentialProcess rootProcess = new SequentialProcess();
    for (ProcessComponent processComponent : processes) {
      rootProcess.add(processComponent);
    }
    return rootProcess;
  }
View Full Code Here


  @Override
  public void run() {
    ProvideUserLocationsContext context = new ProvideUserLocationsContext();

    SequentialProcess process = new SequentialProcess();
    for (String user : task.getUsers()) {
      GetUserLocationsStep step = new GetUserLocationsStep(user, context, dataManager);
      process.add(new AsyncComponent(step));
    }

    try {
      logger.debug("Started getting the list of locations to download {}", task.getDestinationName());
      process.start().await();
    } catch (InvalidProcessStateException | InterruptedException e) {
      task.provideLocations(new HashSet<Locations>());
      task.abortDownload(e.getMessage());
      return;
    }
View Full Code Here

      logger.warn("Not terminate the download because thread is interrupted");
      return;
    }

    DownloadDirectContext context = new DownloadDirectContext(task, metaChunk, tempDestination);
    SequentialProcess process = new SequentialProcess();
    process.add(new SelectPeerForDownloadStep(context));
    process.add(new AskForChunkStep(context, messageManager, keyManager, config));

    try {
      process.start().await();
    } catch (InvalidProcessStateException | InterruptedException e) {
      task.abortDownload(e.getMessage());
    }
  }
View Full Code Here

  }

  private ProcessComponent buildProcess(FileIndex index) throws NoSessionException,
      NoPeerConnectionException {
    // create a new sub-process
    SequentialProcess sequential = new SequentialProcess();

    // each meta document gets own context
    MetaDocumentPKUpdateContext metaContext = new MetaDocumentPKUpdateContext(
        context.consumeOldProtectionKeys(), context.consumeNewProtectionKeys(),
        index.getFilePublicKey(), index);
    sequential.add(new File2MetaFileComponent(index, metaContext, metaContext, dataManager));
    sequential.add(new ChangeProtectionKeysStep(metaContext, dataManager));
    sequential.add(new InitializeChunkUpdateStep(metaContext, dataManager));
    return sequential;
  }
View Full Code Here

TOP

Related Classes of org.hive2hive.core.processes.framework.concretes.SequentialProcess

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.