The Publication Subscription framework is designed to have a similar structure to that of a set of feeds. Each component of a feed (including the feed itself) is stored as an object, and the object’s hierarchy mimics that of a feed (see Figure 2-2). At the same time, the Publication Subscription framework follows the observer design pattern. The observer design pattern defines a one-to-many dependency between objects so that when the subject object changes state, all its dependents are notified and updated automatically. (For more information about the observer design pattern, read Cocoa Design Patterns.)
For your application to communicate with the PubSub Agent, it needs to register itself with Publication Subscription by generating a client object (PSClient). Each application that uses Publication Subscription needs its own client object. If you want to subscribe to a feed, you need to tell the client object. Similarly, if there is a change in a feed your application subscribes to, the client notifies your application. In terms of the observer model, the subject object of the Publication Subscription framework is the client object.
The client object maintains a set of feed objects, one for each feed that it is subscribed to. A feed object (PSFeed) stores information about a feed, such as its title, its URL, the time when it was last updated, and the entries associated with it. Just as a feed contains a number of entries, feed objects contain a number of entry objects (PSEntry). An entry object contains the content (PSContent), the author (PSAuthor), and (if necessary) the enclosure (PSEnclosure) of the entry. Figure 2-3 shows an entry, and each of its components, viewed using Safari.
You can adjust the settings for each client and feed object. For example, you can specify how often to check for feed updates or how long entries should be stored in the PubSub Database. You specify the settings with a settings object (PSFeedSettings). A settings object can be associated with either a client or a feed.
The structure of the subscription objects can be seen in Figure 2-4.
Understanding the components of Publication Subscription and the Publication Subscription framework is necessary for subscribing to feeds within your application. The next two chapters explain how to use the Publication Subscription framework in an application.
Last updated: 2007-05-11