KickJava   Java API By Example, From Geeks To Geeks.

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


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  * The Kilim architecture enforces a clear separation between the mechanims implementing the generic Kilim model semantics (mechanisms controlling
25  * the execution of providers and transformers in accordance with dependancy rules, trigger rules, etc....) and the mechanisms implementing the effective
26  * tasks described by the providers and the transformers (mechanisms to execute constructors, methods, ....). This architecture allows thus different
27  * implementations for the action of providers and transformers : effective instantiation of the system through method and constructor calls,simulation (without
28  * effective instantiation) of the system, code generation of launchers, .... A Mapper implements the effective task associated to providers (through getValue()).
29  * Mappers should be written in order to be used as interceptors and to be combined in pipe fashion.
30  * and transformers (through execute()).
31  * @author horn
32  */

33 public interface Mapper {
34     
35     /**
36      * Method enterContext. Mappers have access to a shared context that stores a global view of the system. the Kilim infrastructure updates this context according
37      * to a stack policy (it is updated every time it invokes the method getValue() or execute()). Method enterContext is a callBack provided by mappers invoked by
38      * the Kilim infrastructure when invoking the method getValue() or execute(). This callback exists because the execution of the effective task associated to these
39      * methods does not necessarily folow immediately the invocation: they can only be applied on "instanciated" components.and ew getValue() calls and execute()
40      * may be recursively introduced by instanciation managers.
41      * @param aContext : the mapping context
42      * @throws KilimException : generated by a specific mapper to indicate a (specific problem).
43      */

44     void enterContext(MappingContext aContext) throws KilimException;
45     
46     /**
47      * Method leaveContext. This method is invoked by the Kilim infrastructure when leaving the method getValue() or execute(). This method is invoked just after the
48      * execution of the effective task associated to the provider or transformer.
49      * @param aContext : the mapping context.
50      * @throws KilimException : generated by a specific mapper to indicate a (specific problem).
51      */

52     void leaveContext(MappingContext aContext) throws KilimException;
53
54     /**
55      * Method getGetterValue. This method performs the effective task associated to the method getValue() of a getter.
56      * @param aSupport : the support of the getter
57      * @param isStatic : true if the getter is static
58      * @param fieldName : the name of the field to be accessed
59      * @param aContext : the mapping context
60      * @return Object : the value returned by getValue()
61      * @throws KilimException : generated if aSupport is null, if fieldName is null or if no getter corresponding to the signature exists.
62      * Also generated by a specific mapper to indicate a (specific problem).
63      */

64     Object JavaDoc getGetterValue (Object JavaDoc aSupport, boolean isStatic, String JavaDoc fieldName, MappingContext aContext) throws KilimException;
65     
66     /**
67      * Method executeSetter. This method performs the effective task associated to the method execute() of a getter.
68      * @param aSupport : the support of the getter
69      * @param isStatic : true if the getter is static
70      * @param fieldName : the name of the field to be accessed
71      * @param toBeSet : the value to be set.
72      * @param aContext : the mapping context
73      * @throws KilimException : generated if aSupport is null, if fieldName is null or if no getter corresponding to the signature exists.
74      * Also generated by a specific mapper to indicate a (specific problem).
75
76      */

77     void executeSetter(Object JavaDoc aSupport, boolean isStatic, String JavaDoc fieldName, Object JavaDoc toBeSet, MappingContext aContext) throws KilimException;
78
79     /**
80      * Method getMethodValue. This method performs the effective task associated to the method getValue() of a factory method.
81      * @param aSupport : the support of the method
82      * @param isStatic : true if the method is static
83      * @param aMethodName : the name of the method
84      * @param paramObjects : the ordered values of the method parameters
85      * @param typeNames : the ordered types of the method parameters.
86      * @param aContext : the mapping context.
87      * @return Object : the value returned by getValue()
88      * @throws KilimException :generated if aSupport is null, if methodName is null or if no method corresponding to the signature exists.
89      * Also generated by a specific mapper to indicate a (specific problem).
90      */

91     Object JavaDoc getMethodValue(Object JavaDoc aSupport, boolean isStatic, String JavaDoc aMethodName, Object JavaDoc[] paramObjects, String JavaDoc[] typeNames, MappingContext aContext) throws KilimException;
92     
93     /**
94      * Method executeMethod. This method performs the effective task associated to the method execute() of a factory method (used as a transformer).
95      * @param aSupport : the support of the method
96      * @param isStatic : true if the method is static
97      * @param aMethodName : the name of the method
98      * @param paramObjects : the ordered values of the method parameters
99      * @param typeNames : the ordered types of the method parameters.
100      * @param aContext : the mapping context.
101      * @throws KilimException :generated if aSupport is null, if methodName is null or if no method corresponding to the signature exists.
102      * Also generated by a specific mapper to indicate a (specific problem).
103      */

104     void executeMethod(Object JavaDoc aSupport, boolean isStatic, String JavaDoc aMethodName, Object JavaDoc[] paramObjects, String JavaDoc[] typeNames, MappingContext aContext) throws KilimException;
105             
106     /**
107      * Method getConstructorValue. This method performs the effective task associated to the method getValue() of a constructor.
108      * @param aClass : the class for the constructor
109      * @param paramObjects : the ordered values of the method parameters
110      * @param typeNames : the ordered types of the method parameters.
111      * @param aContext : the mapping context.
112      * @return Object : the value returned by getValue().
113      * @throws KilimException :generated if aSupport is null, if methodName is null or if no method corresponding to the signature exists.
114      * Also generated by a specific mapper to indicate a (specific problem).
115      */

116     Object JavaDoc getConstructorValue(Class JavaDoc aClass, Object JavaDoc[] paramObjects, String JavaDoc[] typeNames, MappingContext aContext) throws KilimException;
117     
118     /**
119      * Method executeConstructor. This method performs the effective task associated to the method execute() of a constructor.
120      * @param aClass : the class for the constructor
121      * @param paramObjects : the ordered values of the method parameters
122      * @param typeNames : the ordered types of the method parameters.
123      * @param aContext : the mapping context.
124      * @throws KilimException :generated if aSupport is null, if methodName is null or if no method corresponding to the signature exists.
125      * Also generated by a specific mapper to indicate a (specific problem).
126      */

127     void executeConstructor(Class JavaDoc aClass, Object JavaDoc[] paramObjects, String JavaDoc[] typeNames, MappingContext aContext) throws KilimException;
128     
129     /**
130      * Method getPropertyValue. This method performs the effective task associated to the method getValue() of a property.
131      * @param aValue : the property identifier.
132      * @param aContext : the mapping context.
133      * @return Object : the value returned by getValue()
134      * @throws KilimException : generated if aValue is null. Also generated by a specific mapper to indicate a (specific problem).
135      */

136     Object JavaDoc getPropertyValue(Object JavaDoc aValue, MappingContext aContext) throws KilimException;
137         
138     /**
139      * Method getClassSourceValue. This method performs the effective task associated to the method getValue() of a ClassSource.
140      * @param aClassName : the name of the class
141      * @param aContext : the mapping context
142      * @return Object : the value returned by getValue() : generally the corresponding Class object.
143      * @throws KilimException : generated if aClassName is null or if no Class object can be found.
144      * Also generated by a specific mapper to indicate a (specific problem).
145      */

146     Object JavaDoc getClassValue(String JavaDoc aClassName, MappingContext aContext) throws KilimException;
147
148     /**
149      * Method getExternalValue. This method performs the effective task associated to the method getValue() of a external value.
150      * This method exists since the current implementation does not treat external values as properties. It should probably disappear in
151      * the next release.
152      * @param value : the external reference identifier.
153      * @param aContext : the mapping context.
154      * @return Object :the value returned by getValue() : generally a reference to the object designated by the external value.
155      * @throws KilimException : generated if value is null. Also generated by a specific mapper to indicate a (specific problem).
156      */

157     Object JavaDoc getExternalValue(Object JavaDoc value, MappingContext aContext) throws KilimException;
158         
159     /**
160      * Method getNullElementValue. This method performs the effective task associated to the method getValue() of a null.
161      * This method exists since the current implementation does not treat null as a propertiy (null may be associated to a transformer).
162      * @param aContext : the mapping context.
163      * @return Object : the value returned by getValue()
164      * @throws KilimException : generated by a specific mapper to indicate a (specific problem).
165      */

166     Object JavaDoc getNullElementValue(MappingContext aContext) throws KilimException;
167
168     /**
169      * Method executeNullElement. This method performs the effective task associated to the method execute() of a null.
170      * @param aContext : the mapping context
171      * @throws KilimException : generated by a specific mapper to indicate a (specific problem).
172      */

173     void executeNullElement(MappingContext aContext) throws KilimException;
174     
175     /**
176      * Method getEventSourceValue.....
177      * @param aContext : the mapping context.
178      * @return Object :
179      * @throws KilimException : generated by a specific mapper to indicate a (specific problem).
180      */

181     Object JavaDoc getEventSourceValue(MappingContext aContext) throws KilimException;
182
183 }
Popular Tags