Example usage for org.apache.commons.configuration2 YAMLConfiguration YAMLConfiguration

List of usage examples for org.apache.commons.configuration2 YAMLConfiguration YAMLConfiguration

Introduction

In this page you can find the example usage for org.apache.commons.configuration2 YAMLConfiguration YAMLConfiguration.

Prototype

public YAMLConfiguration() 

Source Link

Document

Creates a new instance of YAMLConfiguration .

Usage

From source file:org.linqs.psl.cli.DataLoader.java

public static Set<StandardPredicate> load(DataStore dataStore, String path, boolean useIntIds)
        throws ConfigurationException, FileNotFoundException {
    InputStream inputStream = new FileInputStream(path);

    YAMLConfiguration yaml = new YAMLConfiguration();
    yaml.read(inputStream);//www.  j av  a2  s .  c  o  m

    // Make sure to get the absolute path so we can take the parent.
    path = (new File(path)).getAbsolutePath();

    // All non-absolute paths should be relative to the data file.
    String relativeDir = (new File(path)).getParentFile().getAbsolutePath();

    // Fetch the predicates.
    Set<StandardPredicate> closedPredicates = parsePredicates(yaml, useIntIds, dataStore);

    // Load the partitions.
    loadPartitions(yaml, dataStore, relativeDir);

    return closedPredicates;
}