Register preference schema
@param {string} id
@param {string} name
@param {Object} schema
358205
function register(id, name, schema) {
        if (!id || !name || !schema) {
            console.error("register(): missing required parameters: id, name, or schema");
            return;
        }

        if (validate(schema)) {
            _schemaMap[id] = {
                id: id,
                name: name,
                schema: schema
            };

            // Build Preference Item Map
            _.each(schema, function (item, key) {
                if (item) {
                    _itemMap[key] = item;
                }
            });
        }
    }
329231
public static void setId(Object document, String id) {
		DocumentAccessor d = getAccessor(document);
		if (d.hasIdMutator()) {
			d.setId(document, id);
		}
	}
993073
private static void register(Schema schema) {
    Class clz = schema.getClass();
    synchronized(clz) {
      String clzname = clz.getSimpleName();

      // Was there a race to get here?  If so, return.
      Class<? extends Schema> existing = schemas.get(clzname);
      if (existing != null) {
        if (clz != existing)
          throw H2O.fail("Two schema classes have the same simpleName: " + clz + " and " + existing + ".");
        return;
      }

      // Check that the Schema has the correct type parameters:
      if (clz.getGenericSuperclass() instanceof ParameterizedType) {
        Type[] schema_type_parms = ((ParameterizedType) (clz.getGenericSuperclass())).getActualTypeArguments();
        if (schema_type_parms.length < 2)
          throw H2O.fail("Found a Schema that does not pass at least two type parameters.  Each Schema needs to be " +
              "parametrized on the backing class (if any, or Iced if not) and itself: " + clz);

        Class parm0 = ReflectionUtils.findActualClassParameter(clz, 0);
        Class parm1 = ReflectionUtils.findActualClassParameter(clz, 1);
        String clzstr = clzname + "<" + parm0.getSimpleName() + "," + parm1.getSimpleName() + ">";
        if (!Iced.class.isAssignableFrom(parm0))
          throw H2O.fail("Schema " + clzstr + " has bad type parameters: first arg should be a subclass of Iced");
        if (Schema.class.isAssignableFrom(parm0))
          throw H2O.fail("Schema " + clzstr + " has bad type parameters: first arg cannot be a Schema");
        if (!Schema.class.isAssignableFrom(parm1))
          throw H2O.fail("Schema " + clzstr + " has bad type parameters: second arg should be a subclass of Schema");
        if (!parm1.getSimpleName().equals(clzname))
          throw H2O.fail("Schema " + clzstr + " has bad type parameters: second arg should refer to the schema itself");

      } else {
        throw H2O.fail("Found a Schema that does not have a parametrized superclass.  Each Schema needs to be " +
            "parameterized on the backing class (if any, or Iced if not) and itself: " + clz);
      }

      // Check the version, and bump the LATEST_VERSION
      // NOTE: we now allow non-versioned schemas, for example base classes like ModelMetricsBaseV3, so that we can
      // fetch the metadata for them.
      int version = Schema.extractVersionFromSchemaName(clzname);
      if (version > HIGHEST_SUPPORTED_VERSION && version != EXPERIMENTAL_VERSION)
        throw H2O.fail("Found a schema with a version higher than the highest supported version; you probably want  " +
            "to bump the highest supported version: " + clz);
      if (version > LATEST_VERSION && version != EXPERIMENTAL_VERSION)
        synchronized (Schema.class) {
          if (version > LATEST_VERSION) LATEST_VERSION = version;
        }

      Class<? extends Iced> impl_class = ReflectionUtils.findActualClassParameter(clz, 0);
      Log.debug(String.format("Registering schema: %-40s  (v = %2d, impled by %s)",
                              clz.getCanonicalName(), version, impl_class.getCanonicalName()));
      schemas.put(clzname, clz);
      schema_to_iced.put(clzname, impl_class);

      // Check that it is possible to create a schema object
      try {
        // Validate the fields:
        SchemaMetadata meta = new SchemaMetadata(schema);
        for (SchemaMetadata.FieldMetadata field_meta : meta.fields) {
          String name = field_meta.name;

          // TODO: make a new @API field "ignore_naming_rules", and set to true for the names hardcoded below:
          //       After that these all checks could be eliminated...
          if (name.equals("__meta") || name.equals("__http_status") || name.equals("_exclude_fields") ||
              name.equals("__schema") || name.equals("_fields")) continue;
          if (name.equals("Gini")) continue; // proper name
          if (name.equals("pr_auc")) continue;
          if (name.endsWith("AUC")) continue; // trainAUC, validAUC

          // TODO: remove after we move these into a TwoDimTable:
          if ("f0point5".equals(name) || "f0point5_for_criteria".equals(name) || "f1_for_criteria".equals(name) ||
              "f2_for_criteria".equals(name)) continue;

          if (name.startsWith("_"))
            Log.warn("Found schema field which violates the naming convention; name starts with underscore: " +
                     meta.name + "." + name);
          // allow AUC but not residualDeviance
          // Note: class Word2VecParametersV3 is left as an exception, since it's already a published schema, and it
          // is not possible to alter its field names. However no other exceptions should be created!
          if (!name.equals(name.toLowerCase()) && !name.equals(name.toUpperCase()))
            if (!clzname.equals("Word2VecParametersV3"))
              Log.warn("Found schema field which violates the naming convention; name has mixed lowercase and " +
                       "uppercase characters: " + meta.name + "." + name);
        }
      } catch (Exception e) {
        throw H2O.fail("Failed to instantiate schema class " + clzname + " because: " + e);
      }

      if (impl_class != Iced.class) {
        Pair<String, Integer> versioned = new Pair<>(impl_class.getSimpleName(), version);
        // Check for conflicts
        // The check is invalid: there could be multiple schemas mapping to the same Iced object with the same version.
        // This is why all calls that depend on this mapping should ideally be eliminated (they cannot by
        // type-checked anyways, so they greatly increase bugginness of the code...)
//        if (iced_to_schema.containsKey(versioned))
//          throw H2O.fail("Found two schemas mapping to the same Iced class with the same version: " +
//              iced_to_schema.get(versioned) + " and " + clz + " both map to " +
//              "version: " + version + " of Iced class: " + impl_class);
        iced_to_schema.put(versioned, clz);
      }
    }
  }
