code: def init(ref):
          
          r_http = re.compile(r"^(https?:.*)")
          r_uuid = re.compile(
              r"^([a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12})$",
              re.I)
          r_id = re.compile(r"^([0-9a-fA-F]{24})$")
          r_file = re.compile(r"^file:(.*)$")
          r_any = re.compile(r"([\S\s]{4,})$")
          types = [
              {"cls": BuildHttp, "res": [r_http]},
              {"cls": BuildDatabase, "res": [r_uuid, r_id]},
              {"cls": BuildFile, "res": [r_file, r_any]}
          ]
  
          for _type in types:
              for reg in _type["res"]:
                  match = reg.match(ref)
                  if match:
                      return _type["cls"](ref=match.group(1))
  
          raise NotImplementedError("Cannot detect reference type: %s" % ref)
docs: function init
          ref: reference for build, e.g. file:c:\\.. or http://...