KickJava   Java API By Example, From Geeks To Geeks.

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


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
23 /**
24  * This class is a simple container dedicated to the definition of instanciation strategies. It is used by the component
25  * factory to find the instanciation manager to be associated to each application component. It is possible to redefine
26  * a default instanciation manager, and to define per template managers and per instance managers.
27  * The factory uses the following look up strategy. The search is stopped as soon as a manager is found.
28  * the component factory first looks for a manager explicitely associated to the component.
29  * If none can be found, it then looks for a manager explicitely associated to the component template.
30  * If none can be found, it recursively looks for a manager explicitely associated to super templates.
31  * If none can be found it looks for a default manager.
32  *
33  * No null value can be returned, since this class defines a NAryPreInstanciationMger as default instanciation manager
34  * and no null value is accepted by the setDefaultMger().
35  * @author horn
36  */

37
38 public interface InstanciationStrategy {
39     
40     /**
41      * Method setDefaultMger.
42      * @param aMger : a default instanciation manager (this ctor just contains a call to setDefaultManager(aMger). This value
43      * cannot be null. A NullInstanciationMger should be indicated if no action should be performed at instanciation time.
44      * @throws KilimException : generated if the reference is null.
45      */

46     void setDefaultMger(InstanciationMger aMger) throws KilimException;
47     
48     /**
49      * Method getDefaultMger returns the default manager.
50      * @return InstanciationMger
51      */

52     InstanciationMger getDefaultMger();
53
54     /**
55      * Method setPerTemplateMger sets the manager to be used when the component is an instance of a template or one
56      * of its subtemplates.
57      * @param aName is name of the template.
58      * @param aManager is the manager to be used.
59      * @throws KilimException : generated when aName is null.
60      */

61     void setPerTemplateMger(String JavaDoc aName, InstanciationMger aManager) throws KilimException;
62     
63     /**
64      * Method getPerTemplateMger
65      * @param aName : the name of the template.
66      * @return InstanciationMger
67      * @throws KilimException : generated when aName is null
68      */

69     InstanciationMger getPerTemplateMger(String JavaDoc aName) throws KilimException;
70     
71     /**
72      * Method setPerInstanceMger sets the manager to be used for a given instance.
73      * @param aName : the name of the component.
74      * @param aManager : the manager to be used
75      * @throws KilimException : generated when aName is null.
76      */

77     void setPerInstanceMger(String JavaDoc aName, InstanciationMger aManager) throws KilimException;
78     
79     /**
80      * Method getPerInstanceMger.
81      * @param aName : the name of the component
82      * @return InstanciationMger :
83      * @throws KilimException : generated when aName is null.
84      */

85     InstanciationMger getPerInstanceMger(String JavaDoc aName) throws KilimException;
86 }
87
Popular Tags