Java Code Examples for org.apache.commons.configuration2.Configuration#getInt()

The following examples show how to use org.apache.commons.configuration2.Configuration#getInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PageRankVertexProgram.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@Override
public void loadState(final Graph graph, final Configuration configuration) {
    if (configuration.containsKey(INITIAL_RANK_TRAVERSAL))
        this.initialRankTraversal = PureTraversal.loadState(configuration, INITIAL_RANK_TRAVERSAL, graph);
    if (configuration.containsKey(EDGE_TRAVERSAL)) {
        this.edgeTraversal = PureTraversal.loadState(configuration, EDGE_TRAVERSAL, graph);
        this.incidentMessageScope = MessageScope.Local.of(() -> this.edgeTraversal.get().clone());
        this.countMessageScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.incidentMessageScope));
    }
    this.alpha = configuration.getDouble(ALPHA, this.alpha);
    this.epsilon = configuration.getDouble(EPSILON, this.epsilon);
    this.maxIterations = configuration.getInt(MAX_ITERATIONS, 20);
    this.property = configuration.getString(PROPERTY, PAGE_RANK);
    this.vertexComputeKeys = new HashSet<>(Arrays.asList(
            VertexComputeKey.of(this.property, false),
            VertexComputeKey.of(EDGE_COUNT, true)));
    this.memoryComputeKeys = new HashSet<>(Arrays.asList(
            MemoryComputeKey.of(TELEPORTATION_ENERGY, Operator.sum, true, true),
            MemoryComputeKey.of(VERTEX_COUNT, Operator.sum, true, true),
            MemoryComputeKey.of(CONVERGENCE_ERROR, Operator.sum, false, true)));
}
 
Example 2
Source File: UnshadedKryoShimService.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
private LinkedBlockingQueue<Kryo> initialize(final Configuration configuration) {
    // DCL is safe in this case due to volatility
    if (!INITIALIZED) {
        synchronized (UnshadedKryoShimService.class) {
            if (!INITIALIZED) {
                // so we don't get a WARN that a new configuration is being created within an active context
                final SparkConf sparkConf = null == Spark.getContext() ? new SparkConf() : Spark.getContext().getConf().clone();
                configuration.getKeys().forEachRemaining(key -> sparkConf.set(key, configuration.getProperty(key).toString()));
                final KryoSerializer serializer = new KryoSerializer(sparkConf);
                // Setup a pool backed by our spark.serializer instance
                // Reuse Gryo poolsize for Kryo poolsize (no need to copy this to SparkConf)
                KRYOS.clear();
                final int poolSize = configuration.getInt(GryoPool.CONFIG_IO_GRYO_POOL_SIZE, GryoPool.CONFIG_IO_GRYO_POOL_SIZE_DEFAULT);
                for (int i = 0; i < poolSize; i++) {
                    KRYOS.add(serializer.newKryo());
                }
                INITIALIZED = true;
            }
        }
    }

    return KRYOS;
}
 
Example 3
Source File: PeerPressureVertexProgram.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
public void loadState(final Graph graph, final Configuration configuration) {
    if (configuration.containsKey(INITIAL_VOTE_STRENGTH_TRAVERSAL))
        this.initialVoteStrengthTraversal = PureTraversal.loadState(configuration, INITIAL_VOTE_STRENGTH_TRAVERSAL, graph);
    if (configuration.containsKey(EDGE_TRAVERSAL)) {
        this.edgeTraversal = PureTraversal.loadState(configuration, EDGE_TRAVERSAL, graph);
        this.voteScope = MessageScope.Local.of(() -> this.edgeTraversal.get().clone());
        this.countScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.voteScope));
    }
    this.property = configuration.getString(PROPERTY, CLUSTER);
    this.maxIterations = configuration.getInt(MAX_ITERATIONS, 30);
    this.distributeVote = configuration.getBoolean(DISTRIBUTE_VOTE, false);
}
 
Example 4
Source File: JmxConfiguration.java    From james-project with Apache License 2.0 5 votes vote down vote up
public static JmxConfiguration fromProperties(Configuration configuration) {
    boolean jmxEnabled = configuration.getBoolean("jmx.enabled", true);
    if (!jmxEnabled) {
        return DISABLED;
    }

    String address = configuration.getString("jmx.address", LOCALHOST);
    int port = configuration.getInt("jmx.port", DEFAULT_PORT);
    return new JmxConfiguration(ENABLED, Optional.of(Host.from(address, port)));
}
 
Example 5
Source File: MaxUnknownCmdHandler.java    From james-project with Apache License 2.0 4 votes vote down vote up
@Override
public void init(Configuration config) throws ConfigurationException {
    int maxUnknown = config.getInt("maxUnknownCmdCount", DEFAULT_MAX_UNKOWN);
    setMaxUnknownCmdCount(maxUnknown);        
}
 
Example 6
Source File: MaxRcptHandler.java    From james-project with Apache License 2.0 4 votes vote down vote up
@Override
public void init(Configuration config) throws ConfigurationException {
    int maxRcpt = config.getInt("maxRcpt", 0);
    setMaxRcpt(maxRcpt);        
}