Package org.klomp.snark
Class UpdateRunner
- java.lang.Object
-
- org.klomp.snark.UpdateRunner
-
- All Implemented Interfaces:
UpdateTask
,CompleteListener
class UpdateRunner extends Object implements UpdateTask, CompleteListener
The downloader for router signed updates.- Since:
- 0.9.4
-
-
Constructor Summary
Constructors Constructor Description UpdateRunner(I2PAppContext ctx, UpdateManager umgr, SnarkManager smgr, UpdateType type, List<URI> uris, String newVersion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMessage(Snark snark, String message)
void
fatal(Snark snark, String error)
String
getID()
Valid for pluginsUpdateMethod
getMethod()
CommentSet
getSavedComments(Snark snark)
boolean
getSavedPreserveNamesSetting(Snark snark)
BitField
getSavedTorrentBitField(Snark snark)
long
getSavedTorrentTime(Snark snark)
not really listeners but the easiest way to get back to an optional SnarkManagerlong
getSavedUploaded(Snark snark)
UpdateType
getType()
URI
getURI()
The current URI being checked or downloaded from.String
gotMetaInfo(Snark snark)
We transitioned from magnet mode, we have now initialized our metainfo and storage.void
gotPiece(Snark snark)
boolean
isRunning()
void
locked_saveComments(Snark snark, CommentSet comments)
boolean
shouldAutoStart()
void
shutdown()
void
start()
Tasks must not start themselves in the constructor.void
torrentComplete(Snark snark)
String
toString()
void
updateStatus(Snark snark)
This is called by stopTorrent() among others
-
-
-
Constructor Detail
-
UpdateRunner
public UpdateRunner(I2PAppContext ctx, UpdateManager umgr, SnarkManager smgr, UpdateType type, List<URI> uris, String newVersion)
-
-
Method Detail
-
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interfaceUpdateTask
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceUpdateTask
-
getType
public UpdateType getType()
- Specified by:
getType
in interfaceUpdateTask
-
getMethod
public UpdateMethod getMethod()
- Specified by:
getMethod
in interfaceUpdateTask
-
getURI
public URI getURI()
Description copied from interface:UpdateTask
The current URI being checked or downloaded from. Can change if there are multiple URIs to try.- Specified by:
getURI
in interfaceUpdateTask
-
getID
public String getID()
Description copied from interface:UpdateTask
Valid for plugins- Specified by:
getID
in interfaceUpdateTask
-
start
public void start()
Description copied from interface:UpdateTask
Tasks must not start themselves in the constructor. Do it here.- Specified by:
start
in interfaceUpdateTask
-
torrentComplete
public void torrentComplete(Snark snark)
- Specified by:
torrentComplete
in interfaceCompleteListener
-
updateStatus
public void updateStatus(Snark snark)
This is called by stopTorrent() among others- Specified by:
updateStatus
in interfaceCompleteListener
-
gotMetaInfo
public String gotMetaInfo(Snark snark)
Description copied from interface:CompleteListener
We transitioned from magnet mode, we have now initialized our metainfo and storage. The listener should now call getMetaInfo() and save the data to disk.- Specified by:
gotMetaInfo
in interfaceCompleteListener
- Returns:
- the new name for the torrent or null on error
-
fatal
public void fatal(Snark snark, String error)
- Specified by:
fatal
in interfaceCompleteListener
-
addMessage
public void addMessage(Snark snark, String message)
- Specified by:
addMessage
in interfaceCompleteListener
-
gotPiece
public void gotPiece(Snark snark)
- Specified by:
gotPiece
in interfaceCompleteListener
-
getSavedTorrentTime
public long getSavedTorrentTime(Snark snark)
Description copied from interface:CompleteListener
not really listeners but the easiest way to get back to an optional SnarkManager- Specified by:
getSavedTorrentTime
in interfaceCompleteListener
-
getSavedTorrentBitField
public BitField getSavedTorrentBitField(Snark snark)
- Specified by:
getSavedTorrentBitField
in interfaceCompleteListener
-
getSavedPreserveNamesSetting
public boolean getSavedPreserveNamesSetting(Snark snark)
- Specified by:
getSavedPreserveNamesSetting
in interfaceCompleteListener
-
getSavedUploaded
public long getSavedUploaded(Snark snark)
- Specified by:
getSavedUploaded
in interfaceCompleteListener
-
getSavedComments
public CommentSet getSavedComments(Snark snark)
- Specified by:
getSavedComments
in interfaceCompleteListener
- Since:
- 0.9.31
-
locked_saveComments
public void locked_saveComments(Snark snark, CommentSet comments)
- Specified by:
locked_saveComments
in interfaceCompleteListener
- Since:
- 0.9.31
-
shouldAutoStart
public boolean shouldAutoStart()
- Specified by:
shouldAutoStart
in interfaceCompleteListener
- Since:
- 0.9.42
-
-