use of org.eclipse.aether.transfer.TransferResource in project che by eclipse.
the class ArtifactTransferListener method getMassage.
private String getMassage(TransferEvent event) {
TransferResource resource = event.getResource();
File file = resource.getFile();
String repo = " [" + resource.getRepositoryUrl() + "]";
if (file == null) {
return resource.getResourceName() + repo;
} else {
return file.getName() + repo;
}
}
use of org.eclipse.aether.transfer.TransferResource in project intellij-community by JetBrains.
the class TransferListenerAdapter method formatResourceName.
private static String formatResourceName(TransferEvent event) {
TransferResource resource = event.getResource();
File file = resource.getFile();
return (file == null ? resource.getResourceName() : file.getName()) + " [" + resource.getRepositoryUrl() + "]";
}
use of org.eclipse.aether.transfer.TransferResource in project BIMserver by opensourceBIM.
the class ConsoleTransferListener method transferSucceeded.
@Override
public void transferSucceeded(TransferEvent event) {
transferCompleted(event);
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if (contentLength >= 0) {
String type = (event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded");
String len = contentLength >= 1024 ? toKB(contentLength) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.getTransferStartTime();
if (duration > 0) {
long bytes = contentLength - resource.getResumeOffset();
DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
double kbPerSec = (bytes / 1024.0) / (duration / 1000.0);
throughput = " at " + format.format(kbPerSec) + " KB/sec";
}
out.println(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")");
}
}
use of org.eclipse.aether.transfer.TransferResource in project BIMserver by opensourceBIM.
the class ConsoleTransferListener method transferProgressed.
@Override
public void transferProgressed(TransferEvent event) {
TransferResource resource = event.getResource();
downloads.put(resource, Long.valueOf(event.getTransferredBytes()));
StringBuilder buffer = new StringBuilder(64);
for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
long total = entry.getKey().getContentLength();
long complete = entry.getValue().longValue();
buffer.append(getStatus(complete, total)).append(" ");
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad(buffer, pad);
buffer.append('\r');
out.print(buffer);
}
use of org.eclipse.aether.transfer.TransferResource in project bnd by bndtools.
the class ConsoleTransferListener method transferProgressed.
@Override
public void transferProgressed(TransferEvent event) {
TransferResource resource = event.getResource();
downloads.put(resource, Long.valueOf(event.getTransferredBytes()));
StringBuilder buffer = new StringBuilder(64);
for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) {
long total = entry.getKey().getContentLength();
long complete = entry.getValue().longValue();
buffer.append(getStatus(complete, total)).append(" ");
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad(buffer, pad);
buffer.append('\r');
out.print(buffer);
}
Aggregations