public static List<NodeDescriptor> allInstantiable() { List<NodeDescriptor> r = new ArrayList<>(); for (NodeDescriptor d : all()) if(d.isInstantiable()) r.add(d); return r; } }
NodeDescriptor d = NodeDescriptor.all().findByName(mode); if (d == null) { throw new Failure("No node type ‘" + mode + "’ is known"); d.handleNewNodePage(this,name,req,rsp);
/** * Really creates a new agent. */ @RequirePOST public synchronized void doDoCreateItem( StaplerRequest req, StaplerResponse rsp, @QueryParameter String name, @QueryParameter String type ) throws IOException, ServletException, FormException { final Jenkins app = Jenkins.getInstance(); app.checkPermission(Computer.CREATE); String fixedName = Util.fixEmptyAndTrim(name); checkName(fixedName); JSONObject formData = req.getSubmittedForm(); formData.put("name", fixedName); // TODO type is probably NodeDescriptor.id but confirm Node result = NodeDescriptor.all().find(type).newInstance(req, formData); app.addNode(result); // take the user back to the agent list top page rsp.sendRedirect2("."); }
public Node reconfigure(final StaplerRequest req, JSONObject form) throws FormException { if (form==null) return null; final JSONObject jsonForProperties = form.optJSONObject("nodeProperties"); final AtomicReference<BindInterceptor> old = new AtomicReference<>(); old.set(req.setBindListener(new BindInterceptor() { @Override public Object onConvert(Type targetType, Class targetTypeErasure, Object jsonSource) { if (jsonForProperties != jsonSource) { return old.get().onConvert(targetType, targetTypeErasure, jsonSource); } try { DescribableList<NodeProperty<?>, NodePropertyDescriptor> tmp = new DescribableList<NodeProperty<?>, NodePropertyDescriptor>(Saveable.NOOP,getNodeProperties().toList()); tmp.rebuild(req, jsonForProperties, NodeProperty.all()); return tmp.toList(); } catch (FormException e) { throw new IllegalArgumentException(e); } catch (IOException e) { throw new IllegalArgumentException(e); } } })); try { return getDescriptor().newInstance(req, form); } finally { req.setBindListener(old.get()); } }
@Override public Set<Attribute<Jenkins,?>> describe() { final Set<Attribute<Jenkins,?>> attributes = super.describe(); // Add remoting security, all legwork will be done by a configurator attributes.add(new Attribute<Jenkins, AdminWhitelistRule>("remotingSecurity", AdminWhitelistRule.class) .getter( j -> j.getInjector().getInstance(AdminWhitelistRule.class) ) .setter( noop() )); // Override "nodes" getter so we don't export Nodes registered by Cloud plugins Attribute.<Jenkins,List<Node>>get(attributes, "nodes").ifPresent(a -> a.getter(j -> j.getNodes().stream() .filter(node -> node.getDescriptor().isInstantiable()) .collect(Collectors.toList()) ) ); return attributes; }
@Override public String getConfigPage() { return getViewPage(clazz, "configure-entries.jelly"); }
public void superHandleNewNodePage(ComputerSet computerSet, String name, StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { super.handleNewNodePage(computerSet, name, req, rsp); }
public void superAddHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) { super.addHelpFileRedirect(fieldName, owner, fieldNameToRedirectTo); }
public Node superNewInstance(StaplerRequest req, JSONObject formData) throws FormException { return super.newInstance(req, formData); }
public boolean superIsInstantiable() { return super.isInstantiable(); }
@Override public String getConfigPage() { return getViewPage(clazz, "configure-entries.jelly"); }
@Override public void handleNewNodePage(ComputerSet computerSet, String name, StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { initPython(); if (pexec.isImplemented(1)) { pexec.execPythonVoid("handle_new_node_page", computerSet, name, req, rsp); } else { super.handleNewNodePage(computerSet, name, req, rsp); } }
@Override public void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) { initPython(); if (pexec.isImplemented(20)) { pexec.execPythonVoid("add_help_file_redirect", fieldName, owner, fieldNameToRedirectTo); } else { super.addHelpFileRedirect(fieldName, owner, fieldNameToRedirectTo); } }
public static List<NodeDescriptor> allInstantiable() { List<NodeDescriptor> r = new ArrayList<NodeDescriptor>(); for (NodeDescriptor d : all()) if(d.isInstantiable()) r.add(d); return r; } }
/** * Really creates a new slave. */ public synchronized void doDoCreateItem( StaplerRequest req, StaplerResponse rsp, @QueryParameter String name, @QueryParameter String type ) throws IOException, ServletException, FormException { final Hudson app = Hudson.getInstance(); app.checkPermission(Hudson.ADMINISTER); // TODO: new permission? checkName(name); Node result = NodeDescriptor.all().find(type).newInstance(req, req.getSubmittedForm()); app.addNode(result); // take the user back to the slave list top page rsp.sendRedirect2("."); }
NodeDescriptor d = NodeDescriptor.all().find(mode); d.handleNewNodePage(this,name,req,rsp);
public Node superNewInstance(StaplerRequest req) throws FormException { return super.newInstance(req); }
@Override public boolean isInstantiable() { initPython(); if (pexec.isImplemented(0)) { return pexec.execPythonBool("is_instantiable"); } else { return super.isInstantiable(); } }
@Override public String getConfigPage() { return getViewPage(clazz, "configure-entries.jelly"); }
public static List<NodeDescriptor> allInstantiable() { List<NodeDescriptor> r = new ArrayList<NodeDescriptor>(); for (NodeDescriptor d : all()) if(d.isInstantiable()) r.add(d); return r; } }