From 21cbf23148369cfd9da0e887fbdaa68a4dd16d21 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sun, 15 Apr 2007 04:51:29 +0000 Subject: [PATCH] integrated stapler 1.29. JSON/XML export support is moved to stapler. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3108 71c3de6d-444a-0410-be80-ed276b4c234a --- .../java/hudson/api/CustomExposureBean.java | 13 -- core/src/main/java/hudson/api/DataWriter.java | 35 ----- core/src/main/java/hudson/api/Exposed.java | 52 ------ .../src/main/java/hudson/api/ExposedBean.java | 36 ----- .../main/java/hudson/api/FieldProperty.java | 20 --- .../main/java/hudson/api/MethodProperty.java | 32 ---- core/src/main/java/hudson/api/Parser.java | 81 ---------- .../main/java/hudson/api/ParserBuilder.java | 30 ---- core/src/main/java/hudson/api/Property.java | 132 ---------------- .../main/java/hudson/api/package-info.java | 25 --- .../main/java/hudson/model/AbstractBuild.java | 2 +- .../main/java/hudson/model/AbstractItem.java | 4 +- core/src/main/java/hudson/model/Api.java | 148 +----------------- core/src/main/java/hudson/model/Hudson.java | 2 +- core/src/main/java/hudson/model/Job.java | 3 +- core/src/main/java/hudson/model/Queue.java | 4 +- core/src/main/java/hudson/model/Result.java | 2 +- core/src/main/java/hudson/model/Run.java | 5 +- core/src/main/java/hudson/model/User.java | 4 +- core/src/main/java/hudson/model/View.java | 2 +- .../main/java/hudson/scm/CVSChangeLogSet.java | 4 +- .../main/java/hudson/scm/ChangeLogSet.java | 4 +- core/src/main/java/hudson/scm/EditType.java | 2 +- .../hudson/scm/SubversionChangeLogSet.java | 4 +- core/src/main/java/hudson/tasks/Ant.java | 5 +- 25 files changed, 29 insertions(+), 622 deletions(-) delete mode 100644 core/src/main/java/hudson/api/CustomExposureBean.java delete mode 100644 core/src/main/java/hudson/api/DataWriter.java delete mode 100644 core/src/main/java/hudson/api/Exposed.java delete mode 100644 core/src/main/java/hudson/api/ExposedBean.java delete mode 100644 core/src/main/java/hudson/api/FieldProperty.java delete mode 100644 core/src/main/java/hudson/api/MethodProperty.java delete mode 100644 core/src/main/java/hudson/api/Parser.java delete mode 100644 core/src/main/java/hudson/api/ParserBuilder.java delete mode 100644 core/src/main/java/hudson/api/Property.java delete mode 100644 core/src/main/java/hudson/api/package-info.java diff --git a/core/src/main/java/hudson/api/CustomExposureBean.java b/core/src/main/java/hudson/api/CustomExposureBean.java deleted file mode 100644 index 0f0b238033..0000000000 --- a/core/src/main/java/hudson/api/CustomExposureBean.java +++ /dev/null @@ -1,13 +0,0 @@ -package hudson.api; - -/** - * Interface that an exposed bean can implement, to do the equivalent - * of writeReplace in Java serialization. - * @author Kohsuke Kawaguchi - */ -public interface CustomExposureBean { - /** - * The returned object will be introspected and written as JSON/XML. - */ - Object toExposedObject(); -} diff --git a/core/src/main/java/hudson/api/DataWriter.java b/core/src/main/java/hudson/api/DataWriter.java deleted file mode 100644 index abc8b5c2d8..0000000000 --- a/core/src/main/java/hudson/api/DataWriter.java +++ /dev/null @@ -1,35 +0,0 @@ -package hudson.api; - -import java.io.IOException; - -/** - * Receives the event callback on the model data to be exposed. - * - *

- * The call sequence is: - * - *

- * EVENTS := startObject PROPERTY* endObject
- * PROPERTY := name VALUE
- * VALUE := valuePrimitive
- *        | value
- *        | valueNull
- *        | startArray VALUE* endArray
- *        | EVENTS
- * 
- * - * @author Kohsuke Kawaguchi - */ -public interface DataWriter { - void name(String name) throws IOException; - - void valuePrimitive(Object v) throws IOException; - void value(String v) throws IOException; - void valueNull() throws IOException; - - void startArray() throws IOException; - void endArray() throws IOException; - - void startObject() throws IOException; - void endObject() throws IOException; -} diff --git a/core/src/main/java/hudson/api/Exposed.java b/core/src/main/java/hudson/api/Exposed.java deleted file mode 100644 index 64d83a3df3..0000000000 --- a/core/src/main/java/hudson/api/Exposed.java +++ /dev/null @@ -1,52 +0,0 @@ -package hudson.api; - -import java.lang.annotation.Documented; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Mark the field or the getter method whose value gets exposed - * to the remote API. - * - * @author Kohsuke Kawaguchi - * @see ExposedBean - */ -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Target({FIELD, METHOD}) -public @interface Exposed { - /** - * Controls how visible this property is. - * - *

- * If the value is 1, the property will be - * visible only when the current model object is exposed as the - * top-level object. - *

- * If the value is 2, in addition to above, the property will still - * be visible if the current model object is exposed as the 2nd-level - * object. - *

- * And the rest goes in the same way. If the value is N, the object - * is exposed as the Nth level object. - * - *

- * The default value of this property is determined by - * {@link ExposedBean#defaultVisibility()}. - * - *

- * So bigger the number, more important the property is. - */ - int visibility() default 0; - - /** - * Name of the exposed property. - *

- * This token is used as the XML element name or the JSON property name. - * The default is to use the Java property name. - */ - String name() default ""; -} diff --git a/core/src/main/java/hudson/api/ExposedBean.java b/core/src/main/java/hudson/api/ExposedBean.java deleted file mode 100644 index 7e4d9cfae1..0000000000 --- a/core/src/main/java/hudson/api/ExposedBean.java +++ /dev/null @@ -1,36 +0,0 @@ -package hudson.api; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Indicates that the class has {@link Exposed} annotations - * on its properties to indicate which properties are written - * as values to the remote XML/JSON API. - * - *

