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

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

Introduction

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

Prototype

@Override
public void read(final InputStream in) throws ConfigurationException 

Source Link

Document

Loads the configuration from the given input stream.

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);

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