Package org.hive2hive.core.processes.framework.abstracts

Examples of org.hive2hive.core.processes.framework.abstracts.ProcessComponent


    return FileUtil.getPath(networkManager.getSession().getRoot(), userProfile.getFileById(fileKey)).toFile();
  }

  public static void deleteFile(NetworkManager networkManager, File file) throws NoSessionException,
      NoPeerConnectionException {
    ProcessComponent process = ProcessFactory.instance().createDeleteFileProcess(file, networkManager);
    executeProcess(process);
  }
View Full Code Here


    executeProcess(process);
  }

  public static void moveFile(NetworkManager networkManager, File source, File destination) throws NoSessionException,
      NoPeerConnectionException {
    ProcessComponent process = ProcessFactory.instance().createMoveFileProcess(source, destination, networkManager);
    executeProcess(process);
  }
View Full Code Here

    executeProcess(process);
  }

  public static void shareFolder(NetworkManager networkManager, File folder, String friendId, PermissionType permission)
      throws IllegalFileLocation, IllegalArgumentException, NoSessionException, NoPeerConnectionException {
    ProcessComponent process = ProcessFactory.instance().createShareProcess(folder,
        new UserPermission(friendId, permission), networkManager);
    executeProcess(process);
  }
View Full Code Here

    List<MetaChunk> chunksToDelete = context.getChunksToDelete();
    KeyPair protectionKeys = context.consumeProtectionKeys();

    logger.debug("Cleaning {} old file chunks.", chunksToDelete.size());
    int counter = 0;
    ProcessComponent prev = this;
    for (MetaChunk metaChunk : chunksToDelete) {
      logger.debug("Delete chunk {} of {}.", counter++, chunksToDelete.size());
      DeleteSingleChunkStep deleteStep = new DeleteSingleChunkStep(metaChunk.getChunkId(),
          protectionKeys, dataManager);
View Full Code Here

    // execute all child components
    while (!components.isEmpty() && executionIndex < components.size() && getState() == ProcessState.RUNNING) {

      checkAsyncComponentsForFail(asyncHandles);
      rollbackIndex = executionIndex;
      ProcessComponent next = components.get(executionIndex);
      next.start();
      executionIndex++;

      if (next instanceof AsyncComponent) {
        asyncHandles.add(((AsyncComponent) next).getHandle());
      }
View Full Code Here

  @Override
  protected void doRollback(RollbackReason reason) throws InvalidProcessStateException {

    while (!components.isEmpty() && rollbackIndex >= 0 && getState() == ProcessState.ROLLBACKING) {
      ProcessComponent last = components.get(rollbackIndex);
      last.cancel(reason);
      rollbackIndex--;
    }
  }
View Full Code Here

    assertTrue(process.getState() == ProcessState.SUCCEEDED);
    assertTrue(step.getState() == ProcessState.SUCCEEDED);

    // async components
    process = new SequentialProcess();
    ProcessComponent asyncStep = new AsyncComponent(new BusySucceedingStep());
    process.add(asyncStep);
    process.start();
    assertTrue(process.getState() == ProcessState.SUCCEEDED);
    assertTrue(asyncStep.getState() == ProcessState.SUCCEEDED);
  }
View Full Code Here

    assertTrue(process.getState() == ProcessState.FAILED);
    assertTrue(step.getState() == ProcessState.FAILED);

    // async components
    process = new SequentialProcess();
    ProcessComponent asyncStep = new AsyncComponent(new BusyFailingStep());
    process.add(asyncStep);
    process.start();
    assertTrue(process.getState() == ProcessState.FAILED);
    assertTrue(asyncStep.getState() == ProcessState.FAILED);
  }
View Full Code Here

    uploadVersion("3");

    final int versionToRestore = 2;

    TestVersionSelector selector = new TestVersionSelector(versionToRestore);
    ProcessComponent process = ProcessFactory.instance().createRecoverFileProcess(file, selector, client);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);
    process.start();
    UseCaseTestUtil.waitTillSucceded(listener, 120);

    // to verify, find the restored file
    File restoredFile = null;
    for (File fileInList : root.listFiles()) {
View Full Code Here

    // to be sequential because the parent meta file must be adapted. If they would run in parallel, they
    // would modify the parent meta folder simultaneously.
    Map<Path, SequentialProcess> sameParents = new HashMap<Path, SequentialProcess>();
    for (Path file : files) {
      // create the process which uploads or updates the file
      ProcessComponent uploadProcess;
      if (action == FileProcessAction.NEW_FILE)
        uploadProcess = ProcessFactory.instance().createNewFileProcess(file.toFile(), networkManager);
      else
        uploadProcess = ProcessFactory.instance().createUpdateFileProcess(file.toFile(),
            networkManager);
View Full Code Here

TOP

Related Classes of org.hive2hive.core.processes.framework.abstracts.ProcessComponent

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.