207910
public SchemaRepositoryModelBuilder addSchema(String id, String location) {
        SchemaModel schema = new SchemaModel();
        schema.setId(id);
        schema.setLocation(location);

        if (model.getSchemas() == null) {
            model.setSchemas(new SchemaRepositoryModel.Schemas());
        }

        model.getSchemas().getSchemas().add(schema);
        return this;
    }
37050
public static void register(Context context, int id) {
        register(context, context.getResources().getResourceName(id));
    }
486085
function setOptions(schema, options) {
  function setDefaults(array) {
    if (!array.length) {
      if (options.find) { array.push('find'); }
      if (options.findOne || !options.find) { array.push('findOne'); }
    }
  }

  options = options || {};

  options.only = options.only || [];
  options.validateBeforeSave = options.validateBeforeSave === undefined
                                ? schema.options.validateBeforeSave
                                : Boolean(options.validateBeforeSave);

  ['virtual', 'attach', 'modify'].filter(prop => options[prop])
    .forEach(
      prop => {
        if (typeof options[prop] !== 'object') {
          options[prop] = {};
        }
        options[prop].properties = options[prop].properties || {};
        options[prop].only = options[prop].only || Object.keys(options[prop].properties);
      }
    );

  if (options.modify) {
    delete options.modify.properties;
    options.modify.on = options.modify.on || [];
    setDefaults(options.modify.on);
  }
  if (options.attach) {
    Object.keys(options.attach.properties).forEach(property => {
      options.attach.properties[property].on = options.attach.properties[property].on || [];
      setDefaults(options.attach.properties[property].on);
    });
  }

  return options;
}
991865
function(name) {
			if (!Array.isArray(name)) {
				name = [name];
			}
			
			name.forEach(function(key) {
				if (key in preferences) {
					delete preferences[key];
				}
				
				if (key in defaults) {
					delete defaults[key];
				}
			});
		}
476214
function registerApp(name, description, permissions) {
  const CONNECTION = new Connection();

  return new Promise((resolve, reject) => {
    CONNECTION.register(name, description, permissions)
      .then(() => resolve(new ConnectionHandler(CONNECTION)))
      .catch((error) => reject(error));
  });
}
306241
function(schemaName, schemaJSON) {
  if (typeof schemaName != 'string' || typeof schemaJSON != 'object') {
    console.error('redblade@schema parameter error')
    return
  }

  SCHEMA[schemaName] = initSchema(schemaJSON, schemaName)
}
1053195
private static SyntaxType register(String id, String name)
    {
        SyntaxType syntaxType = new SyntaxType(id, name);
        KNOWN_SYNTAX_TYPES.put(id, syntaxType);
        return syntaxType;
    }