- * This annotation inherits, so it only needs to be placed on the base class. - * - * @author Kohsuke Kawaguchi - * @see Exposed - */ -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Inherited -@Target(ElementType.TYPE) -public @interface ExposedBean { - /** - * Controls the default visibility of all {@link Exposed} properties - * of this class (and its descendants.) - * - *

- * A big default visibility value usually indicates that the bean - * is always exposed as a descendant of another bean. In such case, - * unless the default visibility is set no property will be exposed. - */ - int defaultVisibility() default 1; -} diff --git a/core/src/main/java/hudson/api/FieldProperty.java b/core/src/main/java/hudson/api/FieldProperty.java deleted file mode 100644 index cb1a8c90d4..0000000000 --- a/core/src/main/java/hudson/api/FieldProperty.java +++ /dev/null @@ -1,20 +0,0 @@ -package hudson.api; - -import java.lang.reflect.Field; - -/** - * {@link Property} based on {@link Field}. - * @author Kohsuke Kawaguchi - */ -class FieldProperty extends Property { - private final Field field; - - public FieldProperty(Parser owner, Field field, Exposed exposed) { - super(owner,field.getName(),exposed); - this.field = field; - } - - protected Object getValue(Object object) throws IllegalAccessException { - return field.get(object); - } -} diff --git a/core/src/main/java/hudson/api/MethodProperty.java b/core/src/main/java/hudson/api/MethodProperty.java deleted file mode 100644 index 4050265bdd..0000000000 --- a/core/src/main/java/hudson/api/MethodProperty.java +++ /dev/null @@ -1,32 +0,0 @@ -package hudson.api; - -import java.beans.Introspector; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * {@link Property} based on {@link Method}. - * @author Kohsuke Kawaguchi - */ -public class MethodProperty extends Property { - private final Method method; - MethodProperty(Parser owner, Method m, Exposed exposed) { - super(owner,buildName(m.getName()),exposed); - this.method = m; - } - - private static String buildName(String name) { - if(name.startsWith("get")) - name = name.substring(3); - else - if(name.startsWith("is")) - name = name.substring(2); - - return Introspector.decapitalize(name); - } - - - protected Object getValue(Object object) throws IllegalAccessException, InvocationTargetException { - return method.invoke(object); - } -} diff --git a/core/src/main/java/hudson/api/Parser.java b/core/src/main/java/hudson/api/Parser.java deleted file mode 100644 index 097d85f657..0000000000 --- a/core/src/main/java/hudson/api/Parser.java +++ /dev/null @@ -1,81 +0,0 @@ -package hudson.api; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.io.IOException; - -/** - * Writes all the property of one {@link ExposedBean} to {@link DataWriter}. - * - * @author Kohsuke Kawaguchi - */ -public class Parser { - private final Class type; - - /** - * {@link Parser} for the super class. - */ - private final Parser superParser; - - private final Property[] properties; - - /*package*/ final ParserBuilder parent; - /*package*/ final int defaultVisibility; - - /*package*/ Parser(ParserBuilder parent, Class type) { - this.parent = parent; - this.type = type; - ExposedBean eb = type.getAnnotation(ExposedBean.class); - if(eb ==null) - throw new IllegalArgumentException(type+" doesn't have @ExposedBean"); - this.defaultVisibility = eb.defaultVisibility(); - - parent.parsers.put(type,this); - - Class sc = type.getSuperclass(); - if(sc!=null && sc.getAnnotation(ExposedBean.class)!=null) - superParser = parent.get(sc); - else - superParser = null; - - List properties = new ArrayList(); - - // Use reflection to find out what properties are exposed. - for( Field f : type.getFields() ) { - if(f.getDeclaringClass()!=type) continue; - Exposed exposed = f.getAnnotation(Exposed.class); - if(exposed !=null) - properties.add(new FieldProperty(this,f,exposed)); - } - - for( Method m : type.getMethods() ) { - if(m.getDeclaringClass()!=type) continue; - Exposed exposed = m.getAnnotation(Exposed.class); - if(exposed !=null) - properties.add(new MethodProperty(this,m,exposed)); - } - - this.properties = properties.toArray(new Property[properties.size()]); - Arrays.sort(this.properties); - } - - /** - * Writes the property values of the given object to the writer. - */ - public void writeTo(T object, DataWriter writer) throws IOException { - writer.startObject(); - writeTo(object,1,writer); - writer.endObject(); - } - - void writeTo(T object, int depth, DataWriter writer) throws IOException { - if(superParser!=null) - superParser.writeTo(object,depth,writer); - - for (Property p : properties) - p.writeTo(object,depth,writer); - } -} diff --git a/core/src/main/java/hudson/api/ParserBuilder.java b/core/src/main/java/hudson/api/ParserBuilder.java deleted file mode 100644 index c3919a204f..0000000000 --- a/core/src/main/java/hudson/api/ParserBuilder.java +++ /dev/null @@ -1,30 +0,0 @@ -package hudson.api; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Creates and maintains {@link Parser}s, that are used to write out - * the value representation of {@link ExposedBean exposed beans}. - * @author Kohsuke Kawaguchi - */ -public class ParserBuilder { - /** - * Instanciated {@link Parser}s. - * Registration happens in {@link Parser#Parser(ParserBuilder,Class)} so that cyclic references - * are handled correctly. - */ - /*package*/ final Map parsers = new ConcurrentHashMap(); - - public Parser get(Class type) { - Parser p = parsers.get(type); - if(p==null) { - synchronized(this) { - p = parsers.get(type); - if(p==null) - p = new Parser(this,type); - } - } - return p; - } -} diff --git a/core/src/main/java/hudson/api/Property.java b/core/src/main/java/hudson/api/Property.java deleted file mode 100644 index ac3caf8f7c..0000000000 --- a/core/src/main/java/hudson/api/Property.java +++ /dev/null @@ -1,132 +0,0 @@ -package hudson.api; - -import hudson.util.IOException2; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.net.URL; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * Exposes one {@link Exposed exposed property} of {@link ExposedBean} to - * {@link DataWriter}. - * - * @author Kohsuke Kawaguchi - */ -abstract class Property implements Comparable { - final String name; - final ParserBuilder owner; - final int visibility; - - Property(Parser parent, String name, Exposed exposed) { - this.owner = parent.parent; - this.name = exposed.name().length()>1 ? exposed.name() : name; - int v = exposed.visibility(); - if(v==0) - v = parent.defaultVisibility; - this.visibility = v; - } - - public int compareTo(Property that) { - return this.name.compareTo(that.name); - } - - /** - * Writes one property of the given object to {@link DataWriter}. - */ - public void writeTo(Object object, int depth, DataWriter writer) throws IOException { - if(visibility) value).entrySet()) { - writer.name(e.getKey().toString()); - writeValue(e.getValue(),depth,writer); - } - writer.endObject(); - return; - } - if(value instanceof Calendar) { - writer.valuePrimitive(((Calendar) value).getTimeInMillis()); - return; - } - if(value instanceof Enum) { - writer.value(value.toString()); - return; - } - - // otherwise handle it as a bean - writer.startObject(); - owner.get(c).writeTo(value,depth+1,writer); - writer.endObject(); - } - - /** - * Gets the value of this property from the bean. - */ - protected abstract Object getValue(Object bean) throws IllegalAccessException, InvocationTargetException; - - private static final Set STRING_TYPES = new HashSet(Arrays.asList( - String.class, - URL.class - )); - - private static final Set PRIMITIVE_TYPES = new HashSet(Arrays.asList( - Integer.class, - Long.class, - Boolean.class - )); -} diff --git a/core/src/main/java/hudson/api/package-info.java b/core/src/main/java/hudson/api/package-info.java deleted file mode 100644 index 2a8e58ebc7..0000000000 --- a/core/src/main/java/hudson/api/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Hudson remote XML/JSON API support. - * - *

Design

- *

- * Hudson provides the JSON/XML dump of its model objects - * (mostly {@link ModelObject}s but can be others.) See - * for the user-level - * documentation of this feature. - * - *

- * This mechanism is implemented by marking model objects - * by using {@link ExposedBean} and {@link Exposed} annotations. - * Those annotation together designates what properties are exposed - * to those remote APIs. - * - *

- * So generally speaking the model classes only need to annotate themselves - * by those annotations to get their data exposed to the remote API. - * - * @since 1.101 - */ -package hudson.api; - -import hudson.model.ModelObject; \ No newline at end of file diff --git a/core/src/main/java/hudson/model/AbstractBuild.java b/core/src/main/java/hudson/model/AbstractBuild.java index 836aad360e..613a0ce457 100644 --- a/core/src/main/java/hudson/model/AbstractBuild.java +++ b/core/src/main/java/hudson/model/AbstractBuild.java @@ -3,7 +3,7 @@ package hudson.model; import hudson.Launcher; import hudson.Proc.LocalProc; import hudson.Util; -import hudson.api.Exposed; +import org.kohsuke.stapler.export.Exposed; import hudson.tasks.Fingerprinter.FingerprintAction; import hudson.tasks.test.AbstractTestResultAction; import hudson.maven.MavenBuild; diff --git a/core/src/main/java/hudson/model/AbstractItem.java b/core/src/main/java/hudson/model/AbstractItem.java index f5df4bebf4..05737dea5b 100644 --- a/core/src/main/java/hudson/model/AbstractItem.java +++ b/core/src/main/java/hudson/model/AbstractItem.java @@ -2,8 +2,8 @@ package hudson.model; import hudson.XmlFile; import hudson.Util; -import hudson.api.Exposed; -import hudson.api.ExposedBean; +import org.kohsuke.stapler.export.Exposed; +import org.kohsuke.stapler.export.ExposedBean; import java.io.File; import java.io.IOException; diff --git a/core/src/main/java/hudson/model/Api.java b/core/src/main/java/hudson/model/Api.java index d25be0ee25..f31ac2575f 100644 --- a/core/src/main/java/hudson/model/Api.java +++ b/core/src/main/java/hudson/model/Api.java @@ -1,17 +1,12 @@ package hudson.model; -import hudson.api.DataWriter; -import hudson.api.Exposed; -import hudson.api.Parser; -import hudson.api.ParserBuilder; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.export.Exposed; +import org.kohsuke.stapler.export.Flavor; +import javax.servlet.ServletException; import java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; -import java.util.Stack; -import java.beans.Introspector; /** * Used to expose remote access API for ".../api/" @@ -36,143 +31,14 @@ public class Api extends AbstractModelObject { /** * Exposes the bean as XML. */ - public void doXml(StaplerRequest req, final StaplerResponse rsp) throws IOException { - rsp.setContentType("application/xml;charset=UTF-8"); - - write(new DataWriter() { - private String name = Introspector.decapitalize(bean.getClass().getSimpleName()); - private final Stack objectNames = new Stack(); - private final Stack arrayState = new Stack(); - private final Writer out = rsp.getWriter(); - public boolean isArray; - - public void name(String name) { - this.name = name; - } - - public void valuePrimitive(Object v) throws IOException { - value(v.toString()); - } - - public void value(String v) throws IOException { - String n = adjustName(); - out.write('<'+n+'>'); - out.write(v); - out.write("'); - } - - public void valueNull() { - // use absence to indicate null. - } - - public void startArray() { - // use repeated element to display array - // this means nested arrays are not supported - isArray = true; - } - - public void endArray() { - isArray = false; - } - - public void startObject() throws IOException { - objectNames.push(name); - arrayState.push(isArray); - out.write('<'+adjustName()+'>'); - } - - public void endObject() throws IOException { - name = objectNames.pop(); - isArray = arrayState.pop(); - out.write("'); - } - - /** - * Returns the name to be used as an element name - * by considering {@link #isArray} - */ - private String adjustName() { - if(isArray) { - if(name.endsWith("s")) - return name.substring(0,name.length()-1); - } - return name; - } - }); + public void doXml(StaplerRequest req, final StaplerResponse rsp) throws IOException, ServletException { + rsp.serveExposedBean(req,bean, Flavor.XML); } /** * Exposes the bean as JSON. */ - public void doJson(StaplerRequest req, final StaplerResponse rsp) throws IOException { - rsp.setContentType("text/javascript;charset=UTF-8"); - - String pad = req.getParameter("jsonp"); - PrintWriter w = rsp.getWriter(); - if(pad!=null) w.print(pad+'('); - - write(new DataWriter() { - private boolean needComma; - private final Writer out = rsp.getWriter(); - - public void name(String name) throws IOException { - comma(); - out.write(name+':'); - needComma = false; - } - - private void data(String v) throws IOException { - comma(); - out.write(v); - } - - private void comma() throws IOException { - if(needComma) out.write(','); - needComma = true; - } - - public void valuePrimitive(Object v) throws IOException { - data(v.toString()); - } - - public void value(String v) throws IOException { - data('\"'+v+'\"'); - } - - public void valueNull() throws IOException { - data("null"); - } - - public void startArray() throws IOException { - comma(); - out.write('['); - needComma = false; - } - - public void endArray() throws IOException { - out.write(']'); - needComma = true; - } - - public void startObject() throws IOException { - comma(); - out.write('{'); - needComma=false; - } - - public void endObject() throws IOException { - out.write('}'); - needComma=true; - } - }); - - if(pad!=null) w.print(')'); + public void doJson(StaplerRequest req, final StaplerResponse rsp) throws IOException, ServletException { + rsp.serveExposedBean(req,bean, Flavor.JSON); } - - private void write(DataWriter writer) throws IOException { - Parser p = parserBuilder.get(bean.getClass()); - p.writeTo(bean,writer); - } - - private static final ParserBuilder parserBuilder = new ParserBuilder(); } diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index e61576bf09..fcfb465d45 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -13,7 +13,7 @@ import hudson.TcpSlaveAgentListener; import hudson.Util; import static hudson.Util.fixEmpty; import hudson.XmlFile; -import hudson.api.Exposed; +import org.kohsuke.stapler.export.Exposed; import hudson.model.Descriptor.FormException; import hudson.model.listeners.ItemListener; import hudson.model.listeners.JobListener; diff --git a/core/src/main/java/hudson/model/Job.java b/core/src/main/java/hudson/model/Job.java index 83c07364c8..7f862618ed 100644 --- a/core/src/main/java/hudson/model/Job.java +++ b/core/src/main/java/hudson/model/Job.java @@ -2,8 +2,7 @@ package hudson.model; import hudson.ExtensionPoint; import hudson.Util; -import hudson.api.Exposed; -import hudson.api.ExposedBean; +import org.kohsuke.stapler.export.Exposed; import hudson.model.Descriptor.FormException; import hudson.tasks.BuildTrigger; import hudson.tasks.LogRotator; diff --git a/core/src/main/java/hudson/model/Queue.java b/core/src/main/java/hudson/model/Queue.java index 4783dbb503..ae332b8d14 100644 --- a/core/src/main/java/hudson/model/Queue.java +++ b/core/src/main/java/hudson/model/Queue.java @@ -1,8 +1,8 @@ package hudson.model; import hudson.Util; -import hudson.api.ExposedBean; -import hudson.api.Exposed; +import org.kohsuke.stapler.export.ExposedBean; +import org.kohsuke.stapler.export.Exposed; import hudson.model.Node.Mode; import hudson.util.OneShotEvent; diff --git a/core/src/main/java/hudson/model/Result.java b/core/src/main/java/hudson/model/Result.java index 7ca52f808f..b6806e356c 100644 --- a/core/src/main/java/hudson/model/Result.java +++ b/core/src/main/java/hudson/model/Result.java @@ -5,7 +5,7 @@ import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter; import java.io.Serializable; -import hudson.api.CustomExposureBean; +import org.kohsuke.stapler.export.CustomExposureBean; /** * The build outcome. diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index dc5fc7754c..8fb266559e 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -8,8 +8,8 @@ import hudson.FilePath; import hudson.Util; import static hudson.Util.combine; import hudson.XmlFile; -import hudson.api.Exposed; -import hudson.api.ExposedBean; +import org.kohsuke.stapler.export.Exposed; +import org.kohsuke.stapler.export.ExposedBean; import hudson.tasks.BuildStep; import hudson.tasks.LogRotator; import hudson.tasks.test.AbstractTestResultAction; @@ -17,7 +17,6 @@ import hudson.util.IOException2; import hudson.util.XStream2; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; -import org.kohsuke.stapler.Stapler; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; diff --git a/core/src/main/java/hudson/model/User.java b/core/src/main/java/hudson/model/User.java index 87beb25c1c..14b6c06cdd 100644 --- a/core/src/main/java/hudson/model/User.java +++ b/core/src/main/java/hudson/model/User.java @@ -4,8 +4,8 @@ import com.thoughtworks.xstream.XStream; import hudson.CopyOnWrite; import hudson.FeedAdapter; import hudson.XmlFile; -import hudson.api.ExposedBean; -import hudson.api.Exposed; +import org.kohsuke.stapler.export.ExposedBean; +import org.kohsuke.stapler.export.Exposed; import hudson.model.Descriptor.FormException; import hudson.scm.ChangeLogSet; import hudson.util.RunList; diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java index 7a68ce0dc0..e2ab20a18e 100644 --- a/core/src/main/java/hudson/model/View.java +++ b/core/src/main/java/hudson/model/View.java @@ -1,7 +1,7 @@ package hudson.model; import hudson.Util; -import hudson.api.ExposedBean; +import org.kohsuke.stapler.export.ExposedBean; import hudson.scm.ChangeLogSet.Entry; import hudson.util.RunList; import org.kohsuke.stapler.StaplerRequest; diff --git a/core/src/main/java/hudson/scm/CVSChangeLogSet.java b/core/src/main/java/hudson/scm/CVSChangeLogSet.java index 8ac21b006e..8807b3cbed 100644 --- a/core/src/main/java/hudson/scm/CVSChangeLogSet.java +++ b/core/src/main/java/hudson/scm/CVSChangeLogSet.java @@ -4,8 +4,8 @@ import hudson.model.AbstractBuild; import hudson.model.User; import hudson.scm.CVSChangeLogSet.CVSChangeLog; import hudson.util.IOException2; -import hudson.api.Exposed; -import hudson.api.ExposedBean; +import org.kohsuke.stapler.export.Exposed; +import org.kohsuke.stapler.export.ExposedBean; import org.apache.commons.digester.Digester; import org.xml.sax.SAXException; diff --git a/core/src/main/java/hudson/scm/ChangeLogSet.java b/core/src/main/java/hudson/scm/ChangeLogSet.java index 9ada5917f7..d297fc711b 100644 --- a/core/src/main/java/hudson/scm/ChangeLogSet.java +++ b/core/src/main/java/hudson/scm/ChangeLogSet.java @@ -2,8 +2,8 @@ package hudson.scm; import hudson.MarkupText; import hudson.Util; -import hudson.api.Exposed; -import hudson.api.ExposedBean; +import org.kohsuke.stapler.export.Exposed; +import org.kohsuke.stapler.export.ExposedBean; import hudson.model.AbstractBuild; import hudson.model.User; diff --git a/core/src/main/java/hudson/scm/EditType.java b/core/src/main/java/hudson/scm/EditType.java index 407dde6585..5d07a8e73d 100644 --- a/core/src/main/java/hudson/scm/EditType.java +++ b/core/src/main/java/hudson/scm/EditType.java @@ -1,6 +1,6 @@ package hudson.scm; -import hudson.api.CustomExposureBean; +import org.kohsuke.stapler.export.CustomExposureBean; /** * Designates the SCM operation. diff --git a/core/src/main/java/hudson/scm/SubversionChangeLogSet.java b/core/src/main/java/hudson/scm/SubversionChangeLogSet.java index d0d3c24aa3..81d394944d 100644 --- a/core/src/main/java/hudson/scm/SubversionChangeLogSet.java +++ b/core/src/main/java/hudson/scm/SubversionChangeLogSet.java @@ -3,8 +3,8 @@ package hudson.scm; import hudson.model.AbstractBuild; import hudson.model.User; import hudson.scm.SubversionChangeLogSet.LogEntry; -import hudson.api.Exposed; -import hudson.api.ExposedBean; +import org.kohsuke.stapler.export.Exposed; +import org.kohsuke.stapler.export.ExposedBean; import java.io.IOException; import java.util.ArrayList; diff --git a/core/src/main/java/hudson/tasks/Ant.java b/core/src/main/java/hudson/tasks/Ant.java index 3552a99d10..8d9121c909 100644 --- a/core/src/main/java/hudson/tasks/Ant.java +++ b/core/src/main/java/hudson/tasks/Ant.java @@ -11,6 +11,7 @@ import hudson.util.FormFieldValidator; import hudson.util.ArgumentListBuilder; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.DataBoundConstructor; import javax.servlet.ServletException; import java.io.File; @@ -37,9 +38,7 @@ public class Ant extends Builder { */ private final String antOpts; - /** - * @stapler-constructor - */ + @DataBoundConstructor public Ant(String targets,String antName, String antOpts) { this.targets = targets; this.antName = antName; -- GitLab