KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > triggers > Triggers


1 package hudson.triggers;
2
3 import hudson.model.Descriptor;
4 import hudson.model.Item;
5
6 import java.util.List JavaDoc;
7 import java.util.ArrayList JavaDoc;
8
9 /**
10  * List of all installed {@link Trigger}s.
11  *
12  * @author Kohsuke Kawaguchi
13  */

14 public class Triggers {
15     public static final List JavaDoc<TriggerDescriptor> TRIGGERS = Descriptor.toList(
16         SCMTrigger.DESCRIPTOR,
17         TimerTrigger.DESCRIPTOR
18     );
19
20     /**
21      * Returns a subset of {@link TriggerDescriptor}s that applys to the given item.
22      */

23     public static List JavaDoc<TriggerDescriptor> getApplicableTriggers(Item i) {
24         List JavaDoc<TriggerDescriptor> r = new ArrayList JavaDoc<TriggerDescriptor>();
25         for (TriggerDescriptor t : TRIGGERS) {
26             if(t.isApplicable(i))
27                 r.add(t);
28         }
29         return r;
30     }
31 }
32
Popular Tags