Added readBytes and totalBytes to Bean
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@169896 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0a9194ae1a
commit
92a814672d
|
@ -125,6 +125,8 @@ public abstract class AbstractUploadProgressListener implements ProgressListener
|
|||
UploadProgressChangeEvent event = new UploadProgressChangeEvent();
|
||||
event.setReadPercentage(percentage);
|
||||
event.setReadTime(System.currentTimeMillis());
|
||||
event.setReadBytes(bytesRead);
|
||||
event.setTotalBytes(totalBytes);
|
||||
// logger.trace("Updating percentage.. "+percentage);
|
||||
synchronized (this.uploadProgress) {
|
||||
// logger.trace("Adding event: "+event);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
package org.gcube.portlets.widgets.workspaceuploader.shared.event;
|
||||
|
||||
/**
|
||||
|
@ -17,24 +18,38 @@ public interface UploadEvent {
|
|||
/**
|
||||
* Sets the read percentage.
|
||||
*
|
||||
* @param percentage the new read percentage
|
||||
* @param percentage
|
||||
* the new read percentage
|
||||
*/
|
||||
void setReadPercentage(int percentage);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the read time. (in millisecond)
|
||||
* Sets the read time. (in millisecond) the difference, measured in
|
||||
* milliseconds, between the current time and midnight, January 1, 1970 UTC.
|
||||
*
|
||||
* the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
|
||||
*
|
||||
* @param time the new read time
|
||||
* @param time
|
||||
* the new read time
|
||||
*/
|
||||
void setReadTime(long time);
|
||||
|
||||
/**
|
||||
* Gets the read time (in millisecond)
|
||||
* Gets the read time (in millisecond).
|
||||
*
|
||||
* @return the read time
|
||||
*/
|
||||
long getReadTime();
|
||||
|
||||
/**
|
||||
* Gets the read bytes.
|
||||
*
|
||||
* @return the read bytes
|
||||
*/
|
||||
public long getReadBytes();
|
||||
|
||||
/**
|
||||
* Gets the total bytes.
|
||||
*
|
||||
* @return the total bytes
|
||||
*/
|
||||
public long getTotalBytes();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ public final class UploadProgressChangeEvent implements UploadEvent, Serializabl
|
|||
private static final long serialVersionUID = -3445585716145899197L;
|
||||
private int readPercentage = -1;
|
||||
private long readTime = 0L;
|
||||
private long readBytes = 0L;
|
||||
private long totalBytes = 0L;
|
||||
|
||||
/**
|
||||
* Instantiates a new upload progress change event.
|
||||
|
@ -55,17 +57,68 @@ public final class UploadProgressChangeEvent implements UploadEvent, Serializabl
|
|||
return readTime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the read bytes.
|
||||
*
|
||||
* @param readBytes the readBytes to set
|
||||
*/
|
||||
public void setReadBytes(long readBytes) {
|
||||
|
||||
this.readBytes = readBytes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the total bytes.
|
||||
*
|
||||
* @param totalBytes the totalBytes to set
|
||||
*/
|
||||
public void setTotalBytes(long totalBytes) {
|
||||
|
||||
this.totalBytes = totalBytes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the read bytes.
|
||||
*
|
||||
* @return the readBytes
|
||||
*/
|
||||
public long getReadBytes() {
|
||||
|
||||
return readBytes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the total bytes.
|
||||
*
|
||||
* @return the totalBytes
|
||||
*/
|
||||
public long getTotalBytes() {
|
||||
|
||||
return totalBytes;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("UploadProgressChangeEvent [readPercentage=");
|
||||
builder.append(readPercentage);
|
||||
builder.append(", readTime=");
|
||||
builder.append(readTime);
|
||||
builder.append(", readBytes=");
|
||||
builder.append(readBytes);
|
||||
builder.append(", totalBytes=");
|
||||
builder.append(totalBytes);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue