/** * Get a string associated with the given configuration key. * * @param key The configuration key. * @return The associated string. * @throws ClassCastException is thrown if the key maps to an * object that is not a String. */ public String getString(String key) { return getString(key, null); }
/** * String property accessor method with default to hide the * configuration implementation. * * @param key property key * @param defaultValue default value to return if key not * found in resource manager. * @return value of key or default */ public String getString( String key, String defaultValue) { return configuration.getString(key, defaultValue); }
/** * String property accessor method to hide the configuration implementation * @param key property key * @return value of key or null */ public String getString(String key) { return StringUtils.trim(configuration.getString(key)); }
@Override public void init(ExtProperties configuration) { base = configuration.getString("base"); if (!base.endsWith("/")) { base = base + "/"; } }
/** * @see ResourceLoader#init(org.apache.velocity.util.ExtProperties) */ public void init(ExtProperties configuration) { dataSourceName = StringUtils.trim(configuration.getString("resource.datasource")); tableName = StringUtils.trim(configuration.getString("resource.table")); keyColumn = StringUtils.trim(configuration.getString("resource.keycolumn")); templateColumn = StringUtils.trim(configuration.getString("resource.templatecolumn")); timestampColumn = StringUtils.trim(configuration.getString("resource.timestampcolumn")); if (dataSource != null) { log.debug("DataSourceResourceLoader: using dataSource instance with table \"{}\"", tableName); log.debug("DataSourceResourceLoader: using columns \"{}\", \"{}\" and \"{}\"", keyColumn, templateColumn, timestampColumn); log.trace("DataSourceResourceLoader initialized."); } else if (dataSourceName != null) { log.debug("DataSourceResourceLoader: using \"{}\" datasource with table \"{}\"", dataSourceName, tableName); log.debug("DataSourceResourceLoader: using columns \"{}\", \"{}\" and \"{}\"", keyColumn, templateColumn, timestampColumn); log.trace("DataSourceResourceLoader initialized."); } else { String msg = "DataSourceResourceLoader not properly initialized. No DataSource was identified."; log.error(msg); throw new RuntimeException(msg); } }
@Override public void init(ExtProperties configuration) { super.init(configuration); root = configuration.getString("path"); if (S.blank(root)) { root = "/" + VelocityView.ID; } }
String loaderName = configuration.getString(RuntimeConstants.RESOURCE_LOADER_IDENTIFIER); log = rsvc.getLog("loader." + (loaderName == null ? this.getClass().getSimpleName() : loaderName)); String msg = "Exception parsing cache setting: " + configuration.getString("cache"); log.error(msg, e); throw new VelocityException(msg, e); String msg = "Exception parsing modificationCheckInterval setting: " + configuration.getString("modificationCheckInterval"); log.error(msg, e); throw new VelocityException(msg, e); try className = configuration.getString("class", className);
String repoClass = configuration.getString(REPOSITORY_CLASS, REPOSITORY_CLASS_DEFAULT); String repoName = configuration.getString(REPOSITORY_NAME, REPOSITORY_NAME_DEFAULT); boolean isStatic = configuration.getBoolean(REPOSITORY_STATIC, REPOSITORY_STATIC_DEFAULT); String encoding = configuration.getString(REPOSITORY_ENCODING);
protected void readData(ExtProperties dataset) { if (dataset != null) { for (Iterator i = dataset.getKeys(); i.hasNext(); ) { String key = (String)i.next(); // if it contains a period, it can't be a context key; // it must be a data property. ignore it for now. if (key.indexOf('.') >= 0) { continue; } Data data = new Data(); data.setKey(key); data.setValue(dataset.getString(key)); // get/set the type/converter properties ExtProperties props = dataset.subset(key); setProperties(props, data); addData(data); } } }
return interpolate(defaults.getString(key, defaultValue));
String loaderClass = StringUtils.trim(configuration.getString("class")); ResourceLoader loaderInstance = (ResourceLoader) configuration.get("instance"); configuration.getString(RuntimeConstants.RESOURCE_LOADER_IDENTIFIER) + ".resource.loader.class' specification in configuration." + " This is a critical value. Please adjust configuration.";
protected void readProperties(ExtProperties configProps, Configuration config) { ExtProperties properties = configProps.subset("property"); if (properties != null) { for (Iterator i = properties.getKeys(); i.hasNext(); ) { String name = (String)i.next(); String value = properties.getString(name); ExtProperties propProps = properties.subset(name); if (propProps.size() == 1) { // then set this as a 'simple' property config.setProperty(name, value); } else { // add it as a convertable property Property property = new Property(); property.setName(name); property.setValue(value); // set the type/converter properties setProperties(propProps, property); } } } }