KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > api > JormConfigurator


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.api;
25
26 import org.objectweb.jorm.api.PException;
27 import org.objectweb.jorm.api.PMappingStructuresManager;
28 import org.objectweb.jorm.metainfo.api.Manager;
29 import org.objectweb.jorm.metainfo.api.MappingFactory;
30 import org.objectweb.jorm.xml2mi.api.MappingParser;
31 import org.objectweb.jorm.xml2mi.api.Parser;
32 import org.objectweb.jorm.mi2xml.api.MappingDomtreeBuilder;
33 import org.objectweb.jorm.mi2xml.api.Writer;
34 import org.objectweb.util.monolog.api.LoggerFactory;
35
36 import java.util.Iterator JavaDoc;
37 import java.util.Properties JavaDoc;
38 import java.util.Collection JavaDoc;
39
40 /**
41  * Used to hold the configuration information related to the JORM runtime.
42  * @author P. Dechamboux
43  */

44 public interface JormConfigurator {
45     public static final String JavaDoc LOGGER_NAME =
46             "org.objectweb.jorm.config";
47     public static final String JavaDoc DEFAULT_JORM_CONFIGURATION_FILE =
48             "jorm.properties";
49     public static final String JavaDoc USE_CONTEXT_CLASSLOADER =
50             "use.context.classloader";
51
52     /**
53      * Configures the JORM compiler by loading information related to the
54      * different mappers supported by this instance of JORM using the given
55      * property file.
56      * @throws PException
57      */

58     public void configure(String JavaDoc propertyfile) throws PException;
59
60     /**
61      * Configures the JORM compiler by loading information related to the
62      * different mappers supported by this instance of JORM using the default
63      * property file.
64      * @throws PException
65      */

66     public void configure() throws PException;
67
68     /**
69      * Configures the JORM compiler by loading information related to the
70      * different mappers supported by this instance of JORM using the given
71      * properties.
72      * @param p is the properties containing the jorm configuration
73      */

74     public void configure(Properties JavaDoc p);
75
76     /**
77      * Configures the logger factory object with a properties object.
78      * @param propertyfile a properties object
79      */

80     public void configureLog(String JavaDoc propertyfile) throws PException;
81
82     /**
83      * Lists the names of supported mappers.
84      * @return This list Iterator.
85      */

86     public Iterator JavaDoc knownMappers() throws PException;
87
88     /**
89      * Gets the MI manager to be used by JORM.
90      * @return That MI manager.
91      */

92     public Manager getMIManager() throws PException;
93
94     /**
95      * Gets the parser to be used by JORM.
96      * @return That parser.
97      */

98     public Parser getParser() throws PException;
99
100     /**
101      * Gets the MI factory associated with the given mapper.
102      * @param mappername The name of the concerned mapper.
103      * @return The MappingFactory object.
104      * @throws org.objectweb.jorm.api.PException
105      */

106     public MappingFactory getMIFactory(String JavaDoc mappername) throws PException;
107
108     /**
109      * Gets the schema manager associated with the given mapper.
110      * @param mappername The name of the concerned mapper.
111      * @return The PMappingStructuresManager object.
112      * @throws org.objectweb.jorm.api.PException
113      */

114     public PMappingStructuresManager getSchMgr(String JavaDoc mappername) throws PException;
115
116     /**
117      * Gets the class name of the GenClassMapping associated with the given mapper.
118      * @param mappername The name of the concerned mapper.
119      * @return The string giving the class name.
120      * @throws org.objectweb.jorm.api.PException
121      */

122     public Class JavaDoc getGcmClass(String JavaDoc mappername) throws PException;
123
124     /**
125      * Gets the parser associated with the given mapper for mapping infos.
126      * @param mappername The name of the concerned mapper.
127      * @return The MappingParser object.
128      * @throws org.objectweb.jorm.api.PException
129      */

130     public MappingParser getMappingParser(String JavaDoc mappername) throws PException;
131
132     /**
133      * Gets the BasicDomWriter object.
134      * @return The BasicDomWriter object.
135      * @throws org.objectweb.jorm.api.PException
136      */

137     public Writer getWriter() throws PException;
138
139     /**
140      * Gets the MappingDomTreeBuilder object associated with the given mapper.
141      * @param mappername The name of the concerned mapper.
142      * @return The MappingDomTreeBuilder object.
143      * @throws org.objectweb.jorm.api.PException
144      */

145     public MappingDomtreeBuilder getMappingDomtreeBuilder(String JavaDoc mappername)
146             throws PException;
147
148     /**
149      * Gets the submappers associated with a given mapper.
150      * @param mappername The concerned mapper.
151      * @return The collection of the names of submappers.
152      * @throws org.objectweb.jorm.api.PException
153      */

154     public Collection JavaDoc getSubMappers(String JavaDoc mappername) throws PException;
155
156     /**
157      * Removes this mapper from the list of the ones used for generation.
158      * @param mn The name of the concerned mapper.
159      */

160     public void removeMapper(String JavaDoc mn);
161
162     /**
163      * Removes all mappers from the list of the ones used for generation.
164      */

165     public void removeAllMappers();
166
167     /**
168      * Removes this submapper from the list of the ones used for generation.
169      * @param mn The concerned mapper.
170      * @param smn The submapper to be removed.
171      */

172     public void removeSubMapper(String JavaDoc mn, String JavaDoc smn);
173
174     /**
175      * Adds this submapper to the list of the ones used for generation.
176      * @param mn The concerned mapper.
177      * @param smn The submapper to be added.
178      */

179     public void addSubMapper(String JavaDoc mn, String JavaDoc smn);
180
181     /**
182      * It assignes the logger factory.
183      * @param lf
184      */

185     public void setLoggerFactory(LoggerFactory lf);
186
187     /**
188      * Gets the logger factory associated with this instance of JORM.
189      * @return The logger factory.
190      */

191     public LoggerFactory getLoggerFactory() throws PException;
192 }
193
Popular Tags