xConfig.append(getEnvironmentConfiguration()); xConfig.addConfigurationListener(new MetricsConfigListener()); xConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
private static XMLConfiguration getConfig() { if (config != null) { return config; } String configPfad = FilenameUtils.concat(PicaPlugin.getConfigDir(), PicaPlugin.OPAC_CONFIGURATION_FILE); if (!new File(configPfad).exists()) { String message = "File not found: ".concat(configPfad); throw new RuntimeException(message, new FileNotFoundException(message)); } try { config = new XMLConfiguration(configPfad); } catch (ConfigurationException e) { logger.error(e); config = new XMLConfiguration(); } config.setListDelimiter('&'); config.setReloadingStrategy(new FileChangedReloadingStrategy()); return config; }
config.setReloadingStrategy(reloadingStrategy); initConfig(config); } catch (ConfigurationException e) {
Configuration(final String configPath) { try { config = new XMLConfiguration(configPath); FileChangedReloadingStrategy reloadStrategy = new FileChangedReloadingStrategy(); reloadStrategy.setRefreshDelay(config.getLong("refresh", 6000)); config.setReloadingStrategy(reloadStrategy); config.addConfigurationListener(event -> init(config)); init(config); } catch (ConfigurationException | PatternSyntaxException e) { throw new IllegalStateException("SerialKiller not properly configured: " + e.getMessage(), e); } }
xConfig.append(getEnvironmentConfiguration()); xConfig.addConfigurationListener(new MetricsConfigListener()); xConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
xConfig.append(getEnvironmentConfiguration()); xConfig.addConfigurationListener(new MetricsConfigListener()); xConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
private static XMLConfiguration getConfig() { if (config != null) { return config; } KitodoConfigFile kitodoConfigOpacFile = KitodoConfigFile.OPAC_CONFIGURATION; if (!kitodoConfigOpacFile.exists()) { String message = "File not found: " + kitodoConfigOpacFile.getAbsolutePath(); throw new ConfigException(message, new FileNotFoundException(message)); } try { config = new XMLConfiguration(kitodoConfigOpacFile.getFile()); } catch (ConfigurationException e) { logger.error(e); config = new XMLConfiguration(); } config.setListDelimiter('&'); config.setReloadingStrategy(new FileChangedReloadingStrategy()); return config; } }
FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy(); fileChangedReloadingStrategy.setRefreshDelay(refreshDelay); xmlConfig.setReloadingStrategy(fileChangedReloadingStrategy); compositeConfig.addConfiguration(xmlConfig);
FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy(); fileChangedReloadingStrategy.setRefreshDelay(refreshDelay); propConfig.setReloadingStrategy(fileChangedReloadingStrategy); compositeConfig.addConfiguration(propConfig);
FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy(); fileChangedReloadingStrategy.setRefreshDelay(refreshDelay); propConfig.setReloadingStrategy(fileChangedReloadingStrategy); compositeConfig.addConfiguration(propConfig);
Config.xmlConfig.setReloadingStrategy(new FileChangedReloadingStrategy()); Config.enabaleNettyLogging = Config.xmlConfig.getBoolean("enableNettyLogging"); Config.subChannel = Config.xmlConfig.getString("subscriber.channel");
if (strategy != null) configuration.setReloadingStrategy(strategy);
if (strategy != null) configuration.setReloadingStrategy(strategy);
@Override public Configuration getUserConfig() throws ConfigurationException { // FIXME NPE caused when no project exists because config param is null if (userConfig == null) { XMLConfiguration globalXml; try { globalXml = new XMLConfiguration(environment.getUserConfiguration().getUnderlyingResourceObject()); globalXml.setEncoding("UTF-8"); } catch (org.apache.commons.configuration.ConfigurationException e) { throw new ConfigurationException(e); } globalXml.setReloadingStrategy(new FileChangedReloadingStrategy()); globalXml.setAutoSave(true); ConfigurationAdapter adapter = BeanManagerUtils.getContextualInstance(bm, ConfigurationAdapter.class, new ConfigAdapterQualifierLiteral()); adapter.setDelegate(globalXml); adapter.setBeanManager(bm); userConfig = new ScopedConfigurationAdapter(ConfigurationScope.USER, adapter); } return userConfig; }
@Override public Configuration getProjectConfig(Project project) { ScopedConfigurationAdapter projectConfig = new ScopedConfigurationAdapter(); XMLConfiguration projectLocalConfig; try { projectLocalConfig = new XMLConfiguration(getProjectSettings(project).getUnderlyingResourceObject()); projectLocalConfig.setEncoding("UTF-8"); } catch (org.apache.commons.configuration.ConfigurationException e) { throw new ConfigurationException(e); } projectLocalConfig.setReloadingStrategy(new FileChangedReloadingStrategy()); projectLocalConfig.setAutoSave(true); ConfigurationAdapter adapter = BeanManagerUtils.getContextualInstance(bm, ConfigurationAdapter.class, new ConfigAdapterQualifierLiteral()); adapter.setParent(projectConfig); adapter.setDelegate(projectLocalConfig); adapter.setBeanManager(bm); projectConfig.setScopedConfiguration(ConfigurationScope.PROJECT, adapter); projectConfig.setScopedConfiguration(ConfigurationScope.USER, getUserConfig()); return projectConfig; }