Examples of CleanupOperationOptions


Examples of org.syncany.operations.cleanup.CleanupOperationOptions

   
    return new ConnectOperation(options, listener).execute();
  }

  public CleanupOperationResult cleanup() throws Exception {
    return new CleanupOperation(config, new CleanupOperationOptions()).execute();
  }
View Full Code Here

Examples of org.syncany.operations.cleanup.CleanupOperationOptions

   
    UpOperationOptions upOptionsForceEnabled = new UpOperationOptions();
    upOptionsForceEnabled.setStatusOptions(statusOptions);
    upOptionsForceEnabled.setForceUploadEnabled(true);
   
    CleanupOperationOptions cleanupOptions = new CleanupOperationOptions();
    cleanupOptions.setMinSecondsBetweenCleanups(0);

    // Run
   
    //// 1. CREATE FIRST DIRTY VERSION
   
View Full Code Here

Examples of org.syncany.operations.cleanup.CleanupOperationOptions

    return false;
  }

  @Override
  public int execute(String[] operationArgs) throws Exception {
    CleanupOperationOptions operationOptions = parseOptions(operationArgs);
    CleanupOperationResult operationResult = client.cleanup(operationOptions);

    printResults(operationResult);

    return 0;
View Full Code Here

Examples of org.syncany.operations.cleanup.CleanupOperationOptions

    return 0;
  }

  @Override
  public CleanupOperationOptions parseOptions(String[] operationArgs) throws Exception {
    CleanupOperationOptions operationOptions = new CleanupOperationOptions();

    OptionParser parser = new OptionParser();
    parser.allowsUnrecognizedOptions();

    OptionSpec<Void> optionForce = parser.acceptsAll(asList("f", "force"));
    OptionSpec<Void> optionNoDatabaseMerge = parser.acceptsAll(asList("M", "no-database-merge"));
    OptionSpec<Void> optionNoOldVersionRemoval = parser.acceptsAll(asList("V", "no-version-removal"));
    OptionSpec<Void> optionNoRemoveTempFiles = parser.acceptsAll(asList("T", "no-temp-removal"));
    OptionSpec<Integer> optionKeepVersions = parser.acceptsAll(asList("k", "keep-versions")).withRequiredArg().ofType(Integer.class);
    OptionSpec<String> optionSecondsBetweenCleanups = parser.acceptsAll(asList("t", "time-between-cleanups")).withRequiredArg()
        .ofType(String.class);
    OptionSpec<Integer> optionMaxDatabaseFiles = parser.acceptsAll(asList("x", "max-database-files")).withRequiredArg().ofType(Integer.class);

    OptionSet options = parser.parse(operationArgs);

    // -F, --force
    operationOptions.setForce(options.has(optionForce));

    // -M, --no-database-merge
    operationOptions.setMergeRemoteFiles(!options.has(optionNoDatabaseMerge));

    // -V, --no-version-removal
    operationOptions.setRemoveOldVersions(!options.has(optionNoOldVersionRemoval));
   
    // -T, --no-temp-removal
    operationOptions.setRemoveUnreferencedTemporaryFiles(!options.has(optionNoRemoveTempFiles));

    // -k=<count>, --keep-versions=<count>   
    if (options.has(optionKeepVersions)) {
      int keepVersionCount = options.valueOf(optionKeepVersions);

      if (keepVersionCount < 1) {
        throw new Exception("Invalid value for --keep-versions=" + keepVersionCount + "; must be >= 1");
      }

      operationOptions.setKeepVersionsCount(options.valueOf(optionKeepVersions));
    }

    // -t=<count>, --time-between-cleanups=<count>   
    if (options.has(optionSecondsBetweenCleanups)) {
      long secondsBetweenCleanups = CommandLineUtil.parseTimePeriod(options.valueOf(optionSecondsBetweenCleanups));

      if (secondsBetweenCleanups < 0) {
        throw new Exception("Invalid value for --time-between-cleanups=" + secondsBetweenCleanups + "; must be >= 0");
      }

      operationOptions.setMinSecondsBetweenCleanups(secondsBetweenCleanups);
    }

    // -d=<count>, --max-database-files=<count>
    if (options.has(optionMaxDatabaseFiles)) {
      int maxDatabaseFiles = options.valueOf(optionMaxDatabaseFiles);

      if (maxDatabaseFiles < 1) {
        throw new Exception("Invalid value for --max-database-files=" + maxDatabaseFiles + "; must be >= 1");
      }

      operationOptions.setMaxDatabaseFiles(maxDatabaseFiles);
    }

    // Parse 'status' options
    operationOptions.setStatusOptions(parseStatusOptions(operationArgs));

    // Does this configuration make sense
    boolean nothingToDo = !operationOptions.isMergeRemoteFiles() && operationOptions.isRemoveOldVersions();

    if (nothingToDo) {
      throw new Exception("Invalid parameter configuration: -M and -V cannot be set together. Nothing to do.");
    }
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.