Example usage for org.apache.commons.configuration BaseConfiguration copy

List of usage examples for org.apache.commons.configuration BaseConfiguration copy

Introduction

In this page you can find the example usage for org.apache.commons.configuration BaseConfiguration copy.

Prototype

public void copy(Configuration c) 

Source Link

Document

Copies the content of the specified configuration into this configuration.

Usage

From source file:org.apache.tinkerpop.gremlin.hadoop.structure.io.InputOutputHelper.java

public static HadoopGraph getOutputGraph(final Configuration configuration,
        final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
    final HadoopConfiguration hadoopConfiguration = new HadoopConfiguration(configuration);
    final BaseConfiguration newConfiguration = new BaseConfiguration();
    newConfiguration.copy(hadoopConfiguration);
    if (resultGraph.equals(GraphComputer.ResultGraph.NEW)) {
        newConfiguration.setProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION,
                hadoopConfiguration.getOutputLocation());
        if (hadoopConfiguration.containsKey(Constants.GREMLIN_HADOOP_GRAPH_OUTPUT_FORMAT))
            newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT, InputOutputHelper
                    .getInputFormat(hadoopConfiguration.getGraphOutputFormat()).getCanonicalName());
        newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT_HAS_EDGES,
                persist.equals(GraphComputer.Persist.EDGES));
    }/*from  w  w w .j  a  v  a  2  s.com*/
    newConfiguration.setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION,
            hadoopConfiguration.getOutputLocation() + "_");
    return HadoopGraph.open(newConfiguration);
}

From source file:org.apache.tinkerpop.gremlin.hadoop.structure.util.HadoopHelper.java

public static HadoopGraph getOutputGraph(final HadoopGraph hadoopGraph,
        final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
    final BaseConfiguration newConfiguration = new BaseConfiguration();
    newConfiguration.copy(hadoopGraph.configuration());
    if (resultGraph.equals(GraphComputer.ResultGraph.NEW)) {
        newConfiguration.setProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION,
                hadoopGraph.configuration().getOutputLocation() + "/" + Constants.HIDDEN_G);
        if (hadoopGraph.configuration().containsKey(Constants.GREMLIN_HADOOP_GRAPH_OUTPUT_FORMAT))
            newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT, InputOutputHelper
                    .getInputFormat(hadoopGraph.configuration().getGraphOutputFormat()).getCanonicalName());
        newConfiguration.setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION,
                hadoopGraph.configuration().getOutputLocation() + "_");
        newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT_HAS_EDGES,
                persist.equals(GraphComputer.Persist.EDGES));
    } else {/*from  www. j a v a 2 s. c om*/
        newConfiguration.setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION,
                hadoopGraph.configuration().getOutputLocation() + "_");
    }
    return HadoopGraph.open(newConfiguration);
}

From source file:org.apache.tinkerpop.gremlin.spark.structure.io.InputOutputHelper.java

public static HadoopGraph getOutputGraph(final Configuration configuration,
        final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
    try {// ww w. ja v a2  s .c o  m
        final HadoopConfiguration hadoopConfiguration = new HadoopConfiguration(configuration);
        final BaseConfiguration newConfiguration = new BaseConfiguration();
        newConfiguration.copy(org.apache.tinkerpop.gremlin.hadoop.structure.io.InputOutputHelper
                .getOutputGraph(configuration, resultGraph, persist).configuration());
        if (resultGraph.equals(GraphComputer.ResultGraph.NEW)
                && hadoopConfiguration.containsKey(Constants.GREMLIN_SPARK_GRAPH_OUTPUT_RDD)) {
            newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT,
                    InputRDDFormat.class.getCanonicalName());
            //newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_OUTPUT_FORMAT, OutputRDDFormat.class.getCanonicalName());
            newConfiguration.setProperty(Constants.GREMLIN_SPARK_GRAPH_INPUT_RDD,
                    InputOutputHelper
                            .getInputFormat((Class) Class.forName(
                                    hadoopConfiguration.getString(Constants.GREMLIN_SPARK_GRAPH_OUTPUT_RDD)))
                            .getCanonicalName());
        }
        return HadoopGraph.open(newConfiguration);
    } catch (final ClassNotFoundException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}

From source file:org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration.java

@Override
public WriteConfiguration copy() {
    BaseConfiguration copy = new BaseConfiguration();
    copy.copy(config);
    return new CommonsConfiguration(copy);
}