net.i2p.addressbook

## Class Daemon

- java.lang.Object
- - net.i2p.addressbook.Daemon

-     public class Daemon
      extends Object

  Main class of addressbook. Performs updates, and runs the main loop. As of 0.9.30, package private, run with DaemonThread.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) static String` | `OLD_DEFAULT_SUB`
    `static String` | `VERSION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Daemon()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static HostChecker` | `getHostChecker()` Get the HostChecker instance for use by web applications
    `static Object` | `getHostCheckerInstance()` Get HostChecker instance via reflection-safe method
    `static void` | `main(String[] args)` Load the settings, set the proxy, then enter into the main loop.
    `void` | `run(String[] args)`
    `void` | `stop()`
    `static void` | `test(String[] args)`
    `static void` | `update(AddressBook master, AddressBook router, File published, SubscriptionList subscriptions, Log log)` Update the router and published address books using remote data from the subscribed address books listed in subscriptions.
    `static void` | `update(Map<String,String> settings, String home)` Run an update, using the Map settings to provide the parameters.
    `static void` | `update(NamingService router, File published, SubscriptionList subscriptions, Log log)` Update the router and published address books using remote data from the subscribed address books listed in subscriptions.
    `void` | `wakeup()` Call this to get the addressbook to reread its config and refetch its subscriptions.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### OLD_DEFAULT_SUB

          static final String OLD_DEFAULT_SUB

      See Also:
        Constant Field Values

    - #### VERSION

          public static final String VERSION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Daemon

          public Daemon()

  - ### Method Detail

    - #### getHostChecker

          public static HostChecker getHostChecker()

      Get the HostChecker instance for use by web applications
      Returns:
        HostChecker instance or null if not initialized

    - #### getHostCheckerInstance

          public static Object getHostCheckerInstance()

      Get HostChecker instance via reflection-safe method
      Returns:
        HostChecker instance or null if not initialized

    - #### main

          public static void main(String[] args)

      Load the settings, set the proxy, then enter into the main loop. The main loop performs an immediate update, and then an update every number of hours, as configured in the settings file.
      Parameters:
        `args` - Command line arguments. If there are any arguments provided, the first is taken as addressbook's home directory, and the others are ignored.

    - #### run

          public void run(String[] args)

      Parameters:
        `args` - may be null

    - #### stop

          public void stop()

    - #### test

          public static void test(String[] args)

    - #### update

          public static void update(AddressBook master,
                                    AddressBook router,
                                    File published,
                                    SubscriptionList subscriptions,
                                    Log log)

      Update the router and published address books using remote data from the subscribed address books listed in subscriptions.
      Parameters:
        `master` - The master AddressBook. This address book is never overwritten, so it is safe for the user to write to. It is only merged to the published addressbook. May be null.
        `router` - The router AddressBook. This is the address book read by client applications.
        `published` - The published AddressBook. This address book is published on the user's eepsite so that others may subscribe to it. May be null. If non-null, overwrite with the new addressbook.
        `subscriptions` - A SubscriptionList listing the remote address books to update from.
        `log` - The log to write changes and conflicts to. May be null.

    - #### update

          public static void update(Map<String,String> settings,
                                    String home)

      Run an update, using the Map settings to provide the parameters.
      Parameters:
        `settings` - A Map containg the parameters needed by update.
        `home` - The directory containing addressbook's configuration files.

    - #### update

          public static void update(NamingService router,
                                    File published,
                                    SubscriptionList subscriptions,
                                    Log log)

      Update the router and published address books using remote data from the subscribed address books listed in subscriptions. Merging of the "master" addressbook is NOT supported.
      Parameters:
        `router` - The NamingService to update, generally the root NamingService from the context.
        `published` - The published AddressBook. This address book is published on the user's eepsite so that others may subscribe to it. May be null. If non-null, overwrite with the new addressbook.
        `subscriptions` - A SubscriptionList listing the remote address books to update from.
        `log` - The log to write changes and conflicts to. May be null.

    - #### wakeup

          public void wakeup()

      Call this to get the addressbook to reread its config and refetch its subscriptions.