897192
function Slot(name, elementId) {
  if (this.init_) {
    this.init_();
  }
  this.name = name;
  this.elementId = elementId;
  this.bidProviders = [];
  this.sizes = [];
}
1275652
public void setCurrentSchema(final String schemaName) {
        if (isSwitchFailed()) {
            throw new ShardingException("Failed to switch schema, please terminate current transaction.");
        }
        this.schemaName = schemaName;
        this.logicSchema = LogicSchemas.getInstance().getLogicSchema(schemaName);
    }
410090
public void put(String ID,
                    String alias,
                    boolean visible) {
        registerEntry(ID, new AliasEntry(alias), visible);
    }
510115
function(schemaName, target, cb, options) {
  var schema  = SCHEMA[schemaName]
    , idField = schema._idField_
    , id      = target[idField]
    , options = options || {}

  if (typeof id == 'undefined' || id === '') {
    cb && cb(new Error('update ' + schemaName + ' failed: ID is not exist'))
    return
  }

  var key = schemaName + ':' + id

  client.hgetall(key, function(err, object) {
    if (!object && options.mode != 'insert') {
      cb && cb(err || new Error('update ' + key + ' failed: object doesn\'t exist'))
      return
    }

    filter(schemaName, target, function(err, result) {
      if (err || result === false) {
        cb && cb(err || new Error('update ' + schemaName + ' failed: invalid field value'))
        return
      }

      client.hmset(schemaName + ':' + id, target, function(err) {
        if (err) {
          cb && cb(err)
          return
        }

        filter(schemaName, target, cb, { FUNCS: COMMANDS, mode: options.mode, oldModel: object  })
      })
    }, { FUNCS: FILTERS, mode: options.mode, oldModel: object })

  })

}
630308
void createSchema(HsqlName name, Grantee owner) {

        SqlInvariants.checkSchemaNameNotSystem(name.name);

        Schema schema = new Schema(name, owner);

        schemaMap.add(name.name, schema);
    }
880233
function(name, value) {
			var prefs = name;
			if (typeof name === 'string') {
				prefs = {};
				prefs[name] = value;
			}
			
			Object.keys(prefs).forEach(function(k) {
				var v = prefs[k];
				if (!(k in defaults)) {
					throw new Error('Property "' + k + '" is not defined. You should define it first with `define` method of current module');
				}
				
				// do not set value if it equals to default value
				if (v !== defaults[k].value) {
					// make sure we have value of correct type
					switch (typeof defaults[k].value) {
						case 'boolean':
							v = toBoolean(v);
							break;
						case 'number':
							v = parseInt(v + '', 10) || 0;
							break;
						default: // convert to string
							if (v !== null) {
								v += '';
							}
					}

					preferences[k] = v;
				} else if (k in preferences) {
					delete preferences[k];
				}
			});
		}
612906
protected function _constraint($name, $value, $schema = null) {
		$value += ['options' => []];
		$meta = isset($this->_constraints[$name]) ? $this->_constraints[$name] : null;
		$template = isset($meta['template']) ? $meta['template'] : null;
		if (!$template) {
			return;
		}

		$data = [];
		foreach ($value as $name => $value) {
			switch ($name) {
				case 'key':
				case 'index':
					if (isset($meta[$name])) {
						$data['index'] = $meta[$name];
					}
				break;
				case 'to':
					$data[$name] = $this->name($value);
				break;
				case 'on':
					$data[$name] = "ON {$value}";
				break;
				case 'expr':
					if (is_array($value)) {
						$result = [];
						$context = new Query(['type' => 'none']);
						foreach ($value as $key => $val) {
							$return = $this->_processConditions($key, $val, $context, $schema);
							if ($return) {
								$result[] = $return;
							}
						}
						$data[$name] = join(" AND ", $result);
					} else {
						$data[$name] = $value;
					}
				break;
				case 'toColumn':
				case 'column':
					$data[$name] = join(', ', array_map([$this, 'name'], (array) $value));
				break;
			}
		}

		return trim(Text::insert($template, $data, ['clean' => true]));
	}