URLManager


Inherits From:
LoadBroker
Declared In:
URLManager.h


Class Description

This class manages downloads of URLs for the consumer (see LoadBroker) to make use of the NSData returned from loading the URL. It manages an unlimited number of concurrent downloads, and will message the consumer with the appropriate completion method, along with the data retrieved (or any error message) and the "parameter" passed to the loading method so that the consumer can recognize the data that it has received.

BE SURE to invoke detachConsumer on this object before deallocating this in your class's release method.


Global Variables

Synopsis:

NSString *URLManagerCreateNotification;
NSString *URLManagerChangeNotification;
NSString *URLManagerDeleteNotification;
NSString *URLManagerFinishNotification;


Instance Variables

int mLoadingCounter;
NSMutableDictionary *mLoaderStorage;
NSMutableDictionary *mParamStorage;
NSProgressIndicator *mProgress;

mLoadingCounterNo description.
mLoaderStorageNo description.
mParamStorageNo description.
mProgressNo description.


Method Types

Initialization and Loading
- initWithDescriptor:consumer:progress:success:cancelled:error:
- initWithDescriptor:consumer:progress:
- loadURL:options:parameter:
Status and control
- stopLoading
- stopLoadingParameter:
- loadersRemaining
- isDone
- status
- loaderDictionary

Instance Methods

initWithDescriptor:consumer:progress:

- (id)initWithDescriptor:(NSString *)inDescriptor consumer:(id)inConsumer progress:(NSProgressIndicator *)inProgress

Initialize the URLManager, with default methods


initWithDescriptor:consumer:progress:success:cancelled:error:

- (id)initWithDescriptor:(NSString *)inDescriptor consumer:(id)inConsumer progress:(NSProgressIndicator *)inProgress success:(SEL)inSuccess cancelled:(SEL)inCancelled error:(SEL)inError

Initialize the URLManager. It initializes as in [LoadBroker initWithDescriptor:consumer:success:cancelled:error:] and then sets up the storage for dealing with managing concurrent loads. You can also make use of initWithDescriptor:consumer:progress: to use the default methods.


isDone

- (BOOL)isDone

Returns true if done loading; that is, no loaders remain.


loadURL:options:parameter:

- (void)loadURL:(NSURL *)inURL options:(NSDictionary *)inOptions parameter:(id)inParam

Begin loading inURL in the background. inOptions are passed to the URLLoader. inParam is any object that is passed back to the consumer when the load finishes so the consumer can recognize what finished loading; it might be a string, a dictionary, for example.


loaderDictionary

- (NSDictionary *)loaderDictionary

Return the loader dictionary; for debugging purposes.


loadersRemaining

- (int)loadersRemaining

Return the number of concurrent loads remaining to be completed.


status

- (NSString *)status

Returns a status string; useful for debugging or displaying to the user to show how many items remain to be completed.


stopLoading

- (void)stopLoading

Stop loading all pending URLs. This might be done in response to a "Cancel All" button or some such.


stopLoadingParameter:

- (void)stopLoadingParameter:(id)inParam

Stop loading url with given parameter


Version 1.1 Copyright ©2003 by Karelia Software, LLC. All Rights Reserved.