From 224569bd5e733b544fbb2a23eb369d4dfbbd7372 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Tue, 14 Sep 2010 01:32:46 +0000 Subject: [PATCH] moving this to a plugin git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@34751 71c3de6d-444a-0410-be80-ed276b4c234a --- .../hudson/model/queue/WideJobProperty.java | 116 ------------------ .../ExecutableImpl/executorCell.jelly | 39 ------ .../model/queue/WideJobProperty/config.jelly | 29 ----- 3 files changed, 184 deletions(-) delete mode 100644 core/src/main/java/hudson/model/queue/WideJobProperty.java delete mode 100644 core/src/main/resources/hudson/model/queue/WideJobProperty/ExecutableImpl/executorCell.jelly delete mode 100644 core/src/main/resources/hudson/model/queue/WideJobProperty/config.jelly diff --git a/core/src/main/java/hudson/model/queue/WideJobProperty.java b/core/src/main/java/hudson/model/queue/WideJobProperty.java deleted file mode 100644 index 839aa3b893..0000000000 --- a/core/src/main/java/hudson/model/queue/WideJobProperty.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2010, InfraDNA, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package hudson.model.queue; - -import hudson.Extension; -import hudson.model.AbstractBuild; -import hudson.model.AbstractProject; -import hudson.model.Executor; -import hudson.model.JobProperty; -import hudson.model.JobPropertyDescriptor; -import hudson.model.Queue.Executable; -import hudson.model.Queue.Task; -import org.kohsuke.stapler.DataBoundConstructor; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * - * - * @author Kohsuke Kawaguchi - */ -public class WideJobProperty extends JobProperty> { - public final int weight; - - @DataBoundConstructor - public WideJobProperty(int weight) { - this.weight = weight; - } - - @Override - public List getSubTasks() { - List r = new ArrayList(); - for (int i=1; i< weight; i++) - r.add(new AbstractSubTask() { - public Executable createExecutable() throws IOException { - return new ExecutableImpl(this); - } - - @Override - public Object getSameNodeConstraint() { - // must occupy the same node as the project itself - return getProject(); - } - - @Override - public long getEstimatedDuration() { - return getProject().getEstimatedDuration(); - } - - public Task getOwnerTask() { - return getProject(); - } - - public String getDisplayName() { - return "place holder for "+getProject().getDisplayName(); - } - - private AbstractProject getProject() { - return WideJobProperty.this.owner; - } - }); - return r; - } - - @Extension - public static class DescriptorImpl extends JobPropertyDescriptor { - @Override - public String getDisplayName() { - return "This project occupies multiple executors"; - } - } - - public static class ExecutableImpl implements Executable { - private final SubTask parent; - private final Executor executor = Executor.currentExecutor(); - - private ExecutableImpl(SubTask parent) { - this.parent = parent; - } - - public SubTask getParent() { - return parent; - } - - public AbstractBuild getBuild() { - return (AbstractBuild)executor.getCurrentWorkUnit().context.getPrimaryWorkUnit().getExecutable(); - } - - public void run() { - // nothing. we just waste time - } - } -} diff --git a/core/src/main/resources/hudson/model/queue/WideJobProperty/ExecutableImpl/executorCell.jelly b/core/src/main/resources/hudson/model/queue/WideJobProperty/ExecutableImpl/executorCell.jelly deleted file mode 100644 index ef669abdef..0000000000 --- a/core/src/main/resources/hudson/model/queue/WideJobProperty/ExecutableImpl/executorCell.jelly +++ /dev/null @@ -1,39 +0,0 @@ - - - - -
${%Occupied by} - - - - ${build.parent.fullDisplayName} #${build.number} - - - ${%Unknown Task} - - -
- -
diff --git a/core/src/main/resources/hudson/model/queue/WideJobProperty/config.jelly b/core/src/main/resources/hudson/model/queue/WideJobProperty/config.jelly deleted file mode 100644 index 64cdd1f258..0000000000 --- a/core/src/main/resources/hudson/model/queue/WideJobProperty/config.jelly +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - -