Java Code Examples for com.amazonaws.event.ProgressEvent#getEventType()

The following examples show how to use com.amazonaws.event.ProgressEvent#getEventType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrestoS3FileSystem.java    From presto with Apache License 2.0 6 votes vote down vote up
private ProgressListener createProgressListener(Transfer transfer)
{
    return new ProgressListener()
    {
        private ProgressEventType previousType;
        private double previousTransferred;

        @Override
        public synchronized void progressChanged(ProgressEvent progressEvent)
        {
            ProgressEventType eventType = progressEvent.getEventType();
            if (previousType != eventType) {
                log.debug("Upload progress event (%s/%s): %s", bucket, key, eventType);
                previousType = eventType;
            }

            double transferred = transfer.getProgress().getPercentTransferred();
            if (transferred >= (previousTransferred + 10.0)) {
                log.debug("Upload percentage (%s/%s): %.0f%%", bucket, key, transferred);
                previousTransferred = transferred;
            }
        }
    };
}
 
Example 2
Source File: S3Backuper.java    From cassandra-backup with Apache License 2.0 6 votes vote down vote up
@Override
public void progressChanged(final ProgressEvent progressEvent) {
    final ProgressEventType progressEventType = progressEvent.getEventType();

    if (progressEventType == ProgressEventType.TRANSFER_PART_COMPLETED_EVENT) {
        logger.debug("Successfully uploaded part for {}.", s3RemoteObjectReference.canonicalPath);
    }

    if (progressEventType == ProgressEventType.TRANSFER_PART_FAILED_EVENT) {
        logger.debug("Failed to upload part for {}.", s3RemoteObjectReference.canonicalPath);
    }

    if (progressEventType == TRANSFER_FAILED_EVENT) {
        logger.debug("Failed to upload {}.", s3RemoteObjectReference.canonicalPath);
    }

    if (progressEventType == TRANSFER_COMPLETED_EVENT) {
        logger.debug("Successfully uploaded {}.", s3RemoteObjectReference.canonicalPath);
    }
}
 
Example 3
Source File: RetriableFileCopyCommand.java    From circus-train with Apache License 2.0 6 votes vote down vote up
@Override
public void progressChanged(ProgressEvent progressEvent) {
  StringBuilder message = new StringBuilder();
  switch (progressEvent.getEventType()) {
  case TRANSFER_STARTED_EVENT:
    message.append("Starting: ").append(description);
    break;
  case TRANSFER_COMPLETED_EVENT:
    message.append("Completed: ").append(description);
    break;
  case TRANSFER_FAILED_EVENT:
    message.append("Falied: ").append(description);
    break;
  default:
    break;
  }

  context.setStatus(message.toString());
}
 
Example 4
Source File: S3Accessor.java    From datacollector with Apache License 2.0 6 votes vote down vote up
@Override
public void progressChanged(ProgressEvent progressEvent) {
  switch (progressEvent.getEventType()) {
    case TRANSFER_STARTED_EVENT:
      LOG.debug("Started uploading object {} into Amazon S3", object);
      break;
    case TRANSFER_COMPLETED_EVENT:
      LOG.debug("Completed uploading object {} into Amazon S3", object);
      break;
    case TRANSFER_FAILED_EVENT:
      LOG.warn("Failed uploading object {} into Amazon S3", object);
      break;
    default:
      break;
  }

}
 
Example 5
Source File: S3Restorer.java    From cassandra-backup with Apache License 2.0 4 votes vote down vote up
@Override
public void progressChanged(final ProgressEvent progressEvent) {
    if (progressEvent.getEventType() == ProgressEventType.TRANSFER_COMPLETED_EVENT) {
        logger.debug("Successfully downloaded {}.", objectReference.canonicalPath);
    }
}