KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > kilim > model > instanciation > InstanciationMger


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.instanciation;
20
21 import org.objectweb.kilim.KilimException;
22 import org.objectweb.kilim.model.Component;
23 import org.objectweb.kilim.model.ComponentInterface;
24 import org.objectweb.kilim.model.ComponentSlot;
25 import org.objectweb.kilim.model.mapping.MappingContext;
26
27 /**
28  * @author horn
29  * All Kilim components and slots have a state which is either UNINITIALIZED or INITIALIZED. A component and its slots are both created by the component factory
30  * in the UNINITIALIZED state. A component interface value can only be accessed and used when the component and slot the interface belongs to are in the INITIALIZED state.
31  * It is the responsability of instanciation managers to "initialize" components and slots. The Kilim model therefore uses pre and post methods :
32  * the underlying logics for interfaces is roughly the following :
33  * if (containing component or slot in UNITIALIZED state) {
34  * initializeInstanciation(component, interface);
35  * access to the interface (i.e. invoke getValue() on the interface).
36  * finalizeInstanciation(component, interface);
37  * }
38  * /////////////////////////////////////////////////////////////////////////////////
39  * The same constraints apply to the plug operation. The underlying logics for interfaces is roughly the following :
40  * if (component to be plugged or slot in UNITIALIZED state) {
41  * initializePlug(component, slot);
42  * plug the component
43  * finalizePlugcomponent, slot);
44  * }
45  */

46     
47 public abstract class InstanciationMger {
48
49     /**
50      * This is the "pre" method called by the Kilim runtime when it has to access the value of an interface (port, provider, property) belonging to a UNITIALIZED component or slot.
51      * This method is strictly equivalent to initializeInstanciation(aComponent, aInterface, null);
52      * @param aComponent : the component containing the interface
53      * @param aInterface : the accessed interface
54      * @throws KilimException : generated by the instantiation manager in case of problems. These are specific to each manager.
55      */

56     public void initializeInstanciation(Component aComponent, ComponentInterface aInterface) throws KilimException {
57         initializeInstanciation(aComponent, aInterface, null);
58     }
59
60     /**
61      * This is the "pre" method called by the Kilim runtime when it has to get the value of an interface (port, provider, property) belonging to a UNITIALIZED component or slot.
62      * @param aComponent : the component containing the interface
63      * @param aInterface : the accessed interface
64      * @param aContext : the mapping context
65      * @throws KilimException : generated by the instantiation manager in case of problems. These are specific to each manager.
66      */

67     public abstract void initializeInstanciation(Component aComponent, ComponentInterface aInterface, MappingContext aContext) throws KilimException;
68     
69     /**
70      * This is the "post" method called by the Kilim runtime when it has to get the value of an interface (port, provider, property) belonging to a UNITIALIZED component or slot.
71      * This method is strictly equivalent to finalizeInstanciation(aComponent, aInterface, null);
72      * @param aComponent : the component containing the interface
73      * @param aInterface : the accessed interface
74      * @throws KilimException : generated by the instantiation manager in case of problems. These are specific to each manager.
75      */

76     public void finalizeInstanciation(Component aComponent, ComponentInterface aInterface) throws KilimException {
77         finalizeInstanciation(aComponent, aInterface, null);
78     }
79     
80     /**
81      * This is the "post" method called by the Kilim runtime when it has to get the value of an interface (port, provider, property) belonging to a UNITIALIZED component or slot.
82      * @param aComponent : the component containing the interface
83      * @param aInterface : the accessed interface
84      * @param aContext : the mapping context
85      * @throws KilimException : generated by the instantiation manager in case of problems. These are specific to each manager.
86      */

87     public abstract void finalizeInstanciation(Component aComponent, ComponentInterface aInterface, MappingContext aContext) throws KilimException;
88
89     /**
90      * This is the "pre" method called by the Kilim runtime when it has to plug either an UNINITIALIZED component or an INITIALIZED component into an UNITIALIZED slot.
91      * @param aComponent : the component to be plugged
92      * @param aSlot : the slot
93      * @throws KilimException : generated by the instantiation manager in case of problems. These are specific to each manager.
94      */

95     public void initializePlug(Component aComponent, ComponentSlot aSlot) throws KilimException {
96         initializePlug(aComponent, aSlot, null);
97     }
98
99     /**
100      * This is the "pre" method called by the Kilim runtime when it has to plug either an UNINITIALIZED component or an INITIALIZED component into an UNITIALIZED slot.
101      * @param aComponent : the component to be plugged
102      * @param aSlot : the slot
103      * @param aContext : the maping context
104      * @throws KilimException : generated by the instantiation manager in case of problems. These are specific to each manager.
105      */

106     public abstract void initializePlug(Component aComponent, ComponentSlot aSlot, MappingContext aContext) throws KilimException;
107     
108     /**
109      * This is the "post" method called by the Kilim runtime when it has to plug either an UNINITIALIZED component or an INITIALIZED component into an UNITIALIZED slot.
110      * @param aComponent : the component to be plugged
111      * @param aSlot : the slot
112      * @throws KilimException : generated by the instantiation manager in case of problems. These are specific to each manager.
113      */

114     public void finalizePlug(Component aComponent, ComponentSlot aSlot) throws KilimException {
115         finalizePlug(aComponent, aSlot, null);
116     }
117     
118     /**
119      * This is the "post" method called by the Kilim runtime when it has to plug either an UNINITIALIZED component or an INITIALIZED component into an UNITIALIZED slot.
120      * @param aComponent : the component to be plugged
121      * @param aSlot : the slot
122      * @param aContext : the maping context
123      * @throws KilimException : generated by the instantiation manager in case of problems. These are specific to each manager.
124      */

125     public abstract void finalizePlug(Component aComponent, ComponentSlot aSlot, MappingContext aContext) throws KilimException;
126 }
127
128
Popular Tags