Example usage for com.fasterxml.jackson.dataformat.yaml YAMLFactory YAMLFactory

List of usage examples for com.fasterxml.jackson.dataformat.yaml YAMLFactory YAMLFactory

Introduction

In this page you can find the example usage for com.fasterxml.jackson.dataformat.yaml YAMLFactory YAMLFactory.

Prototype

public YAMLFactory() 

Source Link

Document

Default constructor used to create factory instances.

Usage

From source file:com.chiralBehaviors.slp.hive.configuration.HiveScopeConfiguration.java

public static HiveScopeConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.registerModule(new EngineModule());
    return mapper.readValue(yaml, HiveScopeConfiguration.class);
}

From source file:com.vmware.photon.controller.api.frontend.config.ConfigurationUtils.java

public static ApiFeConfiguration parseConfiguration(String filename)
        throws IOException, ConfigurationException {
    ObjectMapper objectMapper = Jackson.newObjectMapper(new YAMLFactory());
    ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class).configure()
            .addValidatedValueHandler(new OptionalValidatedValueUnwrapper()).buildValidatorFactory();
    final ConfigurationFactory<ApiFeStaticConfiguration> configurationFactory = new DefaultConfigurationFactoryFactory<ApiFeStaticConfiguration>()
            .create(ApiFeStaticConfiguration.class, validatorFactory.getValidator(), objectMapper, "dw");
    checkArgument(StringUtils.isNotBlank(filename), "filename cannot be blank");
    final File file = new File(filename);
    if (!file.exists()) {
        throw new FileNotFoundException("File " + file + " not found");
    }/*  w ww.  j  av a2 s.c o  m*/
    return configurationFactory.build(file);
}

From source file:io.fabric8.kubernetes.client.internal.SerializationUtils.java

public static ObjectMapper getMapper() {
    if (mapper == null) {
        mapper = new ObjectMapper(new YAMLFactory());
    }/*from  w  w  w . j  av a  2s .  com*/
    return mapper;
}

From source file:com.chiralBehaviors.slp.hive.configuration.MulticastConfiguration.java

public static MulticastConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    //mapper.registerModule(new EngineModule());
    return mapper.readValue(yaml, MulticastConfiguration.class);
}

From source file:com.hellblazer.slp.jmx.JmxDiscoveryConfiguration.java

public static JmxDiscoveryConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
    objectMapper.registerModule(new DiscoveryModule());
    return objectMapper.readValue(yaml, JmxDiscoveryConfiguration.class);
}

From source file:com.chiralBehaviors.slp.hive.hardtack.configuration.AggregatorConfiguration.java

public static AggregatorConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    return mapper.readValue(yaml, AggregatorConfiguration.class);
}

From source file:org.apache.myriad.scheduler.resource.TestResourceOfferContainer.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    cfg = mapper.readValue(/*from   www .j  a va  2 s  . c  o  m*/
            Thread.currentThread().getContextClassLoader().getResource("myriad-config-test-default.yml"),
            MyriadConfiguration.class);
}

From source file:com.hellblazer.glassHouse.discovery.HubConfiguration.java

public static HubConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.registerModule(new DiscoveryModule());
    return mapper.readValue(yaml, HubConfiguration.class);
}

From source file:org.fasterxml.jackson.tc.TreeTest.java

static <T extends Enum<T>, K> K transcodeFromMap(Map<T, Object> configuration,
        TypeReference<K> configurationType) {
    ObjectMapper mapper = TestEnumModule.setupObjectMapper(new ObjectMapper(new YAMLFactory()));
    JsonNode tree = mapper.valueToTree(configuration);
    try {/*from w  w  w  .  ja v a2 s.c  o m*/
        return mapper.readerFor(configurationType).readValue(tree);
    } catch (IOException e) {
        throw new RuntimeException(
                "Failed to map configuration map to object of type " + configurationType.toString(), e);
    }
}

From source file:com.chiralBehaviors.slp.hive.configuration.BroadcastConfiguration.java

public static BroadcastConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.registerModule(new EngineModule());
    return mapper.readValue(yaml, BroadcastConfiguration.class);
}