org.eclipse.aether.transfer.TransferResource Java Examples
The following examples show how to use
org.eclipse.aether.transfer.TransferResource.
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: ProgressTransferListener.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void transferStarted(TransferEvent te) throws TransferCancelledException { ProgressContributor c = contrib; if (c == null || handle == null) { return; } TransferResource res = te.getResource(); int total = (int)Math.min((long)Integer.MAX_VALUE, res.getContentLength()); if (total < 0) { c.start(0); } else { c.start(total); } length = total; c.progress(TXT_Started(getResourceName(res))); }
Example #2
Source File: JULMavenTransferListener.java From furnace with Eclipse Public License 1.0 | 6 votes |
@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) { DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH)); double kbPerSec = (contentLength / 1024.0) / (duration / 1000.0); throughput = " at " + format.format(kbPerSec) + " KB/sec"; } out.info(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")"); } }
Example #3
Source File: LogTransferListener.java From furnace with Eclipse Public License 1.0 | 6 votes |
@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) { DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH)); double kbPerSec = (contentLength / 1024.0) / (duration / 1000.0); throughput = " at " + format.format(kbPerSec) + " KB/sec"; } out.println(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")"); } }
Example #4
Source File: ConsoleTransferListener.java From BIMserver with GNU Affero General Public License v3.0 | 6 votes |
@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 + ")"); } }
Example #5
Source File: ConsoleTransferListener.java From BIMserver with GNU Affero General Public License v3.0 | 6 votes |
@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); }
Example #6
Source File: ConsoleTransferListener.java From jenkins-build-monitor-plugin with MIT License | 6 votes |
@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 + ")"); } }
Example #7
Source File: ConsoleTransferListener.java From jenkins-build-monitor-plugin with MIT License | 6 votes |
@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); }
Example #8
Source File: MavenUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@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) { DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH)); double kbPerSec = (contentLength / 1024.0) / (duration / 1000.0); throughput = " at " + format.format(kbPerSec) + " KB/sec"; } log.debug(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")"); } }
Example #9
Source File: MavenUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@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'); log.trace(buffer); }
Example #10
Source File: LoggingTransferListener.java From maven-repository-tools with Eclipse Public License 1.0 | 6 votes |
@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"; } logger.info( type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len + throughput + ")" ); } }
Example #11
Source File: ConsoleTransferListener.java From qpid-broker-j with Apache License 2.0 | 6 votes |
@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 + ")"); } }
Example #12
Source File: ConsoleTransferListener.java From qpid-broker-j with Apache License 2.0 | 6 votes |
@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); }
Example #13
Source File: LogTransferListener.java From furnace with Eclipse Public License 1.0 | 5 votes |
@Override public void transferCorrupted(TransferEvent event) throws TransferCancelledException { TransferResource resource = event.getResource(); out.println("[WARNING] " + event.getException().getMessage() + " for " + resource.getRepositoryUrl() + resource.getResourceName()); }
Example #14
Source File: LogTransferListener.java From furnace with Eclipse Public License 1.0 | 5 votes |
@Override public void transferProgressed(TransferEvent event) throws TransferCancelledException { TransferResource resource = event.getResource(); downloads.put(resource, event.getTransferredBytes()); StringBuilder buffer = new StringBuilder(64); for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) { long total = entry.getKey().getContentLength(); Long complete = entry.getValue(); // NOTE: This null check guards against http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6312056 if (complete != null) { buffer.append(getStatus(complete.longValue(), total)).append(" "); } } int pad = lastLength - buffer.length(); lastLength = buffer.length(); pad(buffer, pad); buffer.append('\r'); out.print(buffer.toString()); }
Example #15
Source File: JULMavenTransferListener.java From furnace with Eclipse Public License 1.0 | 5 votes |
@Override public void transferCorrupted(TransferEvent event) throws TransferCancelledException { TransferResource resource = event.getResource(); out.warning(event.getException().getMessage() + " for " + resource.getRepositoryUrl() + resource.getResourceName()); }
Example #16
Source File: JULMavenTransferListener.java From furnace with Eclipse Public License 1.0 | 5 votes |
@Override public void transferProgressed(TransferEvent event) throws TransferCancelledException { TransferResource resource = event.getResource(); downloads.put(resource, event.getTransferredBytes()); StringBuilder buffer = new StringBuilder(64); for (Map.Entry<TransferResource, Long> entry : downloads.entrySet()) { long total = entry.getKey().getContentLength(); Long complete = entry.getValue(); // NOTE: This null check guards against http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6312056 if (complete != null) { buffer.append(getStatus(complete.longValue(), total)).append(" "); } } int pad = lastLength - buffer.length(); lastLength = buffer.length(); pad(buffer, pad); buffer.append('\r'); out.info(buffer.toString()); }
Example #17
Source File: ProgressTransferListener.java From netbeans with Apache License 2.0 | 4 votes |
private String getResourceName(TransferResource res) { int lastSlash = res.getResourceName().lastIndexOf('/'); return lastSlash > -1 ? res.getResourceName().substring(lastSlash + 1) : res.getResourceName(); }