Examples of YAMLFactory


Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

    Preconditions.checkNotNull(args);
    Preconditions.checkElementIndex(1,args.length);

    // Read the YAML configuration
    ObjectMapper om = new ObjectMapper(new YAMLFactory());
    FileInputStream fis;
    try {
      fis = new FileInputStream(args[1]);
      // Stream will be closed on completion
      this.configuration = om.readValue(fis, SiteConfiguration.class);
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

        super(configSource);
    }

    @Override
    protected ObjectMapper getObjectMapper() {
        return new ObjectMapper(new YAMLFactory()).configure(JsonParser.Feature.ALLOW_COMMENTS, true);
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

        this.klass = klass;
        this.propertyPrefix = propertyPrefix.endsWith(".") ? propertyPrefix : propertyPrefix + '.';
        this.mapper = objectMapper.copy();
        mapper.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
        this.validator = validator;
        this.yamlFactory = new YAMLFactory();
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

     */
    public static void main(final String[] args) {

        Config config;

        config = Config.LoadConfigFromFile(new ObjectMapper(new YAMLFactory()), System.getProperty("user.home") + "/.pgobserver.yaml");
        if ( config == null ) {
            LOG.error("Config could not be read from yaml");
            return;
        }

View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

    public static GossipConfiguration fromYaml(InputStream yaml)
                                                                throws JsonParseException,
                                                                JsonMappingException,
                                                                IOException {
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        mapper.registerModule(new GossipModule());
        return mapper.readValue(yaml, GossipConfiguration.class);
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

*/
public class SimpleJerseyClientExample {

    public SimpleJerseyClientExample() {

        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {

            UrsusJerseyClientConfiguration ursusJerseyClientConfiguration =
                    mapper.readValue(open("jerseyClient.yml"), UrsusJerseyClientConfiguration.class);
            Client client = new UrsusJerseyClientBuilder().using(ursusJerseyClientConfiguration).build();
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

*/
public class SimpleHttpClientExample {

    public SimpleHttpClientExample() {

        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            UrsusHttpClientConfiguration ursusHttpClientConfiguration =
                    mapper.readValue(open("httpClient.yml"), UrsusHttpClientConfiguration.class);
            HttpClient httpClient = new UrsusHttpClientBuilder().build("example", ursusHttpClientConfiguration);
            HttpResponse httpResponse = httpClient.execute(new HttpGet("http://localhost:8080/hello"));
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

   * @param is
   *            the is
   * @return the config
   */
  public static Config load(final InputStream is) {
    final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    try {
      return new Config((ObjectNode) mapper.readTree(is));
    } catch (final JsonProcessingException e) {
      LOG.log(Level.WARNING, "Couldn't parse Yaml file", e);
    } catch (final IOException e) {
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

*/
public class SimpleHttpClientExample {

    public SimpleHttpClientExample(String configFile) {

        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            UrsusHttpClientConfiguration ursusHttpClientConfiguration =
                    mapper.readValue(open(configFile), UrsusHttpClientConfiguration.class);
            HttpClient httpClient = new UrsusHttpClientBuilder().build("example", ursusHttpClientConfiguration);
            HttpResponse httpResponse = httpClient.execute(new HttpGet("http://localhost:8080/hello"));
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.yaml.YAMLFactory

public class SimpleJerseyClientExample {

    public SimpleJerseyClientExample(String configFile) {

        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {

            UrsusJerseyClientConfiguration ursusJerseyClientConfiguration =
                    mapper.readValue(open(configFile), UrsusJerseyClientConfiguration.class);
            Client client = new UrsusJerseyClientBuilder().using(ursusJerseyClientConfiguration).build();
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.