KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > generator > api > Generator


1 /**
2  * JORM: an implementation of a generic mapping system for persistent Java
3  * objects. Two mapping are supported: to RDBMS and to binary files.
4  * Copyright (C) 2001-2003 France Telecom R&D - INRIA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Contact: jorm-team@objectweb.org
21  *
22  */

23
24 package org.objectweb.jorm.generator.api;
25
26 import org.objectweb.jorm.compiler.api.JormCompilerParameter;
27 import org.objectweb.jorm.compiler.api.JormCompilerConfigurator;
28 import org.objectweb.jorm.metainfo.api.Manager;
29 import org.objectweb.jorm.metainfo.api.Class;
30 import org.objectweb.jorm.metainfo.api.CompositeName;
31 import org.objectweb.jorm.util.io.api.TargetHolder;
32 import org.objectweb.jorm.util.io.api.PathExplorer;
33 import org.objectweb.jorm.api.PException;
34
35 /**
36  * Generation is a simple interface which allows to generate object file
37  * depending on their nature. The compiler uses Meta Object to build the
38  * input source tree.
39  *
40  * @author P. Dechamboux
41  */

42 public interface Generator {
43     /**
44      * Initializes the generator. Should be called after setCompilerParameter
45      * and setCompilerConfigurator.
46      * @throws PException
47      */

48     void init() throws PException;
49
50     /**
51      * Assigns the compiler parameter to this generator.
52      * @param jcp the compiler parameter.
53      */

54     void setCompilerParameter(JormCompilerParameter jcp);
55
56     /**
57      * Assigns the compiler configurator to this generator.
58      * @param jcc the compiler configurator.
59      */

60     void setCompilerConfigurator(JormCompilerConfigurator jcc);
61
62     /**
63      * Assigns the meta information manager to this generator.
64      * @param mim the meta information manager to use.
65      */

66     void setMetaInfoManager(Manager mim);
67
68     /**
69      * Assigns a PathExplorer object for locating files that have to be parsed.
70      * @param pathexpl the PathExplorer to be used for file location
71      */

72     void setPathExplorer(PathExplorer pathexpl);
73
74     /**
75      * Adds a mapping generator which generates a specific mapping part.
76      * @param mappername The name of the mapper.
77      * @param mappinggenerator The Mapping Verifier object.
78      */

79     void addMappingGenerator(String JavaDoc mappername, MOPFactory mappinggenerator);
80
81     /**
82      * Generates code for the given Class.
83      * @param mo The class meta-object.
84      * @param th The target holder which allows to create files.
85      * @param cp This parameter permits to reach the compilation parameters.
86      * @param jcc The actual configuration of the compiler.
87      */

88     void generate(Class JavaDoc mo, TargetHolder th, JormCompilerParameter cp, JormCompilerConfigurator jcc) throws PException;
89
90     /**
91      * Generates code for the given CompositeName.
92      * @param mo The composite name meta-object.
93      * @param th The target holder which allows to create files.
94      * @param cp This parameter permits to reach the compilation parameters.
95      */

96     void generate(CompositeName mo, TargetHolder th, JormCompilerParameter cp) throws PException;
97 }
98
Popular Tags