Example usage for org.apache.commons.configuration Configuration setProperty

List of usage examples for org.apache.commons.configuration Configuration setProperty

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration setProperty.

Prototype

void setProperty(String key, Object value);

Source Link

Document

Set a property, this will replace any previously set values.

Usage

From source file:org.apache.tinkerpop.gremlin.hadoop.process.computer.spark.io.OutputRDDTest.java

@Test
public void shouldWriteToArbitraryRDD() throws Exception {
    final Configuration configuration = new BaseConfiguration();
    configuration.setProperty("spark.master", "local[4]");
    configuration.setProperty("spark.serializer", "org.apache.spark.serializer.KryoSerializer");
    configuration.setProperty(Graph.GRAPH, HadoopGraph.class.getName());
    configuration.setProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION,
            HadoopGraphProvider.PATHS.get("tinkerpop-modern.kryo"));
    configuration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT,
            GryoInputFormat.class.getCanonicalName());
    configuration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_OUTPUT_RDD,
            ExampleOutputRDD.class.getCanonicalName());
    configuration.setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, "hadoop-gremlin/target/test-output");
    configuration.setProperty(Constants.GREMLIN_HADOOP_JARS_IN_DISTRIBUTED_CACHE, false);
    /////////* ww  w.  j  a  v  a 2 s .  co m*/
    Graph graph = GraphFactory.open(configuration);
    graph.compute(SparkGraphComputer.class).result(GraphComputer.ResultGraph.NEW)
            .persist(
                    GraphComputer.Persist.EDGES)
            .program(TraversalVertexProgram.build()
                    .traversal(
                            GraphTraversalSource.build()
                                    .engine(ComputerTraversalEngine.build().computer(SparkGraphComputer.class)),
                            "gremlin-groovy", "g.V()")
                    .create(graph))
            .submit().get();
}

From source file:org.apache.tinkerpop.gremlin.hadoop.process.computer.util.MemoryMapReduce.java

@Override
public void storeState(final Configuration configuration) {
    super.storeState(configuration);
    configuration.setProperty(Constants.GREMLIN_HADOOP_MEMORY_KEYS, new ArrayList<>(this.memoryKeys.size()));
}

From source file:org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph.java

/**
 * Construct a Neo4jGraph instance by specifying the directory to create the database in..
 *//*from   ww w  .  j ava 2s.co m*/
public static Neo4jGraph open(final String directory) {
    final Configuration config = new BaseConfiguration();
    config.setProperty(CONFIG_DIRECTORY, directory);
    return open(config);
}

From source file:org.apache.tinkerpop.gremlin.process.computer.bulkloading.BulkLoaderVertexProgramTest.java

private Configuration getWriteGraphConfiguration() {
    final Configuration configuration = new BaseConfiguration();
    configuration.setProperty(Graph.GRAPH, "org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph");
    configuration.setProperty("gremlin.tinkergraph.graphLocation", TINKERGRAPH_LOCATION);
    configuration.setProperty("gremlin.tinkergraph.graphFormat", "gryo");
    return configuration;
}

From source file:org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.ClusterCountMapReduce.java

@Override
public void storeState(final Configuration configuration) {
    super.storeState(configuration);
    configuration.setProperty(CLUSTER_COUNT_MEMORY_KEY, this.memoryKey);
}

From source file:org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.ClusterPopulationMapReduce.java

@Override
public void storeState(final Configuration configuration) {
    super.storeState(configuration);
    configuration.setProperty(CLUSTER_POPULATION_MEMORY_KEY, this.memoryKey);
}

From source file:org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgram.java

@Override
public void storeState(final Configuration configuration) {
    super.storeState(configuration);
    configuration.setProperty(PROPERTY, this.property);
    configuration.setProperty(MAX_ITERATIONS, this.maxIterations);
    configuration.setProperty(DISTRIBUTE_VOTE, this.distributeVote);
    if (null != this.edgeTraversal)
        this.edgeTraversal.storeState(configuration, EDGE_TRAVERSAL);
}

From source file:org.apache.tinkerpop.gremlin.process.computer.lambda.LambdaMapReduce.java

@Override
public void storeState(final Configuration configuration) {
    super.storeState(configuration);
    if (null != this.mapLambdaHolder)
        this.mapLambdaHolder.storeState(configuration);
    if (null != this.mapKeySortLambdaHolder)
        this.mapKeySortLambdaHolder.storeState(configuration);
    if (null != this.combineLambdaHolder)
        this.combineLambdaHolder.storeState(configuration);
    if (null != this.reduceLambdaHolder)
        this.reduceLambdaHolder.storeState(configuration);
    if (null != this.reduceKeySortLambdaHolder)
        this.reduceKeySortLambdaHolder.storeState(configuration);
    if (null != this.memoryLambdaHolder)
        this.memoryLambdaHolder.storeState(configuration);
    configuration.setProperty(MEMORY_KEY, this.memoryKey);
}

From source file:org.apache.tinkerpop.gremlin.process.computer.MapReduce.java

/**
 * When it is necessary to store the state of a MapReduce job, this method is called.
 * This is typically required when the MapReduce job needs to be serialized to another machine.
 * Note that what is stored is simply the instance state, not any processed data.
 *
 * @param configuration the configuration to store the state of the MapReduce job in.
 *//*  w w w .  j  ava 2  s .  c o m*/
public default void storeState(final Configuration configuration) {
    configuration.setProperty(MAP_REDUCE, this.getClass().getName());
}

From source file:org.apache.tinkerpop.gremlin.process.computer.ranking.pagerank.PageRankMapReduce.java

@Override
public void storeState(final Configuration configuration) {
    super.storeState(configuration);
    configuration.setProperty(PAGE_RANK_MEMORY_KEY, this.memoryKey);
}