Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package hudson.plugins.downstream_ext;
 
 import java.util.List;
 
Defines a dependency introduced by the downstream-ext plugin.

Author(s):
kutzi
public class DownstreamDependency extends Dependency {
	private final DownstreamTrigger trigger;
	public DownstreamDependency(AbstractProject<?, ?> upstreamAbstractProject<?, ?> downstream,
			DownstreamTrigger trigger) {
		super(upstreamdownstream);
		this. = trigger;
	}

	@SuppressWarnings("unchecked")
	public boolean shouldTriggerBuild(AbstractBuild build,
			TaskListener listenerList<Actionactions) {
		PrintStream logger = listener.getLogger();
            AbstractProject p = getDownstreamProject();
                
            if(.isOnlyIfSCMChanges()) {
            	if (p.getScm().requiresWorkspaceForPolling()) {
            		// Downstream project locks workspace while building.
            		// If polled synchronously this could make the upstream build
            		// lock for a possibly long time.
            		// See HUDSON-5406
            		logger.println(Messages.DownstreamTrigger_StartedAsynchPoll(p.getName()));
            		p.schedulePolling();
            		return false;
            	}
            	
            	if (p.pollSCMChanges(listener)) {
            		return true;
            	} else {
            		logger.println(Messages.DownstreamTrigger_NoSCMChanges(p.getName()));
            		return false;
            	}
            }
            return true;
else {
			return false;
		}
	}
	// Technically it'd be safe to not override equals
	// since superclass implements it well.
	// But maybe that changes in the future.
	public boolean equals(Object obj) {
		if (!(obj instanceof DownstreamDependency)) {
			return false;
		}
		// Currently, there can be only one downstream-ext dependency per project
		// If that'd change later we must check the trigger instance here, too.
		return super.equals(obj);
	}
New to GrepCode? Check out our FAQ X