本文整理了Java中jenkins.model.Jenkins.save()
方法的一些代码示例,展示了Jenkins.save()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.save()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:save
[英]Save the settings to a file.
[中]将设置保存到文件中。
代码示例来源:origin: jenkinsci/jenkins
/**
* Sets the system message.
*/
public void setSystemMessage(String message) throws IOException {
this.systemMessage = message;
save();
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public void setLabelString(String label) throws IOException {
this.label = label;
save();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Sets the global quiet period.
*
* @param quietPeriod
* null to the default value.
*/
public void setQuietPeriod(Integer quietPeriod) throws IOException {
this.quietPeriod = quietPeriod;
save();
}
代码示例来源:origin: jenkinsci/jenkins
public void setScmCheckoutRetryCount(int scmCheckoutRetryCount) throws IOException {
this.scmCheckoutRetryCount = scmCheckoutRetryCount;
save();
}
代码示例来源:origin: jenkinsci/jenkins
public void setMode(Mode m) throws IOException {
this.mode = m;
save();
}
代码示例来源:origin: jenkinsci/jenkins
public void setNoUsageStatistics(Boolean noUsageStatistics) throws IOException {
this.noUsageStatistics = noUsageStatistics;
save();
}
代码示例来源:origin: jenkinsci/jenkins
private void saveQuietly() {
try {
save();
} catch (IOException x) {
LOGGER.log(Level.WARNING, null, x);
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Sets a number of executors.
* @param n Number of executors
* @throws IOException Failed to save the configuration
* @throws IllegalArgumentException Negative value has been passed
*/
public void setNumExecutors(@Nonnegative int n) throws IOException, IllegalArgumentException {
if (n < 0) {
throw new IllegalArgumentException("Incorrect field \"# of executors\": " + n +". It should be a non-negative number.");
}
if (this.numExecutors != n) {
this.numExecutors = n;
updateComputerList();
save();
}
}
代码示例来源:origin: jenkinsci/jenkins
private void setBuildsAndWorkspacesDir() throws IOException, InvalidBuildsDir {
boolean mustSave = false;
String newBuildsDir = SystemProperties.getString(BUILDS_DIR_PROP);
boolean freshStartup = STARTUP_MARKER_FILE.isOff();
if (newBuildsDir != null && !buildsDir.equals(newBuildsDir)) {
checkRawBuildsDir(newBuildsDir);
Level level = freshStartup ? Level.INFO : Level.WARNING;
LOGGER.log(level, "Changing builds directories from {0} to {1}. Beware that no automated data migration will occur.",
new String[]{buildsDir, newBuildsDir});
buildsDir = newBuildsDir;
mustSave = true;
} else if (!isDefaultBuildDir()) {
LOGGER.log(Level.INFO, "Using non default builds directories: {0}.", buildsDir);
}
String newWorkspacesDir = SystemProperties.getString(WORKSPACES_DIR_PROP);
if (newWorkspacesDir != null && !workspaceDir.equals(newWorkspacesDir)) {
Level level = freshStartup ? Level.INFO : Level.WARNING;
LOGGER.log(level, "Changing workspaces directories from {0} to {1}. Beware that no automated data migration will occur.",
new String[]{workspaceDir, newWorkspacesDir});
workspaceDir = newWorkspacesDir;
mustSave = true;
} else if (!isDefaultWorkspaceDir()) {
LOGGER.log(Level.INFO, "Using non default workspaces directories: {0}.", workspaceDir);
}
if (mustSave) {
save();
}
}
代码示例来源:origin: jenkinsci/jenkins
private boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException, IOException {
Jenkins j = Jenkins.getInstance();
j.checkPermission(Jenkins.ADMINISTER);
boolean result = true;
for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)){
result &= configureDescriptor(req, json, d);
}
j.save();
return result;
}
代码示例来源:origin: jenkinsci/jenkins
@RequirePOST
public synchronized void doConfigure(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
// for compatibility reasons, the actual value is stored in Jenkins
BulkChange bc = new BulkChange(Jenkins.getInstance());
try{
boolean result = configure(req, req.getSubmittedForm());
LOGGER.log(Level.FINE, "security saved: "+result);
Jenkins.getInstance().save();
FormApply.success(req.getContextPath()+"/manage").generateResponse(req, rsp, null);
} finally {
bc.commit();
}
}
代码示例来源:origin: jenkinsci/jenkins
save();
代码示例来源:origin: jenkinsci/jenkins
.setMasterKillSwitch(false);
jenkins.save(); // TODO could probably be removed since some of the above setters already call save
bc.commit();
代码示例来源:origin: jenkinsci/configuration-as-code-plugin
@Override
protected void configure(Mapping config, PluginManager instance, boolean dryrun, ConfigurationContext context) throws ConfiguratorException {
// PluginManager has no dry-run mode : we need to actually install plugins, or we just can't check
// the other elements of the configuration regarding required plugins.
Mapping map = config.asMapping();
final Jenkins jenkins = Jenkins.getInstance();
configureProxy(map, jenkins, context);
final UpdateCenter updateCenter = configureUpdateSites(map, jenkins, context);
configurePlugins(map, jenkins, updateCenter, context);
try {
jenkins.save();
} catch (IOException e) {
throw new ConfiguratorException("failed to save Jenkins configuration", e);
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Accepts submission from the configuration page.
*/
@RequirePOST
public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
BulkChange bc = new BulkChange(this);
try {
checkPermission(ADMINISTER);
JSONObject json = req.getSubmittedForm();
systemMessage = Util.nullify(req.getParameter("system_message"));
boolean result = true;
for (Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfigUnclassified())
result &= configureDescriptor(req,json,d);
save();
updateComputerList();
if(result)
FormApply.success(req.getContextPath()+'/').generateResponse(req, rsp, null);
else
FormApply.success("configure").generateResponse(req, rsp, null); // back to config
} finally {
bc.commit();
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Sets the global quiet period.
*
* @param quietPeriod
* null to the default value.
*/
public void setQuietPeriod(Integer quietPeriod) throws IOException {
this.quietPeriod = quietPeriod;
save();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public void setLabelString(String label) throws IOException {
this.label = label;
save();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private void saveQuietly() {
try {
save();
} catch (IOException x) {
LOGGER.log(Level.WARNING, null, x);
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public void setNumExecutors(int n) throws IOException {
if (this.numExecutors != n) {
this.numExecutors = n;
updateComputerList();
save();
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException, IOException {
Jenkins j = Jenkins.getInstance();
j.checkPermission(Jenkins.ADMINISTER);
boolean result = true;
for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)){
result &= configureDescriptor(req, json, d);
}
j.save();
return result;
}
内容来源于网络,如有侵权,请联系作者删除!