Package org.springframework.boot.config

Examples of org.springframework.boot.config.SimpleConfigMetadataRepository


    Collection<EntityModel> model = parseEntityModel();
    msg.printMessage(Diagnostic.Kind.NOTE, "Processing '" + model.size() + "' entities.");

    // Build the initial repository
    SimpleConfigMetadataRepository repository = buildConfigMetadataRepository(model);

    // Post process the detect the conditions
    harvestConditions(repository);

    // Write the result
View Full Code Here


    }
    return result;
  }

  private SimpleConfigMetadataRepository buildConfigMetadataRepository(Collection<EntityModel> content) {
    SimpleConfigMetadataRepository repository = new SimpleConfigMetadataRepository();
    for (EntityModel entityModel : content) {
      if (!entityModel.isEmpty()) { // Register group only if the model is not empty
        ConfigMetadataGroup rootGroup = ConfigMetadataGroup.root(entityModel.getPrefix());
        fillConfigMetadataGroup(rootGroup, entityModel);
        repository.registerRootGroup(rootGroup);
      }
    }
    return repository;
  }
View Full Code Here

    Assert.notNull(resources, "Resources must not be null");
    if (resources.size() == 1) {
      return load(resources.iterator().next());
    }

    SimpleConfigMetadataRepository repository = new SimpleConfigMetadataRepository();
    for (Resource resource : resources) {
      ConfigMetadataRepository repo = load(resource);
      repository.include(repo);
    }
    return repository;
  }
View Full Code Here

  @Override
  public ConfigMetadataRepository readRepository(InputStream in) throws IOException {
    String content = read(in);
    JSONObject json = new JSONObject(content);

    SimpleConfigMetadataRepository repository = new SimpleConfigMetadataRepository();
    if (json.has(GROUPS)) {
      JSONObject rootGroups = json.getJSONObject(GROUPS);
      for (Object o : rootGroups.keySet()) {
        String groupName = (String) o;
        JSONObject rootGroup = rootGroups.getJSONObject(groupName);
        ConfigMetadataGroup group = ConfigMetadataGroup.root(groupName);
        readGroup(rootGroup, group);
        repository.registerRootGroup(group);
      }
    }
    if (json.has(ITEMS)) {
      ConfigMetadataGroup group = ConfigMetadataGroup.root("");
      JSONObject items = json.getJSONObject(ITEMS);
      for (Object o : items.keySet()) {
        String itemName = (String) o;
        JSONObject item = items.getJSONObject(itemName);
        group.registerItem(readItem(group, item, itemName));
      }
      repository.registerRootGroup(group);
    }

    return repository;
  }
View Full Code Here

TOP

Related Classes of org.springframework.boot.config.SimpleConfigMetadataRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.