Package cloudsync.helper

Examples of cloudsync.helper.Handler$Status


    String name = options.getName();

    final LocalFilesystemConnector localConnection = new LocalFilesystemConnector(options.getPath());

    Handler handler = null;

    try {

      String remoteConnectorName = options.getRemoteConnector();
      RemoteConnector remoteConnector = null;
      try {
        remoteConnector = (RemoteConnector) Class.forName("cloudsync.connector.Remote" + remoteConnectorName + "Connector").newInstance();
      } catch (IllegalAccessException e) {
      } catch (InstantiationException e) {
      } catch (ClassNotFoundException e) {
        throw new CloudsyncException("Remote connector '" + remoteConnectorName + "' not found", e);
      }

      remoteConnector.init(name, options);

      final long start = System.currentTimeMillis();

      SyncType type = options.getType();
      String[] includePatterns = options.getIncludePatterns();
      if (includePatterns != null) {
        LOGGER.log(Level.FINEST, "use include pattern: " + "[^" + StringUtils.join(includePatterns, "$] | [$") + "$]");
      }
      String[] excludePatterns = options.getExcludePatterns();
      if (excludePatterns != null) {
        LOGGER.log(Level.FINEST, "use exclude pattern: " + "[^" + StringUtils.join(excludePatterns, "$] | [$") + "$]");
      }

      handler = new Handler(name, localConnection, remoteConnector, new Crypt(options.getPassphrase()), options.getDuplicate(), options.getFollowLinks(), options.getPermissionType());
      handler.init(type, options.getCacheFile(), options.getLockFile(), options.getPIDFile(), options.getNoCache(), options.getForceStart());

      switch (type) {
      case BACKUP:
        handler.backup(!options.isTestRun(), includePatterns, excludePatterns);
        break;
      case RESTORE:
        handler.restore(!options.isTestRun(), includePatterns, excludePatterns);
        break;
      case LIST:
        handler.list(includePatterns, excludePatterns);
        break;
      case CLEAN:
        handler.clean();
        break;
      }

      final long end = System.currentTimeMillis();

      LOGGER.log(Level.INFO, "runtime: " + ((end - start) / 1000.0f) + " seconds");
    } finally {

      try {
        if (handler != null)
          handler.finalize();
      } catch (CloudsyncException e) {
        throw e;
      }
    }
  }
View Full Code Here


    return request;
  }
 
  private DeleteBucketResponse toDeleteBucketResponse(S3Response engineResponse) {
    DeleteBucketResponse response = new DeleteBucketResponse();
    Status status = new Status();
    status.setCode(engineResponse.getResultCode());
    status.setDescription(engineResponse.getResultDescription());
    response.setDeleteBucketResponse(status);
    return response;
  }
View Full Code Here

  private GetObjectResponse toGetObjectResponse(S3GetObjectResponse engineResponse) {
    GetObjectResponse response = new GetObjectResponse();
    int resultCode = engineResponse.getResultCode();

    GetObjectResult result = new GetObjectResult();
    Status param1 = new Status();
    param1.setCode( resultCode);
    param1.setDescription( engineResponse.getResultDescription());
    result.setStatus( param1 );
   
    if ( 200 == resultCode )
    {
         result.setData(engineResponse.getData());
View Full Code Here

  private GetObjectExtendedResponse toGetObjectExtendedResponse(S3GetObjectResponse engineResponse) {
    GetObjectExtendedResponse response = new GetObjectExtendedResponse();
    int resultCode = engineResponse.getResultCode();

    GetObjectResult result = new GetObjectResult();
    Status param1 = new Status();
    param1.setCode( resultCode );
    param1.setDescription( engineResponse.getResultDescription());
    result.setStatus( param1 );

    if ( 200 == resultCode || 206 == resultCode )
    {
         result.setData(engineResponse.getData());
View Full Code Here

    return request;
  }
 
  private DeleteObjectResponse toDeleteObjectResponse(S3Response engineResponse) {
    DeleteObjectResponse response = new DeleteObjectResponse();
    Status status = new Status();
    status.setCode(engineResponse.getResultCode());
    status.setDescription(engineResponse.getResultDescription());
    response.setDeleteObjectResponse(status);
    return response;
  }
View Full Code Here

        return request;
    }

    private DeleteBucketResponse toDeleteBucketResponse(S3Response engineResponse) {
        DeleteBucketResponse response = new DeleteBucketResponse();
        Status status = new Status();
        status.setCode(engineResponse.getResultCode());
        status.setDescription(engineResponse.getResultDescription());
        response.setDeleteBucketResponse(status);
        return response;
    }
View Full Code Here

    private GetObjectResponse toGetObjectResponse(S3GetObjectResponse engineResponse) {
        GetObjectResponse response = new GetObjectResponse();
        int resultCode = engineResponse.getResultCode();

        GetObjectResult result = new GetObjectResult();
        Status param1 = new Status();
        param1.setCode(resultCode);
        param1.setDescription(engineResponse.getResultDescription());
        result.setStatus(param1);

        if (200 == resultCode) {
            result.setData(engineResponse.getData());
            result.setETag(engineResponse.getETag());
View Full Code Here

    private GetObjectExtendedResponse toGetObjectExtendedResponse(S3GetObjectResponse engineResponse) {
        GetObjectExtendedResponse response = new GetObjectExtendedResponse();
        int resultCode = engineResponse.getResultCode();

        GetObjectResult result = new GetObjectResult();
        Status param1 = new Status();
        param1.setCode(resultCode);
        param1.setDescription(engineResponse.getResultDescription());
        result.setStatus(param1);

        if (200 == resultCode || 206 == resultCode) {
            result.setData(engineResponse.getData());
            result.setETag(engineResponse.getETag());
View Full Code Here

        return request;
    }

    private DeleteObjectResponse toDeleteObjectResponse(S3Response engineResponse) {
        DeleteObjectResponse response = new DeleteObjectResponse();
        Status status = new Status();
        status.setCode(engineResponse.getResultCode());
        status.setDescription(engineResponse.getResultDescription());
        response.setDeleteObjectResponse(status);
        return response;
    }
View Full Code Here

    return request;
  }
 
  private DeleteBucketResponse toDeleteBucketResponse(S3Response engineResponse) {
    DeleteBucketResponse response = new DeleteBucketResponse();
    Status status = new Status();
    status.setCode(engineResponse.getResultCode());
    status.setDescription(engineResponse.getResultDescription());
    response.setDeleteBucketResponse(status);
    return response;
  }
View Full Code Here

TOP

Related Classes of cloudsync.helper.Handler$Status

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.