Package org.syncany.operations.daemon.messages.api

Examples of org.syncany.operations.daemon.messages.api.FolderRequest


  private Request buildFolderRequestFromCommand(Command command, String commandName, String[] commandArgs, String root) throws Exception {
    String thisPackage = BadRequestResponse.class.getPackage().getName(); // TODO [low] Medium-dirty hack.
    String camelCaseMessageType = StringUtil.toCamelCase(commandName) + FolderRequest.class.getSimpleName();
    String fqMessageClassName = thisPackage + "." + camelCaseMessageType;

    FolderRequest folderRequest;

    try {
      Class<? extends FolderRequest> folderRequestClass = Class.forName(fqMessageClassName).asSubclass(FolderRequest.class);
      folderRequest = folderRequestClass.newInstance();
    }
    catch (Exception e) {
      logger.log(Level.INFO, "Could not find FQCN " + fqMessageClassName, e);
      throw new Exception("Cannot read request class from request type: " + commandName, e);
    }

    OperationOptions operationOptions = command.parseOptions(commandArgs);
    int requestId = Math.abs(new Random().nextInt());

    folderRequest.setRoot(root);
    folderRequest.setId(requestId);
    folderRequest.setOptions(operationOptions);

    return folderRequest;
  }
View Full Code Here

TOP

Related Classes of org.syncany.operations.daemon.messages.api.FolderRequest

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.