提交 374b3c05 编写于 作者: K kohsuke

added a few convenience classes around Queue.Task

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@31416 71c3de6d-444a-0410-be80-ed276b4c234a
上级 5a9f5d39
......@@ -34,6 +34,7 @@ import static hudson.util.Iterators.reverse;
import hudson.cli.declarative.CLIMethod;
import hudson.cli.declarative.CLIResolver;
import hudson.model.queue.AbstractQueueTask;
import hudson.model.queue.QueueSorter;
import hudson.model.queue.QueueTaskDispatcher;
import hudson.remoting.AsyncFutureImpl;
......@@ -1020,6 +1021,11 @@ public class Queue extends ResourceController implements Saveable {
* Pending {@link Task}s are persisted when Hudson shuts down, so
* it needs to be persistable via XStream. To create a non-persisted
* transient Task, extend {@link TransientTask} marker interface.
*
* <p>
* Plugins are encouraged to extend from {@link AbstractQueueTask}
* instead of implementing this interface directly, to maintain
* compatibility with future changes to this interface.
*/
public interface Task extends ModelObject, ResourceActivity {
/**
......
/*
* 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.model.Queue;
/**
* Abstract base class for {@link Queue.Task} to protect plugins
* from new additions to the interface.
*
* @author Kohsuke Kawaguchi
* @since 1.360
*/
public abstract class AbstractQueueTask implements Queue.Task {
}
/*
* 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.model.Label;
import hudson.model.Node;
import hudson.model.Queue;
import hudson.model.Queue.Executable;
import hudson.model.Queue.Task;
import hudson.model.ResourceList;
import java.io.IOException;
/**
* Base class for defining filter {@link Queue.Task}.
*
* @author Kohsuke Kawaguchi
* @since 1.360
*/
public abstract class QueueTaskFilter implements Queue.Task {
private final Queue.Task base;
protected QueueTaskFilter(Task base) {
this.base = base;
}
public Label getAssignedLabel() {
return base.getAssignedLabel();
}
public Node getLastBuiltOn() {
return base.getLastBuiltOn();
}
public boolean isBuildBlocked() {
return base.isBuildBlocked();
}
public String getWhyBlocked() {
return base.getWhyBlocked();
}
public CauseOfBlockage getCauseOfBlockage() {
return base.getCauseOfBlockage();
}
public String getName() {
return base.getName();
}
public String getFullDisplayName() {
return base.getFullDisplayName();
}
public long getEstimatedDuration() {
return base.getEstimatedDuration();
}
public Executable createExecutable() throws IOException {
return base.createExecutable();
}
public void checkAbortPermission() {
base.checkAbortPermission();
}
public boolean hasAbortPermission() {
return base.hasAbortPermission();
}
public String getUrl() {
return base.getUrl();
}
public boolean isConcurrentBuild() {
return base.isConcurrentBuild();
}
public String getDisplayName() {
return base.getDisplayName();
}
public ResourceList getResourceList() {
return base.getResourceList();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册