KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > kilim > model > RuntimeTrigger


1 /**
2  * Copyright (C) 2002 Kelua SA
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package org.objectweb.kilim.model;
20
21 import java.util.Iterator JavaDoc;
22 import java.util.LinkedList JavaDoc;
23
24 import org.objectweb.kilim.description.KILIM;
25
26 /**
27  * @author horn
28  */

29 public class RuntimeTrigger {
30     private int eventKind;
31     private LinkedList JavaDoc actions;
32     private RtComponentInterface eventSource;
33     
34     /**
35      * the public constructor for RuntimeTrigger.
36      * @param aEventKind : the kind of event which should be one of Trigger.BIND or Trigger.UNBIND.
37      * @param aSource : the event source.
38      */

39     public RuntimeTrigger(int aEventKind, RtComponentInterface aSource) {
40         eventKind = aEventKind;
41         eventSource = aSource;
42     }
43     
44     /**
45      * returns the event kind associated to the trigger. It is one of Trigger.BIND or Trigger.UNBIND.
46      * @return int
47      */

48     public int getEventKind() {
49         return eventKind;
50     }
51     
52     /**
53      * returns the event source.
54      * @return ComponentInterface
55      */

56     public RtComponentInterface getEventSource() {
57         return eventSource;
58     }
59         
60     /**
61      * @see org.objectweb.kilim.description.Trigger#addTransformer(Transformer)
62     */

63     public void addTransformer(RuntimeAction aAction) {
64         if (actions == null) {
65             actions = new LinkedList JavaDoc();
66         }
67         actions.add(aAction);
68     }
69     
70     /**
71      * returns as an iterator the transformers associated to the the trigger.
72      * @return Iterator
73      */

74     public Iterator JavaDoc getTransformers() {
75         if (actions == null) {
76             return KILIM.EMPTY_ITERATOR;
77         }
78         return actions.listIterator();
79     }
80 }
81
Popular Tags