提交 afe303bc 编写于 作者: K kohsuke

exposing more objects and properties.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3043 71c3de6d-444a-0410-be80-ed276b4c234a
上级 e01074b2
......@@ -179,6 +179,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
*
* @return never null.
*/
@Exposed
public ChangeLogSet<? extends Entry> getChangeSet() {
if(scm==null)
scm = new CVSChangeLogParser();
......
......@@ -197,6 +197,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
/**
* Returns true if the build is not completed yet.
*/
@Exposed
public boolean isBuilding() {
return state!=State.COMPLETED;
}
......@@ -220,6 +221,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
*
* This is used as a signal to the {@link LogRotator}.
*/
@Exposed
public final boolean isKeepLog() {
return getWhyKeepLog()!=null;
}
......@@ -249,6 +251,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
return timestamp;
}
@Exposed
public String getDescription() {
return description;
}
......
......@@ -4,6 +4,7 @@ import hudson.model.AbstractBuild;
import hudson.model.User;
import hudson.scm.CVSChangeLogSet.CVSChangeLog;
import hudson.util.IOException2;
import hudson.api.Exposed;
import org.apache.commons.digester.Digester;
import org.xml.sax.SAXException;
......@@ -125,6 +126,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
f.parent = this;
}
@Exposed
public String getDate() {
return date;
}
......@@ -133,6 +135,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
this.date = date;
}
@Exposed
public String getTime() {
return time;
}
......@@ -141,6 +144,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
this.time = time;
}
@Exposed
public User getAuthor() {
return author;
}
......@@ -161,10 +165,12 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
this.author = User.get(author);
}
@Exposed
public String getUser() {// digester wants read/write property, even though it never reads. Duh.
return author.getDisplayName();
}
@Exposed
public String getMsg() {
return msg;
}
......@@ -178,6 +184,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
files.add(f);
}
@Exposed
public List<File> getFiles() {
return files;
}
......@@ -198,6 +205,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
* <p>
* The path is relative to the workspace root.
*/
@Exposed
public String getName() {
return name;
}
......@@ -210,6 +218,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
* Unlike {@link #getName()}, this method returns
* a full name from the root of the CVS repository.
*/
@Exposed
public String getFullName() {
if(fullName==null) {
// Hudson < 1.91 doesn't record full path name for CVS,
......@@ -250,6 +259,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
this.name = name;
}
@Exposed
public String getRevision() {
return revision;
}
......@@ -258,6 +268,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
this.revision = revision;
}
@Exposed
public String getPrevrevision() {
return prevrevision;
}
......@@ -266,6 +277,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
this.prevrevision = prevrevision;
}
@Exposed
public boolean isDead() {
return dead;
}
......@@ -274,6 +286,7 @@ public final class CVSChangeLogSet extends ChangeLogSet<CVSChangeLog> {
this.dead = true;
}
@Exposed
public EditType getEditType() {
// see issue #73. Can't do much better right now
if(dead)
......
......@@ -2,11 +2,15 @@ package hudson.scm;
import hudson.MarkupText;
import hudson.Util;
import hudson.api.ExposedBean;
import hudson.api.Exposed;
import hudson.model.AbstractBuild;
import hudson.model.User;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
/**
* Represents SCM change list.
......@@ -16,6 +20,7 @@ import java.util.Collections;
*
* @author Kohsuke Kawaguchi
*/
@ExposedBean
public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iterable<T> {
/**
......@@ -32,6 +37,18 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter
*/
public abstract boolean isEmptySet();
/**
* All changes in the change set.
*/
// method for the remote API.
@Exposed
public final Object[] getItems() {
List<T> r = new ArrayList<T>();
for (T t : this)
r.add(t);
return r.toArray();
}
/**
* Constant instance that represents no changes.
*/
......@@ -39,6 +56,7 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter
return new CVSChangeLogSet(build,Collections.<CVSChangeLogSet.CVSChangeLog>emptyList());
}
@ExposedBean
public static abstract class Entry {
private ChangeLogSet parent;
......
package hudson.scm;
import hudson.api.CustomExposureBean;
/**
* Designates the SCM operation.
*
* @author Kohsuke Kawaguchi
*/
public final class EditType {
public final class EditType implements CustomExposureBean {
private String name;
private String description;
......@@ -22,6 +24,10 @@ public final class EditType {
return description;
}
public Object toExposedObject() {
return name;
}
public static final EditType ADD = new EditType("add","The file was added");
public static final EditType EDIT = new EditType("edit","The file was modified");
public static final EditType DELETE = new EditType("delete","The file was removed");
......
......@@ -3,6 +3,7 @@ package hudson.scm;
import hudson.model.AbstractBuild;
import hudson.model.User;
import hudson.scm.SubversionChangeLogSet.LogEntry;
import hudson.api.Exposed;
import java.io.IOException;
import java.util.ArrayList;
......@@ -79,6 +80,7 @@ public final class SubversionChangeLogSet extends ChangeLogSet<LogEntry> {
* If the commit made the repository revision 1532, this
* method returns 1532.
*/
@Exposed
public int getRevision() {
return revision;
}
......@@ -108,10 +110,12 @@ public final class SubversionChangeLogSet extends ChangeLogSet<LogEntry> {
this.author = User.get(author);
}
@Exposed
public String getUser() {// digester wants read/write property, even though it never reads. Duh.
return author.getDisplayName();
}
@Exposed
public String getDate() {
return date;
}
......@@ -120,7 +124,7 @@ public final class SubversionChangeLogSet extends ChangeLogSet<LogEntry> {
this.date = date;
}
@Override
@Override @Exposed
public String getMsg() {
return msg;
}
......@@ -139,6 +143,7 @@ public final class SubversionChangeLogSet extends ChangeLogSet<LogEntry> {
* @return
* can be empty but never null.
*/
@Exposed
public List<Path> getPaths() {
return paths;
}
......@@ -169,6 +174,7 @@ public final class SubversionChangeLogSet extends ChangeLogSet<LogEntry> {
/**
* Path in the repository. Such as <tt>/test/trunk/foo.c</tt>
*/
@Exposed(name="path")
public String getValue() {
return value;
}
......@@ -177,6 +183,7 @@ public final class SubversionChangeLogSet extends ChangeLogSet<LogEntry> {
this.value = value;
}
@Exposed
public EditType getEditType() {
if( action=='A' )
return EditType.ADD;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册