private void execute0() throws IOException, MojoExecutionException { velocity = new RuntimeInstance(); final ExtProperties p = new ExtProperties(); velocity.setConfiguration(p);
/** * Allows an external system to set a property in * the Velocity Runtime. * * @param key property key * @param value property value */ public void setProperty(String key, Object value) { if (overridingProperties == null) { overridingProperties = new ExtProperties(); } overridingProperties.setProperty(key, value); }
/** * Convert a Map into a configuration class. * <p> * NOTE: From Commons Collections 3.2 this method will pick up * any default parent Properties of the specified input object. * * @param props the Map object to convert * @return new ExtProperties created from props */ public static ExtProperties convertProperties(Map props) { ExtProperties c = new ExtProperties(); for (Map.Entry entry : (Set<Map.Entry>)props.entrySet()) { c.setProperty(String.valueOf(entry.getKey()), entry.getValue()); } return c; }
/** * Convert a standard properties class into a configuration class. * <p> * NOTE: From Commons Collections 3.2 this method will pick up * any default parent Properties of the specified input object. * * @param props the properties object to convert * @return new ExtProperties created from props */ public static ExtProperties convertProperties(Properties props) { ExtProperties c = new ExtProperties(); for (Enumeration e = props.propertyNames(); e.hasMoreElements();) { String s = (String) e.nextElement(); c.setProperty(s, props.getProperty(s)); } return c; }
/** * Add a property to the configuration. If it already * exists then the value stated here will be added * to the configuration entry. For example, if * * resource.loader = file * * is already present in the configuration and you * * addProperty("resource.loader", "classpath") * * Then you will end up with a Vector like the * following: * * ["file", "classpath"] * * @param key * @param value */ public void addProperty(String key, Object value) { if (overridingProperties == null) { overridingProperties = new ExtProperties(); } overridingProperties.addProperty(key, value); }
/** * Resets the instance, so Velocity can be re-initialized again. * * @since 2.0.0 */ public synchronized void reset() { this.configuration = new ExtProperties(); this.defaultEncoding = null; this.evaluateScopeName = "evaluate"; this.eventCartridge = null; this.initialized = false; this.initializing = false; this.overridingProperties = null; this.parserPool = null; this.provideEvaluateScope = false; this.resourceManager = null; this.runtimeDirectives = new Hashtable(); this.runtimeDirectivesShared = null; this.uberSpect = null; this.stringInterning = false; /* * create a VM factory, introspector, and application attributes */ vmFactory = new VelocimacroFactory( this ); /* * and a store for the application attributes */ applicationAttributes = new HashMap(); }
defaults = new ExtProperties(defaultFile);
/** * <p>Reads an properties file from an {@link InputStream} * and uses it to configure this {@link FactoryConfiguration}.</p> * * @param url the URL to read from */ protected void readImpl(URL url) throws IOException { ExtProperties props = new ExtProperties(); props.load(url.openStream()); // all factory settings should be prefixed with "tools" read(props.subset("tools")); }
ExtProperties c = new ExtProperties(); Iterator keys = getKeys(); boolean validSubset = false;
private void execute0() throws IOException, MojoExecutionException { velocity = new RuntimeInstance(); final ExtProperties p = new ExtProperties(); velocity.setConfiguration(p);
/** * Add all properties contained in the file fileName to the RuntimeInstance properties */ public void setProperties(String fileName) { ExtProperties props = null; try { props = new ExtProperties(fileName); } catch (IOException e) { throw new VelocityException("Error reading properties from '" + fileName + "'", e); } Enumeration en = props.keys(); while (en.hasMoreElements()) { String key = en.nextElement().toString(); setProperty(key, props.get(key)); } }
/** * Initialize the Velocity Runtime with a * properties file path. * * @param configurationFile */ public void init(String configurationFile) { try { setConfiguration(new ExtProperties(configurationFile)); } catch (IOException e) { throw new VelocityException("Error reading properties from '" + configurationFile + "'", e); } init(); }