'Configure component links for a master table.
@param master: the name of the master table
@param links: component link configurations'

@classmethod
def add_components(cls, master, **links):

    components = current.model.components
    load_all_models = current.response.s3.load_all_models
    master = (master._tablename if (type(master) is Table) else master)
    hooks = components.get(master)
    if (hooks is None):
        hooks = Storage()
    for (tablename, ll) in links.items():
        (prefix, name) = tablename.split('_', 1)
        if (not isinstance(ll, (tuple, list))):
            ll = [ll]
        for link in ll:
            if isinstance(link, str):
                alias = name
                pkey = None
                fkey = link
                linktable = None
                lkey = None
                rkey = None
                actuate = None
                autodelete = False
                autocomplete = None
                defaults = None
                multiple = True
                filterby = None
            elif isinstance(link, dict):
                alias = link.get('name', name)
                joinby = link.get('joinby')
                if (not joinby):
                    continue
                linktable = link.get('link')
                linktable = (linktable._tablename if (type(linktable) is Table) else linktable)
                if load_all_models:
                    if ((alias in hooks) and (hooks[alias].tablename != tablename)):
                        current.log.warning(('Redeclaration    of    component    (%s.%s)' % (master, alias)))
                    if (linktable and (alias == linktable.split('_', 1)[1])):
                        current.log.warning(('Ambiguous    link/component    alias    (%s.%s)' % (master, alias)))
                    if (alias == master.split('_', 1)[1]):
                        raise SyntaxError(('Ambiguous    master/component    alias    (%s.%s)' % (master, alias)))
                pkey = link.get('pkey')
                if (linktable is None):
                    lkey = None
                    rkey = None
                    fkey = joinby
                else:
                    lkey = joinby
                    rkey = link.get('key')
                    if (not rkey):
                        continue
                    fkey = link.get('fkey')
                actuate = link.get('actuate')
                autodelete = link.get('autodelete', False)
                autocomplete = link.get('autocomplete')
                defaults = link.get('defaults')
                multiple = link.get('multiple', True)
                filterby = link.get('filterby')
            else:
                continue
            component = Storage(tablename=tablename, pkey=pkey, fkey=fkey, linktable=linktable, lkey=lkey, rkey=rkey, actuate=actuate, autodelete=autodelete, autocomplete=autocomplete, defaults=defaults, multiple=multiple, filterby=filterby)
            hooks[alias] = component
    components[master] = hooks
