Previous | Next
WireHose Developers Guide

Enabling the importer

Next, we'll add a property that controls whether or not to import feeds at runtime, and actually call the importer.

  1. Select the Properties file in the Resources group in the Files pane, and add these lines:
    # controls whether feeds are imported 
    # when the application starts up
    ImportFeeds = NO

  2. Select Application.java in the Classes group, and uncomment this line in the constructor:
    NSNotificationCenter.defaultCenter().addObserver(
        this, new NSSelector("initialize", new Class[] { NSNotification.class } ), 
        WHApplicationHelper.ApplicationHelperDidFinishInitializing, null);

    WireHose provides an object called the WHApplicationHelper to handle application-level behavior. Among other tasks, WHApplicationHelper handles various initialization and setup tasks. Once it's done, it posts an ApplicationHelperDidFinishInitializing notification which indicates that it's now safe to access WireHose tags and other data structures.

  3. Now add this method, which will be called in response to the notification:
    public void initialize(NSNotification notification) {
        if (NSPropertyListSerialization.booleanForString(
            System.getProperty("ImportFeeds"))) {
            Importer.importFeeds();
        }
    }

    If the "ImportFeeds" property evaluates to true (or "YES"), then the importer will run.


Previous | Next