KickJava   Java API By Example, From Geeks To Geeks.

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


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
23 import org.objectweb.kilim.KilimException;
24 import org.objectweb.kilim.description.TemplateDescription;
25 import org.objectweb.kilim.model.instanciation.InstanciationMger;
26
27 /**
28  * @author horn
29  */

30 public interface Component extends ContainerElement {
31     /**
32      * returns the template describing the component.
33      * @return TemplateDescription
34      */

35     TemplateDescription getTemplate() ;
36     
37     /**
38      * returns a subcomponent identified by its local name. This methods does not recurse and therefore is not
39      * usable to find a subsubcomponent ....
40      * @param aName : the local name of a subcomponent.
41      * @return ComponentElement.
42      */

43     Component getSubComponent(String JavaDoc aName);
44     
45     /**
46      * returns as an iterator the "direct" subcomponents of a component : this method does not recurse and thus only returns
47      * the subcomponent directly defined in the component.
48      * @return Iterator
49      */

50     Iterator JavaDoc getSubComponents();
51
52     /**
53      * adds a new subcomponent.
54      * @param aElement : the component to be added as a subcomponent.
55      * @throws KilimException : generated if aElement is null or is already a subcomponent.
56      */

57     void addSubComponent(Component aElement) throws KilimException;
58     
59     /**
60      * removes a "direct" subcomponent : this method only looks for subcomponent directly defined in the component.
61      * @param aLocalName : the local name of the subcomponent to be removed.
62      * This method does nothing more than just "unregistering" AElement as a subcomponent
63      * @throws KilimException : generated if aElement is null, or if the aElement is not a direct subcomponent
64      */

65     void removeSubComponent(String JavaDoc aLocalName) throws KilimException;
66     
67     /**
68      * removes a "direct" subcomponent : this method only looks for subcomponent directly defined in the component.
69      * @param aLocalChild : the subcomponent to be removed.
70      * This method does nothing more than just "unregistering" AElement as a subcomponent
71      * @throws KilimException : generated if aElement is null, or if the aElement is not a direct subcomponent
72      */

73     void removeSubComponent(Component aLocalChild) throws KilimException;
74
75     /**
76      * Method getSlot returns a component slot identified by its local name.
77      * @param aLocalName : the local name of the slot
78      * @return Slot
79      * @throws KilimException :
80      */

81     ComponentSlot getSlot(String JavaDoc aLocalName) throws KilimException;
82     
83     /**
84      * returns as an iterator the slots defined in the component. Each element is thus an implementation of
85      * the ComponentSlot interface and an instance of the RtComponentSlot.
86      * @return Iterator : every member provided by the iterator implements the ComponentSlot interface and more precisly is an
87      * instance of the RtComponentSlot class.
88      */

89     Iterator JavaDoc getSlots();
90     
91     /**
92      * returns as an iterator the slots the component is plugged into. The type of each element is thus a subtype of ComponentSlot.
93      * @return Iterator: every member provided by the iterator implements the Component interface and more precisly is an
94      * instance of the RtComponent class.
95      */

96     Iterator JavaDoc getPlugTos();
97     
98     /**
99      * plugs a component into a slot.
100      * @param aName : name of the slot.
101      * @param aComponent : the component to be plugged in the slot.
102      * @throws KilimException : generated if aName or aComponent is null, if aName does not identifiy a component slot.
103      */

104     void plug(String JavaDoc aName, Component aComponent) throws KilimException;
105     
106     /**
107      * unplugs a component form a slot.
108      * @param aName : name of the slot.
109      * @param aComponent : the component to be unplugged from the slot .
110      * @throws KilimException : generated if aName or aComponent is null, if aName does not identifiy a component slot or if aCompoonent is not plugged in the slot.
111      */

112     void unplug(String JavaDoc aName, Component aComponent) throws KilimException;
113             
114     /**
115      * creates a copy of a component as defined in the template (same elements, same plugs, ....).
116      * It does not perform any operations executed at runtime on the component on which the fork is invoked.
117      * @return Component
118      * @throws KilimException :
119      */

120     Component fork() throws KilimException;
121     
122     /**
123      * releases a component by (1) removing it as a subcomponent of its containing
124      * component, (2) unpluging it from all slots it is plugged in, (3) removing its naming context from parent context and factory
125      * from parent factory. This method however does not unbind DIRECTLY bound ports (i.e. bound through a bindValue or a
126      * bindProvider method).
127      * @throws KilimException :
128      */

129     void release() throws KilimException;
130     
131     /**
132      * sets the instanciation manager from the instanciation strategy defined in the class KilimConfiguration {@link org.objectweb.kilim.KilimConfiguration}
133      * @return InstanciationMgerI
134      * @throws KilimException :
135      */

136     InstanciationMger getInstanciationMgerFromConfiguration() throws KilimException;
137     
138     /**
139      * sets the instanciation manager to be used for the component. It overrides the
140      * manager defined in the instanciation strategy.
141      * @param aMger : the instanciation manager to be used
142      * @throws KilimException :
143      */

144     void setInstanciationMger(InstanciationMger aMger) throws KilimException;
145     
146     /**
147      * Method getInstanciationMger returns the instanciation manager to be used the component.
148      * @return InstanciationMger
149      */

150     InstanciationMger getInstanciationMger();
151     
152     /**
153      * adds a controller
154      * @param aName : the name of the controller.
155      * @param aController : the controller to be added.
156      * @throws KilimException : generated if aName is null.
157      */

158     void addController(String JavaDoc aName, Object JavaDoc aController) throws KilimException;
159     
160     /**
161      * removes a controller.
162      * @param aName : the name of the controller to be removed.
163      * @throws KilimException : generated if aName is null.
164      */

165     void removeController(String JavaDoc aName) throws KilimException;
166     
167     /**
168      * returns a controller identified by its name.
169      * @param aName : the name of the controller.
170      * @return Object
171      * @throws KilimException : generated if aName is null.
172      */

173     Object JavaDoc getController(String JavaDoc aName) throws KilimException;
174     
175     /**
176      * returns as an iterator the controllersz associated to a component.
177      * @return Iterator
178      */

179     Iterator JavaDoc getControllers();
180 }
Popular Tags