KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > generation > jorm > JormMIMappingBuilder


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
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 package org.objectweb.speedo.generation.jorm;
19
20 import org.objectweb.jorm.metainfo.api.Class;
21 import org.objectweb.jorm.metainfo.api.ClassMapping;
22 import org.objectweb.jorm.metainfo.api.Mapping;
23 import org.objectweb.jorm.metainfo.api.PrimitiveElementMapping;
24 import org.objectweb.jorm.metainfo.api.PrimitiveElement;
25 import org.objectweb.jorm.metainfo.api.CommonClassMapping;
26 import org.objectweb.jorm.metainfo.api.GenClassMapping;
27 import org.objectweb.jorm.metainfo.api.GenClassRef;
28 import org.objectweb.jorm.metainfo.api.NameDef;
29 import org.objectweb.jorm.api.PException;
30 import org.objectweb.speedo.metadata.SpeedoClass;
31 import org.objectweb.speedo.metadata.SpeedoField;
32 import org.objectweb.speedo.metadata.SpeedoElement;
33 import org.objectweb.speedo.api.SpeedoException;
34
35 /**
36  * This interface defines a builder of the mapping part of the Jorm meta
37  * information. It must be implemented for each mapper.
38  *
39  * @author S.Chassande-Barrioz
40  */

41 public interface JormMIMappingBuilder {
42
43     /**
44      * It builds a ClassMapping, assignes it to the mapping and builds
45      * mapping structure for the class (RdbTable, directory name, ...).
46      * @param clazz is the Jorm meta object representing the class which the
47      * ClassMapping must be built.
48      * @param mapping is the Mapping instance which will host the ClassMapping.
49      * @return the ClassMapping instance built by the method (never null).
50      * @throws PException if it is not possible to build the ClassMapping
51      */

52     ClassMapping createClassMapping(Class JavaDoc clazz,
53                                     SpeedoClass sc,
54                                     Mapping mapping)
55             throws PException, SpeedoException ;
56
57     /**
58      * It finishes the filling of a ClassMapping (Inheritance for example).
59      * @throws PException if it is not possible to build the ClassMapping
60      */

61     void finalizeClassMapping(SpeedoClass sc,
62                               String JavaDoc projectName,
63                               String JavaDoc mapperName)
64             throws PException, SpeedoException ;
65
66     /**
67      * It builds a GenClassMapping, assignes it to the mapping and builds
68      * mapping structure for the class (RdbTable, directory name, ...).
69      * @param gcr is the Jorm meta object representing the gen class which the
70      * GenClassMapping must be built.
71      * @param mapping is the Mapping instance which will host the GenClassMapping.
72      * @return the GenClassMapping instance built by the method (never null).
73      * @throws PException if it is not possible to build the GenClassMapping
74      */

75     GenClassMapping createGenClassMapping(GenClassRef gcr,
76                                           SpeedoField sf,
77                                           Mapping mapping)
78             throws PException, SpeedoException ;
79
80     /**
81      * It creates the mapping of a primitive field.
82      * @param pe is the Jorm meta object representing a primitive field
83      * @param cm is the MappingStructure which will host the mapping of the
84      * field
85      * @return a PrimitiveElementMapping corresponding to the given primitive
86      * field.
87      * @throws PException if it is not possible to build the mapping of the
88      * primitive field.
89      */

90     PrimitiveElementMapping createFieldMapping(PrimitiveElement pe,
91                                                SpeedoElement selem,
92                                                CommonClassMapping cm)
93             throws PException, SpeedoException ;
94
95     /**
96      * It creates the mapping of a name def (reference or identifier).
97      * @param cm is the MappingStructure which will host the mapping of the
98      * fields of the name def
99      * @param nd is the NameDef which must be mapped.
100      * @throws PException if it is not possible to build the mapping of the
101      * field.
102      */

103     void createNameDefMapping(CommonClassMapping cm,
104                               NameDef nd,
105                               SpeedoClass sc,
106                               boolean isIdentifier,
107                              boolean isInGenClass)
108             throws PException, SpeedoException;
109
110
111 }
112
Popular Tags