本文整理汇总了Java中org.apache.commons.configuration.FileConfiguration.save方法的典型用法代码示例。如果您正苦于以下问题:Java FileConfiguration.save方法的具体用法?Java FileConfiguration.save怎么用?Java FileConfiguration.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.configuration.FileConfiguration
的用法示例。
在下文中一共展示了FileConfiguration.save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
public static void save(Configuration configuration) throws ConfigurationException {
FileConfiguration fileConfiguration =
getWritableFileConfiguration(configuration);
if (fileConfiguration == null) {
throw new ConfigurationException("Cannot save configuration");
} else {
fileConfiguration.save();
}
}
示例2: flushUserConfigToDefault
import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
public Configuration flushUserConfigToDefault() {
FileConfiguration userConfig = null;
try {
userConfig = BmConfig.forClass(BaseMap2D.class);
userConfig.clear();
userConfig.save();
userConfig = BmConfig.forClass(BaseMap2D.class);
} catch (ConfigurationException | IOException ex) {
Exceptions.printStackTrace(ex);
}
defaultConfig = readDefaultConfig();
return userConfig;
}
示例3: store
import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
void store() throws ConfigurationException, IOException {
updateConfigToUIState();
FileConfiguration userConfig = BmConfig.forClass(BaseMap2D.class);
for (Iterator<String> i = config.getKeys(); i.hasNext();) {
String key = i.next();
Object value = config.getProperty(key);
userConfig.setProperty(key, value);
}
userConfig.save();
}
示例4: update
import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
@Button(list = "settings", key = "update", order = 1, type = Button.TYPE_PRIMARY)
public Resolution update() {
setupFormAndBean();
form.readFromRequest(context.getRequest());
if (form.validate()) {
logger.debug("Applying settings to model");
try {
FileConfiguration fileConfiguration = (FileConfiguration) configuration;
Settings settings = new Settings();
form.writeToObject(settings);
fileConfiguration.setProperty(PortofinoProperties.APP_NAME, settings.appName);
fileConfiguration.setProperty(PortofinoProperties.LANDING_PAGE, settings.landingPage);
fileConfiguration.setProperty(PortofinoProperties.LOGIN_PAGE, settings.loginPage);
if(!settings.preloadGroovyPages ||
fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES) != null) {
fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES, settings.preloadGroovyPages);
}
if(!settings.preloadGroovyClasses ||
fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES) != null) {
fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES, settings.preloadGroovyClasses);
}
fileConfiguration.save();
logger.info("Configuration saved to " + fileConfiguration.getFile().getAbsolutePath());
} catch (Exception e) {
logger.error("Configuration not saved", e);
SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
}
SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
return new RedirectResolution(this.getClass());
} else {
return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
}
}
示例5: update
import org.apache.commons.configuration.FileConfiguration; //导入方法依赖的package包/类
@Button(list = "settings", key = "update", order = 1, type = Button.TYPE_PRIMARY)
public Resolution update() {
setupFormAndBean();
form.readFromRequest(context.getRequest());
if (form.validate()) {
logger.debug("Applying settings to model");
try {
FileConfiguration fileConfiguration = (FileConfiguration) configuration;
Settings settings = new Settings();
form.writeToObject(settings);
fileConfiguration.setProperty(PortofinoProperties.APP_NAME, settings.appName);
fileConfiguration.setProperty(PortofinoProperties.LANDING_PAGE, settings.landingPage);
fileConfiguration.setProperty(PortofinoProperties.LOGIN_PAGE, settings.loginPage);
if (!settings.preloadGroovyPages
|| fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES) != null) {
fileConfiguration
.setProperty(PortofinoProperties.GROOVY_PRELOAD_PAGES, settings.preloadGroovyPages);
}
if (!settings.preloadGroovyClasses
|| fileConfiguration.getProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES) != null) {
fileConfiguration.setProperty(PortofinoProperties.GROOVY_PRELOAD_CLASSES,
settings.preloadGroovyClasses);
}
fileConfiguration.save();
logger.info("Configuration saved to " + fileConfiguration.getFile().getAbsolutePath());
} catch (Exception e) {
logger.error("Configuration not saved", e);
SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
}
SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
return new RedirectResolution(this.getClass());
} else {
return new ForwardResolution("/m/pageactions/actions/admin/settings.jsp");
}
}