Package org.yaml.snakeyaml

Examples of org.yaml.snakeyaml.Yaml.dump()


            throw new IOException(msg);
        }

        FileWriter writer = new FileWriter(yamlFile);
        try {
            yaml.dump(cassandraConfig, writer);
            deleteYamlBackupFile(yamlFileBackup);
        } catch (Exception e) {
            log.error("An error occurred while trying to write the updated configuration back to " + yamlFile, e);
            log.error("Reverting changes to " + yamlFile);
View Full Code Here


    Yaml yaml = new Yaml();
    InputStream resourceAsStream =
        ClassLoader.getSystemClassLoader().getResourceAsStream("hello_world_app_spec.yaml");
    HelloworldAppSpec spec = yaml.loadAs(resourceAsStream, HelloworldAppSpec.class);
    String dump = yaml.dump(spec);
    System.out.println(dump);
    System.out.println(spec.getServiceConfig("HelloWorld").getStringField("num_containers", "1"));

  }
}
View Full Code Here

    Yaml yaml = new Yaml();
    InputStream resourceAsStream =
        ClassLoader.getSystemClassLoader().getResourceAsStream("job_runner_app_spec.yaml");
    MyTaskAppSpec spec = yaml.loadAs(resourceAsStream, MyTaskAppSpec.class);
    String dump = yaml.dump(spec);
    System.out.println(dump);
    System.out.println(spec.getServiceConfig("JobRunner").getStringField("num_containers", "1"));

  }
}
View Full Code Here

        representer.addClassTag(ColumnDefinition.class, Tag.MAP);
        Dumper dumper = new Dumper(representer, options);
        Yaml yaml = new Yaml(dumper);
        Keyspaces ks = new Keyspaces();
        ks.keyspaces = keyspaces;
        return yaml.dump(ks);
    }
   
    public class Keyspaces
    {
        public List<RawKeyspace> keyspaces;
View Full Code Here

        representer.addClassTag(ColumnDefinition.class, Tag.MAP);
        Dumper dumper = new Dumper(representer, options);
        Yaml yaml = new Yaml(dumper);
        Keyspaces ks = new Keyspaces();
        ks.keyspaces = keyspaces;
        return yaml.dump(ks);
    }
   
    public class Keyspaces
    {
        public List<RawKeyspace> keyspaces;
View Full Code Here

        representer.addClassTag(ColumnDefinition.class, Tag.MAP);
        Dumper dumper = new Dumper(representer, options);
        Yaml yaml = new Yaml(dumper);
        Keyspaces ks = new Keyspaces();
        ks.keyspaces = keyspaces;
        return yaml.dump(ks);
    }
   
    public class Keyspaces
    {
        public List<RawKeyspace> keyspaces;
View Full Code Here

        FileWriter writer = null;
        try {
            //Set up the file writer
            writer = new FileWriter(this.getFile());
            //And save it
            rawYaml.dump(data.getRaw(), writer);
        } catch (FileNotFoundException ex) {
            try {
                //Maky any parent directories
                this.getFile().getParentFile().mkdirs();
                //See if we can create a file
View Full Code Here

        FileWriter writer = null;
        try {
            //Set up the file writer
            writer = new FileWriter(this.getFile());
            //And save it
            rawYaml.dump(raw, writer);
        } catch (FileNotFoundException ex) {
            try {
                //Maky any parent directories
                this.getFile().getParentFile().mkdirs();
                //See if we can create a file
View Full Code Here

        Yaml yaml = new Yaml(yamlOptions);

        yamlOptions.setIndent(YamlConfiguration.DEFAULT_IDENT);
        yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);

        return yaml.dump(this.getTestData());
    }

    private Map<Object, Object> getTestData() {
        final HashMap<Object, Object> result = new LinkedHashMap<>();
View Full Code Here

      wf.setModules(modules);
     
     
      Yaml ym = new Yaml();
     
      System.out.println(ym.dump(wf));
      String dumpedString = ym.dump(wf);
     
      WorkflowBean loadedBean = (WorkflowBean)ym.load(dumpedString);
     
      int val = 1000;
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.