All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tinkerpop.rexster.protocol.EngineConfiguration Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package com.tinkerpop.rexster.protocol;

import org.apache.commons.configuration.HierarchicalConfiguration;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * Configuration class for a ScriptEngine implementation.
 *
 * @author Stephen Mallette (http://stephen.genoprime.com)
 * @author Blake Eggleston (bdeggleston.github.com)
 */
public class EngineConfiguration {

    private final int resetCount;
    private final Set initScriptFiles;
    private final String scriptEngineName;
    private final Set imports;
    private final Set staticImports;

    public EngineConfiguration(final HierarchicalConfiguration configuration) {
        this.scriptEngineName = configuration.getString("name", "gremlin-groovy");
        this.initScriptFiles = new HashSet(configuration.getList("init-scripts", new ArrayList()));
        this.resetCount = configuration.getInt("reset-threshold", EngineController.RESET_NEVER);
        this.imports = new HashSet(configuration.getList("imports", new ArrayList()));
        this.staticImports = new HashSet(configuration.getList("static-imports", new ArrayList()));
    }

    public EngineConfiguration(final String scriptEngineName, final int resetCount, final String initScriptFile,
                               final Set imports, final Set staticImports) {
        this.resetCount = resetCount;
        this.initScriptFiles = new HashSet();
        this.initScriptFiles.add(initScriptFile);
        this.scriptEngineName = scriptEngineName;
        this.imports = imports;
        this.staticImports = staticImports;
    }

    public int getResetCount() {
        return resetCount;
    }

    public Set getInitScriptFiles() {
        return initScriptFiles;
    }

    public String getScriptEngineName() {
        return scriptEngineName;
    }

    public Set getImports() {
        return imports;
    }

    public Set getStaticImports() {
        return staticImports;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy