Examples of Yaml


Examples of org.elasticsearch.common.yaml.snakeyaml.Yaml

public class YamlSettingsLoader implements SettingsLoader {

    @Override public Map<String, String> load(String source) throws IOException {
        // replace tabs with whitespace (yaml does not accept tabs, but many users might use it still...)
        source = source.replace("\t", "  ");
        Yaml yaml = new Yaml();
        Map<Object, Object> yamlMap = (Map<Object, Object>) yaml.load(source);
        StringBuilder sb = new StringBuilder();
        Map<String, String> settings = newHashMap();
        if (yamlMap == null) {
            return settings;
        }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

        GetMethod get = new GetMethod(TEST_URI);

        MyObject o1 = YamlResource.createMyObject();

        String s1 = new Yaml().dump(o1);

        client.executeMethod(get);

        Assert.assertEquals(200, get.getStatusCode());
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

        PostMethod post = new PostMethod(TEST_URI);

        MyObject o1 = YamlResource.createMyObject();

        String s1 = new Yaml().dump(o1);

        post.setRequestEntity(new StringRequestEntity(s1, "text/x-yaml", "utf-8"));

        client.executeMethod(post);
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

public class ApiServer extends Application {
  public ApiServer() {
    super();
    try {
      InputStream i = new FileInputStream(new File("../config.yaml"));
      Yaml yaml = new Yaml();
      Map config = (Map)yaml.load(i);
      System.out.println(config);
    } catch (java.io.FileNotFoundException e) {
    }
  }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

    catch (FileNotFoundException fileException) {
      throw CloudErrorUtil.toCoreException(fileException);
    }

    if (inputStream != null) {
      Yaml yaml = new Yaml();

      try {

        Object results = yaml.load(inputStream);

        if (results instanceof Map<?, ?>) {
          return (Map<Object, Object>) results;
        }
        else {
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

    DumperOptions options = new DumperOptions();
    options.setExplicitStart(true);
    options.setCanonical(false);
    options.setPrettyFlow(true);
    options.setDefaultFlowStyle(FlowStyle.BLOCK);
    Yaml yaml = new Yaml(options);
    String manifestValue = yaml.dump(deploymentInfoYaml);

    if (manifestValue == null) {
      throw CloudErrorUtil.toCoreException("Manifest map for " + appModule.getDeployedApplicationName() //$NON-NLS-1$
          + " contained values but yaml parser failed to serialise the map. : " + deploymentInfoYaml); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

    this.values = values;
    this.reifier = new TypeReifier(values);
  }
 
  public IConstructor loadYAML(IString src, IEvaluatorContext ctx) {
    Yaml yaml = new Yaml();
    Object obj = yaml.load(src.getValue());
    if (obj == null) {
      throw RuntimeExceptionFactory.illegalArgument(src, ctx.getCurrentAST(), ctx.getStackTrace());
    }
    IdentityHashMap<Object, Integer> anchors = new IdentityHashMap<Object, Integer>();
    computeAnchors(obj, anchors, 0);
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

  }
 
  public IString dumpYAML(IConstructor yaml, IEvaluatorContext ctx) {
    Map<Integer, Object> visited = new HashMap<Integer, Object>();
    Object obj = dumpYAMLrec(yaml, visited, ctx);
    Yaml y = new Yaml();
    return values.string(y.dump(obj));
  }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

   */
  public boolean parse(final String configfile) throws WrongFormatException {
    try {
      System.out.print("> Parsing configuration file ... ");
      int num = 0;
      for (Object doc : new Yaml().loadAll(new FileInputStream(new File(configfile)))) {
        ++num;
      
        // whole benchmark section
        // ---------------------------------------------------------------------
        Map<String, Object> bmark = (Map<String, Object>) doc;
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml

          }
         
          // Render yaml file with
          String renderedYaml = TemplateLoader.load(yamlFile).render();
         
      Yaml yaml = new Yaml();
      Object o = yaml.load(renderedYaml);
      if (o instanceof LinkedHashMap<?, ?>) {
        LinkedHashMap<Object, Map<?, ?>> objects = (LinkedHashMap<Object, Map<?, ?>>) o;
        for (Object key : objects.keySet()) {
          Matcher matcher = keyPattern.matcher(key.toString().trim());
          if (matcher.matches()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.