Package org.yaml.snakeyaml

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


        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

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

    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

    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

    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

  }
 
  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

   */
  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

          }
         
          // 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

        return (Map<?,?>)loadYaml(name);
    }

    @SuppressWarnings("unchecked")
    public static <T> T loadYaml(String name, Class<T> clazz) {
        Yaml yaml = new Yaml(new CustomClassLoaderConstructor(clazz, Play.classloader));
        yaml.setBeanAccess(BeanAccess.FIELD);
        return (T)loadYaml(name, yaml);
    }
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.