SCMedItem.java 954 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
package hudson.model;

import hudson.scm.SCM;
import hudson.triggers.SCMTrigger;

/**
 * {@link Item}s that has associated SCM.
 *
 * @author Kohsuke Kawaguchi
 * @see SCMTrigger
 */
public interface SCMedItem extends BuildableItem {
    /**
     * Gets the {@link SCM} for this item.
     *
     * @return
     *      may return null for indicating "no SCM".
     */
    SCM getScm();

    /**
     * {@link SCMedItem} needs to be an instance of
     * {@link AbstractProject}.
     *
     * This method does {@code (AbstractProject)this} but emphasizes
     * the fact that this cast must be doable.
     */
    AbstractProject<?,?> asProject();

    /**
     * Checks if there's any update in SCM, and returns true if any is found.
     *
     * <p>
     * The caller is responsible for coordinating the mutual exclusion between
     * a build and polling, as both touches the workspace.
     */
    boolean pollSCMChanges( TaskListener listener );
}