org.klomp.snark
Class UpdateRunner

java.lang.Object
  extended by 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
UpdateRunner(I2PAppContext ctx, UpdateManager umgr, SnarkManager smgr, List<URI> uris, String newVersion)
           
 
Method Summary
 void addMessage(Snark snark, String message)
           
 void fatal(Snark snark, String error)
           
 String getID()
          Valid for plugins
 UpdateMethod getMethod()
           
 BitField getSavedTorrentBitField(Snark snark)
           
 long getSavedTorrentTime(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 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UpdateRunner

public UpdateRunner(I2PAppContext ctx,
                    UpdateManager umgr,
                    SnarkManager smgr,
                    List<URI> uris,
                    String newVersion)
Method Detail

isRunning

public boolean isRunning()
Specified by:
isRunning in interface UpdateTask

shutdown

public void shutdown()
Specified by:
shutdown in interface UpdateTask

getType

public UpdateType getType()
Specified by:
getType in interface UpdateTask

getMethod

public UpdateMethod getMethod()
Specified by:
getMethod in interface UpdateTask

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 interface UpdateTask

getID

public String getID()
Description copied from interface: UpdateTask
Valid for plugins

Specified by:
getID in interface UpdateTask

start

public void start()
Description copied from interface: UpdateTask
Tasks must not start themselves in the constructor. Do it here.

Specified by:
start in interface UpdateTask

torrentComplete

public void torrentComplete(Snark snark)
Specified by:
torrentComplete in interface CompleteListener

updateStatus

public void updateStatus(Snark snark)
This is called by stopTorrent() among others

Specified by:
updateStatus in interface CompleteListener

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 interface CompleteListener
Returns:
the new name for the torrent or null on error

fatal

public void fatal(Snark snark,
                  String error)
Specified by:
fatal in interface CompleteListener

addMessage

public void addMessage(Snark snark,
                       String message)
Specified by:
addMessage in interface CompleteListener

gotPiece

public void gotPiece(Snark snark)
Specified by:
gotPiece in interface CompleteListener

getSavedTorrentTime

public long getSavedTorrentTime(Snark snark)
Specified by:
getSavedTorrentTime in interface CompleteListener

getSavedTorrentBitField

public BitField getSavedTorrentBitField(Snark snark)
Specified by:
getSavedTorrentBitField in interface CompleteListener

toString

public String toString()
Overrides:
toString in class Object