Package org.yaml.snakeyaml

Examples of org.yaml.snakeyaml.Yaml


        /* Use Tag.MAP to avoid the class name being included as global tag */
        representer.addClassTag(RawColumnFamily.class, Tag.MAP);
        representer.addClassTag(Keyspaces.class, Tag.MAP);
        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);
    }
View Full Code Here


            }
            org.yaml.snakeyaml.constructor.Constructor constructor = new org.yaml.snakeyaml.constructor.Constructor(Config.class);
            TypeDescription seedDesc = new TypeDescription(SeedProviderDef.class);
            seedDesc.putMapPropertyType("parameters", String.class, String.class);
            constructor.addTypeDescription(seedDesc);
            Yaml yaml = new Yaml(new Loader(constructor));
            conf = (Config)yaml.load(input);

            logger.info("Data files directories: " + Arrays.toString(conf.data_file_directories));
            logger.info("Commit log directory: " + conf.commitlog_directory);

            if (conf.commitlog_sync == null)
View Full Code Here

        try
        {
            final Constructor constructor = new Constructor(NodeToolHelp.class);
            TypeDescription desc = new TypeDescription(NodeToolHelp.class);
            desc.putListPropertyType("commands", NodeToolHelp.NodeToolCommand.class);
            final Yaml yaml = new Yaml(new Loader(constructor));
            return (NodeToolHelp)yaml.load(is);
        }
        finally
        {
            FileUtils.closeQuietly(is);
        }
View Full Code Here

        try
        {
            final Constructor constructor = new Constructor(CliUserHelp.class);
            TypeDescription desc = new TypeDescription(CliUserHelp.class);
            desc.putListPropertyType("commands", CliCommandHelp.class);
            final Yaml yaml = new Yaml(new Loader(constructor));
            return (CliUserHelp) yaml.load(is);
        }
        finally
        {
            FileUtils.closeQuietly(is);
        }
View Full Code Here

        assert is != null;

        try
        {
            final Constructor constructor = new Constructor(NodeToolHelp.class);
            final Yaml yaml = new Yaml(constructor);
            return (NodeToolHelp)yaml.load(is);
        }
        finally
        {
            FileUtils.closeQuietly(is);
        }
View Full Code Here

            @Override
            public int compare(Map<String, String> left, Map<String, String> right) {
              return left.get("name").compareTo(right.get("name"));
            }}));
    }
    new Yaml().dump(data, w);
  }
View Full Code Here

        try
        {
            final Constructor constructor = new Constructor(CliUserHelp.class);
            TypeDescription desc = new TypeDescription(CliUserHelp.class);
            desc.putListPropertyType("commands", CliCommandHelp.class);
            final Yaml yaml = new Yaml(new Loader(constructor));
            return (CliUserHelp)yaml.load(is);
        }
        finally
        {
            try
            {
View Full Code Here

    String gazbinDir = gazbinFile.getParent();
    String gazbinName = gazbinFile.getName();
   
    // Always read the yaml file so we can get any special location of the cache
    // file or figure out that we should not try to load the cache file
    Yaml yaml = new Yaml();
    BufferedReader yamlReader =
        new BomStrippingInputStreamReader((configFileURL).openStream(), encoding);
    Object configObject = yaml.load(yamlReader);

    List<Map> configListFiles = null;
    if(configObject instanceof Map) {
      Map<String,Object> configMap = (Map<String,Object>)configObject;
      String configCacheDirName = (String)configMap.get("cacheDir");
View Full Code Here

    }

    Config config;
    if (Files.exists(configFile)) {
      try (InputStream is = Files.newInputStream(configFile)) {
        Yaml yaml = new Yaml();
        config = yaml.loadAs(is, Config.class);
      }
    } else {
      config = new Config();
    }
View Full Code Here

      return value;
   }

   protected List<?> loadYamlData(final Reader io) throws IOException {
      final Yaml yaml = new Yaml(new Constructor(), new Representer(),
            new DumperOptions(), new YamlParserResolver());
      final Object loadedYaml = yaml.load(io);

      if (loadedYaml instanceof ArrayList) {
         return (ArrayList<?>) loadedYaml;
      }
View Full Code Here

TOP

Related Classes of org.yaml.snakeyaml.Yaml

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.