Package org.yaml.snakeyaml.constructor

Examples of org.yaml.snakeyaml.constructor.Constructor


   }

   @Override
   public Map<Image, YamlImage> get() {

      Constructor constructor = new Constructor(Config.class);

      TypeDescription imageDesc = new TypeDescription(YamlImage.class);
      imageDesc.putListPropertyType("images", String.class);
      constructor.addTypeDescription(imageDesc);

      // Issue 855: testng is rev-locking us to snakeyaml 1.6
      // we have to use old constructor until this is fixed
      Yaml yaml = new Yaml(new Loader(constructor));
      Config config = (Config) yaml.load(yamlDescriptor);
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

        final InputStream is = CliClient.class.getClassLoader().getResourceAsStream("org/apache/cassandra/cli/CliHelp.yaml");
        assert is != null;

        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);
        }
View Full Code Here

        final InputStream is = NodeCmd.class.getClassLoader().getResourceAsStream("org/apache/cassandra/tools/NodeToolHelp.yaml");
        assert is != null;

        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);
        }
View Full Code Here

        final InputStream is = CliClient.class.getClassLoader().getResourceAsStream("org/apache/cassandra/cli/CliHelp.yaml");
        assert is != null;

        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);
        }
View Full Code Here

    return parse(new StringReader(yaml));
  }

  /** Helper function to parse workflow from a generic {@link Reader} */
  private static Workflow parse(Reader reader) throws Exception {
    Yaml yaml = new Yaml(new Constructor(WorkflowBean.class));
    WorkflowBean wf = (WorkflowBean) yaml.load(reader);
    Builder builder = new Builder(wf.name);

    for (JobBean job : wf.jobs) {
      if (job.name == null) {
View Full Code Here

        final InputStream is = CliClient.class.getClassLoader().getResourceAsStream("org/apache/cassandra/cli/CliHelp.yaml");
        assert is != null;

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

        final InputStream is =  CliClient.class.getClassLoader().getResourceAsStream("org/apache/cassandra/cli/CliHelp.yaml");
        assert is != null;

        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);
        }
View Full Code Here

     * @return a new {@link Optional} object wrapping the created {@link Settings}
     */
    public static Settings read(final InputStream stream) {
        Objects.requireNonNull(stream);

        final Constructor constructor = new Constructor(Settings.class);
        final TypeDescription settingsDescription = new TypeDescription(Settings.class);
        settingsDescription.putMapPropertyType("graphs", String.class, String.class);
        settingsDescription.putMapPropertyType("scriptEngines", String.class, ScriptEngineSettings.class);
        settingsDescription.putListPropertyType("serializers", SerializerSettings.class);
        settingsDescription.putListPropertyType("use", List.class);
        settingsDescription.putListPropertyType("processors", ProcessorSettings.class);
        constructor.addTypeDescription(settingsDescription);

        final TypeDescription serializerSettingsDescription = new TypeDescription(SerializerSettings.class);
        serializerSettingsDescription.putMapPropertyType("config", String.class, Object.class);
        constructor.addTypeDescription(serializerSettingsDescription);

        final TypeDescription scriptEngineSettingsDescription = new TypeDescription(ScriptEngineSettings.class);
        scriptEngineSettingsDescription.putListPropertyType("imports", String.class);
        scriptEngineSettingsDescription.putListPropertyType("staticImports", String.class);
        scriptEngineSettingsDescription.putListPropertyType("scripts", String.class);
        scriptEngineSettingsDescription.putMapPropertyType("config", String.class, Object.class);
        constructor.addTypeDescription(scriptEngineSettingsDescription);

        final TypeDescription sslSettings = new TypeDescription(SslSettings.class);
        constructor.addTypeDescription(sslSettings);

        final TypeDescription serverMetricsDescription = new TypeDescription(ServerMetrics.class);
        constructor.addTypeDescription(serverMetricsDescription);

        final TypeDescription consoleReporterDescription = new TypeDescription(ConsoleReporterMetrics.class);
        constructor.addTypeDescription(consoleReporterDescription);

        final TypeDescription csvReporterDescription = new TypeDescription(CsvReporterMetrics.class);
        constructor.addTypeDescription(csvReporterDescription);

        final TypeDescription jmxReporterDescription = new TypeDescription(JmxReporterMetrics.class);
        constructor.addTypeDescription(jmxReporterDescription);

        final TypeDescription slf4jReporterDescription = new TypeDescription(Slf4jReporterMetrics.class);
        constructor.addTypeDescription(slf4jReporterDescription);

        final TypeDescription gangliaReporterDescription = new TypeDescription(GangliaReporterMetrics.class);
        constructor.addTypeDescription(gangliaReporterDescription);

        final TypeDescription graphiteReporterDescription = new TypeDescription(GraphiteReporterMetrics.class);
        constructor.addTypeDescription(graphiteReporterDescription);

        final Yaml yaml = new Yaml(constructor);
        return yaml.loadAs(stream, Settings.class);
    }
View Full Code Here

        final InputStream is = NodeCmd.class.getClassLoader().getResourceAsStream("org/apache/cassandra/tools/NodeToolHelp.yaml");
        assert is != null;

        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);
        }
View Full Code Here

TOP

Related Classes of org.yaml.snakeyaml.constructor.Constructor

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.