Example usage for org.apache.maven.repository ArtifactTransferEvent REQUEST_PUT

List of usage examples for org.apache.maven.repository ArtifactTransferEvent REQUEST_PUT

Introduction

In this page you can find the example usage for org.apache.maven.repository ArtifactTransferEvent REQUEST_PUT.

Prototype

int REQUEST_PUT

To view the source code for org.apache.maven.repository ArtifactTransferEvent REQUEST_PUT.

Click Source Link

Document

Indicates PUT transfer (to the repository)

Usage

From source file:org.commonjava.emb.boot.log.BatchTransferListener.java

License:Apache License

protected void doInitiated(final ArtifactTransferEvent transferEvent) {
    final String message = transferEvent.getRequestType() == ArtifactTransferEvent.REQUEST_PUT ? "Uploading"
            : "Downloading";

    out.println(message + ": " + transferEvent.getResource().getUrl());
}

From source file:org.commonjava.emb.boot.log.BatchTransferListener.java

License:Apache License

protected void doCompleted(final ArtifactTransferEvent transferEvent) {
    final ArtifactTransferResource artifact = transferEvent.getResource();
    final long contentLength = transferEvent.getTransferredBytes();
    if (contentLength >= 0) {
        final String type = (transferEvent.getRequestType() == ArtifactTransferEvent.REQUEST_PUT ? "Uploaded"
                : "Downloaded");
        final String len = contentLength >= 1024 ? toKB(contentLength) + " KB" : contentLength + " B";

        String throughput = "";
        final long duration = System.currentTimeMillis() - artifact.getTransferStartTime();
        if (duration > 0) {
            final DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
            final double kbPerSec = (contentLength / 1024.0) / (duration / 1000.0);
            throughput = " at " + format.format(kbPerSec) + " KB/sec";
        }/*from  w w w .j  ava  2  s.co  m*/

        out.println(type + ": " + artifact.getUrl() + " (" + len + throughput + ")");
    }
}

From source file:org.sonatype.gshell.artifact.monitor.ProgressSpinnerMonitor.java

License:Apache License

private String renderRequestType(final ArtifactTransferEvent event) {
    assert event != null;

    return event.getRequestType() == ArtifactTransferEvent.REQUEST_PUT ? "Uploading" : "Downloading";
}

From source file:org.sonatype.gshell.artifact.monitor.ProgressSpinnerMonitor.java

License:Apache License

private String renderRequestTypeFinished(final ArtifactTransferEvent event) {
    assert event != null;

    return event.getRequestType() == ArtifactTransferEvent.REQUEST_PUT ? "Uploaded" : "Downloaded";
}