KickJava   Java API By Example, From Geeks To Geeks.

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


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
25 /**
26  * @author horn
27  * ContainerElement is an intermediate interface corresponding to component entities that can contain elements i.e. components and slots.
28  * All containier elements have a state that is either "non-initialized" or "initialized". This state has been introduced because instanciation
29  * rises difficult and subtile problems which should be solved through precisely defined instanciation stategies. These strategies are
30  * usually enforced with the help of instanciation managers which should be executed prior to any access to a value. A container is thus
31  * created in the "non initialized" state. Access to the value of an element is only possible on an instanciated element which in turn requires
32  * that the container is instanciated. More precisely the evaluation algorithm of component interfaces always starts by looking whether the
33  * interface containier is initialized. The general instanciation strategy is invoked if it is not the case. It is the responsability of the instanciation
34  * manager to set the container in the "initialized" state.
35  *
36  * A container is a naming context .
37  */

38 public interface ContainerElement extends ComponentElement {
39     /**
40      * returns true when the container is in the "initialized" state or not.
41      * @return boolean
42      */

43     boolean isInitialized();
44
45     /**
46      * sets the container in the"initialized" state.
47      */

48     void setInitialized();
49
50     /**
51      * returns the factory used to create the container.
52      * The result is a CompoonentFactory if the container is a component or a SlotFactory if the container is a slot.
53      * @return Factory
54      */

55     Factory getFactory();
56     
57     /**
58      * returns true if the container is a component.
59      * @return boolean
60      */

61     boolean isComponent();
62     
63     /**
64      * returns true if the container is a slot.
65      * @return boolean
66      */

67     boolean isSlot();
68         
69     /**
70      * returns as an iterator the interfaces declared in the container.
71      * @return Iterator
72      */

73      Iterator JavaDoc getInterfaces();
74     
75     /**
76      * returns the local interface identified by its local name.
77      * @param aName : the local name of the interface.
78      * @return ComponentInterface : the reference of the interface.
79      * @throws KilimException : generated if aName is null or if no interface exists with the specified name.
80      */

81      ComponentInterface getInterface(String JavaDoc aName) throws KilimException;
82      
83      /**
84      * adds an Interface.in the slot.
85      * @param aInterface : the interface to be added.
86      * @throws KilimException : generated if aInterface is null or is already present in the slot.
87      */

88     void addInterface(ComponentInterface aInterface) throws KilimException;
89     
90         /**
91      * removes the interface from a component.
92      * @param aElement : the interface to be removed
93      * @throws KilimException : generated if aElement is null, if the component has no interface or if the interface is not defined in the component
94      */

95     void removeInterface(ComponentInterface aElement) throws KilimException;
96 }
Popular Tags