/** * Gets the {@link TopLevelItem} of the given name. */ public TopLevelItem getItem(String name) { return getOwner().getItemGroup().getItem(name); }
@Override public String getShortDescription() { Computer computer = node.toComputer(); String name = computer != null ? computer.getDisplayName() : node.getDisplayName(); return Messages.Node_BecauseNodeIsNotAcceptingTasks(name); }
/** * {@inheritDoc} */ @Override protected void checkRename(String newName) throws Failure { if (isBuilding()) { throw new Failure(Messages.Job_NoRenameWhileBuilding()); } }
/** * The entry unique ID needs to be tied to a project, so that * new builds will replace the old result. */ @Override public String getEntryID(Run e) { // can't use a meaningful year field unless we remember when the job was created. return "tag:hudson.dev.java.net,2008:"+e.getParent().getAbsoluteUrl(); } };
/** * Returns true if a build of this project is in progress. */ public boolean isBuilding() { RunT b = getLastBuild(); return b!=null && b.isBuilding(); }
@Override protected Callable<ClockDifference,IOException> createCallable(Computer c) { Node n = c.getNode(); if(n==null) return null; return n.getClockDifferenceCallable(); }
public ParameterValue createValue(String str) { StringParameterValue value = new StringParameterValue(getName(), str, getDescription()); if (isTrim() && value!=null) { value.doTrim(); } return value; } }
@Override protected int run() throws Exception { node.toComputer().waitUntilOnline(); return 0; } }
/** * Visits an {@link ItemGroup} by visits the member items. */ public void onItemGroup(ItemGroup<?> group) { for (Item i : group.getItems()) if (i.hasPermission(Item.READ)) onItem(i); }
/** * {@code getTotalExecutors()-getBusyExecutors()}, plus executors that are being brought online. */ public int getIdleExecutors() { int r=0; for (Computer c : get_all()) if((c.isOnline() || c.isConnecting()) && c.isAcceptingTasks()) r += c.countIdle(); return r; }
@Override public synchronized void save() throws IOException { super.save(); updateTransientActions(); }
@Override public void addProperty(JobProperty<? super P> jobProp) throws IOException { super.addProperty(jobProp); updateTransientActions(); }
/** * The file we save our configuration. */ public static XmlFile getConfigFile(Item item) { return getConfigFile(item.getRootDir()); }
/** * If true, this is a view that renders the top page of Hudson. */ public boolean isDefault() { return getOwner().getPrimaryView()==this; }
private void locationChanged(ViewGroup vg, String oldFullName, String newFullName) { for (View v : vg.getViews()) { if (v instanceof ListView) { renameViewItem(oldFullName, newFullName, vg, (ListView) v); } if (v instanceof ViewGroup) { locationChanged((ViewGroup) v, oldFullName, newFullName); } } }
private void deleted(ViewGroup vg, Item item) { for (View v : vg.getViews()) { if (v instanceof ListView) { deleteViewItem(item, vg, (ListView) v); } if (v instanceof ViewGroup) { deleted((ViewGroup) v, item); } } }
@Override public Mapping map(Task task, MappingWorksheet worksheet) { if (Queue.isBlockedByShutdown(task)) { // if we are quieting down, don't start anything new so that // all executors will be eventually free. return null; } return base.map(task, worksheet); }
@Override public void run() { execute(new BuildExecution()); } }