aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author8nevil82011-11-25 09:52:32 (EST)
committerWinston Prakash2011-12-01 20:47:39 (EST)
commita291ae8bd958146d9af1ee1719e2f5adeec63aca (patch)
tree8a5d8b56d2630355bb31025fdf87d035f3180c12
parent0619c31d0b2eeceb500000ca4eac51c0fc878729 (diff)
downloadorg.eclipse.hudson.core-a291ae8bd958146d9af1ee1719e2f5adeec63aca.zip
org.eclipse.hudson.core-a291ae8bd958146d9af1ee1719e2f5adeec63aca.tar.gz
org.eclipse.hudson.core-a291ae8bd958146d9af1ee1719e2f5adeec63aca.tar.bz2
Move public method to intefaces for Job hierarchy. Introduce ICascadingJob interface with methods for cascading support
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/BaseBuildableProject.java5
-rw-r--r--hudson-core/src/main/java/hudson/model/FreeStyleProject.java19
-rw-r--r--hudson-core/src/main/java/hudson/model/Job.java82
-rw-r--r--hudson-core/src/main/java/hudson/util/CascadingUtil.java16
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java30
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java256
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/IBaseBuildableProject.java79
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/ICascadingJob.java151
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java21
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java271
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java22
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/AxisListProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java10
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BooleanProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/CopyOnWriteListProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/IntegerProjectProperty.java6
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/SCMProjectProperty.java6
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/StringProjectProperty.java4
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java4
24 files changed, 827 insertions, 187 deletions
diff --git a/hudson-core/src/main/java/hudson/model/BaseBuildableProject.java b/hudson-core/src/main/java/hudson/model/BaseBuildableProject.java
index 64d2376..5ce3761 100644
--- a/hudson-core/src/main/java/hudson/model/BaseBuildableProject.java
+++ b/hudson-core/src/main/java/hudson/model/BaseBuildableProject.java
@@ -31,7 +31,7 @@ import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import net.sf.json.JSONObject;
-import org.eclipse.hudson.api.model.IProject;
+import org.eclipse.hudson.api.model.IBaseBuildableProject;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
@@ -42,7 +42,7 @@ import org.kohsuke.stapler.StaplerResponse;
*/
public abstract class BaseBuildableProject<P extends BaseBuildableProject<P,B>,B extends AbstractBuild<P,B>>
extends AbstractProject<P, B>
- implements Saveable, BuildableItemWithBuildWrappers, IProject {
+ implements Saveable, BuildableItemWithBuildWrappers, IBaseBuildableProject {
public static final String BUILDERS_PROPERTY_NAME = "builders";
@@ -168,6 +168,7 @@ public abstract class BaseBuildableProject<P extends BaseBuildableProject<P,B>,B
public Publisher getPublisher(Descriptor<Publisher> descriptor) {
return (Publisher) CascadingUtil.getExternalProjectProperty(this, descriptor.getJsonSafeClassName()).getValue();
}
+
/**
* Returns the list of the publishers available in the hudson.
*
diff --git a/hudson-core/src/main/java/hudson/model/FreeStyleProject.java b/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
index 31e38d8..d9280a7 100644
--- a/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
+++ b/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
@@ -19,7 +19,6 @@ package hudson.model;
import hudson.Extension;
import hudson.util.CascadingUtil;
-import java.io.File;
import java.io.IOException;
import org.eclipse.hudson.api.model.IFreeStyleProject;
@@ -68,23 +67,7 @@ public class FreeStyleProject extends Project<FreeStyleProject,FreeStyleBuild> i
}
/**
- * User-specified workspace directory, or null if it's up to Hudson.
- *
- * <p>
- * Normally a free-style project uses the workspace location assigned by its parent container,
- * but sometimes people have builds that have hard-coded paths (which can be only built in
- * certain locations. see http://www.nabble.com/Customize-Workspace-directory-tt17194310.html for
- * one such discussion.)
- *
- * <p>
- * This is not {@link File} because it may have to hold a path representation on another OS.
- *
- * <p>
- * If this path is relative, it's resolved against {@link Node#getRootPath()} on the node where this workspace
- * is prepared.
- * @param customWorkspace new custom workspace to set
- * @since 1.320
- * @throws IOException if any.
+ * {@inheritDoc}
*/
public void setCustomWorkspace(String customWorkspace) throws IOException {
CascadingUtil.getStringProjectProperty(this, CUSTOM_WORKSPACE_PROPERTY_NAME).setValue(customWorkspace);
diff --git a/hudson-core/src/main/java/hudson/model/Job.java b/hudson-core/src/main/java/hudson/model/Job.java
index a24f788..c2da67a 100644
--- a/hudson-core/src/main/java/hudson/model/Job.java
+++ b/hudson-core/src/main/java/hudson/model/Job.java
@@ -86,6 +86,7 @@ import net.sf.json.JSONException;
import net.sf.json.JSONObject;
+import org.eclipse.hudson.api.model.ICascadingJob;
import org.eclipse.hudson.api.model.IJob;
import org.eclipse.hudson.api.model.IProjectProperty;
import org.eclipse.hudson.model.project.property.BaseProjectProperty;
@@ -114,7 +115,7 @@ import static javax.servlet.http.HttpServletResponse.*;
* @author Nikita Levyankov
*/
public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, RunT>>
- extends AbstractItem implements ExtensionPoint, StaplerOverridable, IJob {
+ extends AbstractItem implements ExtensionPoint, StaplerOverridable, IJob, ICascadingJob {
private static transient final String HUDSON_BUILDS_PROPERTY_KEY = "HUDSON_BUILDS";
private static transient final String PROJECT_PROPERTY_KEY_PREFIX = "has";
public static final String PROPERTY_NAME_SEPARATOR = ";";
@@ -165,7 +166,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
/**
* List of {@link UserProperty}s configured for this project.
- * According to new implementation {@link org.eclipse.hudson.api.model.project.property.ParametersDefinitionProperty} were moved from this collection. So, this
+ * According to new implementation {@link hudson.model.ParametersDefinitionProperty} were moved from this collection. So, this
* field was left protected for backward compatibility. Don't use this field directly for adding or removing
* values. Use {@link #addProperty(JobProperty)}, {@link #removeProperty(JobProperty)},
* {@link #removeProperty(Class)} instead.
@@ -232,10 +233,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
/**
- * Put job property to properties map.
- *
- * @param key key.
- * @param property property instance.
+ * {@inheritDoc}
*/
public void putProjectProperty(String key, IProjectProperty property) {
if (null != key && null != property) {
@@ -244,9 +242,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Returns project properties.
- *
- * @return project properties.
+ * {@inheritDoc}
*/
@SuppressWarnings({"unchecked"})
public Map<String, IProjectProperty> getProjectProperties() {
@@ -254,9 +250,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Removes project property.
- *
- * @param key property key.
+ * {@inheritDoc}
*/
public void removeProjectProperty(String key){
jobProperties.remove(key);
@@ -279,10 +273,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Returns job property by specified key.
- *
- * @param key key.
- * @return {@link org.eclipse.hudson.api.model.IProjectProperty} instance or null.
+ * {@inheritDoc}
*/
public IProjectProperty getProperty(String key){
return CascadingUtil.getProjectProperty(this, key);
@@ -296,9 +287,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Returns list of cascading children project names.
- *
- * @return list of cascading children project names.
+ * {@inheritDoc}
*/
@Exported
public Set<String> getCascadingChildrenNames() {
@@ -306,10 +295,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Adds cascading child project name and saves configuration.
- *
- * @param cascadingChildName cascading child project name.
- * @throws java.io.IOException if configuration couldn't be saved.
+ * {@inheritDoc}
*/
public void addCascadingChild(String cascadingChildName) throws IOException {
cascadingChildrenNames.add(cascadingChildName);
@@ -317,26 +303,22 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Remove cascading child project name and saves job configuration
- *
- * @param cascadingChildName cascading child project name.
- * @throws java.io.IOException if configuration couldn't be saved.
+ * {@inheritDoc}
*/
public void removeCascadingChild(String cascadingChildName) throws IOException {
cascadingChildrenNames.remove(cascadingChildName);
save();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean hasCascadingChild(String cascadingChildName) {
return null != cascadingChildName && cascadingChildrenNames.contains(cascadingChildName);
}
/**
- * Remove cascading child project name and saves job configuration
- *
- * @param oldChildName old child project name.
- * @param newChildName new child project name.
- * @throws java.io.IOException if configuration couldn't be saved.
+ * {@inheritDoc}
*/
public synchronized void renameCascadingChildName(String oldChildName, String newChildName) throws IOException {
cascadingChildrenNames.remove(oldChildName);
@@ -554,13 +536,16 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
getNextBuildNumberFile().write(String.valueOf(nextBuildNumber) + '\n');
}
+ /**
+ * {@inheritDoc}
+ */
@Exported
public boolean isInQueue() {
return false;
}
/**
- * If this job is in the build queue, return its item.
+ * {@inheritDoc}
*/
@Exported
public Queue.Item getQueueItem() {
@@ -568,7 +553,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Returns true if a build of this project is in progress.
+ * {@inheritDoc}
*/
public boolean isBuilding() {
RunT b = getLastBuild();
@@ -581,14 +566,14 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Returns whether the name of this job can be changed by user.
+ * {@inheritDoc}
*/
public boolean isNameEditable() {
return true;
}
/**
- * If true, it will keep all the build logs of dependency components.
+ * {@inheritDoc}
*/
@Exported
public boolean isKeepDependencies() {
@@ -596,7 +581,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Allocates a new buildCommand number.
+ * {@inheritDoc}
*/
public synchronized int assignBuildNumber() throws IOException {
int r = nextBuildNumber++;
@@ -605,7 +590,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Peeks the next build number.
+ * {@inheritDoc}
*/
@Exported
public int getNextBuildNumber() {
@@ -613,14 +598,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Programatically updates the next build number.
- *
- * <p>
- * Much of Hudson assumes that the build number is unique and monotonic, so
- * this method can only accept a new value that's bigger than
- * {@link #getLastBuild()} returns. Otherwise it'll be no-op.
- *
- * @since 1.199 (before that, this method was package private.)
+ * {@inheritDoc}
*/
public synchronized void updateNextBuildNumber(int next) throws IOException {
RunT lb = getLastBuild();
@@ -631,16 +609,14 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Returns the log rotator for this job, or null if none.
+ * {@inheritDoc}
*/
public LogRotator getLogRotator() {
return CascadingUtil.getLogRotatorProjectProperty(this, LOG_ROTATOR_PROPERTY_NAME).getValue();
}
/**
- * Sets log rotator.
- *
- * @param logRotator log rotator.
+ * {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public void setLogRotator(LogRotator logRotator) {
@@ -649,7 +625,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
/**
- * Perform log rotation.
+ * {@inheritDoc}
*/
public void logRotate() throws IOException, InterruptedException {
LogRotator lr = getLogRotator();
@@ -659,7 +635,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * True if this instance supports log rotation configuration.
+ * {@inheritDoc}
*/
public boolean supportsLogRotator() {
return true;
@@ -1699,7 +1675,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Renames cascading project name. For the properties prcessing and children links updating
+ * Renames cascading project name. For the properties processing and children links updating
* please use {@link #setCascadingProjectName} instead.
*
* @param cascadingProjectName new project name.
diff --git a/hudson-core/src/main/java/hudson/util/CascadingUtil.java b/hudson-core/src/main/java/hudson/util/CascadingUtil.java
index 53617c2..ad9f595 100644
--- a/hudson-core/src/main/java/hudson/util/CascadingUtil.java
+++ b/hudson-core/src/main/java/hudson/util/CascadingUtil.java
@@ -36,7 +36,7 @@ import java.util.Set;
import net.sf.json.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
import org.eclipse.hudson.api.model.IProjectProperty;
import org.eclipse.hudson.model.project.property.AxisListProjectProperty;
import org.eclipse.hudson.model.project.property.BaseProjectProperty;
@@ -240,14 +240,14 @@ public class CascadingUtil {
* @throws IllegalArgumentException if currentJob is null.
*/
@SuppressWarnings("unchecked")
- public static <T extends IProjectProperty> T getProjectProperty(Job currentJob, String key, Class<T> clazz) {
- if(currentJob == null){
+ public static <T extends IProjectProperty> T getProjectProperty(ICascadingJob currentJob, String key, Class<T> clazz) {
+ if (currentJob == null) {
throw new IllegalArgumentException("Job cannot be null");
}
IProjectProperty t = (IProjectProperty) currentJob.getProjectProperties().get(key);
if (null == t && null != clazz) {
try {
- t = clazz.getConstructor(IJob.class).newInstance(currentJob);
+ t = clazz.getConstructor(ICascadingJob.class).newInstance(currentJob);
t.setKey(key);
currentJob.putProjectProperty(key, t);
} catch (InstantiationException e) {
@@ -294,7 +294,7 @@ public class CascadingUtil {
* @return true if project was unlinked, false - if cascadingProject or projectToUnlink is Null
* @throws java.io.IOException if cascading project couldn't be saved.
*/
- public static boolean unlinkProjectFromCascadingParents(Job cascadingProject, String projectToUnlink)
+ public static boolean unlinkProjectFromCascadingParents(ICascadingJob cascadingProject, String projectToUnlink)
throws IOException {
if (null != cascadingProject && null != projectToUnlink) {
Job job = Functions.getItemByName(Hudson.getInstance().getAllItems(Job.class), projectToUnlink);
@@ -313,7 +313,7 @@ public class CascadingUtil {
* @return if project was unlinked
* @throws java.io.IOException if cascading project couldn't be saved.
*/
- private static boolean unlinkProjectFromCascadingParents(Job cascadingProject, Set<String> projectsToUnlink)
+ private static boolean unlinkProjectFromCascadingParents(ICascadingJob cascadingProject, Set<String> projectsToUnlink)
throws IOException {
if (null != cascadingProject && null != projectsToUnlink) {
for (String toUnlink : projectsToUnlink) {
@@ -335,7 +335,7 @@ public class CascadingUtil {
* @param childProjectName the name of child project name.
* @throws java.io.IOException if cascading project couldn't be saved.
*/
- public static void linkCascadingProjectsToChild(Job cascadingProject, String childProjectName) throws IOException {
+ public static void linkCascadingProjectsToChild(ICascadingJob cascadingProject, String childProjectName) throws IOException {
if (cascadingProject != null) {
cascadingProject.addCascadingChild(childProjectName);
if (cascadingProject.hasCascadingProject()) {
@@ -354,7 +354,7 @@ public class CascadingUtil {
* @param newName new project name.
* @throws java.io.IOException if cascading project couldn't be saved.
*/
- public static void renameCascadingChildLinks(Job cascadingProject, String oldName, String newName)
+ public static void renameCascadingChildLinks(ICascadingJob cascadingProject, String oldName, String newName)
throws IOException {
if (cascadingProject != null) {
cascadingProject.renameCascadingChildName(oldName, newName);
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java
index b614c17..7b3e857 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java
@@ -15,22 +15,16 @@
package org.eclipse.hudson.api.matrix;
import hudson.matrix.AxisList;
-import hudson.model.Descriptor;
-import org.eclipse.hudson.api.model.IAbstractProject;
import hudson.model.Result;
-import hudson.tasks.BuildWrapper;
-import hudson.tasks.Builder;
-import hudson.tasks.Publisher;
import java.io.IOException;
-import java.util.List;
-import java.util.Map;
+import org.eclipse.hudson.api.model.IBaseBuildableProject;
/**
* Matrix Project Interface.
*
* @author Anton Kozak
*/
-public interface IMatrixProject extends IAbstractProject {
+public interface IMatrixProject extends IBaseBuildableProject {
/**
* Returns {@link hudson.matrix.AxisList} of configured axes.
@@ -140,24 +134,4 @@ public interface IMatrixProject extends IAbstractProject {
*/
void setCustomWorkspace(String customWorkspace) throws IOException;
- /**
- * Returns list of active {@link Builder}s configured for this project.
- *
- * @return list of active {@link Builder}s configured for this project.
- */
- List<Builder> getBuilders();
-
- /**
- * Returns map of active {@link Publisher} configured for this project.
- *
- * @return map of active {@link Publisher} configured for this project.
- */
- Map<Descriptor<Publisher>, Publisher> getPublishers();
-
- /**
- * Returns map of active {@link BuildWrapper} configured for this project.
- *
- * @return map of active {@link BuildWrapper} configured for this project.
- */
- Map<Descriptor<BuildWrapper>,BuildWrapper> getBuildWrappers();
} \ No newline at end of file
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java
index aa40966..c287e91 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java
@@ -14,11 +14,24 @@
*******************************************************************************/
package org.eclipse.hudson.api.model;
+import hudson.FilePath;
+import hudson.model.AbstractBuild;
+import hudson.model.AbstractProject;
+import hudson.model.AppointedNode;
+import hudson.model.Fingerprint;
+import hudson.model.JDK;
import hudson.model.Label;
+import hudson.model.Node;
+import hudson.model.ProminentProjectAction;
import hudson.scm.SCM;
import hudson.triggers.Trigger;
import hudson.triggers.TriggerDescriptor;
+import hudson.util.DescribableList;
+import java.io.IOException;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
/**
* Interface that reflects common methods for AbstractProject model
@@ -37,6 +50,14 @@ public interface IAbstractProject extends IJob {
SCM getScm();
/**
+ * Sets scm value.
+ *
+ * @param scm {@link SCM}
+ * @throws IOException if any.
+ */
+ void setScm(SCM scm) throws IOException;
+
+ /**
* Returns map of triggers.
*
* @return {@link Map}.
@@ -44,6 +65,16 @@ public interface IAbstractProject extends IJob {
Map<TriggerDescriptor, Trigger> getTriggers();
/**
+ * @return list of {@link Trigger} elements.
+ */
+ List<Trigger<?>> getTriggersList();
+
+ /**
+ * @return describable list of trigger elements.
+ */
+ DescribableList<Trigger<?>, TriggerDescriptor> getTriggerDescribableList();
+
+ /**
* Gets the specific trigger, should be null if the property is not configured for this job.
*
* @param clazz class of trigger
@@ -52,6 +83,29 @@ public interface IAbstractProject extends IJob {
<T extends Trigger> T getTrigger(Class<T> clazz);
/**
+ * Sets list of triggers.
+ *
+ * @param triggerList list of {@link Trigger} object
+ */
+ void setTriggers(List<Trigger<?>> triggerList);
+
+ /**
+ * Adds a new {@link Trigger} to this {@link hudson.model.Project} if not active yet.
+ *
+ * @param trigger new trigger.
+ * @throws IOException if any.
+ */
+ void addTrigger(Trigger<?> trigger) throws IOException;
+
+ /**
+ * Removes {@link Trigger} frin this {@link hudson.model.Project} by {@link TriggerDescriptor}.
+ *
+ * @param trigger descriptor of trigger.
+ * @throws IOException if any.
+ */
+ void removeTrigger(TriggerDescriptor trigger) throws IOException;
+
+ /**
* Checks whether workspace should be cleaned before build
*
* @return boolean value
@@ -59,6 +113,13 @@ public interface IAbstractProject extends IJob {
boolean isCleanWorkspaceRequired();
/**
+ * Sets cleanWorkspaceRequired flag.
+ *
+ * @param cleanWorkspaceRequired true - to always clean workspace.
+ */
+ void setCleanWorkspaceRequired(boolean cleanWorkspaceRequired);
+
+ /**
* Indicates whether build should be blocked while downstream project is building.
*
* @return true if yes, false - otherwise.
@@ -66,6 +127,14 @@ public interface IAbstractProject extends IJob {
boolean blockBuildWhenDownstreamBuilding();
/**
+ * Sets blockBuildWhenDownstreamBuilding flag.
+ *
+ * @param b new boolean value.
+ * @throws IOException if any.
+ */
+ void setBlockBuildWhenDownstreamBuilding(boolean b) throws IOException;
+
+ /**
* Indicates whether build should be blocked while upstream project is building.
*
* @return true if yes, false - otherwise.
@@ -73,6 +142,14 @@ public interface IAbstractProject extends IJob {
boolean blockBuildWhenUpstreamBuilding();
/**
+ * Sets blockBuildWhenUpstreamBuilding flag.
+ *
+ * @param b new boolean value.
+ * @throws IOException if any.
+ */
+ void setBlockBuildWhenUpstreamBuilding(boolean b) throws IOException;
+
+ /**
* Returns scm checkout retry count.
*
* @return int value.
@@ -87,6 +164,14 @@ public interface IAbstractProject extends IJob {
int getQuietPeriod();
/**
+ * Sets the custom quiet period of this project, or revert to the global default if null is given.
+ *
+ * @param seconds quiet period
+ * @throws IOException if any.
+ */
+ void setQuietPeriod(Integer seconds) throws IOException;
+
+ /**
* If this project is configured to be always built on this node,
* return that {@link hudson.model.Node}. Otherwise null.
*
@@ -102,10 +187,179 @@ public interface IAbstractProject extends IJob {
String getAssignedLabelString();
/**
+ * Sets the assigned label.
+ *
+ * @param label node label.
+ * @throws java.io.IOException exception.
+ */
+ void setAssignedLabel(Label label) throws IOException;
+
+ /**
+ * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}.
+ *
+ * @param node node.
+ * @throws java.io.IOException exception
+ */
+ void setAssignedNode(Node node) throws IOException;
+
+ /**
* Gets whether this project is using the advanced affinity chooser UI.
*
* @return true - advanced chooser, false - simple textfield.
*/
- //TODO this method is UI only. Investigate how-to remove it from model.
boolean isAdvancedAffinityChooser();
+
+ /**
+ * Sets whether this project is using the advanced affinity chooser UI.
+ *
+ * @param b true - advanced chooser, false - otherwise
+ * @throws java.io.IOException exception.
+ */
+ void setAdvancedAffinityChooser(boolean b) throws IOException;
+
+ /**
+ * Sets {@link hudson.model.AppointedNode}.
+ *
+ * @param appointedNode {@link hudson.model.AppointedNode}.
+ */
+ void setAppointedNode(AppointedNode appointedNode);
+
+ /**
+ * Returns {@link AppointedNode}. Returned value is not null.
+ *
+ * @return appointedNode {@link AppointedNode}.
+ */
+ AppointedNode getAppointedNode();
+
+ /**
+ * Returns the root project value.
+ *
+ * @return the root project value.
+ */
+ AbstractProject getRootProject();
+
+ /**
+ * Gets a workspace for some build of this project.
+ * <p/>
+ * <p/>
+ * This is useful for obtaining a workspace for the purpose of form field validation, where exactly
+ * which build the workspace belonged is less important. The implementation makes a cursory effort
+ * to find some workspace.
+ *
+ * @return null if there's no available workspace.
+ * @since 1.319
+ */
+ FilePath getSomeWorkspace();
+
+ /**
+ * Gets some build that has a live workspace.
+ *
+ * @return null if no such build exists.
+ */
+ <R extends AbstractBuild> R getSomeBuildWithWorkspace();
+
+ /**
+ * Used in <tt>sidepanel.jelly</tt> to decide whether to display
+ * the config/delete/build links.
+ *
+ * @return true - if configurable, false - otherwise.
+ */
+ boolean isConfigurable();
+
+ /**
+ * @return true if project disabled, false - otherwise.
+ */
+ boolean isDisabled();
+
+ /**
+ * Marks the build as disabled.
+ *
+ * @param b true - to disable project, false - enable.
+ * @throws IOException if any.
+ */
+ void makeDisabled(boolean b) throws IOException;
+
+ /**
+ * @return list of {@link ProminentProjectAction}s for current project.
+ */
+ List<ProminentProjectAction> getProminentActions();
+
+ /**
+ * @return true if project is parameterized.
+ */
+ boolean isParameterized();
+
+ /**
+ * Cleans project workspace.
+ *
+ * @return true if success, false otherwise.
+ * @throws IOException if any.
+ * @throws InterruptedException if any.
+ */
+ boolean cleanWorkspace() throws IOException, InterruptedException;
+
+ /**
+ * @return name of jdk chosen for current project. Could taken from parent
+ */
+ String getJDKName();
+
+ /**
+ * @return JDK that this project is configured with, or null.
+ */
+ JDK getJDK();
+
+ /**
+ * Overwrites the JDK setting.
+ *
+ * @param jdk new jdk name value.
+ */
+ void setJDK(String jdk);
+
+ /**
+ * Overwrites the JDK setting.
+ *
+ * @param jdk new {@link JDK} candidate
+ * @throws IOException if any.
+ */
+ void setJDK(JDK jdk) throws IOException;
+
+ /**
+ * @return the other {@link AbstractProject}s that should be built when a build of this project is completed.
+ */
+ List<AbstractProject> getDownstreamProjects();
+
+ /**
+ * @return the other {@link AbstractProject}s that should be built before a build of this project is started.
+ */
+ List<AbstractProject> getUpstreamProjects();
+
+ /**
+ * Returns only those upstream projects that defines {@link hudson.tasks.BuildTrigger} to this project.
+ * This is a subset of {@link #getUpstreamProjects()}
+ *
+ * @return A List of upstream projects that has a {@link hudson.tasks.BuildTrigger} to this project.
+ */
+ List<AbstractProject> getBuildTriggerUpstreamProjects();
+
+ /**
+ * @return all the upstream projects including transitive upstream projects.
+ * @since 1.138
+ */
+ Set<AbstractProject> getTransitiveUpstreamProjects();
+
+ /**
+ * @return all the downstream projects including transitive downstream projects.
+ * @since 1.138
+ */
+ Set<AbstractProject> getTransitiveDownstreamProjects();
+
+ /**
+ * Gets the dependency relationship map between this project (as the source)
+ * and that project (as the sink.)
+ *
+ * @param that {@link AbstractProject} to find relations.
+ * @return can be empty but not null. build number of this project to the build
+ * numbers of that project.
+ */
+ SortedMap<Integer, Fingerprint.RangeSet> getRelationship(AbstractProject that);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IBaseBuildableProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IBaseBuildableProject.java
new file mode 100644
index 0000000..ab4619d
--- /dev/null
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IBaseBuildableProject.java
@@ -0,0 +1,79 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2011, Oracle Corporation, Nikita Levyankov
+ *
+ * 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 org.eclipse.hudson.api.model;
+
+import hudson.model.Descriptor;
+import hudson.tasks.BuildWrapper;
+import hudson.tasks.Builder;
+import hudson.tasks.Publisher;
+import hudson.util.DescribableList;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Interface for {@link hudson.model.BaseBuildableProject}.
+ * <p/>
+ * Date: 11/25/11
+ *
+ * @author Nikita Levyankov
+ */
+public interface IBaseBuildableProject extends IAbstractProject {
+ /**
+ * @return list of project {@link hudson.tasks.Builder}
+ */
+ List<Builder> getBuilders();
+
+ DescribableList<Builder, Descriptor<Builder>> getBuildersList();
+
+ void setBuilders(DescribableList<Builder, Descriptor<Builder>> builders);
+
+ /**
+ * @return map of project {@link hudson.tasks.BuildWrapper}
+ */
+ Map<Descriptor<BuildWrapper>, BuildWrapper> getBuildWrappers();
+
+ /**
+ * @return map of project {@link hudson.tasks.Publisher}
+ */
+ Map<Descriptor<Publisher>, Publisher> getPublishers();
+
+ Publisher getPublisher(Descriptor<Publisher> descriptor);
+
+ /**
+ * Adds a new {@link hudson.tasks.BuildStep} to this {@link IBaseBuildableProject} and saves the configuration.
+ *
+ * @param publisher publisher.
+ * @throws java.io.IOException exception.
+ */
+ void addPublisher(Publisher publisher) throws IOException;
+
+ /**
+ * Removes a publisher from this project, if it's active.
+ *
+ * @param publisher publisher.
+ * @throws java.io.IOException exception.
+ */
+ void removePublisher(Descriptor<Publisher> publisher) throws IOException;
+}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/ICascadingJob.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/ICascadingJob.java
new file mode 100644
index 0000000..82a8f55
--- /dev/null
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/ICascadingJob.java
@@ -0,0 +1,151 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2004-2011, Oracle Corporation, Nikita Levyankov
+ *
+ * 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 org.eclipse.hudson.api.model;
+
+import hudson.model.Job;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Job interface that exposes cascading functionality
+ * <p/>
+ * Date: 11/25/11
+ *
+ * @author Nikita Levyankov
+ */
+public interface ICascadingJob<T extends Job<?,?>> extends IJob<T> {
+
+ /**
+ * Returns cascading project name.
+ *
+ * @return cascading project name.
+ */
+ String getCascadingProjectName();
+
+ /**
+ * Sets cascadingProject name and saves project configuration.
+ *
+ * @param cascadingProjectName cascadingProject name.
+ * @throws java.io.IOException if configuration couldn't be saved.
+ */
+ void setCascadingProjectName(String cascadingProjectName) throws IOException;
+
+ /**
+ * Returns selected cascading project.
+ *
+ * @return cascading project.
+ */
+ ICascadingJob getCascadingProject();
+
+ /**
+ * Returns job property by specified key.
+ *
+ * @param key key.
+ * @param clazz IProperty subclass.
+ * @return {@link IProjectProperty} instance or null.
+ */
+ IProjectProperty getProperty(String key, Class<? extends IProjectProperty> clazz);
+
+ /**
+ * Returns job property by specified key.
+ *
+ * @param key key.
+ * @return {@link org.hudsonci.api.model.IProjectProperty} instance or null.
+ */
+ IProjectProperty getProperty(String key);
+
+ /**
+ * Removes project property.
+ *
+ * @param key property key.
+ */
+ void removeProjectProperty(String key);
+
+ /**
+ * Put job property to properties map.
+ *
+ * @param key key.
+ * @param property property instance.
+ */
+ void putProjectProperty(String key, IProjectProperty property);
+
+ /**
+ * @return project properties.
+ */
+ Map<String, IProjectProperty> getProjectProperties();
+
+ /**
+ * Checks whether current job is inherited from other project.
+ *
+ * @return boolean.
+ */
+ boolean hasCascadingProject();
+
+ /**
+ * Remove cascading child project name and saves job configuration
+ *
+ * @param oldChildName old child project name.
+ * @param newChildName new child project name.
+ * @throws java.io.IOException if configuration couldn't be saved.
+ */
+ void renameCascadingChildName(String oldChildName, String newChildName) throws IOException;
+
+ /**
+ * Checks whether job has cascading children with given name
+ *
+ * @param cascadingChildName name of child.
+ * @return true if job has child with specified name, false - otherwise.
+ */
+ boolean hasCascadingChild(String cascadingChildName);
+
+ /**
+ * Remove cascading child project name and saves job configuration
+ *
+ * @param cascadingChildName cascading child project name.
+ * @throws java.io.IOException if configuration couldn't be saved.
+ */
+ void removeCascadingChild(String cascadingChildName) throws IOException;
+
+ /**
+ * Adds cascading child project name and saves configuration.
+ *
+ * @param cascadingChildName cascading child project name.
+ * @throws java.io.IOException if configuration couldn't be saved.
+ */
+ void addCascadingChild(String cascadingChildName) throws IOException;
+
+ /**
+ * @return list of cascading children project names.
+ */
+ Set<String> getCascadingChildrenNames();
+
+ /**
+ * Renames cascading project name. For the properties processing and children links updating
+ * please use {@link #setCascadingProjectName} instead.
+ *
+ * @param cascadingProjectName new project name.
+ */
+ void renameCascadingProjectNameTo(String cascadingProjectName);
+}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java
index 6182996..33646de 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java
@@ -32,4 +32,25 @@ public interface IFreeStyleProject extends IProject {
* @throws IOException if any.
*/
String getCustomWorkspace() throws IOException;
+
+ /**
+ * User-specified workspace directory, or null if it's up to Hudson.
+ *
+ * <p>
+ * Normally a free-style project uses the workspace location assigned by its parent container,
+ * but sometimes people have builds that have hard-coded paths (which can be only built in
+ * certain locations. see http://www.nabble.com/Customize-Workspace-directory-tt17194310.html for
+ * one such discussion.)
+ *
+ * <p>
+ * This is not {@link java.io.File} because it may have to hold a path representation on another OS.
+ *
+ * <p>
+ * If this path is relative, it's resolved against {@link hudson.model.Node#getRootPath()} on the node where
+ * this workspace is prepared.
+ * @param customWorkspace new custom workspace to set
+ * @since 1.320
+ * @throws IOException if any.
+ */
+ void setCustomWorkspace(String customWorkspace) throws IOException;
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java
index fd262b5..7c67f40 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java
@@ -14,11 +14,26 @@
*******************************************************************************/
package org.eclipse.hudson.api.model;
+import hudson.PermalinkList;
+import hudson.model.BallColor;
+import hudson.model.BuildTimelineWidget;
+import hudson.model.Fingerprint;
+import hudson.model.HealthReport;
import hudson.model.Item;
+import hudson.model.Job;
import hudson.model.JobProperty;
import hudson.model.JobPropertyDescriptor;
+import hudson.model.Queue;
+import hudson.model.Result;
+import hudson.model.Run;
import hudson.tasks.LogRotator;
+import hudson.util.graph.Graph;
+import hudson.util.RunList;
+import hudson.widgets.Widget;
+import java.io.IOException;
+import java.util.List;
import java.util.Map;
+import java.util.SortedMap;
/**
* Interface that represents Job.
@@ -27,59 +42,265 @@ import java.util.Map;
*
* @author Nikita Levyankov
*/
-public interface IJob<T extends IJob> extends Item {
+public interface IJob<JobT extends Job> extends Item {
/**
- * Returns cascading project name.
+ * @return whether the name of this job can be changed by user.
+ */
+ boolean isNameEditable();
+
+ /**
+ * Returns the log rotator for this job, or null if none.
*
- * @return cascading project name.
+ * @return {@link LogRotator} instance.
*/
- String getCascadingProjectName();
+ LogRotator getLogRotator();
/**
- * Returns selected cascading project.
+ * Sets log rotator.
*
- * @return cascading project.
+ * @param logRotator log rotator.
*/
- T getCascadingProject();
+ void setLogRotator(LogRotator logRotator);
/**
- * Returns job property by specified key.
+ * @return true if this instance supports log rotation configuration.
+ */
+ boolean supportsLogRotator();
+
+ /**
+ * Gets all the job properties configured for this job.
*
- * @param key key.
- * @param clazz IProperty subclass.
- * @return {@link IProjectProperty} instance or null.
+ * @return Map of properties.
*/
- IProjectProperty getProperty(String key, Class<? extends IProjectProperty> clazz);
+ Map<JobPropertyDescriptor, JobProperty<? super JobT>> getProperties();
/**
- * Checks whether current job is inherited from other project.
+ * @return List of all {@link JobProperty}.
+ */
+ List<JobProperty<? super JobT>> getAllProperties();
+
+ /**
+ * @return true if the build is in the queue.
+ */
+ boolean isInQueue();
+
+ /**
+ * @return queue item If this job is in the build queue.
+ */
+ Queue.Item getQueueItem();
+
+ /**
+ * @return true if a build of this project is in progress.
+ */
+ boolean isBuilding();
+
+ /**
+ * @return flag, which shows whether all the build logs of dependency components will be kept.
+ */
+ boolean isKeepDependencies();
+
+ /**
+ * Allocates a new buildCommand number.
*
- * @return boolean.
+ * @return new build number.
+ * @throws IOException if any.
*/
- boolean hasCascadingProject();
+ int assignBuildNumber() throws IOException;
/**
- * @return whether the name of this job can be changed by user.
+ * @return the next build number.
*/
- boolean isNameEditable();
+ int getNextBuildNumber();
/**
- * Returns the log rotator for this job, or null if none.
+ * Programatically updates the next build number.
+ * <p/>
+ * <p/>
+ * Much of Hudson assumes that the build number is unique and monotonic, so
+ * this method can only accept a new value that's bigger than
+ * {@link #getLastBuild()} returns. Otherwise it'll be no-op.
*
- * @return {@link LogRotator} instance.
+ * @param next build number to set.
+ * @throws IOException if any.
+ * @since 1.199 (before that, this method was package private.)
*/
- LogRotator getLogRotator();
+ void updateNextBuildNumber(int next) throws IOException;
/**
- * @return true if this instance supports log rotation configuration.
+ * Perform log rotation.
+ *
+ * @throws IOException if any.
+ * @throws InterruptedException if any.
*/
- boolean supportsLogRotator();
+ void logRotate() throws IOException, InterruptedException;
/**
- * Gets all the job properties configured for this job.
+ * @return {@link hudson.widgets.HistoryWidget}
+ */
+ List<Widget> getWidgets();
+
+ /**
+ * @return true if we should display "build now" icon
+ */
+ boolean isBuildable();
+
+ /**
+ * Gets all the {@link hudson.model.PermalinkProjectAction.Permalink}s defined for this job.
*
- * @return Map of properties.
+ * @return never null
+ */
+ PermalinkList getPermalinks();
+
+ /**
+ * Gets the read-only view of all the builds.
+ *
+ * @return never null. The first entry is the latest build.
+ */
+ <RunT extends Run> RunList<RunT> getBuilds();
+
+ /**
+ * @param rs target rangeSet.
+ * @return all the {@link Run}s whose build numbers matches the given {@link Fingerprint.RangeSet}.
+ */
+ <RunT extends Run> List<RunT> getBuilds(Fingerprint.RangeSet rs);
+
+ /**
+ * @return all the builds in a map.
+ */
+ <RunT extends Run> SortedMap<Integer, RunT> getBuildsAsMap();
+
+ /**
+ * @param n The build number.
+ * @return null if no such build exists.
+ * @see Run#getNumber()
+ */
+ <RunT extends Run> RunT getBuildByNumber(int n);
+
+ /**
+ * Gets the youngest build #m that satisfies <tt>n&lt;=m</tt>.
+ * <p/>
+ * This is useful when you'd like to fetch a build but the exact build might
+ * be already gone (deleted, rotated, etc.)
+ *
+ * @param n build to compare with.
+ * @return youngest build.
+ */
+ <RunT extends Run> RunT getNearestBuild(int n);
+
+ /**
+ * Gets the latest build #m that satisfies <tt>m&lt;=n</tt>.
+ * <p/>
+ * This is useful when you'd like to fetch a build but the exact build might
+ * be already gone (deleted, rotated, etc.)
+ *
+ * @param n build to compare with.
+ * @return the oldest build.
+ */
+ <RunT extends Run> RunT getNearestOldBuild(int n);
+
+ /**
+ * @return the last build
+ */
+ <RunT extends Run> RunT getLastBuild();
+
+ /**
+ * @return the oldest build in the record.
+ */
+ <RunT extends Run> RunT getFirstBuild();
+
+ /**
+ * @return the last successful build, if any. Otherwise null. A successful build
+ * would include either {@link Result#SUCCESS} or {@link Result#UNSTABLE}.
+ * @see #getLastStableBuild()
+ */
+ <RunT extends Run> RunT getLastSuccessfulBuild();
+
+ /**
+ * @return the last build that was anything but stable, if any. Otherwise null.
+ * @see #getLastSuccessfulBuild
+ */
+ <RunT extends Run> RunT getLastUnsuccessfulBuild();
+
+ /**
+ * @return the last unstable build, if any. Otherwise null.
+ * @see #getLastSuccessfulBuild
+ */
+ <RunT extends Run> RunT getLastUnstableBuild();
+
+ /**
+ * @return the last stable build, if any. Otherwise null.
+ * @see #getLastSuccessfulBuild
+ */
+ <RunT extends Run> RunT getLastStableBuild();
+
+ /**
+ * @return the last failed build, if any. Otherwise null.
+ */
+ <RunT extends Run> RunT getLastFailedBuild();
+
+ /**
+ * @return the last completed build, if any. Otherwise null.
+ */
+ <RunT extends Run> RunT getLastCompletedBuild();
+
+ /**
+ * Returns the last 'numberOfBuilds' builds with a build result >= 'threshold'
+ *
+ * @param numberOfBuilds build count to return.
+ * @param threshold required {@link Result} of the build.
+ * @return a list with the builds. May be smaller than 'numberOfBuilds' or even empty
+ * if not enough builds satisfying the threshold have been found. Never null.
+ */
+ <RunT extends Run> List<RunT> getLastBuildsOverThreshold(int numberOfBuilds, Result threshold);
+
+ /**
+ * @return build status image link. Info is taken from {@link BallColor#getImage()}.
+ * @see #getIconColor()
+ * @see BallColor#getImage()
+ */
+ String getBuildStatusUrl();
+
+ /**
+ * @return the color of the status ball for the project.
+ */
+ BallColor getIconColor();
+
+ /**
+ * Get the current health report for a job.
+ *
+ * @return the health report. Never returns null
+ */
+ HealthReport getBuildHealth();
+
+ /**
+ * @return list of {@link HealthReport}
+ */
+ List<HealthReport> getBuildHealthReports();
+
+ /**
+ * @return {@link Graph} of builds
+ */
+ Graph getBuildTimeGraph();
+
+ /**
+ * @return {@link BuildTimelineWidget} based on build history
+ */
+ BuildTimelineWidget getTimeline();
+
+ /**
+ * Returns the author of the job.
+ *
+ * @return the author of the job.
+ * @since 2.0.1
+ */
+ String getCreatedBy();
+
+ /**
+ * Returns time when the project was created.
+ *
+ * @return time when the project was created.
+ * @since 2.0.1
*/
- Map<JobPropertyDescriptor, JobProperty<?>> getProperties();
+ long getCreationTime();
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java
index 4871b73..57481e7 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java
@@ -14,13 +14,6 @@
*******************************************************************************/
package org.eclipse.hudson.api.model;
-import hudson.model.Descriptor;
-import hudson.tasks.BuildWrapper;
-import hudson.tasks.Builder;
-import hudson.tasks.Publisher;
-import java.util.List;
-import java.util.Map;
-
/**
* Project interface
* <p/>
@@ -28,19 +21,6 @@ import java.util.Map;
*
* @author Nikita Levyankov
*/
-public interface IProject extends IAbstractProject {
- /**
- * @return list of project {@link Builder}
- */
- List<Builder> getBuilders();
-
- /**
- * @return map of project {@link BuildWrapper}
- */
- Map<Descriptor<BuildWrapper>, BuildWrapper> getBuildWrappers();
+public interface IProject extends IBaseBuildableProject {
- /**
- * @return map of project {@link Publisher}
- */
- Map<Descriptor<Publisher>, Publisher> getPublishers();
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
index 9f72dd7..0ccea08 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
@@ -41,9 +41,9 @@ public interface IProjectProperty<T> extends Serializable {
/**
* Sets the job, which is owner of current property.
*
- * @param job {@link IJob}
+ * @param job {@link ICascadingJob}
*/
- void setJob(IJob job);
+ void setJob(ICascadingJob job);
/**
* Sets property value.
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/AxisListProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/AxisListProjectProperty.java
index 5134bc0..6bd0804 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/AxisListProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/AxisListProjectProperty.java
@@ -16,7 +16,7 @@
package org.eclipse.hudson.model.project.property;
import hudson.matrix.AxisList;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Represents {@link hudson.matrix.AxisList} property.
@@ -27,7 +27,7 @@ import org.eclipse.hudson.api.model.IJob;
*/
public class AxisListProjectProperty extends BaseProjectProperty<AxisList> {
- public AxisListProjectProperty(IJob job) {
+ public AxisListProjectProperty(ICascadingJob job) {
super(job);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java
index 36ac845..a37957a 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java
@@ -17,7 +17,7 @@ package org.eclipse.hudson.model.project.property;
import hudson.util.DeepEquals;
import org.apache.commons.lang3.ObjectUtils;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
import org.eclipse.hudson.api.model.IProjectProperty;
/**
@@ -32,7 +32,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
static final String INVALID_PROPERTY_KEY_EXCEPTION = "Project property should have not null propertyKey";
private transient String propertyKey;
- private transient IJob job;
+ private transient ICascadingJob job;
private T originalValue;
private boolean propertyOverridden;
@@ -41,7 +41,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
*
* @param job owner of current property.
*/
- public BaseProjectProperty(IJob job) {
+ public BaseProjectProperty(ICascadingJob job) {
setJob(job);
}
@@ -62,7 +62,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
/**
* {@inheritDoc}
*/
- public void setJob(IJob job) {
+ public void setJob(ICascadingJob job) {
if (null == job) {
throw new IllegalArgumentException(INVALID_JOB_EXCEPTION);
}
@@ -72,7 +72,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
/**
* @return job that property belongs to.
*/
- final IJob getJob() {
+ final ICascadingJob getJob() {
return job;
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BooleanProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BooleanProjectProperty.java
index 129a832..6409bec 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BooleanProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BooleanProjectProperty.java
@@ -14,7 +14,7 @@
*******************************************************************************/
package org.eclipse.hudson.model.project.property;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Represents boolean property.
@@ -25,7 +25,7 @@ import org.eclipse.hudson.api.model.IJob;
*/
public class BooleanProjectProperty extends BaseProjectProperty<Boolean> {
- public BooleanProjectProperty(IJob job) {
+ public BooleanProjectProperty(ICascadingJob job) {
super(job);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/CopyOnWriteListProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/CopyOnWriteListProjectProperty.java
index bd3c591..1ed5b27 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/CopyOnWriteListProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/CopyOnWriteListProjectProperty.java
@@ -15,7 +15,7 @@
package org.eclipse.hudson.model.project.property;
import hudson.util.CopyOnWriteList;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Project property for {@link CopyOnWriteList}
@@ -26,7 +26,7 @@ import org.eclipse.hudson.api.model.IJob;
*/
public class CopyOnWriteListProjectProperty extends BaseProjectProperty<CopyOnWriteList> {
- public CopyOnWriteListProjectProperty(IJob job) {
+ public CopyOnWriteListProjectProperty(ICascadingJob job) {
super(job);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java
index 29c9dcd..6514a2e 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java
@@ -16,7 +16,7 @@ package org.eclipse.hudson.model.project.property;
import hudson.util.DescribableList;
import org.apache.commons.collections.CollectionUtils;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Property represents DescribableList object.
@@ -26,7 +26,7 @@ import org.eclipse.hudson.api.model.IJob;
* @author Nikita Levyankov
*/
public class DescribableListProjectProperty extends BaseProjectProperty<DescribableList> {
- public DescribableListProjectProperty(IJob job) {
+ public DescribableListProjectProperty(ICascadingJob job) {
super(job);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java
index 45915cd..6def695 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java
@@ -14,7 +14,7 @@
*******************************************************************************/
package org.eclipse.hudson.model.project.property;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Class property is intended to be used for ProjectProperties without correct equals and hashCode methods, such as
@@ -32,7 +32,7 @@ public class ExternalProjectProperty<T> extends BaseProjectProperty<T> {
private boolean modified;
- public ExternalProjectProperty(IJob job) {
+ public ExternalProjectProperty(ICascadingJob job) {
super(job);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/IntegerProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/IntegerProjectProperty.java
index affc003..44448c2 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/IntegerProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/IntegerProjectProperty.java
@@ -14,10 +14,10 @@
*******************************************************************************/
package org.eclipse.hudson.model.project.property;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
- * Represents integer property.
+ * Represents integer property for project.
* <p/>
* Date: 9/22/11
*
@@ -25,7 +25,7 @@ import org.eclipse.hudson.api.model.IJob;
*/
public class IntegerProjectProperty extends BaseProjectProperty<Integer> {
- public IntegerProjectProperty(IJob job) {
+ public IntegerProjectProperty(ICascadingJob job) {
super(job);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java
index 6eaef07..4565863 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java
@@ -15,7 +15,7 @@
package org.eclipse.hudson.model.project.property;
import hudson.tasks.LogRotator;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Represents LogRotator property.
@@ -25,7 +25,7 @@ import org.eclipse.hudson.api.model.IJob;
* @author Nikita Levyankov
*/
public class LogRotatorProjectProperty extends BaseProjectProperty<LogRotator> {
- public LogRotatorProjectProperty(IJob job) {
+ public LogRotatorProjectProperty(ICascadingJob job) {
super(job);
}
} \ No newline at end of file
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java
index 9e4c92b..0f98732 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java
@@ -15,7 +15,7 @@
package org.eclipse.hudson.model.project.property;
import hudson.model.Result;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Represents {@link Result} property.
@@ -26,7 +26,7 @@ import org.eclipse.hudson.api.model.IJob;
*/
public class ResultProjectProperty extends BaseProjectProperty<Result> {
- public ResultProjectProperty(IJob job) {
+ public ResultProjectProperty(ICascadingJob job) {
super(job);
}
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/SCMProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/SCMProjectProperty.java
index 607b38e..b7bc051 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/SCMProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/SCMProjectProperty.java
@@ -13,10 +13,10 @@
*
*******************************************************************************/
package org.eclipse.hudson.model.project.property;
+
import hudson.scm.NullSCM;
import hudson.scm.SCM;
-import org.eclipse.hudson.api.model.IJob;
-
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Represents {@link SCM} property.
@@ -27,7 +27,7 @@ import org.eclipse.hudson.api.model.IJob;
*/
public class SCMProjectProperty extends BaseProjectProperty<SCM> {
- public SCMProjectProperty(IJob job) {
+ public SCMProjectProperty(ICascadingJob job) {
super(job);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/StringProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/StringProjectProperty.java
index 047cca1..8241489 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/StringProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/StringProjectProperty.java
@@ -16,7 +16,7 @@
package org.eclipse.hudson.model.project.property;
import org.apache.commons.lang3.StringUtils;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* String property for project.
@@ -27,7 +27,7 @@ import org.eclipse.hudson.api.model.IJob;
*/
public class StringProjectProperty extends BaseProjectProperty<String> {
- public StringProjectProperty(IJob job) {
+ public StringProjectProperty(ICascadingJob job) {
super(job);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java
index cde7dfd..0be106a 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java
@@ -16,14 +16,14 @@
package org.eclipse.hudson.model.project.property;
import hudson.triggers.Trigger;
-import org.eclipse.hudson.api.model.IJob;
+import org.eclipse.hudson.api.model.ICascadingJob;
/**
* Property for triggers in case of we should use child project trigger
* instead of parent project if they are equals.
*/
public class TriggerProjectProperty extends BaseProjectProperty<Trigger> {
- public TriggerProjectProperty(IJob job) {
+ public TriggerProjectProperty(ICascadingJob job) {
super(job);
}