jenkins.model.Jenkins.save()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(256)

本文整理了Java中jenkins.model.Jenkins.save()方法的一些代码示例,展示了Jenkins.save()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.save()方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:save

Jenkins.save介绍

[英]Save the settings to a file.
[中]将设置保存到文件中。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Sets the system message.
  3. */
  4. public void setSystemMessage(String message) throws IOException {
  5. this.systemMessage = message;
  6. save();
  7. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public void setLabelString(String label) throws IOException {
  3. this.label = label;
  4. save();
  5. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Sets the global quiet period.
  3. *
  4. * @param quietPeriod
  5. * null to the default value.
  6. */
  7. public void setQuietPeriod(Integer quietPeriod) throws IOException {
  8. this.quietPeriod = quietPeriod;
  9. save();
  10. }

代码示例来源:origin: jenkinsci/jenkins

  1. public void setScmCheckoutRetryCount(int scmCheckoutRetryCount) throws IOException {
  2. this.scmCheckoutRetryCount = scmCheckoutRetryCount;
  3. save();
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. public void setMode(Mode m) throws IOException {
  2. this.mode = m;
  3. save();
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. public void setNoUsageStatistics(Boolean noUsageStatistics) throws IOException {
  2. this.noUsageStatistics = noUsageStatistics;
  3. save();
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. private void saveQuietly() {
  2. try {
  3. save();
  4. } catch (IOException x) {
  5. LOGGER.log(Level.WARNING, null, x);
  6. }
  7. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Sets a number of executors.
  3. * @param n Number of executors
  4. * @throws IOException Failed to save the configuration
  5. * @throws IllegalArgumentException Negative value has been passed
  6. */
  7. public void setNumExecutors(@Nonnegative int n) throws IOException, IllegalArgumentException {
  8. if (n < 0) {
  9. throw new IllegalArgumentException("Incorrect field \"# of executors\": " + n +". It should be a non-negative number.");
  10. }
  11. if (this.numExecutors != n) {
  12. this.numExecutors = n;
  13. updateComputerList();
  14. save();
  15. }
  16. }

代码示例来源:origin: jenkinsci/jenkins

  1. private void setBuildsAndWorkspacesDir() throws IOException, InvalidBuildsDir {
  2. boolean mustSave = false;
  3. String newBuildsDir = SystemProperties.getString(BUILDS_DIR_PROP);
  4. boolean freshStartup = STARTUP_MARKER_FILE.isOff();
  5. if (newBuildsDir != null && !buildsDir.equals(newBuildsDir)) {
  6. checkRawBuildsDir(newBuildsDir);
  7. Level level = freshStartup ? Level.INFO : Level.WARNING;
  8. LOGGER.log(level, "Changing builds directories from {0} to {1}. Beware that no automated data migration will occur.",
  9. new String[]{buildsDir, newBuildsDir});
  10. buildsDir = newBuildsDir;
  11. mustSave = true;
  12. } else if (!isDefaultBuildDir()) {
  13. LOGGER.log(Level.INFO, "Using non default builds directories: {0}.", buildsDir);
  14. }
  15. String newWorkspacesDir = SystemProperties.getString(WORKSPACES_DIR_PROP);
  16. if (newWorkspacesDir != null && !workspaceDir.equals(newWorkspacesDir)) {
  17. Level level = freshStartup ? Level.INFO : Level.WARNING;
  18. LOGGER.log(level, "Changing workspaces directories from {0} to {1}. Beware that no automated data migration will occur.",
  19. new String[]{workspaceDir, newWorkspacesDir});
  20. workspaceDir = newWorkspacesDir;
  21. mustSave = true;
  22. } else if (!isDefaultWorkspaceDir()) {
  23. LOGGER.log(Level.INFO, "Using non default workspaces directories: {0}.", workspaceDir);
  24. }
  25. if (mustSave) {
  26. save();
  27. }
  28. }

代码示例来源:origin: jenkinsci/jenkins

  1. private boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException, IOException {
  2. Jenkins j = Jenkins.getInstance();
  3. j.checkPermission(Jenkins.ADMINISTER);
  4. boolean result = true;
  5. for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)){
  6. result &= configureDescriptor(req, json, d);
  7. }
  8. j.save();
  9. return result;
  10. }

代码示例来源:origin: jenkinsci/jenkins

  1. @RequirePOST
  2. public synchronized void doConfigure(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  3. // for compatibility reasons, the actual value is stored in Jenkins
  4. BulkChange bc = new BulkChange(Jenkins.getInstance());
  5. try{
  6. boolean result = configure(req, req.getSubmittedForm());
  7. LOGGER.log(Level.FINE, "security saved: "+result);
  8. Jenkins.getInstance().save();
  9. FormApply.success(req.getContextPath()+"/manage").generateResponse(req, rsp, null);
  10. } finally {
  11. bc.commit();
  12. }
  13. }

代码示例来源:origin: jenkinsci/jenkins

  1. save();

代码示例来源:origin: jenkinsci/jenkins

  1. .setMasterKillSwitch(false);
  2. jenkins.save(); // TODO could probably be removed since some of the above setters already call save
  3. bc.commit();

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

  1. @Override
  2. protected void configure(Mapping config, PluginManager instance, boolean dryrun, ConfigurationContext context) throws ConfiguratorException {
  3. // PluginManager has no dry-run mode : we need to actually install plugins, or we just can't check
  4. // the other elements of the configuration regarding required plugins.
  5. Mapping map = config.asMapping();
  6. final Jenkins jenkins = Jenkins.getInstance();
  7. configureProxy(map, jenkins, context);
  8. final UpdateCenter updateCenter = configureUpdateSites(map, jenkins, context);
  9. configurePlugins(map, jenkins, updateCenter, context);
  10. try {
  11. jenkins.save();
  12. } catch (IOException e) {
  13. throw new ConfiguratorException("failed to save Jenkins configuration", e);
  14. }
  15. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Accepts submission from the configuration page.
  3. */
  4. @RequirePOST
  5. public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
  6. BulkChange bc = new BulkChange(this);
  7. try {
  8. checkPermission(ADMINISTER);
  9. JSONObject json = req.getSubmittedForm();
  10. systemMessage = Util.nullify(req.getParameter("system_message"));
  11. boolean result = true;
  12. for (Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfigUnclassified())
  13. result &= configureDescriptor(req,json,d);
  14. save();
  15. updateComputerList();
  16. if(result)
  17. FormApply.success(req.getContextPath()+'/').generateResponse(req, rsp, null);
  18. else
  19. FormApply.success("configure").generateResponse(req, rsp, null); // back to config
  20. } finally {
  21. bc.commit();
  22. }
  23. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Sets the global quiet period.
  3. *
  4. * @param quietPeriod
  5. * null to the default value.
  6. */
  7. public void setQuietPeriod(Integer quietPeriod) throws IOException {
  8. this.quietPeriod = quietPeriod;
  9. save();
  10. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. @Override
  2. public void setLabelString(String label) throws IOException {
  3. this.label = label;
  4. save();
  5. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. private void saveQuietly() {
  2. try {
  3. save();
  4. } catch (IOException x) {
  5. LOGGER.log(Level.WARNING, null, x);
  6. }
  7. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. public void setNumExecutors(int n) throws IOException {
  2. if (this.numExecutors != n) {
  3. this.numExecutors = n;
  4. updateComputerList();
  5. save();
  6. }
  7. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. private boolean configure(StaplerRequest req, JSONObject json) throws hudson.model.Descriptor.FormException, IOException {
  2. Jenkins j = Jenkins.getInstance();
  3. j.checkPermission(Jenkins.ADMINISTER);
  4. boolean result = true;
  5. for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)){
  6. result &= configureDescriptor(req, json, d);
  7. }
  8. j.save();
  9. return result;
  10. }

相关文章

Jenkins类方法