KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > kilim > model > mapping > MappingStrategy


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.mapping;
20
21 import org.objectweb.kilim.KilimException;
22
23 /**
24  * This class is a simple container dedicated to the definition of mapping strategies. It is used at run time
25  * to find the mapper to be associated to each application component. It is possible to redefine
26  * a default mapper, and to define per template mappers and per instance mappers.
27  * The run time uses the following look up strategy. The search is stopped as soon as a mapper is found.
28  * the runtime first looks for a mapper explicitely associated to the component.
29  * If none can be found, it then looks for a mapper explicitely associated to the component template.
30  * If none can be found, it recursively looks for a mapper explicitely associated to super templates.
31  * If none can be found it looks for a default mapper.
32  *
33  * No null value can be returned, since this class defines a default mapper and no null value is accepted by the
34  * setDefaultMapper() method
35  * @author horn
36  */

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

46     void setDefaultMapper(Mapper aMapper) throws KilimException;
47     
48     /**
49      * Method getDefaultMapper returns the default mapper.
50      * @return Mapper
51      */

52     Mapper getDefaultMapper();
53
54     /**
55      * Method setPerTemplateMapper sets the mapper 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 aMapper is the mapper to be used.
59      * @throws KilimException : generated when aName is null.
60      */

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

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

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

85     Mapper getPerInstanceMapper(String JavaDoc aName) throws KilimException;
86 }
87
Popular Tags