/** * Sets the system message. */ public void setSystemMessage(String message) throws IOException { this.systemMessage = message; save(); }
@Override public void setLabelString(String label) throws IOException { this.label = label; save(); }
/** * Sets the global quiet period. * * @param quietPeriod * null to the default value. */ public void setQuietPeriod(Integer quietPeriod) throws IOException { this.quietPeriod = quietPeriod; save(); }
public void setScmCheckoutRetryCount(int scmCheckoutRetryCount) throws IOException { this.scmCheckoutRetryCount = scmCheckoutRetryCount; save(); }
public void setMode(Mode m) throws IOException { this.mode = m; save(); }
public void setNoUsageStatistics(Boolean noUsageStatistics) throws IOException { this.noUsageStatistics = noUsageStatistics; save(); }
private void saveQuietly() { try { save(); } catch (IOException x) { LOGGER.log(Level.WARNING, null, x); } }
/** * 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(); } }
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(); } }
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; }
@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(); } }
.setMasterKillSwitch(false); jenkins.save(); // TODO could probably be removed since some of the above setters already call save bc.commit();
@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); } }
/** * 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(); } }
/** * Sets the global quiet period. * * @param quietPeriod * null to the default value. */ public void setQuietPeriod(Integer quietPeriod) throws IOException { this.quietPeriod = quietPeriod; save(); }
@Override public void setLabelString(String label) throws IOException { this.label = label; save(); }
private void saveQuietly() { try { save(); } catch (IOException x) { LOGGER.log(Level.WARNING, null, x); } }
public void setNumExecutors(int n) throws IOException { if (this.numExecutors != n) { this.numExecutors = n; updateComputerList(); save(); } }
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; }