BLIPDispatcher Class Reference

#import <BLIPDispatcher.h>

List of all members.


Detailed Description

Routes BLIP messages to targets based on a series of rule predicates.

Every BLIPConnection has a BLIPDispatcher, which is initially empty but you can add rules to it.

Every BLIPListener also has a dispatcher, which is inherited as the parent by every connection that it accepts, so you can add rules to the listener's dispatcher to share them between all connections.

It's not necessary to use a dispatcher. Any undispatched requests will be sent to the BLIPConnection's delegate's -connection:receivedRequest: method, which can do its own custom handling. But it's often easier to use the dispatcher to associate handlers with request based on property values.

Public Member Functions

(void) - addTarget:forPredicate:
 Adds a new rule, to call a given target method if a given predicate matches the message.
(void) - addTarget:forValueOfProperty:forKey:
 Convenience method that adds a rule that compares a property against a string.
(void) - removeTarget:
 Removes all rules with the given target method.
(BOOL) - dispatchMessage:
 Tests the message against all the rules, in the order they were added, and calls the target of the first matching rule.
(MYTarget *) - asTarget
 Returns a target object that will call this dispatcher's -dispatchMessage: method.

Properties

retain BLIPDispatcherparent
 The inherited parent dispatcher.


Member Function Documentation

- (void) addTarget: (MYTarget*)  target
forPredicate: (NSPredicate*)  predicate 

Adds a new rule, to call a given target method if a given predicate matches the message.

- (void) addTarget: (MYTarget*)  target
forValueOfProperty: (NSString*)  value
forKey: (NSString*)  key 

Convenience method that adds a rule that compares a property against a string.

- (void) removeTarget: (MYTarget*)  target  

Removes all rules with the given target method.

- (BOOL) dispatchMessage: (BLIPMessage*)  message  

Tests the message against all the rules, in the order they were added, and calls the target of the first matching rule.

If no rule matches, the message is passed to the parent dispatcher's -dispatchMessage:, if there is a parent. If no rules at all match, NO is returned.

- (MYTarget *) asTarget  

Returns a target object that will call this dispatcher's -dispatchMessage: method.

This can be used to make this dispatcher the target of another dispatcher's rule, stringing them together hierarchically.


Property Documentation

- (retain BLIPDispatcher*) parent [protected]

The inherited parent dispatcher.

If a message does not match any of this dispatcher's rules, it will next be passed to the parent, if there is one.


The documentation for this class was generated from the following files:
Generated on Tue May 27 22:56:33 2008 for MYNetwork:MooseyardNetworking by  doxygen 1.5.4