'Gather prerequisites and store data for a source.
Return is a list of source specifications, such as prerequisites
needed to load the source, or follow-on sources identified by the
source.'

def gather(self, requester, storage):

    if (self.state == self.STATE_INIT):
        try:
            load_return = self.load_and_validate_existing(storage)
        except self.SourceError as error:
            self.error = error
            self.state = self.STATE_ERROR
        else:
            (has_existing, next_sources) = load_return
            if has_existing:
                self.state = self.STATE_DONE
                self.freshness = self.FRESH_NO
                return next_sources
            else:
                self.state = self.STATE_PREREQ
    if (self.state == self.STATE_PREREQ):
        try:
            (has_prereqs, data) = self.load_prereqs(requester, storage)
        except self.SourceError as error:
            self.error = error
            self.state = self.STATE_ERROR
        else:
            if has_prereqs:
                self.freshness = self.FRESH_YES
                try:
                    next_sources = self.save_data(storage, data)
                except self.SourceError as error:
                    self.error = error
                    self.state = self.STATE_ERROR
                else:
                    self.state = self.STATE_DONE
                    return next_sources
            else:
                return data[u'needs']
    assert (self.state in [self.STATE_ERROR, self.STATE_DONE])
    return []
