File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\jenkins\scm\SCMCheckoutStrategyDescriptor.java.html

1 package jenkins.scm;
2
3 import com.google.common.collect.Lists;
4 import hudson.DescriptorExtensionList;
5 import hudson.matrix.MatrixExecutionStrategyDescriptor;
6 import hudson.model.AbstractProject;
7 import hudson.model.Descriptor;
8 import hudson.scm.SCM;
9 import jenkins.model.Jenkins;
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14 /**
15 * {@link Descriptor} for {@link SCMCheckoutStrategy}.
16 *
17 */
18 public abstract class SCMCheckoutStrategyDescriptor extends Descriptor<SCMCheckoutStrategy> {
19 protected SCMCheckoutStrategyDescriptor(Class<? extends SCMCheckoutStrategy> clazz) {
20 super(clazz);
21 }
22
23 protected SCMCheckoutStrategyDescriptor() {
24 }
25
26 /**
27 * Allows {@link SCMCheckoutStrategyDescriptor} to target specific kind of projects,
28 * such as matrix projects.
29 */
30 public abstract boolean isApplicable(AbstractProject project);
31
32 /**
33 * Returns all the registered {@link MatrixExecutionStrategyDescriptor}s.
34 */
35 public static DescriptorExtensionList<SCMCheckoutStrategy,SCMCheckoutStrategyDescriptor> all() {
36 return Jenkins.getInstance().<SCMCheckoutStrategy,SCMCheckoutStrategyDescriptor>getDescriptorList(SCMCheckoutStrategy.class);
37 }
38
39 public static List<SCMCheckoutStrategyDescriptor> _for(AbstractProject p) {
40 List<SCMCheckoutStrategyDescriptor> r = Lists.newArrayList();
41 for (SCMCheckoutStrategyDescriptor d : all()) {
42 if (d.isApplicable(p))
43 r.add(d);
44 }
45 return r;
46 }
47
48
49
50 }
51