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.

- - ### Constructor Summary

    Constructors
    Constructor and 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 and Description
    --- | ---
    `void` | `addMessage(Snark snark, String message)`
    `void` | `fatal(Snark snark, String error)`
    `BandwidthListener` | `getBandwidthListener()`
    `String` | `getID()` Valid for plugins
    `UpdateMethod` | `getMethod()` Get the update method.
    `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 SnarkManager
    `long` | `getSavedUploaded(Snark snark)`
    `UpdateType` | `getType()` Get the update type.
    `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()` Check if the task is currently running.
    `void` | `locked_saveComments(Snark snark, CommentSet comments)`
    `boolean` | `shouldAutoStart()`
    `void` | `shutdown()` Shutdown the task.
    `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,
                              UpdateType type,
                              List<URI> uris,
                              String newVersion)

  - ### Method Detail

    - #### addMessage

          public void addMessage(Snark snark,
                                 String message)

      Specified by:
        `addMessage` in interface `CompleteListener`

    - #### fatal

          public void fatal(Snark snark,
                            String error)

      Specified by:
        `fatal` in interface `CompleteListener`

    - #### getBandwidthListener

          public BandwidthListener getBandwidthListener()

      Specified by:
        `getBandwidthListener` in interface `CompleteListener`

    - #### getID

          public String getID()

      Description copied from interface: `UpdateTask`
      Valid for plugins
      Specified by:
        `getID` in interface `UpdateTask`
      Returns:
        plugin ID

    - #### getMethod

          public UpdateMethod getMethod()

      Description copied from interface: `UpdateTask`
      Get the update method.
      Specified by:
        `getMethod` in interface `UpdateTask`
      Returns:
        update method

    - #### getSavedComments

          public CommentSet getSavedComments(Snark snark)

      Specified by:
        `getSavedComments` in interface `CompleteListener`

    - #### getSavedPreserveNamesSetting

          public boolean getSavedPreserveNamesSetting(Snark snark)

      Specified by:
        `getSavedPreserveNamesSetting` in interface `CompleteListener`

    - #### getSavedTorrentBitField

          public BitField getSavedTorrentBitField(Snark snark)

      Specified by:
        `getSavedTorrentBitField` in interface `CompleteListener`

    - #### 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 interface `CompleteListener`

    - #### getSavedUploaded

          public long getSavedUploaded(Snark snark)

      Specified by:
        `getSavedUploaded` in interface `CompleteListener`

    - #### getType

          public UpdateType getType()

      Description copied from interface: `UpdateTask`
      Get the update type.
      Specified by:
        `getType` in interface `UpdateTask`
      Returns:
        update type

    - #### 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`
      Returns:
        current URI

    - #### 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

    - #### gotPiece

          public void gotPiece(Snark snark)

      Specified by:
        `gotPiece` in interface `CompleteListener`

    - #### isRunning

          public boolean isRunning()

      Description copied from interface: `UpdateTask`
      Check if the task is currently running.
      Specified by:
        `isRunning` in interface `UpdateTask`
      Returns:
        true if running

    - #### locked_saveComments

          public void locked_saveComments(Snark snark,
                                          CommentSet comments)

      Specified by:
        `locked_saveComments` in interface `CompleteListener`

    - #### shouldAutoStart

          public boolean shouldAutoStart()

      Specified by:
        `shouldAutoStart` in interface `CompleteListener`

    - #### shutdown

          public void shutdown()

      Description copied from interface: `UpdateTask`
      Shutdown the task.
      Specified by:
        `shutdown` 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`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### updateStatus

          public void updateStatus(Snark snark)

      This is called by stopTorrent() among others
      Specified by:
        `updateStatus` in interface `CompleteListener`