public void configure(final Properties configuration) throws ConfigurationException { if (!configuration.containsKey("project")) { throw new ConfigurationException("project is required"); } project = configuration.getProperty("project"); if (!configuration.containsKey(CONFIG_FILE)) { throw new ConfigurationException(CONFIG_FILE + " is required"); } scriptFile = new File(configuration.getProperty(CONFIG_FILE)); if (!scriptFile.isFile()) { throw new ConfigurationException( CONFIG_FILE + " does not exist or is not a file: " + scriptFile.getAbsolutePath()); } interpreter = configuration.getProperty(CONFIG_INTERPRETER); args = configuration.getProperty(CONFIG_ARGS); if (!configuration.containsKey(CONFIG_FORMAT)) { throw new ConfigurationException(CONFIG_FORMAT + " is required"); } format = configuration.getProperty(CONFIG_FORMAT); interpreterArgsQuoted = Boolean.parseBoolean(configuration.getProperty(CONFIG_INTERPRETER_ARGS_QUOTED)); configDataContext = new HashMap<String, Map<String, String>>(); final HashMap<String, String> configdata = new HashMap<String, String>(); configdata.put("project", project); configDataContext.put("context", configdata); executionDataContext = ScriptDataContextUtil.createScriptDataContextForProject(framework, project); executionDataContext.putAll(configDataContext); }
void configure() { if (configuration.containsKey(PROJECT)) { project = configuration.getProperty(PROJECT); } if (configuration.containsKey(FILE)) { nodesFile = new File(configuration.getProperty(FILE)); } if (configuration.containsKey(FORMAT)) { format = configuration.getProperty(FORMAT); } if (configuration.containsKey(GENERATE_FILE_AUTOMATICALLY)) { generateFileAutomatically = Boolean.parseBoolean(configuration.getProperty(GENERATE_FILE_AUTOMATICALLY)); } if (configuration.containsKey(INCLUDE_SERVER_NODE)) { includeServerNode = Boolean.parseBoolean(configuration.getProperty(INCLUDE_SERVER_NODE)); } if (configuration.containsKey(REQUIRE_FILE_EXISTS)) { requireFileExists = Boolean.parseBoolean(configuration.getProperty(REQUIRE_FILE_EXISTS)); } }
public Configuration generateFileAutomatically(boolean generate) { this.generateFileAutomatically = generate; configuration.put(GENERATE_FILE_AUTOMATICALLY, Boolean.toString(generate)); return this; }
public Configuration requireFileExists(boolean require) { this.requireFileExists = require; configuration.put(REQUIRE_FILE_EXISTS, Boolean.toString(requireFileExists)); return this; }
public Configuration includeServerNode(boolean include) { this.includeServerNode = include; configuration.put(INCLUDE_SERVER_NODE, Boolean.toString(include)); return this; }