Package jadex.bridge.service.types.chat
Class TransferInfo
- java.lang.Object
-
- jadex.bridge.service.types.chat.TransferInfo
-
- All Implemented Interfaces:
java.io.Serializable
public class TransferInfo extends java.lang.Object implements java.io.Serializable
Information about a requested, ongoing or completed file transfer.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected long
done
The done size.protected boolean
download
True for download, false for upload.protected java.lang.String
filename
The name of the local file (without path).protected java.lang.String
filepath
The full path of the local file (including filename).protected java.lang.String
id
The id.protected long
lastdone
The done size of the last update (for calculating speed).protected long
lastupdate
The time (millis) of the last update (for calculating speed).protected IComponentIdentifier
other
The ID of the component at the other side of the transfer (i.e.protected long
size
The size.protected double
speed
The upload/download speed calculated as dynamic moving average (bytes/sec).protected java.lang.String
state
The state.static java.lang.String
STATE_ABORTED
State when transfer was aborted by sending or receiving user.static java.lang.String
STATE_CANCELLING
State when cancel was requested.static java.lang.String
STATE_COMPLETED
State when transfer was successful.static java.lang.String
STATE_ERROR
State when transfer was stopped due to e.g.static java.lang.String
STATE_REJECTED
State when transfer was rejected by receiver.static java.lang.String
STATE_TRANSFERRING
State when transfer is in progress.static java.lang.String
STATE_WAITING
State waiting for acceptance.protected long
timeout
The absolute timeout value.
-
Constructor Summary
Constructors Constructor Description TransferInfo()
Create a new file transfer info.TransferInfo(boolean download, java.lang.String id, java.lang.String filename, java.lang.String filepath, IComponentIdentifier other, long size, long timeout)
Create a new file transfer info.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Test for equality.long
getDone()
Get the done.java.lang.String
getFileName()
Get the name of the local file (without path).java.lang.String
getFilePath()
Get the full path of the local file (including filename).java.lang.String
getId()
Get the id.IComponentIdentifier
getOther()
Get the opposite component.long
getSize()
Get the size.double
getSpeed()
Get the speed.java.lang.String
getState()
Get the state.long
getTimeout()
Get the timeout.int
hashCode()
Get the hash code.boolean
isDownload()
Check if transfer is a download or upload.boolean
isFinished()
Check if transfer is finished.void
setDone(long done)
Set the done.void
setDownload(boolean download)
Set the transfer as a download or upload.void
setFileName(java.lang.String filename)
Set the name of the local file (without path).void
setFilePath(java.lang.String filepath)
Set the full path of the local file (including filename).void
setId(java.lang.String id)
Set the id.void
setOther(IComponentIdentifier other)
Set the opposite component.void
setSize(long size)
Set the size.void
setSpeed(double speed)
Set the speed.void
setState(java.lang.String state)
Set the state.void
setTimeout(long timeout)
Set the timeout.boolean
update(long done)
Update the transfer info.
-
-
-
Field Detail
-
STATE_WAITING
public static final java.lang.String STATE_WAITING
State waiting for acceptance.- See Also:
- Constant Field Values
-
STATE_REJECTED
public static final java.lang.String STATE_REJECTED
State when transfer was rejected by receiver.- See Also:
- Constant Field Values
-
STATE_TRANSFERRING
public static final java.lang.String STATE_TRANSFERRING
State when transfer is in progress.- See Also:
- Constant Field Values
-
STATE_CANCELLING
public static final java.lang.String STATE_CANCELLING
State when cancel was requested.- See Also:
- Constant Field Values
-
STATE_COMPLETED
public static final java.lang.String STATE_COMPLETED
State when transfer was successful.- See Also:
- Constant Field Values
-
STATE_ABORTED
public static final java.lang.String STATE_ABORTED
State when transfer was aborted by sending or receiving user.- See Also:
- Constant Field Values
-
STATE_ERROR
public static final java.lang.String STATE_ERROR
State when transfer was stopped due to e.g. network error.- See Also:
- Constant Field Values
-
download
protected boolean download
True for download, false for upload.
-
id
protected java.lang.String id
The id.
-
filename
protected java.lang.String filename
The name of the local file (without path).
-
filepath
protected java.lang.String filepath
The full path of the local file (including filename).
-
other
protected IComponentIdentifier other
The ID of the component at the other side of the transfer (i.e. sender for downloads, receiver for uploads).
-
size
protected long size
The size.
-
state
protected java.lang.String state
The state.
-
timeout
protected long timeout
The absolute timeout value.
-
done
protected long done
The done size.
-
speed
protected double speed
The upload/download speed calculated as dynamic moving average (bytes/sec).
-
lastupdate
protected long lastupdate
The time (millis) of the last update (for calculating speed).
-
lastdone
protected long lastdone
The done size of the last update (for calculating speed).
-
-
Constructor Detail
-
TransferInfo
public TransferInfo()
Create a new file transfer info.
-
TransferInfo
public TransferInfo(boolean download, java.lang.String id, java.lang.String filename, java.lang.String filepath, IComponentIdentifier other, long size, long timeout)
Create a new file transfer info.
-
-
Method Detail
-
getFileName
public java.lang.String getFileName()
Get the name of the local file (without path).- Returns:
- the file name.
-
setFileName
public void setFileName(java.lang.String filename)
Set the name of the local file (without path).- Parameters:
filename
- The file name to set.
-
getFilePath
public java.lang.String getFilePath()
Get the full path of the local file (including filename).- Returns:
- the file path.
-
setFilePath
public void setFilePath(java.lang.String filepath)
Set the full path of the local file (including filename).- Parameters:
filepath
- The file pathto set.
-
getOther
public IComponentIdentifier getOther()
Get the opposite component.- Returns:
- the CID.
-
setOther
public void setOther(IComponentIdentifier other)
Set the opposite component.- Parameters:
other
- The CID to set.
-
getSize
public long getSize()
Get the size.- Returns:
- the size.
-
setSize
public void setSize(long size)
Set the size.- Parameters:
size
- The size to set.
-
getTimeout
public long getTimeout()
Get the timeout.- Returns:
- the absolute timeout value.
-
setTimeout
public void setTimeout(long timeout)
Set the timeout.- Parameters:
timeout
- The absolute timeout value to set.
-
getDone
public long getDone()
Get the done.- Returns:
- the done.
-
setDone
public void setDone(long done)
Set the done.- Parameters:
done
- The done to set.
-
update
public boolean update(long done)
Update the transfer info. Use this method instead of set done for having the transfer speed calculated.- Parameters:
done
- The done to set.- Returns:
- True, when a new speed has been calculated (approx. once per second).
-
getId
public java.lang.String getId()
Get the id.- Returns:
- the id.
-
setId
public void setId(java.lang.String id)
Set the id.
-
getState
public java.lang.String getState()
Get the state.- Returns:
- the state.
-
isDownload
public boolean isDownload()
Check if transfer is a download or upload.
-
setDownload
public void setDownload(boolean download)
Set the transfer as a download or upload.
-
getSpeed
public double getSpeed()
Get the speed.- Returns:
- the speed.
-
setSpeed
public void setSpeed(double speed)
Set the speed.
-
setState
public void setState(java.lang.String state)
Set the state.- Parameters:
state
- The state to set.
-
isFinished
public boolean isFinished()
Check if transfer is finished.
-
hashCode
public int hashCode()
Get the hash code.- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test for equality.- Overrides:
equals
in classjava.lang.Object
-
-