/** * Installs a list of plugins from a JSON POST. * @param req The request object. * @return A JSON response that includes a "correlationId" in the "data" element. * That "correlationId" can then be used in calls to * {@link UpdateCenter#doInstallStatus(org.kohsuke.stapler.StaplerRequest)}. * @throws IOException Error reading JSON payload fro request. */ @RequirePOST @Restricted(DoNotUse.class) // WebOnly public HttpResponse doInstallPlugins(StaplerRequest req) throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); String payload = IOUtils.toString(req.getInputStream(), req.getCharacterEncoding()); JSONObject request = JSONObject.fromObject(payload); JSONArray pluginListJSON = request.getJSONArray("plugins"); List<String> plugins = new ArrayList<>(); for (int i = 0; i < pluginListJSON.size(); i++) { plugins.add(pluginListJSON.getString(i)); } UUID correlationId = UUID.randomUUID(); try { boolean dynamicLoad = request.getBoolean("dynamicLoad"); install(plugins, dynamicLoad, correlationId); JSONObject responseData = new JSONObject(); responseData.put("correlationId", correlationId.toString()); return hudson.util.HttpResponses.okJSON(responseData); } catch (Exception e) { return hudson.util.HttpResponses.errorJSON(e.getMessage()); } }
if (protocols instanceof JSONArray) { for (int i = 0; i < ((JSONArray) protocols).size(); i++) { agentProtocols.add(((JSONArray) protocols).getString(i));
@Override public String unmarshal(JSONArray value, int index) { return value.getString(index); } });
@Override public String unmarshal(JSONArray value, int index) { return value.getString(index); } });
private List<String> FromJsonArray(JSONArray jsonArray) { List<String> list = new ArrayList<String>(); for (int i = 0; i < jsonArray.size(); i++) { list.add(jsonArray.getString(i)); } return list; }
public void SetMachineList(JSONArray machineListJSONArray) { machineList = new ArrayList<String>(); for(int i = 0;i < machineListJSONArray.size();i++) { String machine = machineListJSONArray.getString(i); machineList.add(machine); } }
public void SetMachineList(JSONArray machineListJSONArray) { machineList = new ArrayList<String>(); for(int i = 0;i < machineListJSONArray.size();i++) { String machine = machineListJSONArray.getString(i); machineList.add(machine); } }
public void SetMachineList(JSONArray machineListJSONArray) { machineList = new ArrayList<String>(); for(int i = 0;i < machineListJSONArray.size();i++) { String machine = machineListJSONArray.getString(i); machineList.add(machine); } }
public void SetMachineList(JSONArray machineListJSONArray) { machineList = new ArrayList<String>(); for(int i = 0;i < machineListJSONArray.size();i++) { String machine = machineListJSONArray.getString(i); machineList.add(machine); } }
private List<String> ExtractJsonArray(JSONArray ojbect) { ArrayList<String> result = new ArrayList<String>(); try { for (int i = 0; i < ojbect.size(); i++) { result.add(ojbect.getString(i)); } } catch (JSONException e) { // ignore } return result; }
protected ArrayList<String> ExtractConfigsFromResponse(JSONObject object) { ArrayList<String> configs = new ArrayList<String>(); JSONArray configobj = object.getJSONArray("configs"); for (int i = 0; i < configobj.size(); ++i) { configs.add(configobj.getString(i)); } return configs; }
protected ArrayList<String> ExtractConfigMachineGroupFromResponse(JSONObject object) { ArrayList<String> configs = new ArrayList<String>(); JSONArray configobj = object.getJSONArray("machinegroups"); for (int i = 0; i < configobj.size(); ++i) { configs.add(configobj.getString(i)); } return configs; }
protected ArrayList<String> ExtractConfigsFromResponse(JSONObject object) { ArrayList<String> configs = new ArrayList<String>(); JSONArray configobj = object.getJSONArray("configs"); for (int i = 0; i < configobj.size(); ++i) { configs.add(configobj.getString(i)); } return configs; }
public void SetKey(JSONArray key) throws LogException { try { this.key = new ArrayList<String>(); for (int i = 0; i < key.size(); i++) { this.key.add(key.getString(i)); } } catch (JSONException e) { throw new LogException("FailToSetKey", e.getMessage(), e, ""); } }
public void SetShardHashKey(JSONArray shardHashKey) throws LogException { try { this.shardHashKey = new ArrayList<String>(); for (int i = 0; i < shardHashKey.size(); i++) this.shardHashKey.add(shardHashKey.getString(i)); } catch (JSONException e) { throw new LogException("FailToSetShardHashKey", e.getMessage(), e, ""); } }
public void SetFilterRegex(JSONArray filterRegex) throws LogException { try { this.filterRegex = new ArrayList<String>(); for (int i = 0; i < filterRegex.size(); i++) { this.filterRegex.add(filterRegex.getString(i)); } } catch (JSONException e) { throw new LogException("FailToSetFilterRegex", e.getMessage(), e, ""); } }
public void SetKey(JSONArray key) throws LogException { try { this.key = new ArrayList<String>(); for (int i = 0; i < key.size(); i++) { this.key.add(key.getString(i)); } } catch (JSONException e) { throw new LogException("FailToSetKey", e.getMessage(), e, ""); } }
public void SetShardHashKey(JSONArray shardHashKey) throws LogException { try { this.shardHashKey = new ArrayList<String>(); for (int i = 0; i < shardHashKey.size(); i++) this.shardHashKey.add(shardHashKey.getString(i)); } catch (JSONException e) { throw new LogException("FailToSetShardHashKey", e.getMessage(), e, ""); } }
public void SetFilterKey(JSONArray filterKey) throws LogException { try { this.filterKey = new ArrayList<String>(); for (int i = 0; i < filterKey.size(); i++) { this.filterKey.add(filterKey.getString(i)); } } catch (JSONException e) { throw new LogException("FailToSetFilterKey", e.getMessage(), e, ""); } }
public void SetKey(JSONArray key) throws LogException { try { this.key = new ArrayList<String>(); for (int i = 0; i < key.size(); i++) { this.key.add(key.getString(i)); } } catch (JSONException e) { throw new LogException("FailToSetKey", e.getMessage(), e, ""); } }