use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration in project hadoop by apache.
the class TestMetricsConfig method testInstances.
private void testInstances(MetricsConfig c) throws Exception {
Map<String, MetricsConfig> map = c.getInstanceConfigs("t1");
Map<String, MetricsConfig> map2 = c.getInstanceConfigs("t2");
assertEquals("number of t1 instances", 2, map.size());
assertEquals("number of t2 instances", 1, map2.size());
assertTrue("contains t1 instance i1", map.containsKey("i1"));
assertTrue("contains t1 instance 42", map.containsKey("42"));
assertTrue("contains t2 instance i1", map2.containsKey("i1"));
MetricsConfig t1i1 = map.get("i1");
MetricsConfig t1i42 = map.get("42");
MetricsConfig t2i1 = map2.get("i1");
LOG.debug("--- t1 instance i1:" + t1i1);
LOG.debug("--- t1 instance 42:" + t1i42);
LOG.debug("--- t2 instance i1:" + t2i1);
Configuration t1expected1 = new ConfigBuilder().add("name", "p1.t1.i1.name").config;
Configuration t1expected42 = new ConfigBuilder().add("bar", "p1.t1.42.bar").config;
Configuration t2expected1 = new ConfigBuilder().add("foo", "p1.t2.i1.foo").config;
assertEq(t1expected1, t1i1);
assertEq(t1expected42, t1i42);
assertEq(t2expected1, t2i1);
LOG.debug("asserting foo == default foo");
// Check default lookups
assertEquals("value of foo in t1 instance i1", "default foo", t1i1.getString("foo"));
assertEquals("value of bar in t1 instance i1", "p1.t1 default bar", t1i1.getString("bar"));
assertEquals("value of foo in t1 instance 42", "default foo", t1i42.getString("foo"));
assertEquals("value of foo in t2 instance i1", "p1.t2.i1.foo", t2i1.getString("foo"));
assertEquals("value of bar in t2 instance i1", "p1 default bar", t2i1.getString("bar"));
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration in project engine by craftercms.
the class GroovyScriptUtils method addSiteConfigVariable.
private static void addSiteConfigVariable(Map<String, Object> variables) {
SiteContext siteContext = SiteContext.getCurrent();
Configuration config = null;
if (siteContext != null) {
config = siteContext.getConfig();
}
variables.put(VARIABLE_SITE_CONFIG, config);
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration in project engine by craftercms.
the class MultiResourceConfigurationBuilder method getConfiguration.
@Override
public HierarchicalConfiguration getConfiguration() throws ConfigurationException {
List<HierarchicalConfiguration> configs = new ArrayList<>();
// Last configurations should be loaded and added first so that they have greater priority.
logger.info("Loading XML configurations in the order in which the properties will be resolved");
for (int i = configPaths.length - 1; i >= 0; i--) {
try {
Resource resource = resourceLoader.getResource(configPaths[i]);
if (resource.exists()) {
Map<String, Lookup> prefixLookups = null;
if (configDecryptor != null) {
prefixLookups = Collections.singletonMap(encryptedValuePrefix, new DecryptionLookup(configDecryptor));
}
XMLConfiguration config = ConfigUtils.readXmlConfiguration(resource, configListDelimiter, prefixLookups);
logger.info("XML configuration loaded from " + resource);
configs.add(config);
}
} catch (Exception e) {
throw new ConfigurationException("Unable to load configuration at " + configPaths[i], e);
}
}
if (configs.size() > 1) {
CombinedConfiguration combinedConfig = new CombinedConfiguration(new OverrideCombiner());
for (Configuration config : configs) {
combinedConfig.addConfiguration(config);
}
return combinedConfig;
} else if (configs.size() == 1) {
return configs.get(0);
} else {
return null;
}
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration in project cas by apereo.
the class CasConfigurationPropertiesEnvironmentManager method savePropertyForStandaloneProfile.
/**
* Save property for standalone profile.
*
* @param pair the pair
*/
@SneakyThrows
public void savePropertyForStandaloneProfile(final Pair<String, String> pair) {
final File file = getStandaloneProfileConfigurationDirectory();
final Parameters params = new Parameters();
final FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class).configure(params.properties().setFile(new File(file, getApplicationName() + ".properties")));
final Configuration config = builder.getConfiguration();
config.setProperty(pair.getKey(), pair.getValue());
builder.save();
}
use of de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff2.Configuration in project winery by eclipse.
the class Environment method copyConfiguration.
/**
* Overwrite configuration parameters by using the given file
*
* @param path a path pointing to a file where the configuration should be read from
*/
public static void copyConfiguration(Path path) throws Exception {
Configurations configs = new Configurations();
Configuration configuration = configs.properties(path.toFile());
copyConfiguration(configuration);
}
Aggregations